Take the 2-minute tour ×
Arqade is a question and answer site for passionate videogamers on all platforms. It's 100% free, no registration required.

In Sonic The Hedgehog, some levels wrapped around from top to bottom. Some levels also have water in them. What confuses me is that a few levels have both. The bottom wraps around to the top, so the notions of up and down become relative, yet part of the map is underwater.

For a good example of such a zone, consider Labyrinth Zone 3 from Sonic 1, which features both an infinite water slide at the beginning and an upward-climbing rising-water chase-scene doom gauntlet boss fight at the end, in which the water rises up about 1.5 times the actual height of the map.

Can anyone explain how they made this work? Is there a "bottom" to the underwater area somewhere, cleverly manipulated so that it is never visible on screen? Or is there something more interesting going on?

share|improve this question
    
This was a very interesting question! –  Ben Brocka Feb 28 '12 at 19:45
add comment

1 Answer 1

up vote 27 down vote accepted

The level tiles vertically, that's why you fall through and come at the same spot again. You can clearly see this in your zone example that if you take the slide down and hit the bottom of the map that you will simply return at the top and go back. The water is programmed to just fall through, the engine just loads the upper and lower part each time you see the split.

As for the underwater zone, there is solid rock at the top causing the water to just stay in place.

Implementation wise, they insert a water flow(s) which cause a horizontal water line (limited by walls) and make those parts under it consist of water; the whole bottom of the level is not made of water.

In the following image, the red arrows are the water lines. Everything below it is water.

If you don't remember the level well, check this speed run which takes the slide and visits the bottom.

Note that it displays water across the walls, it's an animation as drawing it to the walls is too complex.

share|improve this answer
6  
Man, I was going to flag this for being better able to be answered at gamedev, but now that I've seen your answer, I think that's no longer necessary. –  Raven Dreamer Aug 9 '11 at 2:11
    
@Raven: Yeah, I was first thinking the same. But yet answered it as it feels on the edge as he isn't looking at it from a developer's view but rather from a why-isn't-the-water-across-the-whole-level view. The applied animation sprite makes you think it goes across the walls. There is one possible flaw in my answer and that is that I'm unsure if the third arrow actually exists, but that's just a minor detail... –  Tom Wijsman Aug 9 '11 at 16:01
    
Aha! The water over the walls is an illusion, just as you say! If you stop that video around 8 seconds, while Sonic is on the water slide, you can see part of the underwater area in the top right corner, and it doesn't look underwater at all. Also, there is this revealing video that shows the across-the-screen water is an illusion, and that I guess certain areas are marked as underwater. –  Ryan Thompson Aug 14 '11 at 17:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.