So it turns out procedural generation is hard.
After some more poking around, I’ve found a compromise I’m willing to settle with for now. Especially considering I only have just a little over a day left to complete the game.
Presenting Zack Banack’s ASCII level generator!
This script is a little overkill for what the project needs, but it’s working quite efficiently. Basically, it works by drawing out stages in a .txt document using specific characters to represent different objects. For example, the X’s above are walls and floors, while the P is the player. A few scripts in Game Maker are then used to tell the engine to read the document and copy all the objects into an empty room. After some working, I’ve gotten it to where it will load in a random level at the start of the game and, if the player dies, it will restart with a different level.
Unfortunately, this means I’ll have to build every level by hand, although I still plan to incorporate the level chunk idea my brother helped me out with. Tomorrow, I’ll be designing somewhere between 10-20 level chunks and building 5-10 levels out of them. Hopefully the game will still feel procedurally generated and relatively random despite the fact that it’s all hand made.
Some more bad news is that, due to the fact that the stages are pre-made, they’ll all have ends rather than being an infinite runner. To that end, the purpose of the game has gone from surviving as long as possible to reaching the goal without dying. I’ve seen quite a few scripts available that would allow the room to loop horizontally, but I ain’t got time for that.
But there’s some good news! We have a functioning platformer!
We’ve got player movement, jumping, screen-scrolling, dying, and restarting. All that needs doing is getting the door to react to the player, coding the spooky ghost to follow the player, and light switch functionality. After that, given time, I might like to spruce up the sprites and I think an opening cutscene giving the game some kind of basic story would be really cool.
All I can say is I probably won’t be sleeping tomorrow night.