TEAM
Eunice Lim, Nancy Hsi Lin
MY RESPONSIBILITIES
-
Co-designed game.
-
Scripted cellular automata procedural map generator.
-
Scripted dynamic runtime navigation mesh.
-
Implemented pathfinding.
-
Scripted creep waves.
-
3D voxel art.
VILLAGE DEFENSE
An experiment of love focused on procedural generation and its possibilities.
Defend your home! Build a tower anywhere in any formation! But beware, if you block the creeps they will destroy your towers!
GENRE
3D. tower defense
GAME ENGINE
Unity, C#
MAKING PROCEDURAL PLAYABLE
I basically generated blocks based on the cellular automata method but added a couple of twists to make it more interesting.
ADDING VISUAL VARIETY
A bunch of square cubes looked boring, so I figured out how to add variety to a uniform method like cellular automata.
1. Create an array of prefab objects (eg. Broken wall, Altar)
2. Set the fill density to a very low number (~10%)
3. Check how many cubes surrounded a position.
4. The more surrounding neighbors, the larger the prefab I'd instantiate.
MAKING SURE EVERY LEVEL IS PLAYABLE
With the method above, there was a risk that a map could not be playable because the creep's path might be blocked. Short of allowing creeps to destroy walls, I came up with a simple solution.
1. Generate the map
2. Destroy any objects in a zone around the start and endpoints
3. Using NavMesh, check if there's a valid path from start to end
4. If not, regenerate the map
Done! This solution leverages the same NavMesh logic I'd scripted for creep pathfinding.
ENSURING FREEDOM OF TOWER PLACEMENT DIDN'T INVALIDATE THE GAME
A core design was that tower placement wasn't restricted, which meant paths could be blocked at runtime too. So I set up the following:
-
Update navmesh & pathfinding when a tower is placed
-
Set up a state machine for creeps - Enraged, Idle, Walking
In Enraged mode, creeps would attack towers until a new path was made!