Sonic and Sega Retro Message Board: Saxman's Sonic Boom engine - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 6 Pages +
  • 1
  • 2
  • 3
  • 4
  • Last ►
    Locked
    Locked Forum

Saxman's Sonic Boom engine Throw out your S2 disassemblies. Try this instead.

#16 User is offline saxman 

Posted 05 December 2014 - 06:37 PM

  • Oldbie
  • Posts: 2625
  • Joined: 08-April 04
  • Gender:Male
  • Location:United States of America
  • Wiki edits:136

View PostMainMemory, on 05 December 2014 - 06:12 PM, said:

Importing Knuckles really isn't that hard. Speaking of which, did you fix his art loading so it's not horrendously wasteful, and add in his missing sound effects from S3K?

I could write some code for SonLVL to handle the new level and ring formats, but obviously it wouldn't be able to do the separate graphics and collision, it would only be able to use one set of data and the other would be lost.


I felt importing Knuckles was pretty challenging myself, but perhaps I did it differently. I haven't actually read the guide on porting him over. I did not import the sound effects. I'd like to. And if you mean did I change the art so it uses the correct palette right out of the box, then yes I did.

Honestly, if you did what you propose there regarding the SBLF, then what I could do to accommodate the physical/visual separation is to simply "merge" two maps via a tool of some sort. That is, you have a copy of EHZ for the physical, and another copy for the visual. Then, run my tool and it will bind them together in a third copy. It would be a pretty easy solution.

I'll probably start that tool sooner rather than later so I can put together some demonstrations, record them in a video, and upload the video so people can really see the advantages of the new format.
This post has been edited by saxman: 05 December 2014 - 06:38 PM

#17 User is offline Varion Icaria 

Posted 05 December 2014 - 09:16 PM

  • He's waiting....
  • Posts: 1004
  • Joined: 26-August 03
  • Gender:Male
  • Project:S4: Cybernetic Outbreak
  • Wiki edits:1
I'm still rather curious on the whole format and how it works, can you explain it better and how much more RAM it takes?

#18 User is offline saxman 

Posted 05 December 2014 - 11:28 PM

  • Oldbie
  • Posts: 2625
  • Joined: 08-April 04
  • Gender:Male
  • Location:United States of America
  • Wiki edits:136

View PostVarion Icaria, on 05 December 2014 - 09:16 PM, said:

I'm still rather curious on the whole format and how it works, can you explain it better and how much more RAM it takes?


If you look at Chemical Plant Zone Act 2, the whole meta-block layout takes up 1241 bytes. 4096 bytes are allocated for meta-block layout. So, CPZ2 is only using 30% of that. And obviously, because of the nature of data compression, different levels are going to compress at different ratios.

The level format specification from my first post lays out the entire format, but I can summarize it for you:

You have two bytes to start. One says how many rows there are for the front layout data, and the other says how many rows there are for the background layout data.

Then you have a list of words, each one for a different row, with physical and visual each having one. So for 16 rows of visual and physical layout, you will have 32 words. Each word specifies the format of the row, as well as where the row data is located. The format is as follows:

fffffppp pppppppp

f = format
p = pointer


The pointer is multiplied by 2, so data always has to start at even addresses.

Now, there are 7 formats. They are as follows:

0x00 (00000) = AST: Always specified type
0x01 (00001) = BALE: Bitwise-AND at line-end
0x02 (00010) = WOLE: Wrap once at line-end
0x03 (00011) = ZLE: Zero at line-end
0x10 (10000) = (reserved -- acts as AST)
0x11 (10001) = BALE4: Bitwise-AND at line-end 4-bit
0x12 (10010) = WOLE4: Wrap once at line-end 4-bit
0x13 (10011) = ZLE4: Zero at line-end 4-bit


AST is special, because it uses the pointer value to determine which meta-block to use. It will fill up the entire row with that value. It works great for levels like EHZ where the very top of the level uses 0 for every meta-block position.

BALE data starts with a byte to say how long the data is. 1 is always added to that value. Then the list of meta-blocks starts. At the end of the data, Sonic Boom it will do a bitwise AND operation and repeat the meta-block data endlessly. This format works well with backgrounds.

WOLE data is formatted just like BALE is. The difference is Sonic Boom will wrap this data once (meaning, it does NOT do a modulus operation, but rather does simple subtraction to repeat the data when needed). This is useful when the data is more than half the length of the level and needs repeating, even if only for a few meta-blocks at the very end.

ZLE data is formatted like BALE and WOLE, but Sonic Boom uses 0 for every meta-block position after the data ends.

