In Twilight Dream you use your grappling hook to survive in an endless repeating dream while trying for the highest score. See how long you can survive!

Twilight dream was our entry for GMTK Game Jam 2025. Like usual, I worked on the majority of the programming, although I didn’t have as much time to work on it this year. The others did some great work on this one, especially YoruVII with the visuals who got us to 14th place in the Artwork category!

Try it here!

Development

Although the gameplay loop could have been improved somewhat, there’s some nice tech that went into this game.

Early prototype clip testing the world looping

The looping world idea was the first thing I worked on, as it was the theme after all. To prevent issues that may arise from constantly falling, the actual coordinates of the player never actually leave the box that the level is in. Physics are calculated normally but the last step in the physics loop involves applying a modulo to the player’s coordinates values. The same is done to enemies. This implements the basic looping mechanic cleanly without having to do any collision detection at the boundaries.

Early prototype clip with basic enemy chase

Despite this approach however, some checks needed to be implemented to determine if the player did pass this boundary. One of the main reasons being the grapple hook. Although the end result looks rather seamless, the grapple point coordinates have to be changed whenever the player passes the boundary to compensate for the looping coordinates. You don’t really notice that everything has to essentially teleport whenever you loop around.

Swarm stress test

The enemy chasing was also interesting to implement.

But first, we need to talk about parallel universes…

There is one “real” player and “real” enemies only exist within the playing area. However, enemies had to be cloned across adjacent parallel universes to look convincing and not just pop in whenever you pass the boundary. I called them ghost enemies. They’re pretty simple, they’re just lower detail copies of the real enemies which copy the rotation and relative position of the real enemy, just with an offset. To chase the player however, each real enemies sees the real coordinates of the player, and a list of coordinates with offset that match where the player would be in each parallel universe… Essentially, each enemy also sees ghost players. The enemy then picks the closest option, which allows them to chase the player through world boundaries. Otherwise, the enemies would stop and turn around whenever the player looped around.