Page 1 of 1

Rouge-like super level

Posted: Tue Oct 23, 2018 4:47 pm
by Autofire

Keep in mind that this is kind of a "let's see if it can be done" kind of project. I can't work on this for a few weeks, but... I hope to dedicate a few weekends to this. This is largely inspired by Alon Bond's Zelda and Zelda II games/levels. Though both of these are incredibly impressive, I have a few critiques.

First, both Zelda and Zelda II have elements of resources management; Zelda II has limited ammo, while both have have limited health. However, the HP of the first game and the ammo of the second tend to feel meaningless; I remember always having way more than I ever needed. (Though Zelda II's HP cap does curb this effect.)

My second critique is just that things feel very samey. Zelda II definitely improved on this by having a few unique mechanics (like the ice). It also helps that the rooms are carefully tailored, unlike most of Zelda's rooms which followed fairly forgettable blueprints. However, combat gets kind of dull. No matter what weapon you have, the strategy is the same: you get enemies at some choke point, shoot for a little while, and then go to a new choke point. (Or, in the case of the first game, run circles around them so that you get more space to shoot them.)

I'd like to experiment with a different approach. Rather than having pre-built levels, I want to create a pseudo-random level generator. I want to experiment with making each play-through unique by having items that have variable appearance (e.g. potions from Nethack). And, rather than giving players a lot of resources, I want to try giving players a very small amount of resources. On top of this, I hope to try creating at least a few variations of the enemies, rather than making them all chase the player (or just move randomly).

I'll be using this thread to post the various strategies I have to actually implementing all this stuff. I may have questions from time to time, but I'll make those in separate threads.

If you're curious, I'll be keeping the WIP version on Github.

Re: Rouge-like super level

Posted: Tue Oct 23, 2018 5:10 pm
by Autofire
At the moment, one of the most important things to worry about is the room/level generation. I can't do much without that, after all.

I'm going to be borrowing Spelunky's system. Spelunky is a platforming rogue-like that also has random level generation, but Spelunky does something quite interesting. Rather than generating levels entirely from scratch, Spelunky splits its rooms into chunks. The game decides what the main path through the chunks will look like. With this decided, it knows what kinds of "presets" to use for each chunk. For example, some presets allow you to drop farther down, while others don't.

I'll get into the details (well, once I figure them out), but the main thing is that I need a way to copy these chunks. And I think I have a solution!
Screen Shot 2018-10-23 at 9.58.59 AM.png
Screen Shot 2018-10-23 at 9.58.59 AM.png (313.09 KiB) Viewed 1024 times
So the red pipe here is the "read head," and the arrow on the bottom is the "write head." The read head can dig anything, and then puts whatever it dug back. The write head creates a copy of whatever gets created. Thus, anything the read head runs through, the write head will copy. This has a small drawback in that I cannot copy many things at once (since the write head writes whenever a new thing is created). Also, if the read head goes too fast, the write head falls behind.

However, now I can copy elements row-by-row. With this, I hope to be able to copy my level chunks, row-by-row. I'll use this, but if anyone has any ideas to speed this up, that would be awesome.

Next, I'll be coming up with a way to copy a bunch of chunks. This is kind of tricky because chunks will probably be square, so each chunk has many rows. I don't think I could move the write head around mid-row, so I'll have to jump between chunks instead. I have some ideas of what I could do.

Re: Rouge-like super level

Posted: Thu Oct 25, 2018 5:19 pm
by Autofire
I hope no one minds me posting multiple times in a row... I can keep these things to myself. Really, my main goal is to explain this stuff in case I end up getting busy for weeks. I'll be able to come back to it and pick up where I left off. (This stuff will get complex really fast as I add more moving parts...)
Screen Shot 2018-10-25 at 9.41.33 AM.png (404.06 KiB) Viewed 999 times
So I was tinkering around some more, and I got this working. The picture shows three micro-chunks after they've been copied into the "playfield." (Everything's small atm to make it easier to work with. The plan is to upgrade chunks into 6x6 squares, and a entire playfield will consist of 5x5 of them, making a 30x30 playfield in total.)

In this case, the bottom-left chunk was selected first, which was followed by the chunk wit the arrows, and then finished with the chunk with the wheels. (Keep in mind that the red pipe is the is the read head and not part of the chunk.) However, I can select chunks in any order I wish. Eventually, the system itself will be the one to decide which chunks get selected, not me.

Read Spawners (the green lights) can either be idle or primed. Idle Read Spawners (IRS) just turn into Primed Read Spawners (PRS) upon player switch. PRS are a bit more complex. They start with a CE value of 3, and do a couple of things:
  • They decrement their own CE Value when a IRS turns into a PRS, a Read Head vanishes (because it hit a Steel Wall), or when the player collects a Red Key.
  • When the CE Value hits 0, it creates a Read Head in the space to the right, creates a PRS beneath itself, and becomes an IRS.
As we convert each IRS into a PRS, The oldest PRS gets a CE Value of 1, the second oldest has a CE Value of 2, etc. Then each one has an internal counter, and knows when it needs to start reading next. They take turns, row-by-row, until each has copied the entire chunk. (In the picture, you can see that the bottom rows are next to get copied.) The starting CE Value must match the number of chunks in a row! It will probably become 5!

Write Spawners (the red switches) can also be idle or primed. Again, Idle Write Spawners (IWS) turn into Primed Write Spawners (PWS) when switched. The PWS has a CE Value of 6 and does this:
  • Decrements CE Value when the Write Head copies a single element.
  • Creates an Inactive Write Head (right) when the (1) a Red Key is collected, (2) the CE Value hits 0. Then the current PWS turns into a IWS and the object below becomes a PWS.
Thus, the PWS will create a new Write Head when the current Write Head finished filling out a row of elements, and tells the IWS underneath it to start counting the elements in the current row. The rows will get filled out, one by one. And, future me, make sure that the starting CE Value becomes the width (in elements) of the playfield!

I currently have one main difficulty: I cannot copy blank spaces! I have a couple of ideas, but we'll see if any of them work... Once that's dealt with, I'll go on to making it so that we can copy rows of chunks.