This pr was meant to just add undo support to the sokoban game, but as I was digging around I ended up being inspired to do a bit more
Changes
Gameplay
Undo support (buffer holds 512 moves)
Added noclip triggered by a secret code
Added a final GG level which cannot be beaten
You can no longer fail to finish a level by pushing the barrel over the final goal
Audio
Added noise sfx for undo
Added noise sfx for noclip walk
Build process
Fixed a glitch in the sokoban conversion script which miscalculated remaining available space
Moved grass foliage generation from sokoban script to runtime. This allows significantly better compression (level data ~16k -> ~8k)
Related to above: this removal of build time randomization is a step towards reproducibility
Added package-lock.json files to repo. This is best practice and also helps with reproducibility
Other
Added a function weak_rnd in random.c to reduce the amount of shuffling done by the lsfr. This will produce less apparently random results but for the sake of randomizing grass foliage it is sufficient and significantly reduces lag when generating levels
scan_level now exits early when finding a starting position for the player. This should be faster but would change behavior for levels with multiple start positions set (none of the current set have multiple start positions)
Changed how checking for level completion is done. Previously there was a goals_remaining counter which tracked how many goals did not have barrels covering them. Because undo support somewhat complicated keeping this value synced I removed it and instead just scan the level for open goals once per frame. A potentially faster method I have not tried: at level start time put all goal locations into a buffer and only check those tiles.
Work which remains to be done
Bgm
I want to add a special sfx for enabling noclip, currently it uses the yee song
This pr was meant to just add undo support to the sokoban game, but as I was digging around I ended up being inspired to do a bit more
Changes
package-lock.json
files to repo. This is best practice and also helps with reproducibilityweak_rnd
inrandom.c
to reduce the amount of shuffling done by the lsfr. This will produce less apparently random results but for the sake of randomizing grass foliage it is sufficient and significantly reduces lag when generating levelsscan_level
now exits early when finding a starting position for the player. This should be faster but would change behavior for levels with multiple start positions set (none of the current set have multiple start positions)goals_remaining
counter which tracked how many goals did not have barrels covering them. Because undo support somewhat complicated keeping this value synced I removed it and instead just scan the level for open goals once per frame. A potentially faster method I have not tried: at level start time put all goal locations into a buffer and only check those tiles.Work which remains to be done