The Frozen Firepits of Generic Dungeon Name (TFFGDN)

Executable (Windows) | Report | Videos | Project (Unity)

The Frozen Firepits of Generic Dungeon Name (TFFGDN) is an experimental turn-based, physics-based dungeon crawler inspired by classic roguelikes (Angband, Nethack, Dungeons of Dredmor…) and cue sports (Snooker, Pool…), implemented in the Unity engine. I created TFFGDN for the AI assignment of the Game Behaviour module in the final year of my Computer Games Programming (BScH) at the University of Derby. I was also required to produce a short report on the project – which I failed to do in that my report was about twice the desirable length. I personally think the extra length is justified; what you see here will be an abbreviated version, but I’ll make sure you can go read the original document if you like, wherein you will find additional information on the game mechanics, controls, and AI implementation.

Dungeons in TFFGDN are represented by a flat, tiled map of surfaces with differing friction coefficients (lowest to highest: Ice, Smoothstone, Roughstone, Gravel), divided by walls and lava-filled pits. Player and enemy pieces are represented by short cyllinders (pucks) which fight by attempting to push each other into the lava. Walls and pucks have high restitution, allowing for snooker-like movements. Different pucks have different sizes and stats intended to represent different classes and creatures. I had also intended to give them magic and special abilities, but I did not have time to implement this.

There are five factions in TFFGDN: Human (player), Goblin, Cutthroat, Kenku, and Clockwork. Turn orders are fixed but each may move its own pieces in any order. Goblins, Cutthroats and Kenku are in a temporary alliance and will not attack each other. The goal of the player is to collect all of the green crystals in a level before all of his pieces are eliminated, while other factions simply seek to eliminate known enemies. Pieces can only be eliminated by falling into lava.

Pucks are moved by applying a given direction and velocity and no further inputs are accepted until all movement has ceased due to friction, collision, or lava-death. Actions per turn are restricted by the following per-unit statistics: Move Points, Stamina, Action Points, and Mana. Further information on these statistics and the game controls is available in the full report.

Screenshot of a typical dungeon in TFFGDN

Screenshot of a typical dungeon in TFFGDN

In many ways the challenge of selecting moves in this environment is similar to that in cue sports, and while shots may potentially be simulated and executed with perfect accuracy, this would not make for very interesting opponents. Furthermore, TFFGDN complicates the matter by introducing varying surface friction, piece size, mass, and variable move order. Pathfinding is also necessitated by the more complex game world, and since we wish for enemy pieces to behave like individual creatures rather than a single player, we also have to model their knowledge of the world.

AI in TFFGDN runs on a separate thread so that the player may look around at his leisure during enemy turns. Each piece has basic vision and memory parameters which determine when it is aware of enemy pucks, and will decide it’s behaviour based on whether it has direct access, line of sight, or just knowledge of an enemy’s existence.

A* pathfinding is utilized when a route must be found, with the cost of traversing tiles based upon an influence map generated during level loading; this causes pucks to avoid tiles near to lava or walls. The way in which the pathing nodes are traversed once a path is found differs between enemy types, but all depend on basic physics calculations to determine the launch speed and direction required, based on the friction coefficient of the surface beneath them. These calculations are not completely consistent with Unity’s physics; exhibited friction, for example, is stronger, and so the AI applies a random offset to its launch velocity with a bias towards overshooting. Some enemies also offset their launch direction randomly.

A more in-depth explanation of the AI implemented and its effectiveness can be found in the full report.

Screenshot of a map in game (left) and it's generated influence map (right), where darker values represent a greater cost coefficient.

Screenshot of a map in game (left) and it’s generated influence map (right), where darker values represent a greater cost coefficient.

Issues and Improvements
There is a known gameplay bug which causes pieces to occasionally change trajectory in an unpredictable manner. This is a result of high penetration in Unity’s physics engine causing pucks to catch on the side of tiles. Possible solutions include migrating to a different engine, or assembling collision meshes for environments. This would be naturally fixed if levels were switched to a more complex format, such as structures with ramps, hills, cliffs, etc. – though this would complicate the AI a lot.

For more flexible AI we also need to synthesize a greater understanding of the physics, enabling more complex moves such as those which involve bouncing pieces off of walls, or proxy-kills by using other pieces as projectiles. This is probably most easily achieved by using simulation and evaluation of randomly sampled moves (Monte-Carlo move selection), where evaluation is based on current intentions. This would also potentially result in more human-like error, as the best move may be, for example, near to a kill, but not quite. Great improvements could also be made to the AI’s knowledge model, which currently allows it to know the location of any enemy recently seen.

As mentioned earlier, I also intended to implement magic and special abilities. I think there is great potential for interesting buffs and abilities in this environment, such as modifying a puck’s mass, levitation, area-of-effect (AoE) impulses, projectiles, stealth, etc.

Finally, the code needs a lot of work. TFFGDN was implemented in less than three weeks, and Unity was a pain on multiple fronts: it was not ideal for setting up a turn based system (something I had not tried before), crashed frequently during debugging of threaded code, and the physics penetration issue took a lot of time to smooth into its current state.

I really think this concept has potential but the current implementation is a bit boring in my opinion. It’s unlikely I’ll take it any further in the foreseeable future though, as I think that would be a huge undertaking.



One thought on “The Frozen Firepits of Generic Dungeon Name (TFFGDN)

  1. Pingback: Portfolio Update – Game Behaviour | Confect's Codex

Your thoughts:

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s