Sonic Physics Guide

Discussion in 'Fangaming Discussion' started by Lapper, Apr 1, 2021.

  1. Lapper


    Sonic Studio, Sonic Physics Guide, Kyle & Lucy: WW, Freedom Planet 2
    The Sonic Physics Guide

    It has been around for a while now, started/created by Mercury of course.

    Through making my own fangame, I have become rather obsessed with researching and recording all the information about Sonic games as I can. They are fantastic games and they spawn so many fantastic fan projects, and I want to give information I learn for my own game back to the rest of you making your own Sonic frameworks. A lot of the information I add isn't even relevant for my own projects, I simply love exploring deeper into the game and forever having the information for all to see. I learned to read ASM and find out a lot of information for the guide, along with nuggets of wisdom from others.

    Some of the latest additions are
    • Refactoring pages
      • Solid Tiles page has been greatly changed, putting a great deal of detail into how sensors work. Information on how Sonic collides has been split into the individual sensors needed
      • Solid tiles has been split into 2 pages, as there was a great deal of slope physics information on a page about tile collision. Slope physics now has it's own page
    • Plenty of imagery
      • Character specific sizes
      • Character hitboxes
      • Slope tile collision demonstrations
    • Game Loop information
      • Explaining the order of events for characters and in what order objects run their code
    • Detailed solid tile sensor information
      • Game accurate explanations of how a detected floor or wall translates into movement of the character
    • Game Object Solidity
      • Sloped objects
      • Jump Through objects
    • Game Object hitboxes and movements
      • Badniks
      • Projectiles, Particles
    • Character Specific information
      • Character sizes
      • Character moves (with new collision info)
    • Game data
      • Pixels and subpixels
      • 256 angle vs 360 angle systems
    And more!

    And finally, there are some larger scale changes which I am making which are still in the middle of happening currently:
    • Changing "Sonic" to "the Player" to be clear that most things apply to all characters, and keeping all character specific info to it's own page.
    • Moving often repeated, and integral information so it's own starter page "Basics".
    • Standardising the way subjects are handled such as replacing X Speed with Ground Speed for motion along the ground, along with variable names and more.

    That's not all. I'm personally working on other elements that can go hand in hand with the guide, such as:
    • Lua script overlays for Gens (for all 3 games!) which show an approximation of player and object collision sizes and sensors, to help merge the concepts explained on the guide with actual gameplay to be easier to understand.

    • ASM code comparisons, actual code snippets from a disassembly which are completely commented but otherwise unchanged, which act as reference for certain parts of the guide such as object collision or the way enemies behave, which can help people merge into hacking as well as fan games.

    I don't see much talk about the guide, here or elsewhere. It does have a feeling of scrawling on the wall to myself about something no one cares about when adding swaths of information there.
    Not everyone needs it, plenty can do their own research. But I know it is used often, for example I keep seeing new fan projects using the same colour coding for Solid Tile sensors that I used in the first image I added to the guide. Small things like that I love to see.

    For a while now I've wanted a thread here to be a place for people to possibly discuss the information found on the guide, maybe people who use the guide but don't want to add to it directly can discuss parts that they find hard to understand or need elaboration - and suggesting adding information that isn't currently there. Not just for me to add of course, I'm sure there are plenty of people with knowledge which is currently missing or incorrect/outdated.
    There are other ways/places to discuss this of course, but I feel discussion here would be very easy to find and digest, and may indeed get more eyes on the guide. With the result hopefully being even more better and more accurate classic Sonic fangames built from the ground up or on newer and newer frameworks.

    I was unsure whether to post this here or in Reverse Engineering because it takes knowledge of the disassembly and modifying the game to add to the guide, however, the guide is primarily used to make fan projects so I think it belongs here.

    and thus concludes my tech member application :)
    Last edited: Apr 7, 2021
    • Like Like x 9
    • Informative Informative x 1
    • List
  2. I'm actually really looking forward to the example scripts you mentioned. I tried looking through the Physics guide a long time ago, and couldn't make head or tails of it at all. Making it a bit easier to understand with examples to show off what each part means should make it much easier to do things with it. Back when I gave it a look, I just gave up and decided to use discrete angles like Sonic Pocket Adventure with all of the various "physics" behaviors pre-baked into separate player states depending on what angle floor it's in contact with. Never did finish the project, but it did give me a lot more interest in the 8-bit games and wanting to see more fan-games based around those rather than imitating the Genesis games.
  3. Pexs


    Otherwise known as Spex Member
    As someone big into Sonic and big into Game Dev (but not big into ASM), thank you for the updates.
    • Like Like x 1
    • Agree Agree x 1
    • List
  4. Techokami


    For use only on NTSC Genesis systems Researcher
    Sonic Edge
    Holy crapperoni, this is going to be incredibly useful when I and my cohorts finally get off our asses and make that proper Sonic Worlds successor.
  5. Lapper


    Sonic Studio, Sonic Physics Guide, Kyle & Lucy: WW, Freedom Planet 2

    Here's a preview of that LUA overlay for Sonic 1 (for GensRR), it's pretty much going to be in line with the visual conventions set by the guide imagery. Each element like hitboxes, solid sizes and names can be toggled on and off. This is purely aimed to help visualise the things written on the guide more easily.

    One thing it has brought to light for me is that objects are coded very inconsistently, some define their sizes ahead of time as they should and where the overlay code can read it easily, some just do it on the fly (which means I have to manually do the same for the overlay). Some use the general hitbox system, some don't. Some stuff has to be manually manipulated to get the best result but ideally a good representation of what is going on is the aim.
  6. Lapper


    Sonic Studio, Sonic Physics Guide, Kyle & Lucy: WW, Freedom Planet 2

    Wanted to show some progress with the Physics Guide Gens Re-Recording overlay Lua script.

    Notable changes:
    • The script reads values as the game code is executed, something it didn't do before (before the focus was more on displaying the object variables, but now it does that and also shows visual representations of the processes going on), giving an extremely accurate representation of Solid Objects for example.
      • Solid Objects show up as green, while the actual object sizes (Width/Height Radius) show up as yellow (the sizes are not enabled in the video).
    • All solid tile sensors of all objects (such as enemies, and falling rings or item monitors) are now on display and visible. Again, read directly as they are executed.
      • Also, there is an option to smooth out things like sensors. This isn't accurate but without it sensors and boxes will appear to shake. Basically on a given frame Sonic moves forward, casts a sensor to find the floor height, if running up a slope the sensor might have been cast inside the floor. Then Sonic moves up to where the floor surface was found. Well, now you have a sensor inside the floor while Sonic isn't, and that might look shaky. It's accurate, but shaky, and the same applies to any moving object. So you can choose to "correct" this, which looks nicer but with diminished accuracy of where the sensors were actually cast that frame.
    • Objects with slopes now display the slope array, directly from the game data.
    • When you stand on any object, the left and right boundaries for Sonic staying on the object (which varies, sometimes it extends past the sides, sometimes it does not) is properly indicated with a horizontal line. If Sonic moves past the ends of the line he will fall off.
      • The box of an object does not appear when standing on it because the code for coming into contact with said object doesn't run when you are on it.
    • There's a minimal amount of manual manipulation of visual information now, the only things added manually are the names of objects and the random collision boxes that aren't defined or run through a subroutine - like the trigger for a checkpoint, endpost, or active area of a SLZ fan.
    • Solid Tiles are now visible thanks to Mercury, a way to show the tile properties is also in there.
    The script will be released in the near future.

    By the way, It's posting this sort of thing that makes me wonder if this should be in the hacking section, but the intent is to aid those creating fan games/frameworks so, I assume those people are just as if not more interested.
    Last edited: Apr 19, 2021 at 8:45 PM