In previous episode we gave our snake a purpose: food, growth and the beginnings of a real challenge. Now, in Episode 4, that challenge turns inward. We are introducing a brand new threat: yourself! or rather your past self. This is where the clone mechanic comes into play.
What We Covered
- Introduced a global
player_path
array to store the player’s movement history - Added the ability to spawn clones that replay the player’s path
- Made each clone operate on a delay using a
player_path_idx
index into theplayer_path
array - Created a
SnakeClone
struct wrapping aSnake
with extra data - Implemented per step logic to grow and animate clones independently
- Added clone decay: every time the player eats food all existing clones shrink by one segment and are removed when they reach length zero
Every time the player eats food a new clone spawns and begins to trace the player’s old footsteps. It’s deterministic, clean and eerily effective at making the player fear their own past.
Design Insights
- Clones move based on positions from the
player_path
array - The player’s path is updated every movement tick
- All clones are stored in a simple array, updated alongside the player
Implementation Highlights
SnakeClone
=Snake
+player_path_idx
Position *player_path
stores every step the player takes- On food pickup: spawn new clone, set
player_path_idx = 0
and add togame.clones
- Also on food pickup: reduce all existing clones’ length by 1
- During update: clones follow the path, shift their own tiles and draw as usual
Gameplay Impact
This is the moment where Snake Rewind becomes more than a remake. It is now a strategy game about space, timing and memory. Clones create risk zones and slowly turn the grid into a trap.
Acknowledgements
Snake Snake Snake - Original idea of a Snake clone
What’s Next?
In Episode 5 we’ll tie this mechanic into the game loop by implementing collision detection, game over logic and a retry prompt - completing the core loop.