Games-and-Simulations / sc-docker

Multi-platform Version of StarCraft: Brood War in a Docker Container, ready to use for bot play simulations.
MIT License
231 stars 39 forks source link

Give user option to select game speed in headless mode #75

Open adakitesystems opened 6 years ago

adakitesystems commented 6 years ago

expected behaviour

Latency Frames = 3

actual behaviour

Latency Frames = 6

steps to reproduce

Start bots in headless mode and observe the number latency frames reported by a bot (e.g. krasioAIClient).

Possible Solution

Modify the bwheadless source code to accept a runtime argument for game speed (e.g. --speed NORMAL). By default, bwheadless sets the game speed to 6 (Fastest) which sets Latency Frames to 6. SSCAIT is run with game speed 3 (Normal) which sets Latency Frames to 3. This is the corresponding line in the bwheadless source where the game speed is set when hosting a game:

offset<uint8_t>(&create_info, 0x26) = 6; // game speed

So, create a variable opt_game_speed which is read near the other runtime arguments then set via:

offset<uint8_t>(&create_info, 0x26) = opt_game_speed; // game speed

The game speeds correspond to an integer starting from 0 and going up to 6.

Slowest: 0
Slower:  1
Slow:    2
Normal:  3
Fast:    4
Faster:  5
Fastest: 6

Let me know if you want a compiled binary from me or if you have a bwheadless repo where I could submit a PR.

michalsustr commented 6 years ago

Hi :) can you please submit PR to https://github.com/Games-and-Simulations/bwheadless ?

Ideally if you could make an ENV variable like BWHEADLESS_GAME_SPEED that is read within the C code and I'll set it from the outside (as in sc-tm: https://github.com/Games-and-Simulations/sc-tm/blob/master/TM/TM.hpp#L65)

adakitesystems commented 6 years ago

Hello! Pull request submitted.

bmnielsen commented 6 years ago

@michalsustr Any update on this one?