Posted January 06, 2025 by crcdng
#tinysim
The 0.5 update for Tiny Sim is out, and it is a big one. I had to postpone development a bit because in the meantime I published Pooooong on the Play Store (I had to publish a game there by January 10, but that's for another story). And Tiny Sim, as a 48 hour prototype, needed some major code refactoring. The rules for entity collision resolution were surprisingly complex and a number of other issues needed to be iterated on. All this is done in 0.5.
Collision resolution happens when different entities land on the same square. The complexity arises from the fact that more than two entities can appear at a location. I first used recursion which turned out to be confusing and not useful. Collision resolution is now handled based on priority: only one rule is triggered and all the lower-priority ones are ignored.
Here are the current rules in ascending priority (R = RED, B = BLUE, N = NEUTRAL, P = Player):
Rule 6 (no change) | R + R -> R + R B + B -> B + B G + G -> G + G |
Rule 5a / Rule 5b | R + G -> R + R G + R -> R + R B + G -> B + B G + B -> B + B |
Rule 4 | R + B -> G B + R -> G |
Rule 3 | P + B -> P + B' TODO B + P -> B' + P TODO |
Rule 2 | P + G -> P + B G + P -> B + P |
Rule 1 | P + R -> R ---> P-1 R + P -> R ---> P-1 |
Rule 1, with the highest priority, states that the collision between Player and REDs results in the RED surviving and the Player losing a life and turning up at a random location. Rule 3 states that the Player can boost BLUEs which is not implemented yet. The other rules show the conditions and results of collisions.
Havin the big clean-up out of the way leaves room for the next iteration to focus on adding effects and animations to the game events for more "Game Feel". I am also planning to experiment with a bit less random movement of entities. I am looking forward to tackle this to-do list, but before that, Hot and Cold will get a much needed update.