Finally, Rooms

Chase Williams
Developing Developers
3 min readMar 12, 2018

At last, after toiling away at my computer for many hours, I’ve finally evolved the gameplay to more than one room, with more than one enemy available to spawn in each room.

Now, there isn’t any procedural generation yet. It’s all still manually placed by yours truly, but now, the player is truly treated with a sense of progression, rather than what was literally nothing more than a proof of concept.

The Room system, as I call it, basically consists of the physical walls that surround an area, the enemies inside of the walls, and a master script that handles state changes. When the player walks in, all exits are barred, and the player must defeat the enemies to continue onwards on their journey. It’s incredibly simple in concept, but its implementation was quite challenging due to the way I had previously written my code. I essentially broke anything that could break, and spent many hours revising and rewriting code to become both more future proof and more bug free (especially you, pathfinding).

The above is a screenshot of my Unity workspace. I’m sharing this because I want to quickly highlight how I’ve set up my workflow. The middle panel is the “scene” view, or a way of viewing how all the game objects are laid out independent of any actual game camera. The red and white rectangles in the picture are “gizmos” I’ve told Unity to draw for me. Gizmos are basically just a neat way of creating shapes that aren’t actually in the game for visual reference — so in this case, the white rectangles are the boundaries of the rooms, and the red squares are tiles that serve as entrances and exits.

The left panel is a hierarchy of all the game objects in the scene. You can think of it as a file structure — each object can potentially have parents and children, denoted by its indentation. This is a practical way of organizing the objects, such as grouping each Room separately and thus isolating the enemies and other components involved in each Room.

Finally, the right panel (the bottom panel is irrelevant for now) provides the “inspector” view, where you can change values of selected game objects. Room “2” is currently selected, and you can see all of the options I’ve manually created in order to facilitate the customization of rooms: boundaries of the rooms, entrances, the associated tilemap to use, what wall tile to use for the entrances, etc. This way I can just copy and paste a Room object, and then changes the options to best fit the room I pasted it into.

And some “patch notes” for what I’ve done lately:

Basic shooter enemy

Implemented priority queue

Switched from using in-house Node class to Unity’s TileMap system

Pathfinding no longer uses diagonals

Reimplemented a*

Set up the Room system

Reworked enemy controllers to be compatible with the Room system

Set up map with Tiles + 4 Rooms

Simplistic camera movement

--

--