4-bit formats start with a byte to specify how many nybbles will be used. Then is uses a series of nybbles (even numbered of course) to specify meta-block references. Then a list of meta-blocks for each reference is specified after the nybbles. So for example, 04 01 23 A0 B0 C0 D0 means that there are 4 nybbles, and nybbles 0 = A0, 1 = B0, 2 = C0, and 3 = D0. It cuts normal 8-bit data down to almost half the size. These formats are useful when 16 or fewer different meta-blocks are used in a row.


As for ring layout, it uses pretty much the same general format as Sonic 2, but now all 32 bits of the positions are used with some bits being moved. Doing this allows rings to be placed anywhere in the 0x8000 x 0x2000 area supported by the engine. Here's the format used for each position:

The 'xPos' word is broken up into this format:

oxxxxxxx xxxxxxxx

o = orientation
x = horizontal position

The orientation determines if this is a row or column of rings.

The following format is used for the 'yPos' word:

lllyyyyy yyyyyyyy

l = length
y = vertical position

The length determines the number of rings between 1 and 8.

This post has been edited by saxman: 06 December 2014 - 07:06 PM

#19 User is offline Varion Icaria 

Posted 06 December 2014 - 05:40 PM

  • He's waiting....
  • Posts: 1004
  • Joined: 26-August 03
  • Gender:Male
  • Project:S4: Cybernetic Outbreak
  • Wiki edits:1
That's really interesting but seems tedious to work with, without proper tools

#20 User is offline DigitalDuck 

Posted 06 December 2014 - 07:05 PM

  • Arriving four years late.
  • Posts: 3364
  • Joined: 23-June 08
  • Gender:Male
  • Location:Lincs, UK
  • Project:TurBoa, S1RL
Fuck the haters.

This would be perfect for one of the things I'd like to do with Sonic 2, and it seems to be just me because I'm finding Sonic 1 Two-Eight more useful than the original too...

#21 User is offline saxman 

Posted 07 December 2014 - 02:33 AM

  • Oldbie
  • Posts: 2625
  • Joined: 08-April 04
  • Gender:Male
  • Location:United States of America
  • Wiki edits:136
Saxman's Sonic Boom Engine is now on GitHub: https://github.com/saxman727/sboom

Please create a new branch if you plan to make modifications!


View PostVarion Icaria, on 06 December 2014 - 05:40 PM, said:

That's really interesting but seems tedious to work with, without proper tools


I think 'tedious' would apply if someone wants to use a hex editor to change the levels. On the first post of this topic, I included a link to some level format conversion tools I wrote to port Sonic 2 levels to Sonic Boom. If MainMemory adds Sonic Boom support back into his editor, then that will allow larger zones to be created. Then, the only thing to really do at that point is update my tools to be able to merge physical and visual files since there's no level editor yet that supports this concept.


View PostDigitalDuck, on 06 December 2014 - 07:05 PM, said:

Fuck the haters.

This would be perfect for one of the things I'd like to do with Sonic 2, and it seems to be just me because I'm finding Sonic 1 Two-Eight more useful than the original too...


You should use it for the hacking contest next year! I would like to see how many people will pick it up.

#22 User is offline Tets 

Posted 12 December 2014 - 06:09 AM

  • one rude dude
  • Posts: 569
  • Joined: 26-December 05
  • Gender:Male
I like what I'm seeing! This looks like a really solid base for Sonic 2 modifications, taking a serious chunk of the busywork out of the whole process and adding really cool stuff like the new level layout format on top of that. I'm very happy to see Knuckles ported in by default, I've done this myself but it's truly mind numbing work, not to mention error-prone if you're anything like me. So many hours lost, so much rage at compile errors.

I hardly have the time anymore to hack around with Sonic games but I still want to play with this.

#23 User is offline Varion Icaria 

Posted 19 December 2014 - 07:41 PM

  • He's waiting....
  • Posts: 1004
  • Joined: 26-August 03
  • Gender:Male
  • Project:S4: Cybernetic Outbreak
  • Wiki edits:1
Saxman which SH2 is doing the Kos decompression? If it's master then I may try to add PWM out of boredom to see how well it will work. Also curious question, What method did you use to get your DMA working? I use the RV bit with a RAM Run code to get my DMA working for the Player art which works well.

#24 User is offline kazblox 

Posted 19 December 2014 - 08:41 PM

  • Posts: 61
  • Joined: 20-August 14
  • Gender:Male
  • Location:localhost
  • Project:What projects?
@Varion: According to SB source, SH-2 Master does the Kosinski Decompression.
This post has been edited by kazblox: 19 December 2014 - 08:42 PM

#25 User is offline saxman 

