Its good but pallet swapping to save memory seems to be used all over the place on 2D 8-bit and 16-bit games. Waterfalls are the most impressive to me, but the chequered ball is also good too.
@@tensevo Water, fire… many of the things we'd use particle engines for today are more efficiently implemented using palette tricks in the old days. (Water sparkles, twinkling starfields, fades of sky from daytime to nighttime, …) Writing my own video codec (which was *essentially* a stream of PNG frames using 1-bit transparency to exclude areas from update in the given frame) I also allowed each frame to define a new palette, if needed. As a result, some components of any given encoded animation are encoded purely as palette changes, given sufficient availability in the palette.
@@romusz don't know, even a simple android app keeps pushing updates every week without any noticeable improvement or changes. The developer assumes that the user has all the space in the world.
@@romusz Several audio players (Winamp, foobar2000 and ZXTune to name a few) can play .SPC files (the closest thing to a modular music format for Super Nintendo music), all of which, when dumped from original or hardware-compatible games, are always 64 KB each. You could implement the source code of an SPC playback engine into your modern game. I suppose it's a different story for remastered/remixed tracks though.
There's also a yellow sphere, that launches you a few spheres ahead. Stealth made a proof of concept Blue Sphere 2 that added a green and pink sphere. Green spheres turn blue when run through, so you gotta clear them twice, while pink spheres randomly(?) teleport you to another pink sphere. I think it may have been implemented in Sonic Mania, but I'm not sure.
Sonic music in general does that to you. For instance, firstly I buy the Crush 40 album 'Driving Through Forever' for my iPad... next thing I know I'm downloading Dreams of an Absolution, and then as many Sonic songs as I can!
@@blap721 Just because you suck at it doesn't mean it's bad, how come this certain game has rom hacks (s3 special stage edit, blue shares plus.) kiaso levels and more. Grow up and stop being such a hater
I feel like Sonic CD is hiding lots of secrets, all past present and further versions of stages and very unique special stage, would make a great video! Would also love to hear you talk about sonic and knuckles and how that all works, that lock on cartridge blew my mind as a kid and still does if I’m honest !
You should check out the Sega Genesis game Red Zone. It haves a lot of effects including FMV in the way you did the SEGA logo and the Game Over screen in Sonic 3D Blast.
Not to mention that most of the main gameplay uses a pseudo-3D effect a lot like the tricks he used to make the backgrounds in Toy Story's platformer levels.
Modern ones get less respect because they are crude - the use straight forward codecs for audio and video. They treat memory very reckless, where game take up GYGABITES of memory. Game engines are pre-made, things are whole lot simpler. Their coding is sloppy, because the engine has allot of fool-proof securities that forgive allot of things to coders.
@@digimaks don't generalize things there still are games made from scratch on engines made in-house, sometimes specifically for the game, like in the case of literally every single game that Media Molecule has ever made
The floppy drive on my Commodore 64 died right before I got around to learning how to do sprites, so it's fun to finally get to see a bit of how they work.
I’ve also been down the rabithole of S3 special stage remixes. Such a catchy tune! The star-sphere hidden in the sphere graphics caught me by surprise!
Damn, working around these types of memory limitations really brought out some genius programming tricks. That's what's so fun about dealing with older hardware, figuring out how to get it to do what you want. There's usually a way, you've just got to be clever in order to implement it. Nowadays games just release with massive files sizes. Like excuse me... 100gb for a single game? That's like an entire hard drive if you're playing on a computer from only a couple of years ago.
These videos are great... all of these techniques need to be documented, programmers these days don't have these challenges... they have unlimited resources and just make games 60gb without a care in the world. This style of game making will become a lost art... a bit like how no one knows how they built the pyramids haha
You can't do much tricks to compress 50mb 8-layers HD textures besides general compression. Modern games do use a lot of optimization tricks and push hardware to the limit while rendering, even one modern game can fill up entire book describing techniques. But you cannot compress HD assets further. If you have hours of dialogues you can remove some audio channels, but you can't compress them too much.
@@friendlylaser Pretty much, gamers tend to not realise just how much space highly detailed maps, textures and 3D models can use up, even with aggressive compression.
When he revealed the animation by switching palettes my jaw dropped. I don’t think I have the intelligence to thought of such a clever technique. In English. Never mind actually coding it.
@@jonweinraub it was a fairly well known technique at the time, you'd palette swap a lot because it's an easy way to add content sometimes sacrificing only a few colours for a totally new image.
I know the Genesis does not have built in sprite scaling...it can scale sprites through software. There are a few games with this technique without any specialized hardware add-ons. For example, there is an amazing fan translation of Wolfenstein 3d that runs on a stock Genesis and it's amazing. EA made a helicopter game that ran scaling not as a trick like a boss fight but throughout the entirety of the game...I think it was called Red Zone.
Holy smokes, I was just thinking last night about how Sonic 3's special stages were made after watching your Sonic 2 special stages video. And now here we are.
I didn't. Just last year I started a class in coding, and am currently learning web development, and I know soon enough I'll work my way up to knowing what it takes to code a game myself, because I have a soul filled with DETERMINATION.
I also dreamed of designing games as a kid but the fact that it's difficult didn't stop me, and for a while I just overanalyzed my favourite games to get an educated guess on how it works, and later when I actually learned how to program started to implement those ideas to see if they work or not, and am now working towards starting a full project using my skills you shouldn't give up
@@TorutheRedFox I liked art a lot growing up, and once I realized that you didn't just "draw" all the sprites and levels and stuff, all the computer stuff bored me... I use computers everyday now (as a machinist, and also for hobbies like audio recording)😆
I think the reason they didnt wanna dip into the pallet swap is because they knew they will have to change the colours of the checkerboard sphere at some point, and this would have possibly caused problems later on? There were 7 special stages and I think each one used a different colour sphere, so having the rotations using different colours for animation could have messed with this, as you said it would have reduced the amount of pallet swaps and in the 90s games NEEDED pallet swaps.
New subscriber here. Not a developer, but I love watching creative uses of limited resources. The fact that these levels were spellbinding for me when I was young? So awesome seeing them analyzed. Very well done, thank you for all of it!
If you're a sega fan into VGM I can highly recommend Radio Sega. They have a 24/7 stream of sega music and live shows too. Really worth checking out, the community are awesome too.
Your passion and knowledge for this ancient hardware and software for where you are in life is one of a kind. The fact that you acknowledge and educate this tiny enthusiastic side of the gaming sphere with your free time fills me with so much joy. As selfish as it is, I hope this kind of unique content providing you do never ceases to bore you. It is so special.
The tech demo red sphere objects in the S3-solo ROM and the Nov 3 Prototype showed how they tested the graphics for this special stage, with a rotating spherical grid and a splash/wave animation grid for testing the stage clear animation.
You should make a video about your particle system for these 16 bit game and also explain with the maths involved in it. Your video really inspired me to do programming, keep making these videos
As usual, an amazing take teaching us what many tricks were used to create crazy effects back then! And I think this is the first time a Coding Secrets video took a clip from another video in the series to further explain a trick. It's awesome.
I've been following Coding Secrets pretty much since the beginning, on the GameHut channel, and I _love_ seeing all these tricks and techniques; your explanations are easy-to-understand and really fun to watch. Please keep 'em coming!
Woohoo! I requested this one in an earlier video and it happened! Based on previous videos I'd seen, I figured it was either something along the lines of the palette swapping used for the Sonic 3D "SEGA" logo or the animated ground used for Mickey Mouse being chased by the moose. In my limited knowledge, I figured that either of those could conceivably work, but the floor's rotation was what kept making me hit a wall. Thanks so much for breaking it down!
Your explanation here was pretty much spot on. I've known this stuff for a while, but your explanation of it is pretty easy to understand, and I suspect that someone else who hadn't gone through all this code before would probably find this a very useful resource.
Its crazy to think how much work was put in to make games 30+ years ago, so much optimisation was needed to fit a game on what is a tiny amount of space today. Great video as always :3
Good old color cycling :). Half the fun back then was finding smart ways to do effects with limited resources. Having this (mostly) friendly competition of who could do the coolest things on the Commodore Amiga was a great way to learn the trade, and for many, a gateway into the videogame business. I love these videos, keep up the great work!
Further proof S3&K is one the greatest games ever produced by humanity. Thank you for going down the rabbit hole for one my most cherished games from my 90s childhood.
This is probably my favorite special stage of the classics! I particularly like the theme cover by the J-Music Pocket Band; make sure to check them out if you haven't already! Thank you for the great explanation as always; you do a great job of showing how everything works in a way that is not only accurate, but also very easy to understand for someone who doesn't know how the hardware works going in. Can't wait to see more of these! As a suggestion, could you check out the Mushroom Hill Act 2 boss? It seems to use some similar effects to the Toy Story 3D, but I'm not sure.
Excellent video as always! To answer your last point, I think it's important to remember that "Sonic 3" and "Sonic & Knuckles" were originally intended to be one game. Of course, we got 2 different games, but regardless there's 14 special stages: 7 chaos emeralds, and 7 super(?) chaos emeralds. So, I'm guessing they opted for a wider color palette to ensure there's enough variety.
Make a video on the boundary flood-fill algorithm used to check if blue spheres are completely surrounded by red spheres. Or a video on how the 3D positions within the special stage are stored.
For the storing the special stage thing, if you mean how the stages are stored in the ROM, it could literally just be a 2D grid which denotes what sphere is on an area.
I think it wasn't that difficult, as the Mega CD has dedicated hardware for sprite scaling and rotation. But the stock Mega Drive lacks these hardware features, so they had to work around these limitations.
If you’re looking for requests for games to look into I’d ask for Gunstar Heroes (you could probably do several hours on the various effects that game has) and also the depth effects in Ranger X.
You could've shown off how the game stores the map layout of any given special stage. It's a false sphere, only an illusion of course. As you can tell from a globe with latitude/longitude lines, you can't exactly tile squares on a sphere perfectly all the way around. The layouts are all just squares; when you reach one edge, you go to the opposite edge of the square like a game of Asteroids.
Yeah, that's pretty typical for games, owing to the fact that it's really easy to code. Ironically, you can in fact map that onto 3d geometry, it just doesn't look like a sphere.. If you wrap a 2d area the way games frequently do in one axis only, you've created a world that's cylindrical. The worlds that allow traversal across both axes are actually mapping onto a toroid (donut) shaped world in 3d... So, every time you see a game do this, what you're actually witnessing is something taking place on the surface of a donut. xD
All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle. All these squares make a circle.
"went down a rabbit hole of remixes of the special stage music" - time well spent. I recommend McVaffe's 'LatinSphere' from OC ReMix if you haven't already come across it.
I would love to hear about *workflow* in those days. A lot of these techniques, though brilliant, the work and process needed to reach them seem so alien to me.
Do programming students ever have assignments where they limit the amounts of RAM and ROM they can use to achieve it? Seems like a neat technique to know even if it's "solved" by the abundance of RAM and Storage space in modern machines...
There are some other interesting tricks in Sonic 3 that could warrant more videos. For instance, the title screen intro animation, the 3D water effect seen in Hydrocity Zone, the multilayer backgrounds seen in several levels (i.e. Hydrocity and Carnival Night), and the software scaling used for the boss of Marble Garden Act 2. p.s. it's pronounced "hydrossity" don't @ me
I just discovered your channel. Kudos for such a great work ! I am amazed by the quality of the explanations. Also you’re very understandable even for non English native which is absolutely a bonus point :D you deserve a subscription!
I've just bought Sonic Mania (three years late!!!) and been struggling with the Get Blue Spheres special zones (gosh, these are much harder than I remember 25 years ago...) so this was very timely. The palette swapping to simulate animation is quite ingenious. The star bumper being just a recoloured red sphere was something I never knew before.
for me it depends on what version of mania you have. i first bought the ps3 version in which I felt the special stages were unplayable because of a slight delay when you turned. and you can believe me if i say I played these stages to death in 1994 (hint: just watch my videos. hint, hint. xD). on switch they fixed this issue, where I could get all the emeralds properly. still don't know what exactly they messed up, but there's surely something off on ps3.
Dude... I subbed to you without knowing you're behind Sonic3D, and now that i know, my respect for you went from 100 to 100000000. Dude, i love you (no homo) :)
It blows my mind how inventors of these games had to be to work around such limitations, and it also blows my mind how you're able to reverse-engineer the process!
I have an entire book on the subject of these kinds of engines written in 1994 - it speculates as to how Doom works, but since the source code wasn't yet available, their guesses were quite wrong. Still, they came up with a variety of techniques for extending a raycasting engine to do the kind of things Doom did. As it turns out, Doom isn't based around raycasting... But that doesn't mean there aren't other possible approaches that get similar results. (one example is the build engine powering Duke Nukem 3d - that's a portal based engine, and as a result can do some weird tricks Doom cannot... Still similar overall though...)
I know the Genesis cannot do hardware scaling (Sega should have added a scaler before release) but what does it look like when a dev uses a software method? Like for example Panorama Cotton for the Japanese Mega Drive. That game absolutely defies all conventional logic and what's more it runs silky smooth like Space Harrier II should have.
Forgot about the trick of animating 4 monochrome frames from a 16 colour pallet swap, most of the rest I found quite predictable. The blue and red were obvious pallet swap but I thought the star would have used a few unique tiles with mirroring. What about the positioning of sprites? Presumably the Genesis isn't performing 3d math for the positioning of up to 80 sprites each frame so I'm guessing it's a lookup table? Is layout of the balls actually spherical or does it use something like a square with 2 way wrapping?
Is there any reason the shadow is usually broke on most emulators? I remember playing it on PS2 Emulators and the shadow, aside from the dark effect, was always a swap between brown and orange. Is there a specific reason for this? Or did I missed a point on the video? I always thought it was a too complex feature most emulators programmers couldn't achieve. Thanks for the awesome video and keep up with the good work. These are always notifications that bring a smile to my face.
The shadow is probably using the shadow/highlight function of the VDP, for which Jon has done a video displaying how it works with Toy Story cutscenes. I recall PS2 Picodrive doesn't have the best implementation of that feature.
For shadows/transparency the developers relied on the CRT to provide the effect by alternating which frames/scanlines on which the shadow was drawn, 0 -> 1 -> 0 -> 1, on a CRT the shadow looks transparent due to the way CRTs scanned down the screen and how the phosphor reacted, but on a LCD it's flickering or solid or missing (depending on how fast the LCD refreshes) since the LCD updates the pixel immediately unlike the CRT so the effect is lost.
The shadow is implemented using the shadow/highlight feature of the VDP, many old emulators didn't support it (practically every modern emulator supports it, though). The one thing that *is* broken is that the shadow shows up on top of the spheres, but that's a bug in Sonic 3 itself. They fixed that in Sonic & Knuckles.
How was moving the sprites forward in an arc and around a turn handled? Online maps of stages are arranged in a grid, but how was it bent into a sphere without problems when edge of the grid is reached and repeated to the start? Making a world map flat distorts it, so making a flat grid round should too.
After you did that video explaining the SEGA logo from 3D Blast, I was playing sonic 3's bonus level one day and I thought to myself: I wonder if this is using the same method.
Chaotix uses no tricks. The special stage uses 3D polygons, who is what the 32X can do my itself. And the bonus stages uses pixel scalling, who is what the 32X can do it by itself. The difference between the 32X and the stock Mega Drive / Genesis is the latter can't work with polygon or scalling. The purpose of this channel is to show the tricks to make games overcomme the system's limitations with clever programing tricks. One example is with Burning Rangers for the Sega Saturn. The Saturn can't work with transparent objects by itself, but Yuji Naka make the Saturn display transparent objects with the creation of a dedicated code inside the game.
miasuke Keep in mind that the 32X can’t pull off those aforementioned effects in hardware, every bit of graphics on the 32X’s side is rendered in software to a framebuffer
@@Jamie-yp7qz So, in that case, it's a case to explain how the 32X works, and not a specific game exceeding the 32X power. But I would love to see an explanation of this thing, but I think Jon created a game for the 32X before (not under the TT Games label... Maybe a personal demo...).
@DejaVoodooDoll Again: The Sega Genesis was not build to offer polygons or scalling sprites by its own power. To a Sega Genesis game offer scalling or polygons without the help of a dedicated chip or processor, a specific code must me writed to make the genesis display this kind of effect, or use smart program tricks to create an illusion of such effect. It's like the example of the Sega Saturn displaying transparent sprites in Burning Rangers I comented before. A demo of Star Fox and F-Zero for the Genesis was made using the stock console by just making use of the fast Genesis processor with a proper code (who is different of a system who have a dedicated processor / component to do this job). Jon creted many programming codes to make the games he worked to offer something exceed the expectation of what the system can do, like the Genesis displaying more colors than its limit... Many other effects other systems can do from that time, the Sega Genesis was able to do it with a dedicated programing code or trick, like zoom and MODE7. In the 32X case, the porpose of the system is to offer Arcade-like games to the Sega Genesis. Polygons are present in 32X games since day 1, as Virtua Racing Deluxe and Star Wars Arcade. Scalling object are present in 32X games since day 1, as After Burner Complete and Space Harrier. But, again, I would like to know a programmer like Jon deal with the 32X when programming games for the system. But the purpose of Coding Secrets is to revell as "the impossible was possible". Want an example? I would like Jon could explain how *Panorama Cotton* works...
I knew that the red and blue orbs were palette swaps, but the white one with a star, I thought it was a white palette with a separate star sprite on top. But that too is part of the palette!? That blew my mind!
You cheated me with the racing sections of Toy Story... I believed that it was another algorithm to draw full strips... shame on me! Great work as always!
Not only would the sphere and ring icons have cut into the other graphics on the foreground layer, but it also could have required them to draw and store two different boxes around the two counters.
You can tell how much love the developers had for games like these. Devs these days wouldn't dare to be this creative. Brilliant work as always, dude. I adore these insights.
I'd love to see how the animation at the start of Sonic 3 (where sonic jumps through the Sega logo) was achieved. I remember as a kid being blown away by that.
In the recently discovered beta of Sonic 3 that was released last year, there's one sprite in the debug mode that seems to utilize software sprite scaling... it appears as though it was used in the Marble Garden Act 2 boss fight when Robotnik zooms out into the background. If you enable debug mode and enter the first level of the game, it is the 19th item when you cycle through available items (a big mess of blue pixels); placing the item puts it in the environment, at which point it scales away from the screen and returns (and also destroys all other level graphics and collision lol). in the final release version of the game, Robotnik still performs this movement during that boss fight AND it absolutely looks like SOME type of sprite scaling, but you cannot access the sprite/character item in the debug menu anywhere in the game. There is also another mystery item in the debug menu of the first level, a weird matrix of spinning red spheres. It doesn't appear to utilize sprite scaling, but it does seem to have them arranged in some kind of calculated spherical grid. It is visible in both the prototype and the final, and when you select the Special Stage in the prototype's Level Select, you're greeted with a very similar matrix of spinning red spheres that can be manipulated on different axes with both controllers. Controller 2 can also change the behavior of the placeable item from the debug mode in the first level if you're running the final version of the game. The prototype rom also has a square grid of red spheres that can be manipulated ("Special Stage 2" from the level select menu), but this also uses finite sized sprites for its scaling effect. I'd love to see you pick apart these aspects of the game if you ever felt so inclined. The original Genesis/MD trilogy has been extensively researched by a part of the Sonic community (some of those talents went on to be commissioned/hired by Sega directly to do mobile ports of the old games and be the backbone of the recent Sonic Mania)... you might be able to reach out to a handful of people for some insight. It would be really cool to see if/how/where these components were implemented in the actual "normal" gameplay :o
That Red Star trick has to be one of the most clever use of Pallets I've ever seen.
Its good but pallet swapping to save memory seems to be used all over the place on 2D 8-bit and 16-bit games.
Waterfalls are the most impressive to me, but the chequered ball is also good too.
indeed!
*palette
Yes!
@@tensevo Water, fire… many of the things we'd use particle engines for today are more efficiently implemented using palette tricks in the old days. (Water sparkles, twinkling starfields, fades of sky from daytime to nighttime, …)
Writing my own video codec (which was *essentially* a stream of PNG frames using 1-bit transparency to exclude areas from update in the given frame) I also allowed each frame to define a new palette, if needed. As a result, some components of any given encoded animation are encoded purely as palette changes, given sufficient availability in the palette.
The Amiga makes great use of cyclic palette for animation in loads of games and demos.
Developers in the 90's:
I fit all of Sonic 3 in less than 4 MB
Developers in 2020:
help my balloon popping simulator uses 4 GB
Chrono Trigger on SNES, 1995: 4 Megabytes (MB)
Chrono Trigger on Steam, 2018: 588 MB
@@romusz got to collect all the user information.
@@kkgt6591 From what Ive read, they say its due to the filesize of the uncompressed music tracks.... which sounds like crap to me, but whatever. :p
@@romusz don't know, even a simple android app keeps pushing updates every week without any noticeable improvement or changes. The developer assumes that the user has all the space in the world.
@@romusz Several audio players (Winamp, foobar2000 and ZXTune to name a few) can play .SPC files (the closest thing to a modular music format for Super Nintendo music), all of which, when dumped from original or hardware-compatible games, are always 64 KB each. You could implement the source code of an SPC playback engine into your modern game.
I suppose it's a different story for remastered/remixed tracks though.
There's also a yellow sphere, that launches you a few spheres ahead.
Stealth made a proof of concept Blue Sphere 2 that added a green and pink sphere. Green spheres turn blue when run through, so you gotta clear them twice, while pink spheres randomly(?) teleport you to another pink sphere. I think it may have been implemented in Sonic Mania, but I'm not sure.
The yellow sphere was used nowhere in Sonic 3.
@Giova I think it may have been used in Sonic & Knuckes, if it wasn’t used in Sonic 3.
@@everardogarcia6047 It was, in fact, used in Sonic & Knuckles.
The green and pink spheres were in fact used in Mania.
@@giovannidotgen there was a yellow/orange sphere that would spring you forward. If I recall this was added in S&K
Of course you went down that rabbit hole. The theme of the Special Stage is that good!
It's almost non special anymore, because the entire god damn sound design with every bit of Sonic 3 is marvelous!
Yeah. Also, that username of yours is in fact a username.
Sonic music in general does that to you.
For instance, firstly I buy the Crush 40 album 'Driving Through Forever' for my iPad... next thing I know I'm downloading Dreams of an Absolution, and then as many Sonic songs as I can!
It's just like, it's just like, a mini, mall!
The thing is that it wasn't originally for Sonic 3. It was for an unreleased sonic Tetris like game called Sega Sonic Bros
this singlehandedly made me appreciate Blue Spheres 100x more. another excellent video, Jon!
100 X 0 = 0
@@blap721 Just because you suck at it doesn't mean it's bad, how come this certain game has rom hacks (s3 special stage edit, blue shares plus.) kiaso levels and more. Grow up and stop being such a hater
oh hey look its nick robinson
I feel like Sonic CD is hiding lots of secrets, all past present and further versions of stages and very unique special stage, would make a great video! Would also love to hear you talk about sonic and knuckles and how that all works, that lock on cartridge blew my mind as a kid and still does if I’m honest !
Sonic cd is my fav but the special stage has to be the worse one
@@Mikey-zj8bn you clearly haven't played the modern Sonic special stages. Like Lost World 3DS.
@@toopienator well yea who would play sonic after sonic adventure 1 that was the last good one
@@Mikey-zj8bn fair point.
Yes please explain the whole "lock on " thing.
Lol, this special stage is so nerve wrecking for me that i never noticed it had a sky background before and i've been playing this game for decades.
You should check out the Sega Genesis game Red Zone. It haves a lot of effects including FMV in the way you did the SEGA logo and the Game Over screen in Sonic 3D Blast.
Not to mention that most of the main gameplay uses a pseudo-3D effect a lot like the tricks he used to make the backgrounds in Toy Story's platformer levels.
From same Developer there's also Adventure of Batman and Robin on Genesis. And it has some crazy effects in spots. Especially in Mad Hatter levels.
Its crazy how much "video" goes into old video games, especially compared to more modern ones
today a crapton of video goes into video games too
it's just that nobody talks about it in-depth outside of things like SIGGRAPH
8bit guy did a video on oldschool graphics, and originally, you couldn't even load a full screen with a 16 color pallet into RAM without using tricks.
Necessity being the mother of invention was the rule of the day.
Modern ones get less respect because they are crude - the use straight forward codecs for audio and video. They treat memory very reckless, where game take up GYGABITES of memory. Game engines are pre-made, things are whole lot simpler. Their coding is sloppy, because the engine has allot of fool-proof securities that forgive allot of things to coders.
@@digimaks don't generalize things
there still are games made from scratch on engines made in-house, sometimes specifically for the game, like in the case of literally every single game that Media Molecule has ever made
The floppy drive on my Commodore 64 died right before I got around to learning how to do sprites, so it's fun to finally get to see a bit of how they work.
I was guessing that they would of used pallet swapping for all of them. Pretty crazy the bounds people had to go through to store memory back then.
I’ve also been down the rabithole of S3 special stage remixes. Such a catchy tune!
The star-sphere hidden in the sphere graphics caught me by surprise!
When I was a kid, I’d rent Sonic 3 and play it just to ear that bonus level music. Still love it.
what about the blue sphere secret game when putting sonic 1 inside sonic and knuckles
Can you talk about Adventures Batman and Robin on Sega ? damn that game blow me away with, some rotation, fog transition and scrolling
Even the soundtrack on AB&R is so constantly great!! Just played it again after a few years and it is a blaster!
Thanks for doing my request! I am eternally grateful for you doing this, it means a lot to me and seveal others I know. Thanks so much!!!
Damn, working around these types of memory limitations really brought out some genius programming tricks. That's what's so fun about dealing with older hardware, figuring out how to get it to do what you want. There's usually a way, you've just got to be clever in order to implement it. Nowadays games just release with massive files sizes. Like excuse me... 100gb for a single game? That's like an entire hard drive if you're playing on a computer from only a couple of years ago.
These videos are great... all of these techniques need to be documented, programmers these days don't have these challenges... they have unlimited resources and just make games 60gb without a care in the world. This style of game making will become a lost art... a bit like how no one knows how they built the pyramids haha
You can't do much tricks to compress 50mb 8-layers HD textures besides general compression. Modern games do use a lot of optimization tricks and push hardware to the limit while rendering, even one modern game can fill up entire book describing techniques. But you cannot compress HD assets further. If you have hours of dialogues you can remove some audio channels, but you can't compress them too much.
@@friendlylaser Pretty much, gamers tend to not realise just how much space highly detailed maps, textures and 3D models can use up, even with aggressive compression.
When he revealed the animation by switching palettes my jaw dropped. I don’t think I have the intelligence to thought of such a clever technique. In English. Never mind actually coding it.
@@jonweinraub it was a fairly well known technique at the time, you'd palette swap a lot because it's an easy way to add content sometimes sacrificing only a few colours for a totally new image.
I know the Genesis does not have built in sprite scaling...it can scale sprites through software. There are a few games with this technique without any specialized hardware add-ons. For example, there is an amazing fan translation of Wolfenstein 3d that runs on a stock Genesis and it's amazing. EA made a helicopter game that ran scaling not as a trick like a boss fight but throughout the entirety of the game...I think it was called Red Zone.
Holy smokes, I was just thinking last night about how Sonic 3's special stages were made after watching your Sonic 2 special stages video. And now here we are.
I dreamed of designing video games as a kid.
Then I realized how difficult it was, and promptly gave up on that dream 😆
I didn't. Just last year I started a class in coding, and am currently learning web development, and I know soon enough I'll work my way up to knowing what it takes to code a game myself, because I have a soul filled with DETERMINATION.
I also dreamed of designing games as a kid
but the fact that it's difficult didn't stop me, and for a while I just overanalyzed my favourite games to get an educated guess on how it works, and later when I actually learned how to program started to implement those ideas to see if they work or not, and am now working towards starting a full project using my skills
you shouldn't give up
@@TorutheRedFox I liked art a lot growing up, and once I realized that you didn't just "draw" all the sprites and levels and stuff, all the computer stuff bored me... I use computers everyday now (as a machinist, and also for hobbies like audio recording)😆
I'm not encouraging anyone to give up on their dreams. It just turned out that my dreams changed over time. 😉
@@scramblesthedeathdealer and what about graphic design / 3d modeling and not the programming itself, did you consider that back then?
Confirmed, Genesis can Run Crysis, if done by you!
I love this. The Special Stage of Sonic 3 looked incredible back then and it is still one of my favorite memories of the Megadrive.
I think the reason they didnt wanna dip into the pallet swap is because they knew they will have to change the colours of the checkerboard sphere at some point, and this would have possibly caused problems later on?
There were 7 special stages and I think each one used a different colour sphere, so having the rotations using different colours for animation could have messed with this, as you said it would have reduced the amount of pallet swaps and in the 90s games NEEDED pallet swaps.
New subscriber here. Not a developer, but I love watching creative uses of limited resources. The fact that these levels were spellbinding for me when I was young? So awesome seeing them analyzed. Very well done, thank you for all of it!
Woohoo! My favourite special stage! Much appreciated. (And that BGM *is* amazing!)
yeah
If you're a sega fan into VGM I can highly recommend Radio Sega. They have a 24/7 stream of sega music and live shows too. Really worth checking out, the community are awesome too.
Hang on a second, you said Red or Orange squares, they look orange and brown to me, different to the red of the balls.
What color is the dress?
They are brown and orange, it's a scripting mistake
@@titanic_monarch796 Brown is just orange in context
i mean, brown is a shade of red
no brown is orange with context
Your passion and knowledge for this ancient hardware and software for where you are in life is one of a kind. The fact that you acknowledge and educate this tiny enthusiastic side of the gaming sphere with your free time fills me with so much joy. As selfish as it is, I hope this kind of unique content providing you do never ceases to bore you. It is so special.
The tech demo red sphere objects in the S3-solo ROM and the Nov 3 Prototype showed how they tested the graphics for this special stage, with a rotating spherical grid and a splash/wave animation grid for testing the stage clear animation.
That kind of palette-shift wizardry on a grand scale is what enabled the GBC port of _Cannon Fodder_ to have an FMV intro. Have you covered that one?
You should make a video about your particle system for these 16 bit game and also explain with the maths involved in it. Your video really inspired me to do programming, keep making these videos
As usual, an amazing take teaching us what many tricks were used to create crazy effects back then! And I think this is the first time a Coding Secrets video took a clip from another video in the series to further explain a trick. It's awesome.
1993: Six minutes of explanation worth of palette rotations, mirroring tricks, and sprite hacks.
2020: 4 lines of vertex and pixel shader code.
I've been following Coding Secrets pretty much since the beginning, on the GameHut channel, and I _love_ seeing all these tricks and techniques; your explanations are easy-to-understand and really fun to watch. Please keep 'em coming!
Woohoo! I requested this one in an earlier video and it happened! Based on previous videos I'd seen, I figured it was either something along the lines of the palette swapping used for the Sonic 3D "SEGA" logo or the animated ground used for Mickey Mouse being chased by the moose. In my limited knowledge, I figured that either of those could conceivably work, but the floor's rotation was what kept making me hit a wall. Thanks so much for breaking it down!
Your explanation here was pretty much spot on. I've known this stuff for a while, but your explanation of it is pretty easy to understand, and I suspect that someone else who hadn't gone through all this code before would probably find this a very useful resource.
Its crazy to think how much work was put in to make games 30+ years ago, so much optimisation was needed to fit a game on what is a tiny amount of space today.
Great video as always :3
I remember suggesting the s3 special stage for a coding secrets video. Thank you for making it happen! I can't wait to see what's next
Good old color cycling :). Half the fun back then was finding smart ways to do effects with limited resources. Having this (mostly) friendly competition of who could do the coolest things on the Commodore Amiga was a great way to learn the trade, and for many, a gateway into the videogame business.
I love these videos, keep up the great work!
Further proof S3&K is one the greatest games ever produced by humanity.
Thank you for going down the rabbit hole for one my most cherished games from my 90s childhood.
This is probably my favorite special stage of the classics! I particularly like the theme cover by the J-Music Pocket Band; make sure to check them out if you haven't already!
Thank you for the great explanation as always; you do a great job of showing how everything works in a way that is not only accurate, but also very easy to understand for someone who doesn't know how the hardware works going in. Can't wait to see more of these!
As a suggestion, could you check out the Mushroom Hill Act 2 boss? It seems to use some similar effects to the Toy Story 3D, but I'm not sure.
A video about the SNES port of Doom would be awesome now that the source code is available
Excellent video as always!
To answer your last point, I think it's important to remember that "Sonic 3" and "Sonic & Knuckles" were originally intended to be one game. Of course, we got 2 different games, but regardless there's 14 special stages: 7 chaos emeralds, and 7 super(?) chaos emeralds. So, I'm guessing they opted for a wider color palette to ensure there's enough variety.
This really is fascinating to watch you break down games that I grew up with. Just goes to show how much work went into such a simple looking game.
Speaking of that Toy Story driving section.... (can you do one for that pretty please?) ❤️
Make a video on the boundary flood-fill algorithm used to check if blue spheres are completely surrounded by red spheres. Or a video on how the 3D positions within the special stage are stored.
For the storing the special stage thing, if you mean how the stages are stored in the ROM, it could literally just be a 2D grid which denotes what sphere is on an area.
I still find it amazing how you guys did so much with so little memory space
I’m curious how they were able to get the UFO stages in Sonic CD to work.
Me too... 🤔
I think it wasn't that difficult, as the Mega CD has dedicated hardware for sprite scaling and rotation.
But the stock Mega Drive lacks these hardware features, so they had to work around these limitations.
Mode 7? Or the Sega equivalent?
The CD add-on could have chips installed the basic Mega Drive was lacking.
This special stage always mystified me
Glad to know how it works
this channel's gonna blow. just one more viral vid and you're good
This is actually Gamehut's second channel, if you wearnt aware.. :)
But yeah, I found this in my recommended, so it may catch on
If you’re looking for requests for games to look into I’d ask for Gunstar Heroes (you could probably do several hours on the various effects that game has) and also the depth effects in Ranger X.
This makes me very happy that we can draw as many sprites as we want nowadays.
You could've shown off how the game stores the map layout of any given special stage. It's a false sphere, only an illusion of course. As you can tell from a globe with latitude/longitude lines, you can't exactly tile squares on a sphere perfectly all the way around. The layouts are all just squares; when you reach one edge, you go to the opposite edge of the square like a game of Asteroids.
Yeah, that's pretty typical for games, owing to the fact that it's really easy to code.
Ironically, you can in fact map that onto 3d geometry, it just doesn't look like a sphere..
If you wrap a 2d area the way games frequently do in one axis only, you've created a world that's cylindrical.
The worlds that allow traversal across both axes are actually mapping onto a toroid (donut) shaped world in 3d...
So, every time you see a game do this, what you're actually witnessing is something taking place on the surface of a donut. xD
I realised that a sphere covered with only square checkerboards is impossible...
still fun tho
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
All these squares make a circle.
Wow, that's pretty cool, some ingenious design there!
Subbed cuz I like how you explain stuff
"went down a rabbit hole of remixes of the special stage music" - time well spent. I recommend McVaffe's 'LatinSphere' from OC ReMix if you haven't already come across it.
I would love to hear about *workflow* in those days. A lot of these techniques, though brilliant, the work and process needed to reach them seem so alien to me.
I love when creators share the rabbit holes they go down when they are making videos.
Do programming students ever have assignments where they limit the amounts of RAM and ROM they can use to achieve it? Seems like a neat technique to know even if it's "solved" by the abundance of RAM and Storage space in modern machines...
This shows how knowledgeable Yuji Naka, Hiroshi Nikaidoh & Masanobu Yamamoto were in the Megadrive hardware.
There are some other interesting tricks in Sonic 3 that could warrant more videos. For instance, the title screen intro animation, the 3D water effect seen in Hydrocity Zone, the multilayer backgrounds seen in several levels (i.e. Hydrocity and Carnival Night), and the software scaling used for the boss of Marble Garden Act 2.
p.s. it's pronounced "hydrossity" don't @ me
Great video, I aced all these levels back in the day (Sonic 3 + Sonic & Knuckles) and never got tired of the looping music.
I just discovered your channel. Kudos for such a great work ! I am amazed by the quality of the explanations. Also you’re very understandable even for non English native which is absolutely a bonus point :D you deserve a subscription!
I've just bought Sonic Mania (three years late!!!) and been struggling with the Get Blue Spheres special zones (gosh, these are much harder than I remember 25 years ago...) so this was very timely. The palette swapping to simulate animation is quite ingenious. The star bumper being just a recoloured red sphere was something I never knew before.
for me it depends on what version of mania you have. i first bought the ps3 version in which I felt the special stages were unplayable because of a slight delay when you turned. and you can believe me if i say I played these stages to death in 1994 (hint: just watch my videos. hint, hint. xD). on switch they fixed this issue, where I could get all the emeralds properly. still don't know what exactly they messed up, but there's surely something off on ps3.
Finally, after so many years, I have gained a new fact about my favorite Sonic game to launch at people when we talk about it.
Next two coding secrets I like to see is the Special Stages of Sonic CD and Knuckles' Chaotix.
Dude... I subbed to you without knowing you're behind Sonic3D, and now that i know, my respect for you went from 100 to 100000000. Dude, i love you (no homo) :)
It blows my mind how inventors of these games had to be to work around such limitations, and it also blows my mind how you're able to reverse-engineer the process!
I played the hell out of this game as a kid and this has to be one of the most fascinating videos I’ve ever seen
Sonic is never on a black or white square. He is always in between them.
Jon did you know the Special Stage song was recycled from the unreleased arcade game SegaSonic Bros?
was watching a video of that game but didn't hear this track.
I would like to see coding secrets on Zero Tolerance. It looks like wolf3d stile engine, but supports 45 degree angle walls.
It also supports system link. Yes, really.
It actually supports sloped floors as well, and if you can clip into an elevator door you can see both levels at once as you move between them.
I have an entire book on the subject of these kinds of engines written in 1994 - it speculates as to how Doom works, but since the source code wasn't yet available, their guesses were quite wrong.
Still, they came up with a variety of techniques for extending a raycasting engine to do the kind of things Doom did.
As it turns out, Doom isn't based around raycasting...
But that doesn't mean there aren't other possible approaches that get similar results.
(one example is the build engine powering Duke Nukem 3d - that's a portal based engine, and as a result can do some weird tricks Doom cannot... Still similar overall though...)
I know the Genesis cannot do hardware scaling (Sega should have added a scaler before release) but what does it look like when a dev uses a software method? Like for example Panorama Cotton for the Japanese Mega Drive. That game absolutely defies all conventional logic and what's more it runs silky smooth like Space Harrier II should have.
“Is it really that easy?” I thought this video was going to show an easy trick for beating all the special stages.
Forgot about the trick of animating 4 monochrome frames from a 16 colour pallet swap, most of the rest I found quite predictable. The blue and red were obvious pallet swap but I thought the star would have used a few unique tiles with mirroring.
What about the positioning of sprites? Presumably the Genesis isn't performing 3d math for the positioning of up to 80 sprites each frame so I'm guessing it's a lookup table? Is layout of the balls actually spherical or does it use something like a square with 2 way wrapping?
oh shit, as a developer I'm jealous of those things. I'll never achieve this level of genius.
Yuji naka is a true genius
I’d be interested in seeing something like on the Mad Hatter Boss
stage in Adventures of Batman and Robin for the Genesis.
Is there any reason the shadow is usually broke on most emulators? I remember playing it on PS2 Emulators and the shadow, aside from the dark effect, was always a swap between brown and orange. Is there a specific reason for this? Or did I missed a point on the video? I always thought it was a too complex feature most emulators programmers couldn't achieve.
Thanks for the awesome video and keep up with the good work. These are always notifications that bring a smile to my face.
The shadow is probably using the shadow/highlight function of the VDP, for which Jon has done a video displaying how it works with Toy Story cutscenes. I recall PS2 Picodrive doesn't have the best implementation of that feature.
For shadows/transparency the developers relied on the CRT to provide the effect by alternating which frames/scanlines on which the shadow was drawn, 0 -> 1 -> 0 -> 1, on a CRT the shadow looks transparent due to the way CRTs scanned down the screen and how the phosphor reacted, but on a LCD it's flickering or solid or missing (depending on how fast the LCD refreshes) since the LCD updates the pixel immediately unlike the CRT so the effect is lost.
The shadow is implemented using the shadow/highlight feature of the VDP, many old emulators didn't support it (practically every modern emulator supports it, though).
The one thing that *is* broken is that the shadow shows up on top of the spheres, but that's a bug in Sonic 3 itself. They fixed that in Sonic & Knuckles.
The special stage theme is bangin!
How was moving the sprites forward in an arc and around a turn handled? Online maps of stages are arranged in a grid, but how was it bent into a sphere without problems when edge of the grid is reached and repeated to the start? Making a world map flat distorts it, so making a flat grid round should too.
aw that was soooo cool and I love the ambient music you used for the vid
After you did that video explaining the SEGA logo from 3D Blast, I was playing sonic 3's bonus level one day and I thought to myself: I wonder if this is using the same method.
im not a coder by any means but playing most of these games so many years ago, im finding this series so intresting, thanks for these,
Can you do Knuckles Chaotix next? I'd like to see how the special stage works
EDIT: I like the sonic 3 special stage song as well
Chaotix uses no tricks. The special stage uses 3D polygons, who is what the 32X can do my itself. And the bonus stages uses pixel scalling, who is what the 32X can do it by itself.
The difference between the 32X and the stock Mega Drive / Genesis is the latter can't work with polygon or scalling. The purpose of this channel is to show the tricks to make games overcomme the system's limitations with clever programing tricks.
One example is with Burning Rangers for the Sega Saturn. The Saturn can't work with transparent objects by itself, but Yuji Naka make the Saturn display transparent objects with the creation of a dedicated code inside the game.
@@miasuke damn
miasuke Keep in mind that the 32X can’t pull off those aforementioned effects in hardware, every bit of graphics on the 32X’s side is rendered in software to a framebuffer
@@Jamie-yp7qz So, in that case, it's a case to explain how the 32X works, and not a specific game exceeding the 32X power. But I would love to see an explanation of this thing, but I think Jon created a game for the 32X before (not under the TT Games label... Maybe a personal demo...).
@DejaVoodooDoll Again: The Sega Genesis was not build to offer polygons or scalling sprites by its own power. To a Sega Genesis game offer scalling or polygons without the help of a dedicated chip or processor, a specific code must me writed to make the genesis display this kind of effect, or use smart program tricks to create an illusion of such effect. It's like the example of the Sega Saturn displaying transparent sprites in Burning Rangers I comented before.
A demo of Star Fox and F-Zero for the Genesis was made using the stock console by just making use of the fast Genesis processor with a proper code (who is different of a system who have a dedicated processor / component to do this job). Jon creted many programming codes to make the games he worked to offer something exceed the expectation of what the system can do, like the Genesis displaying more colors than its limit... Many other effects other systems can do from that time, the Sega Genesis was able to do it with a dedicated programing code or trick, like zoom and MODE7.
In the 32X case, the porpose of the system is to offer Arcade-like games to the Sega Genesis. Polygons are present in 32X games since day 1, as Virtua Racing Deluxe and Star Wars Arcade. Scalling object are present in 32X games since day 1, as After Burner Complete and Space Harrier. But, again, I would like to know a programmer like Jon deal with the 32X when programming games for the system.
But the purpose of Coding Secrets is to revell as "the impossible was possible". Want an example? I would like Jon could explain how *Panorama Cotton* works...
I knew that the red and blue orbs were palette swaps, but the white one with a star, I thought it was a white palette with a separate star sprite on top. But that too is part of the palette!? That blew my mind!
I really enjoy the explanations of how you made classic video games. Fascinating.
The Sonic 3 bonus video we have been waiting for.
You cheated me with the racing sections of Toy Story... I believed that it was another algorithm to draw full strips... shame on me! Great work as always!
Not only would the sphere and ring icons have cut into the other graphics on the foreground layer, but it also could have required them to draw and store two different boxes around the two counters.
You can tell how much love the developers had for games like these. Devs these days wouldn't dare to be this creative.
Brilliant work as always, dude. I adore these insights.
Sonic Mania uses 2x the amount of colors for the same effect, and I think it also overlays a sprite ontop to give that fog effect
The Blue Sphere specials stages are my favorite special stages in the Sonic the Hedgehog series.
Is this guy tryna make me learn how to reprogram just to beat special stages?
This stuff makes me really appreciate my old game collection.
Can you do a video on how Sonic 3 does parallax scrolling for some of its backgrounds? (Launch Base and Carnival Night for example)
It's just animated tiles. Even the NES does it.
I'd love to see how the animation at the start of Sonic 3 (where sonic jumps through the Sega logo) was achieved. I remember as a kid being blown away by that.
In the recently discovered beta of Sonic 3 that was released last year, there's one sprite in the debug mode that seems to utilize software sprite scaling... it appears as though it was used in the Marble Garden Act 2 boss fight when Robotnik zooms out into the background. If you enable debug mode and enter the first level of the game, it is the 19th item when you cycle through available items (a big mess of blue pixels); placing the item puts it in the environment, at which point it scales away from the screen and returns (and also destroys all other level graphics and collision lol).
in the final release version of the game, Robotnik still performs this movement during that boss fight AND it absolutely looks like SOME type of sprite scaling, but you cannot access the sprite/character item in the debug menu anywhere in the game.
There is also another mystery item in the debug menu of the first level, a weird matrix of spinning red spheres. It doesn't appear to utilize sprite scaling, but it does seem to have them arranged in some kind of calculated spherical grid. It is visible in both the prototype and the final, and when you select the Special Stage in the prototype's Level Select, you're greeted with a very similar matrix of spinning red spheres that can be manipulated on different axes with both controllers. Controller 2 can also change the behavior of the placeable item from the debug mode in the first level if you're running the final version of the game. The prototype rom also has a square grid of red spheres that can be manipulated ("Special Stage 2" from the level select menu), but this also uses finite sized sprites for its scaling effect.
I'd love to see you pick apart these aspects of the game if you ever felt so inclined. The original Genesis/MD trilogy has been extensively researched by a part of the Sonic community (some of those talents went on to be commissioned/hired by Sega directly to do mobile ports of the old games and be the backbone of the recent Sonic Mania)... you might be able to reach out to a handful of people for some insight. It would be really cool to see if/how/where these components were implemented in the actual "normal" gameplay :o
Really great videos man! How can we find the song you play in the background of your videos?
As someone who developed a rotoscoped game for blind gamers, you are a wizard.