You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a bug in the battle-stream-example.ts located in ./sim/examples/, when running node build && node .sim-dist/examples/battle-stream-example inside the root directory after running git clone https://github.com/smogon/pokemon-showdown. It returned the following error:
node:internal/modules/cjs/loader:1137
throw err;
^
Error: Cannot find module '/home/cyi/pokemon-show
down/.sim-dist/examples/battle-stream-example'
at Module._resolveFilename (node:internal/mod
ules/cjs/loader:1134:15)
at Module._load (node:internal/modules/cjs/loader:975:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v18.19.0
It appears the .sim-dist directory does not exist, so I went and nuked the repo locally, and git clone again, then based on the latest commit that modifies battle-stream-example, it has the SHA256 checksum of 13189fd, so I did git checkout 13189fdb02778f4c99cfe81da9ee82978485f48a inside the repo and did the same node build && .sim-dist/examples/battle-stream-example and this time, it works, and produces the expected output of the battle stream of a random battle using RandomPlayerAI from ./sim/tools/random-player-ai
Looks good and all, but this is for printing the omniscient stream, originally it looks like this:
void (async () => {
for await (const chunk of streams.omniscient) {
console.log(chunk);
}
})();
There's a p1 and p2 stream, we can modify the program by changing omniscient to p1 or p2, then run node build again.
Results of p1:
p1 is RandomPlayerAI
p2 is RandomPlayerAI
For some reason the stream of p1 is non-existent, maybe this is how the class handles the streams?
Results of p2:
p1 is RandomPlayerAI
p2 is RandomPlayerAI
|t:|1726063393
|gametype|singles
|player|p1|Bot 1||
|player|p2|Bot 2||
|teamsize|p1|6
|teamsize|p2|6
|gen|7
|tier|[Gen 7] Custom Game
|clearpoke
…
This looks normal, but if you try node .sim-dist/examples/battle-stream-example | grep "|request", it returns nothing, and if you try node .sim-dist/examples/battle-stream-example | grep "|faint", it would return something like below:
The command to run the only example in sim does not work as it does not produce .sim-dist
Even when going back to the state where it works, it does not work consistently, specifically with the handling of p1 and p2
In latest commit, after node build, running tsc sim/example/battle-stream-example.ts it returns the error:
error TS6053: File 'sim/example/battle-stream-example.ts' not found.
The file is in the program because:
Root file specified for compilation
Found 1 error.
And running node sim/example/battle-stream-example.js after tsc returns the following error:
node:internal/modules/cjs/loader:1137
throw err;
^
Error: Cannot find module '/home/cyi/pokemon-showdown/sim/../config/formats'
Require stack:
- /home/cyi/pokemon-showdown/sim/dex-formats.js
- /home/cyi/pokemon-showdown/sim/dex.js
- /home/cyi/pokemon-showdown/sim/battle.js
- /home/cyi/pokemon-showdown/sim/index.js
- /home/cyi/pokemon-showdown/sim/examples/battle-stream-example.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1134:15)
at Module._load (node:internal/modules/cjs/loader:975:27)
at Module.require (node:internal/modules/cjs/loader:1225:19)
at require (node:internal/modules/helpers:177:18)
at DexFormats.load (/home/cyi/pokemon-showdown/sim/dex-formats.js:437:23)
at ModdedDex.includeFormats (/home/cyi/pokemon-showdown/sim/dex.js:524:22)
at ModdedDex.loadData (/home/cyi/pokemon-showdown/sim/dex.js:463:18)
at ModdedDex.get (/home/cyi/pokemon-showdown/sim/dex.js:121:25)
at DexFormats.get (/home/cyi/pokemon-showdown/sim/dex-formats.js:523:22)
at exports.Teams.Teams.getGenerator (/home/cyi/pokemon-showdown/sim/teams.js:549:36) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/cyi/pokemon-showdown/sim/dex-formats.js',
'/home/cyi/pokemon-showdown/sim/dex.js',
'/home/cyi/pokemon-showdown/sim/battle.js',
'/home/cyi/pokemon-showdown/sim/index.js',
'/home/cyi/pokemon-showdown/sim/examples/battle-stream-example.js'
]
}
Node.js v18.19.0
So question: is this a bug in RandomPlayerAI that should be fixed, or is such result somehow working as expected?
The text was updated successfully, but these errors were encountered:
There is a bug in the
battle-stream-example.ts
located in./sim/examples/
, when runningnode build && node .sim-dist/examples/battle-stream-example
inside the root directory after runninggit clone https://github.com/smogon/pokemon-showdown
. It returned the following error:It appears the
.sim-dist
directory does not exist, so I went and nuked the repo locally, andgit clone
again, then based on the latest commit that modifiesbattle-stream-example
, it has the SHA256 checksum of 13189fd, so I didgit checkout 13189fdb02778f4c99cfe81da9ee82978485f48a
inside the repo and did the samenode build && .sim-dist/examples/battle-stream-example
and this time, it works, and produces the expected output of the battle stream of a random battle usingRandomPlayerAI
from./sim/tools/random-player-ai
Looks good and all, but this is for printing the
omniscient
stream, originally it looks like this:There's a
p1
andp2
stream, we can modify the program by changingomniscient
top1
orp2
, then runnode build
again.Results of
p1
:For some reason the stream of
p1
is non-existent, maybe this is how the class handles the streams?Results of
p2
:This looks normal, but if you try
node .sim-dist/examples/battle-stream-example | grep "|request"
, it returns nothing, and if you trynode .sim-dist/examples/battle-stream-example | grep "|faint"
, it would return something like below:So tldr:
sim
does not work as it does not produce.sim-dist
p1
andp2
In latest commit, after
node build
, runningtsc sim/example/battle-stream-example.ts
it returns the error:And running
node sim/example/battle-stream-example.js
aftertsc
returns the following error:So question: is this a bug in
RandomPlayerAI
that should be fixed, or is such result somehow working as expected?The text was updated successfully, but these errors were encountered: