Extending Sonic 2 level size

Discussion in 'Discussion & Q&A' started by Psi, Feb 6, 2023.

  1. Psi

    Psi Well-Known Member Member

    Dec 20, 2014
    I'm working on making a fairly long level in Sonic 2.

    What I need to figure out is either how to extend the horizontal level size limit beyond $3FFF, or alternatively, figure out how to transition the level to a new area while keeping the time limit and other statuses in tact (like S3K's Death Egg Act 2 to 3 transition I guess). Which would be simplest and more practical to do and how would I do it?
  2. Devon

    Devon I think I'm paranoid Member

    Aug 26, 2013
    your mom
    If you want to extend the actual stags themselves, you would need to allocate more RAM to hold the extra data (or reference the data from ROM instead), and change any reference to the stage layouts so that it accounts for the new size when calculating the chunk index from a coordinate.

    For transitions, your best bet would be that you would want to have a "connecting piece" of sorta between the 2 layout segments (basically, have a copy of the ending segment of the 1st layout be the start of the 2nd, it should be large enough to take tue entire screen), and when Sonic is in that connecting area, swap the layouts and reposition things (like Sonic and the camera) as necessary. Some things like the stage renderer and object manager will probably need to be reset somewhat during the transition.

    You could also port over S3K's stage layout format. Basically, it starts off with a list of pointers to the rows of chunks. That basically replaces the having to multiply a Y position by the width to help calculate the chunk index, and as such, with the dynamicness of this format, the size of the stage can be whatever you want it to be, as long as you have the memory space for it.
    Inferno and DeltaWooloo like this.