Classic Snake game - with a twist! (Well, not yet, but it’s coming.)
This project started as an experiment: can Forge be used to make even a simplest game?
The level was created in a Forge's Editor app and is loaded by the game at runtime.
The game project is standalone but depends on the Forge engine.
The snake can be controlled either by a human or by an AI. The entire game state is decoupled from rendering, which means the simulation can run without visuals — leaving the door open to plug in machine learning in the future.
The AI is based on an A* pathfinding approach. It’s able to avoid blocking itself, but it has one flaw - It can create one-cell “holes” in the level that are unreachable. Once that happens, the game can continue forever without ending.
A more robust solution would be using a Hamiltonian cycle.
That would guarantee every cell is eventually visited and prevent creating "holes", though it would need some tweaks to look less robotic and not always force the snake through every cell when a straight path to the apple exists.
