Sonic Physics Guide
From Sonic Retro
Welcome to the Sonic Physics Guide, a comprehensive resource dedicated to describing the inner workings of the classic Genesis & Sega CD Sonic games, along with Sonic Mania. Here, the intricate details of how the game's physics function are thoroughly explored, providing in-depth explanations about the exact values and rules and precise speed values governing Sonic's movements, 360 slope physics, Badnik & object behaviour, all the way to the construction of the sloped terrain. The guide will shed light on exactly how every aspect, from navigating slopes and loops to interacting with Springs, contributes to the gameplay.
Whether you're a curious newcomer, an experienced fan game developer, or a seasoned Sonic fan seeking a deeper understanding of the games, this guide aims to present the information in an accessible manner, providing clear and concise breakdowns of the underlying concepts.
This guide will present these physics rules in an engine-agnostic manner, focusing on the tangible results of the game logic instead of delving into the minutiae of how the original 68k assembly code operated. As a result, these rules can be applied to modern programming languages such as Java, C, C++, Python, or a Lisp dialect when implementing the physics described in this guide. Moreover, individuals using this guide will be able to easily utilise specialised engines/IDEs such as GameMaker, Unity, Godot, Clickteam Fusion, or Love2D to implement the described game rules. Nevertheless, it is important to note that this guide will still acknowledge the quirks, limitations, and workarounds that were necessary for the original game due to its utilisation of a low-level programming language.
A prerequisite for much of the info on this guide, including common object variables, how angles work, how object sizes are displayed, and more.
A detailed explanation of how values like speeds, positions, and angles are stored and calculated in the original games. While it is not necessary to emulate things for an extremely close recreation, they are necessary for absolute accuracy
Information about specific characters and their constants, variables, sizes, and jump height.
These guides will explain what happens during gameplay scenarios, such as slope collision, player movement, and object interactions.
Terrain Part 1: A detailed description of the individual building blocks of terrain, and how they are processed and detected.
- Terrain Part 2: How Solid Tiles and collison layers are used to construct slopes, loops, and other structures.
Slopes Part 1: How the Player object uses their sensor arrangement to detect and react to terrain, including 360° slopes such as walls and ceilings, and collision while airborne.
Object hitboxes, the Player's hitbox, and other ways objects directly interact with the player other than solidity.
Object solidity, jump through platforms, and sloped variants of each.
Slopes Part 2: How the Player moves with momentum over angled surfaces.
Physics & control of the Player while walking/running.
Physics & control of the Player while rolling.
Physics & control of the Player while they are in the air.
Physics & control while Jumping, how controllable jump height is achieved, and jumping at angles.
What happens when the Player gets hit or dies.
Physics when bouncing off enemies, bosses and other destroy-able items.
Physics underwater, and how their remaining air is depleted.
The Player's speeds and abilities when super.
Main Game Loop
The order that objects update each frame, and order of specific events like Player collision and movement.
Mechanics and sizes for things like rings, pushable blocks, buttons, and springs. How they are constructed, function, and interact with the Player.
Badnik and bosses behaviour, collision, and specific interaction with the Player.
Ring dispersal mechanics and physics when lost.
General special abilities such as spindashing, and also detailing how character specific moves work.
Elemental Shield abilities, powers, and moves.
How the second Player will follow you throughout stages, and how they respawn when they fall offscreen.
Special stages including the rotating mazes from Sonic 1.
Camera mechanics when following the Player.
Animations system, and specific animation timings & rules.
Lua scripts which overlay the game in an emulator for an interactive visual of collision.