Not to brag, but we have a lot of flat pack furniture. And I treat all of it like a stiff breeze through the window would cause it to collapse like a particularly late-stage jenga. Other people don’t do that, they lean on things, jump on things, bump into things... So far it’s all been fine, but I am waiting for that triple fatality because someone clipped a bookcase. It turns out a great source of anxiety is people treating things I have made as if they function properly.
Order of Operations
SOKOBOT is a programming game where 5 little robots can push, pull and rotate arbitrary-size shapes on a grid. They do this simultaneously and on a conflict, such as one bot trying to move into a tile another is also shoving a shape into, they cancel their action and alert the player by shaking their heads all cute. And if another bot was about to move forwards, whose movement is now blocked because of this cancellation, that should cancel too. This continues until conflicts are resolved. This is not really handled by recursion, but by more of an iterative nope.
It’s not the most complicated code in the world but it has a lot of rules. Mostly because a bot doesn’t need to be interacting directly to cause problems. They can be using a large shape as a plough to push a line of loose 1x1 shapes, and those could collide with a moving bot instead.
It is also not as simple as checking if more than one bot is interacting with the same shape or tile. Multiple bots holding onto a shape and moving in the same direction is fine, whereas if a shape is held by two bots and only one decides to move that is a conflict.
To make things even more prickly there is some chronological importance within each tick. For instance if one bot is asked to go to Sleep, while another bot is asked to tell everyone to Wake Up - removing sleep status. Making this behaviour consistent is done by making sure that one command is checked before the other, rather than resolving it all at once like collisions.
Out In The Wild
This was all quite nerve-wracking to post out into the wild with minimal playtesting (no moneys). Especially with leaderboards for each solution. I would hate the optimal solutions to be using bugs and it would be painful to have to scrub leaderboards. So it was scary watching streams, videos and tweets where people treated the game like it wasn’t held together with glue and string.
A player called ゴマ卵 started posting extremely good scores for commands. These beat my own records by a long way I just had to ask how they were doing this. Which they did in a lot of detail! Thankfully, they were just much better at the game than I was.
But alas, ゴマ卵 also found that in certain circumstances... rotation is order dependant. If BOT-00 rotates a shape out of a space and BOT-01 rotates a shape into that space that’s fine. If the opposite happens it’s blocked. So, despite it being a design pillar I missed something major. Unfortunately fixing it will break a lot of solutions made by players unaware of the bug and it would need a total leaderboard scrub for a game that had already hit its tail.
