Dev Blog 02 | First Day At School
Updated: Jul 9, 2020
My game needs a school. A big one preferably. One with plenty of corridors and rooms and secret passages to explore. And it needs to be different every time you press the play button because I don't want players to be able to memorise paths as a means of optimising their pathing - this is your first day at school after all, you have no idea where the potions corridor is.
A procedurally generated school is what I need.
So, as my game design document so earnestly promised, the next big pillar of 'First Year' casts its shadow over me. Procedurally generating my traversible school. In all honesty, as I weigh up the task now, it doesn't seem as daunting as it once might have. In the last 8 or so months I have developed tremendously as a C# programmer and 'First Year' already features some very advanced - in my honest opinion - programmatic systems.
As an artist I am privy to one of the best kept secrets of producing quality media. Always use reference. Trying to reinvent the wheel is a rookie error but one I understand the trappings of all too well.
What if it's comes off as unoriginal?
What if it is considered plagiarism?
It can't be that easy can it?
Oh god won't somebody think of the artistic integrity!
So reference. Which in this case means keeping in mind the games that feature the type of procedural generation that I like. For 'First Year' I have always imagined the room and world structure as emulating The Binding of Isaac. By extension I've been told this means that it is also Zelda-esque. I wasn't a Nintendo kid so, whatever. Having a kind of screen-based system where I can load rooms in and out of a boundless void appeals to me. I can hide crimes outside the camera, I don't have to worry about really accurately joining up adjoining rooms, and - very helpfully, I only need to operate in a limited area of my game world.
With these principles in mind, I have spent a lot of time developing the look and inner workings of the rooms on a room-to-room basis. Cameras, lights, visual style, cinematic and event triggering, UI and physics all look and work how I want them too and individual rooms can be explored and enemies battled in a really satisfying way.
But how do I chain them together a la Isaac?
Well, in comes SixDot with a great video tutorial that helped everything fall into place. I just needed to headbutt the wall for while. I have a framework now that lets me specify rooms ahead of time (in my case, my floors absolutely must have a start room and a boss room) and then poll spots on a grid for neighbouring rooms. Depending on given parameters, potential rooms are kept or tossed. Best thing is, it all hooks beautifull into my system by spawning each room from data held locally by the room itself, meaning that my room centric approach thusfar needs minimal reworking.
Eventually you get some cool stuff like this:
Next step is to tweak these layouts so I get less deadends. If you look at some of the longer corridors they seem reluctant to loop back into neighbouring corridors to form loops, which is something I want as I feel it will minimise backtracking and more faithfully emulate a real school layout.
I'll post a more detailed breakdown of the code once it's all nice and shiny.