Random Levels Project

Discussion in 'Showroom' started by DigitalDuck, Apr 28, 2017.

Thread Status:
Not open for further replies.
  1. DigitalDuck

    DigitalDuck Active Member Member

    Joined:
    Apr 27, 2017
    Messages:
    38
    Location:
    Lincs, UK
    v-0.1.1 available, details here

    v0.1: DOWNLOAD


    Razor's video:


    Obligatory screenshot:
    [​IMG]

    Controls - as Sonic 1, plus:
    - down+A/B/C while standing: Spindash (Sonic 2)
    - up+A/B/C while standing: Peelout (Sonic CD)
    - up while rolling: unroll
    - down or A/B/C while airborne: curl in air
    - A while paused: regenerate level (only loses progress since last checkpoint)

    ------------

    About S1RL:

    S1RL: Random Levels Project is a hack/mod of Sonic the Hedgehog that allows the game to generate its own levels in real-time. Other changes have been made with this in mind: Sonic's moveset is now tailored for maximum control rather than risk/reward payoffs; acts are much longer than usual; the timer now shows hours, minutes, and seconds, and the time limit has been extended to 24 hours; the life system has been removed entirely, with any death resulting in going back to the previous checkpoint; the camera moves in front of Sonic to reveal more of the level ahead; checkpoints trigger when going past them at any height; and there are multiple palettes to each level that change either with time or with a monitor. There are also numerous other minor cosmetic changes and bugfixes.

    S1RL contains a number of monitors additional or changed from the original game.
    - Static: changes the level palette
    - S: gives both invincibility and speed shoes
    - Eggman: hurts Sonic
    - Sonic: produces a number of rings

    Code added to the game was written in 68k ASM. Data added to the game was first produced by a program written in C#, and then tweaked by hand.

    This is version 0.1. Only Green Hill Zone is playable in this version.

    ------------

    Development backstory:

    The idea for this hack first came about in 2009. I was writing a maze generator and experimenting with tiling patterns and fitting different types of tiles together with different rules, and I wondered if the same could be done with the large chunks in a Sonic game. In 2010 I tried with limited success, getting Sonic 2 generating usually traversable levels in this way in the timespan of ~12 seconds. However, the levels weren't frequently traversable enough, nor was the generation time low enough, for myself to consider it a success. At the time I was also suffering a nasty breakup as well as needing to focus on my Games Computing degree, and the stress of it all left me abandoning it entirely for a while.

    For my Final Year Project I chose to study real-time adaptive track generation in racing games, creating a racing game which dynamically produces a road ahead of the player tailored to their driving style, and writing a dissertation about it, complete with user testing showing its effectiveness. It was successful enough that I was asked to cut down the dissertation into journal paper format and submit it to GAMEON'2012 with help from my supervisor.

    During that time I read a lot about procedural generation, took a thorough look at how other games used it and how well it worked, and began forming new ideas about creating random levels in a Sonic game. Gone was the original tile-based generator, replaced with a strip-based generator instead. Objects could and should be attached to chunks that they're not contained in, and even in entirely different strips, provided it makes sense for them to be there. Strips that are otherwise the same can be duplicated to allow object placements that prevent certain tile placements, making the objects as much part of the level generator as the terrain.

    However, I couldn't work on it in any serious capacity. I was too busy applying for jobs and attending interviews (and not getting the jobs), working with a team and a publisher as my own company to produce a shmup (and getting rejected by the publisher), spiralling into a depression at the first two not going anywhere, getting a new girlfriend, and working on my own mobile games - I still intend to make this professional when I eventually find software I like. I had a few small attempts at it; inspired by Sonic Runners in 2014 I recreated the boss and playstyle, testing the infinite-level concept in S128, along with using strips that were 8 chunks long and tall and attempting to tile them correctly. I also made a quick prototype of S1RL towards the end of 2015 and... it was a massive improvement over my 2010 attempts.

    But after simply not finding any engine up to snuff, I got stuck in a rut again. I still wanted (nay, needed) to code, and the focus shifted back to S1RL. I had no distractions. Studies were over, job well was dry, relationship was stable, and mobile games were going nowhere. So I dug deep into 68k (I'd learned it previously, but only with frequent reference to an instruction list), learnt how the game engine works, which parts needed to change and how, and plugged away at it. I didn't manage to do everything I wanted to, but I'm happy enough with the results to release it now. Of course, I'm going to continue working on it...

    ------------

    How you can help:

    This hack is far from finished, and certainly not bug-free. Reporting anything you feel shouldn't belong is appreciated, even if I've already been made aware of it and it's in the list below. What I find particularly important in this case is identifying any problems with the generated level - perhaps two strips are joined together incorrectly, or perhaps two objects are overlapping when they shouldn't be. Because of the nature of the hack, I will not be able to fix these without a savestate in the affected area and a full description of what's wrong and how it should look.

    Known bugs:
    - Objects respawn after hitting a checkpoint. This is not so much a bug as a workaround; I couldn't figure out the OPL routines, so I chose to have objects consistently respawn rather than unpredictably despawn/respawn/not load in the first place.
    - Checkpoints sometimes load already activated, causing the level beyond to stop loading. I'm not sure what causes this, but regeneration (start+A) usually fixes it.
    - Signposts sometimes load earlier than they should, with corrupted graphics and typically causing death shortly after touching it. Again, I'm not sure what causes this, but regeneration (start+A) usually fixes it.
    - Demo does not lock Sonic's controls and cannot be ended with the start button. (fixed for next release)
    - Dying with speed shoes causes music to stay at the faster speed until more speed shoes are collected.

    ------------

    Credits:

    Original game by SEGA and Sonic Team
    Modified by Digital Duck using the Sonic Retro disassembly with great help from the SCHG How-to guides

    Special thanks to all involved in making the disassembly and guides
     
    Last edited: Jul 17, 2017
  2. Pineapple Arse

    Pineapple Arse I ironically hate cold temperatures. Member

    Joined:
    Jun 19, 2016
    Messages:
    129
    Location:
    A cold place.
    This hack is very technical and beautiful. Great job there! Through of my gameplays, I accidentally jumped into a wall and performed a zip (the wall where you place the breakable walls, but I believe that chunk set always had weird collision). As for suggestions I have, I recommend to change the running in peelout animation to the actual peelout animation so it doesn't feel akward performing the move. My second recommendation is a day/night cycle from hitting one of those static monitors, because what I can assume is a night pallet is sore on the eyes. Beside those small issues and suggestions, I honestly can't wait to see future releases of this hack (especially when it will let me play labyrinth zone all day)
     
    Last edited: Apr 28, 2017
    Gametoons and DigitalDuck like this.
  3. DigitalDuck

    DigitalDuck Active Member Member

    Joined:
    Apr 27, 2017
    Messages:
    38
    Location:
    Lincs, UK
    This is planned, it just wasn't a priority. Either next version or the one after that I'll be making the effort to port all the necessary graphics.

    You're the first to complain about the day/night cycle, but it'll be optional next time (and have its own monitor too when I port the art).

    Labyrinth Zone is next. :D
     
  4. Selbi

    Selbi Plug in, baby. Retired Staff

    Joined:
    Jul 20, 2008
    Messages:
    2,398
    Location:
    Northern Germany
    Got stuck in a dead-end about 3 minutes in. Maybe I was supposed to get around this using some wicked bypassing, but it definitely didn't seem intuitive at all. Gens/GS savestate in the attachments. Not sure if it helps.
     

    Attached Files:

  5. DigitalDuck

    DigitalDuck Active Member Member

    Joined:
    Apr 27, 2017
    Messages:
    38
    Location:
    Lincs, UK
    Yep, that's the bug where objects stop loading because of dodgy checkpoints. It's in the bug list and I know what happens, I just can't figure out why.

    The way to get around it, at least for the moment, is to regenerate the level with start+A.
     
  6. StephenUK

    StephenUK Working on a Quackshot disassembly Administrator

    Joined:
    Aug 5, 2007
    Messages:
    975
    Yet another member of the community I recognise and haven't heard of for years, welcome to SSRG.

    I seem to remember you first throwing the idea of this around on Retro some years back, trying to come up with methods of handling the level generation on a chunk by chunk basis. It's good to see that through some experimentation and with the help of some additional knowledge, you've come up with a method that seems to work extremely well, very impressive work.

    I do have a couple of suggestions for future releases based on my own experience of playing it, although I wouldn't consider any of these issues major in the grand scheme of things, so they aren't what I'd consider necessary.

    The first suggestion would be to offer some kind of music selection menu or have a level cycle between a few set tracks, cycling every few minutes or so. I played through this for 15 minutes, and after that time the GHZ music was making me want to blow my brains out. Don't get me wrong, I like the GHZ music, but not for 15 minutes solid. I think any game that has levels that can span that much time needs a bit of musical variety to stop it from getting stale.

    Secondly, I'm not sure how many of these preset strips you're operating with in GHZ, but after the first few minutes I seemed to keep seeing the same ones popping up pretty frequently. Obviously, given the method of level generation this was always going to happen at some point, but it seemed to happen quite a lot, almost as if there weren't a lot of layout strips and object layouts to choose from when it was building the level together. Again, I could be wrong on this, I have no idea how many of these strips you have set up and maybe I was just having some very shit luck with the generation, but I think if possible some extra strip choices to help keep it a bit more fresh would work well. As I said though, given the nature of how this hack plays, I wouldn't imagine people would run the zone endlessly for hours so it probably isn't that big a deal.

    Other than these, I actually enjoyed playing a 15 minute stretch of GHZ, which is unusual for me because I'm not a fan of the level in S1 at all, so congrats on making GHZ have some nice replay value. I'm very much looking forward to seeing what you do with other zones in the future, particularly SLZ and SBZ if you take these on at any point. Keep up the good work.

    Also, I punted you up to Member status, just because I can =P
     
    Xeal and DigitalDuck like this.
  7. DigitalDuck

    DigitalDuck Active Member Member

    Joined:
    Apr 27, 2017
    Messages:
    38
    Location:
    Lincs, UK
    This was mentioned on Retro as well. There is an option to disable the music that's already half-implemented and will be in next time.

    I considered the music changing with the time of day (so four variations on the theme), but I don't know how to create music in a format I can use in-game, and it's more effort than I wanted to do for now (my focus was on the level generation). It's something on my to-do list, though.

    A playlist would be a reasonable substitution but I don't know how to do that either. I should probably learn the music side of things at some point.

    It wasn't bad luck, this is common. I created 36 acts of Green Hill Zone to use as a basis, but I'd need to do a couple of hundred to get any real variety out of it. I'll see what I can do to solve this problem, but it's probably just going to need a day where I don't feel like coding and instead feel like blocking out Green Hill Zone Act 462.

    Yay, I'm out of the basement. \o/
     
    Xeal, ProjectFM and StephenUK like this.
  8. Giovanni

    Giovanni sometimes comes out of his cave Member

    Joined:
    Apr 16, 2015
    Messages:
    115
    Location:
    Vercelli, Italy
    A few weeks ago, I was thinking: "Why isn't there yet a randomly generated layout hack?". Then this came out.
    I love this. It's the only hack that made me play the same level for 30 minutes straight without me even complaining!
    Also, for those wondering, levels are not infinite.
    s1rl-v01.001.png
    I could finish a level in 31:07 with a total of 1475 rings. It was a great ride though.

    This also comes out with a bug: The ring counter goes above 1000 rings. Known the nature of this hack, I think you should put a ring cap and set it to 9999 rings.

    Anyways, this hack is one of the best hacks I've ever seen. I hope to see more from you.
     
    ProjectFM likes this.
  9. DigitalDuck

    DigitalDuck Active Member Member

    Joined:
    Apr 27, 2017
    Messages:
    38
    Location:
    Lincs, UK
    Still got two acts left. :D

    Already done for next time. The bug exists in the original game, but there's no way of getting that many rings.
     
  10. Chris Highwind

    Chris Highwind Newcomer Member

    Joined:
    Aug 6, 2012
    Messages:
    14
    Just got done with my own 28 minute run of Act 1, and honestly, unlike the others, I was starting to get sick of it at the end. Though that could just be me being abysmally bad at the classic Sonic games compared to most of the people in SSRG or Retro, seeing as the only classic Sonic games I had growing up were Sonic 2 Game Gear, the old PC version of Sonic CD from the 90's, and the PC version of Sonic R. Still, I did manage to learn to read a few of the level strips, such as jumping after a breakable wall lest I fling myself into a bottomless pit. However, deaths were still plentiful, especially at the 27 minute mark. Make no mistake, I will play the other 2 acts, but I definitely need a break after playing a 30-minute-long act without pausing. My suggestion for future versions of the hack would be to allow players to choose a level to play, either from the start or unlocking as you complete them.
     
  11. DigitalDuck

    DigitalDuck Active Member Member

    Joined:
    Apr 27, 2017
    Messages:
    38
    Location:
    Lincs, UK
    Yeah, uh... I haven't even played through a full act without pausing. Reaching the end isn't really the point of the hack, I just put the end in for the sake of having an end.

    Yep, that's planned. Wouldn't be much use in this version because only GHZ works at the moment, but it'll be implemented for next time.
     
  12. Chris Highwind

    Chris Highwind Newcomer Member

    Joined:
    Aug 6, 2012
    Messages:
    14
    Booted up a savestate to play Act 2, and that was much more buggy. I played through the level 3 times and had to regenerate twice. The first time, what I assumed to be a strip with springs in it didn't load the springs (It was the strip with the two horizontal springs and a vertical spring, all red) requiring me to regenerate. The second time, the level layout abruptly ended, in what I assume is the checkpoint bug, and the final time, the layout ended again and the game outright crashed. I'm assuming only Act 1 is meant to be played?
     
  13. DigitalDuck

    DigitalDuck Active Member Member

    Joined:
    Apr 27, 2017
    Messages:
    38
    Location:
    Lincs, UK
    Act 2 is literally identical to Act 1 except for the length it checks for; you just got bad luck.

    The checkpoint bug is responsible for both the objects not loading and the layout ending, and I'm still trying to fix it.
     
  14. Chris Highwind

    Chris Highwind Newcomer Member

    Joined:
    Aug 6, 2012
    Messages:
    14
    Shame, I was kinda looking forward to the other 2 acts in case you did a thing where each act has its own pool of strips to use when generating the level. It's nice to know that it was just crap luck on my part that the checkpoint bug kept happening to the extent of a crash and that it's being looked at, though. For a tech demo, this is actually fun if you don't try to get through an act in one sitting, since you never know what's next in the level and have to read the individual strips of layout instead of the entirety of the level.
     
  15. DigitalDuck

    DigitalDuck Active Member Member

    Joined:
    Apr 27, 2017
    Messages:
    38
    Location:
    Lincs, UK
    I did consider that, but you've seen how little variety there is when I don't do it...

    The crash is new - I've never had it actually crash on me before.
     
  16. Chris Highwind

    Chris Highwind Newcomer Member

    Joined:
    Aug 6, 2012
    Messages:
    14
    It might have been the emulator, as I'm using both Genesis Plus GX and Picodrive off of the Vita version of RetroArch, and the crash happened while playing in GPGX, which does have an option to turn off and on various errors that could make games crash on real hardware, but if turned off, can make hacks functional. Also, I was playing in Picodrive, and while I haven't had any more bugs, I did hit a bit of a generator snafu where there was a rock literally planted right at the exit of an S-tube.
    2017-05-03-092237.jpg
    I was able to spindash back up the S-tube, but as I didn't see another path to take, I ended up hitting the regenerate combo anyway. This is probably the first time anyone's ever reported a hiccup like this, though.

    EDIT: Looking back, I probably should've screenshotted the crash too, but I remember being in a slightly foul mood at the time due to RL bothers.
     
  17. DigitalDuck

    DigitalDuck Active Member Member

    Joined:
    Apr 27, 2017
    Messages:
    38
    Location:
    Lincs, UK
    Even better than a screenshot would be a savestate, because it's hard to know which strips to fix if I don't know which strips are there. :D
     
  18. Chris Highwind

    Chris Highwind Newcomer Member

    Joined:
    Aug 6, 2012
    Messages:
    14
    Heh, true. Didn't think about that. If I come across the hiccup again, I'll savestate.
     
  19. Chris Highwind

    Chris Highwind Newcomer Member

    Joined:
    Aug 6, 2012
    Messages:
    14
  20. Greenknight9000

    Greenknight9000 Well-Known Member Member

    Joined:
    Apr 30, 2014
    Messages:
    53
    T-this is INCREDIBLE!!!!! The possibillites are going to be ENDLESS!!
    If this gets completed (all zones generated etc) this could turn into the unofficial Sonic The Hedgehog Maker EXCLUSIVELY for Sega Mega Drive / Sega Genesis!
    Also, will Super Sonic make an appearance, or will that be for when we have to wait a few decades for Sonic 2 Random Levels?
     
Thread Status:
Not open for further replies.