Posted 05 January 2015 - 12:40 AM

  • Oldbie
  • Posts: 2625
  • Joined: 08-April 04
  • Gender:Male
  • Location:United States of America
  • Wiki edits:136
Development on the next major version is underway. Current plans for the next release:

* Merge Sonic 1 into Saxman's Sonic Boom to create one consolidated code base from which to build Sonic 1 and 2 ROMs and allow features from each game to be mixed and matched via configurations in the "constants.asm" file.
* Enhanced sound driver to support more sounds and add PWM support (I'm looking at you Varion, that is if you want to help with this).
* Import the Sonic 3 objects manager for improved performance
* Update the code to improve labeling and data organization (perhaps partially based on the current GitHub efforts)

Those are my priorities. But I'm curious what you all would like to see in the next release. What are some things you think Saxman's Sonic Boom really needs that it doesn't currently offer?

#26 User is offline DigitalDuck 

Posted 05 January 2015 - 10:56 AM

  • Arriving four years late.
  • Posts: 3364
  • Joined: 23-June 08
  • Gender:Male
  • Location:Lincs, UK
  • Project:TurBoa, S1RL

View Postsaxman, on 05 January 2015 - 12:40 AM, said:

* Merge Sonic 1 into Saxman's Sonic Boom to create one consolidated code base from which to build Sonic 1 and 2 ROMs and allow features from each game to be mixed and matched via configurations in the "constants.asm" file.
* Enhanced sound driver to support more sounds and add PWM support (I'm looking at you Varion, that is if you want to help with this).
* Import the Sonic 3 objects manager for improved performance
* Update the code to improve labeling and data organization (perhaps partially based on the current GitHub efforts)


They all sound good to me. Will start working with it soon. :v:

#27 User is offline redquebec 

Posted 05 January 2015 - 07:46 PM

  • Posts: 17
  • Joined: 29-April 14
I would suggest anything related to gameplay performance first, then anything to improve the sound driver. Clownacy is currently doing a universal SOnic 2 Clone Driver, could it be a good candidate for inclusion?

#28 User is offline Clownacy 

Posted 06 January 2015 - 09:01 AM

  • Needs to make an avatar
  • Posts: 309
  • Joined: 06-July 13
  • Gender:Male
  • Location:Englandland
Eh, I'd rather see an improved S2 driver. I've been using one in my S2 hack for a while. The changes you can make are minimal, but they're nice. Things like removing the 'nop's from the jump tables, removing unused junk, fixing 'bugs', reducing the size of some things, even dynamic music, SFX and DAC bank selection.

The DAC driver has a really obvious optimisation you can make to the DPCM stream loop, which makes the playback speed a bit better, consistent (the two halves of the loop use the same cycles if you use a 'nop' after the optimisation), and requires all samples' "pitch" values be increased by 1, which means you should be able to get away with higher quality samples, but I don't know if the maximum speed is beyond what the YM2612 can read. Maybe you can even merge a Mega PCM feature or two in there.

Besides, my driver still isn't 100% accurate yet. It looks like S2's driver contains some cryptic fixes for bugs that originate in S1's driver, and I still haven't found them.

By the way, I have a suggestion: There's the old mapping error where Knuckles moves forward when he looks up.
This post has been edited by Clownacy: 06 January 2015 - 10:02 AM

#29 User is offline Tets 

Posted 07 January 2015 - 01:31 PM

  • one rude dude
  • Posts: 569
  • Joined: 26-December 05
  • Gender:Male

View PostClownacy, on 06 January 2015 - 09:01 AM, said:

By the way, I have a suggestion: There's the old mapping error where Knuckles moves forward when he looks up.

I've always been curious about that. When I look at Knuckles in SonMapEd that sprite doesn't appear to be misaligned at all, I never understood what causes it to shift forward that one pixel in game. Easy to fix in the mappings, but I wonder if that's actually more of a workaround than a proper fix. It just never felt right to me.

#30 User is offline Varion Icaria 

Posted 07 January 2015 - 01:39 PM

  • He's waiting....
  • Posts: 1004
  • Joined: 26-August 03
  • Gender:Male
  • Project:S4: Cybernetic Outbreak
  • Wiki edits:1
Given if the S2 Sound driver's disassembly works like the S3K one in terms of compiling I can implement the PWM into the stock Sonic 2 driver and remove DAC. Though the S3K driver does allow for more customizations currently thanks to Flamewing. We restored FM6 not that long ago in that driver and I implemented PWM into my version [along side of DAC actually but that's a whole different story] Anyways it's relatively easy to setup once the Z80 driver is fully setup. just give me a shout on skype where I'm usually at and I can assist.

  • 6 Pages +
  • 1
  • 2
  • 3
  • 4
  • Last ►
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users