#27742 - QuantumDoja - Wed Oct 20, 2004 8:58 am
Ok, so in Mario we moved on blocks on flat surfaces, in Sonic we moved along surfaces which were not flat, but sometimes curved, ie sloped.
How do they do that?
_________________
Chris Davis
#27745 - Touchstone - Wed Oct 20, 2004 10:13 am
I don't know exactly how Sonic did it but if I can remember it correctly the slopes had the same angle across the entire tile. So what they could have done was to have a equation associated with each tile.
Code: |
| | For example, this tile would have the equation:
|* | coll = y < x
|** |
|*** |
| | And this tile would be
| | coll = y > 1
|****|
|****| |
And with that they just have to solve the equation and figure out if coll is true or false
_________________
You can't beat our meat
#27748 - keldon - Wed Oct 20, 2004 1:10 pm
my cousin's got a mega drive somewhere, but I'm sure sonic doesn't run clean over those curves .. but anyway it's a small calculation so using sin+cos to calculate the height won't really hurt.
#27753 - jma - Wed Oct 20, 2004 4:43 pm
keldon wrote: |
my cousin's got a mega drive somewhere, but I'm sure sonic doesn't run clean over those curves .. |
He doesn't, just the middle of the sprite does. On hills and such, one foot will always protrude over the tiled background. It just gives a very good appearance of curved because 90%+ of the time he's the ball sprite across the "curved" surfaces.
_________________
massung@gmail.com
http://www.retrobyte.org
#27758 - sajiimori - Wed Oct 20, 2004 6:47 pm
It might have been tepples who posted a pretty complete description of how it was done. Try searching the forum, or even google. Basically, there's a set of collision tiles to choose from, and each one is defined by an array of left-to-right extents of the solid portion of the tile. (Or was it top-to-bottom?)
#27898 - LOst? - Sat Oct 23, 2004 5:32 am
The Genesis Sonic is complex. 8x8 tiles for basic VRAM art put into 16x16 tiles that has a counterpart height map collision array and a counterpart angle array, and the levels are built up of 128x128 tiles of those 16x16 tiles.
The height maps are the curve data and Sonic checks them with two or more hot spot routies depending on which angle he enters using cin and cos tables. And each 16x16 has an angle array, and it's needed to tell Sonic how to land on the ground after a jump using some kind of an arctan2 table.
Sonic is running 360 degrees, but the Genesis hardware doesn't have rotating sprites.