Sonic 3D, but each time you jump, you jump higher! (CHAOS)
ฝัง
- เผยแพร่เมื่อ 10 ก.พ. 2025
- I hack Sonic 3D Blast to alter gravity, with crazy results...
Is That You or Are You You by Chris Zabriskie is licensed under a Creative Commons Attribution license (creativecommon...)
Source: chriszabriskie....
Artist: chriszabriskie....
Yes - I meant shift by 11 not 10 to divide by 2048! Doh!
You just started counting at 0 ;)
Whoops!
I didn't notice.
With all your mega drive knowledge, do you ever feel like making a 16bit game again?
*D'oh!
The real impressive thing here is that you can jump back into code you wrote decades ago and still work with it and know what everything is.
Good comments and variable names.
The code is trivial, have you seen all the multitudes of sonic hacks around, they did not even have the original source code, they were made using a disassembly.
@@sonicmastersword8080 *COUGH COUGH SONIC 3K CIGH COUGH*
I can't even do that with code I wrote 2 weeks ago.
@@sonicmastersword8080 "Hack" "Ynot" "Aok3" uh huh. Nah, some people can just code without comments, and that's why they get paid a lot for doing big projects by themselves. It's a thing you can learn, by never reading comments in the first place. Competitive programming sites and competitions, and stuff like code golf, are also great ways to learn it. There's an OG Microsoft programmer on youtube who talks about it too, he's also a big fan of competitions
"Let me know if you like this kind of video."
Yes! The answer is always yes!
I was about to say the same thing lol
"if you want me to do a video about this, let me know in the comm-" YES YES YES
The thing that surprises me the most is that you have a working development environment after all these years. Getting set up is one of the hardest parts of developing.
This guy gets it
It's the worst part of development. SDKs, toolchains, all that garbage...
I'd rather build separate (virtual) machines or OSs specifically for each dev environment.
Its worse now than in the past, I would guess that to build that game just requires a few exe files on path.
The other day I tried setting one up which I found online, as I wanted to mess around with something. Took forever to compile/install and it still didn’t work.
@@michaelstamper1191 You needed multiple machines in the process. A Mac was needed just to do audio and graphics.
For the people that are interested, that 2048 "trick" is called fixed-point precision, as opposed to to usual floating-point precision.
And, like most good ideas in programming, it's a built-in feature of Ada.
Not sure about that. I'm going to over explain this a bit so it hopefully makes sense even to someone without background knowledge. What he did is basically the same thing that floating point does where you have a number multiplied by another number representing an either very large or very small number.
With both fixed point and floating point you have a certain number of bits to represent your number (I believe it's 32 bits in most modern systems). In fixed point every bit before a certain position in the number is before the 'decimal' point and every number after is after the 'decimal' point, excepting 1 bit that's used for the sign, that is whether the number is positive or negative. This allows you to have extremely precise fractional numbers that are easy to work with but the size of the number is very limited (the point is fixed). With Floating point you have a certain number of bits that represent a number, let's say X, and a certain number of bits that represents another number, we'll go with n. The actual number this represents is X * 10^n (there's also 1 bit for sign just like with fixed point). This allows for much larger numbers BUT you lose accuracy. So with fixed point you might only get 15 (binary) digits before the 'decimal' point and 16 after while with floating point you might get 65,000 digits before OR after the 'decimal' point but only the first OR last 15 bits (0 through 32,767) would be unique numbers (assuming 15 bits for X and 16 for n, and 1 bit for sign). 32767.3255 might be possible with fixed point but not floating point while 32767*10^65000 might be possible with floating point but way out of the scope of fixed point. To be clear I'm not sure how many bits are actually reserved for X and n in a standard floating point and I'm even less certain what the standards are for fixed point (or if there even are standards for modern languages though I presume there'd have to be). I just remember the basics of how they work and did some math using a few presumptions.
Since he's multiplying or dividing a number by 2048 (2^11, he misspoke during the video and meant to say dividing by 11) that seems a lot closer to the way floating points are handled and as such won't have the same precision as a fixed point (of course a good programmer will take measures to offset the inaccuracies of floating point numbers).
I should probably also mention that while 32-bit is standard most modern hardware can handle 64-bit (or perhaps even higher) precision variables (the general name for floats, ints, strings, ect in programming). In fact it wasn't that long ago that TH-cam switched the views variable from an INT (32-bits) to a LONG (64-bits) because the Gangnam Style video exceeded 2,147,483,647 views [(2^31)-1]* and started appearing negative . Suppose you have a 4 bit number 1110 and you add 1 you would get 1111, if you add another 1 you get 11111 but obviously that's more digits than you're supposed to have, that's called an overflow. In an INT (just like floating and fixed point number) the number farthest to the left represents the sign so if the number overflows the sign can end up flipped. Technically TH-cam could have used a different type of variable called an unsigned integer (literally doesn't have the sign) and that would have prevented the number from appearing negative but it's generally best practice (and standard practice for Google Engineer apparently) to avoid using unsigned numbers when possible (it opens up the possibility of more severe and harder to diagnose bugs).
*Continuing to try to over-explain for those less knowledgeable on the subject, 2^32 would be the number represented by an unsigned Integer if we started at 1 (not 0). We use 31 since one of the bits contains the sign and we subtract 1 to include 0 so a 32-bit (signed) Integer can represent any number from -2,147,483,648 to 2,147,483,647 (we can go 1 lower on the negative side since we subtract 1 from the positive side to include 0, technically we could go the other way and have 648 on the positive side and 647 on the negative side but for whatever, probably arbitrary, reason that's not the standard).
Edit: Wanted to mention that converting to a floating point still has some advantages since he can do some math on the expanded, more accurate form before reverting (dividing) to a smaller number. When the number is divided back it loses some of it's accuracy but it's still more accurate than doing the math without having multiplied it out first.
I'm happy to watch and drop some likes on whatever you feel like making. That said, I found the deep technical stuff where you have to work around limitations of the older hardware incredibly fascinating. I love that stuff. If you've mostly exhausted that avenue though, I'm happy to see whatever you find fun to make.
Time for another episode of "CS Dunks on Us C# Scrubs for 11 Minutes".
Reminds me of this
th-cam.com/video/RnqAXuLZlaE/w-d-xo.html
That's not C#
That's 68k ASM
(sorry if I annoyed you,but I just want to correct the com- wait,i misread the comment)
@@nil8659 You misread the comment.
@@nolram ohhhhh
I still remember when I was a kid and an uncle bought me this game as a gift during a long trip. Barely remember the trip but cannot forget receiving this game. And played it a lot during the following years
It's kinda weird to see Sonic being able to inflict damage while being hurt.
Well, he's got those sharp quills on his back, so it makes sense.
I don't code, don't understand much of any of the explanations either, but I always enjoy these kinds of videos. Thank you, CS. 😀
I'm definitely enjoying the "one hack breaks all" type of video.
I enjoy this kinda stuff. Gives me a weird appreciation for the nitty gritty of your coding.
As I feel alot of videos and challenge runs lack the intimacy you have with this project. Such a wild look at an under appreciated gem.
Wow I really do want to learn about precision in the coding you mentioned
Basically he only has integer so he does the binarey equivalent of multyplying by 10000 and dividing by 10000
@@AuxenceF It's a little more complex than that. While the number is expanded (multiplied) he can do various operations to it with more accuracy than he could with smaller numbers. When he divides it back he loses some of that accuracy but it's still closer than when he started. It's basically the same thing as floating point numbers (a few people here have mentioned fixed point numbers but that's not really accurate since fixed point has perfect precision at the cost of a smaller range).
the thumbnails are getting extra spicy now
Your channels has helped me come closer to understanding assembly language.
Jon, wtf are these thumbnails??? They're amazing
Creative guy. He should go into gamedevelopment or something
@@acos21 hahah funny
Hey Coding Secrets, hope you're having a good day!
what a weird comment to get a heart like...
@@ForeverMan Hey ForeverMan, hope you're having a great day!
I would like to see a video about using integer math to replace floating-point calculations. As far as I can tell, floating-point on modern computers is so fast there's not much of a performance penalty, but it'd be interesting to see what you had to do in those days when such functions were a (computationally expensive)) luxury.
Here's a good starting point en.wikipedia.org/wiki/Fixed-point_arithmetic
Hey my dad makes cars and says they don't use floats, they just store a int for each digit. Just wanted to say fixed point is still being used nowadays!!
ComputerPhile has some good (albeit older) videos on the subject. There's a few tricks that were discovered that allow floating point math to be done a lot faster and of course modern CPUs (and GPUs) have dedicated floating point modules.
It was always my childhood dream to be able to get over those gates and walk the loops normally. I would spend the longest time trying to glitch my way in, haha.
5:30 I must go now; my planet needs me.
Bye poochie
Nice!! I love it that you’re still messing around with your game releasd like 25 years ago. There are definitely great aspects of the game!!
This guy just casually flexing on us with the original source code
Meme content is a nice change of pace for this channel
A video on the binary fraction stuff would be cool!
I agree!!!!!!
it's interesting to me that you can still damage the bosses even if you aren't "spinning"
This is why I love these videos-they’re still relevant! I’m working on a chunk based voxel game and theres a lot of divisions by 64 going on to calculate which chunk a voxel belongs to. Bit shifting will speed this up? Awesome!
Edit: that is unless the C# compiler is already doing this under the hood however the current chunksize (64) is mutable
Your compiler should be doing that already, assuming the variable isn't floating point. If it's an "integer" variable (regardless of the bit size) then the compiler will do everything it can to substitute division with bit shifting if you're dividing by a power of 2.
You know what, the opposite would make for an interesting challenge. Where you need to complete the level in a limited number of jumps, because the jump height decreases every time you jump, so eventually, you might not reach something you need to reach. And people could compete on the starting jump height needed to complete the game.
That's probs the buzz factor for angrybirds addicts/gamers Lol
I would love to see a speed runner try to beat the game like this!
More detail on how this works please
That was really interesting! And the fact that you've added a button to bring Sonic down kind of made me think about how a drop dash would work on this game!
I think it would be fun to play with and could make a great content too!
Now between Retro Game Mechanics explained planning a SNES ASM tutorial, after this episode I kinda wanna see Coding secrets unlock the Coding secrets of coding on Genesis
There's a short series on the GameHut channel about making a Genesis game in ASM: th-cam.com/play/PLi29TNPrdbwLmUjiVvLLrRky7cXrlSIYr.html
That's really cool definitely love to see more
Oh... For some reason I never realized this about bit-shifting... It makes so much more sense now \o/
(It's also so obvious in hindsight)
Thank you for the video, always very enjoyable :)
Great video. Would definately like to see more like this
I really liked this type of video and I hope you make more in the future, your voice was a bit more shy while playing the game for some reason!? but none the less really enjoyed it.
E3TIMER? Your source code still has stuff from an E3 Demo version?
Ask any developer you know, or find a friendly one on Twitter. They will tell you the same - they don't remove stuff that was meant for debugging purposes, because they don't know what other important functions they do.
Interesting. Watching you add a feature to the code helped me understand the code better. Thank you!
I think it is so very endearing and motivating to see someone still having fun with this after all this years. Obviously must have been quite fun and still is quite fun making games for the mega drive(the only correct name.. sue me :P), can't imagine some ps3 developer remiscening about the crunch times and developing for the cell architecture, in the same way ;)
Seems like a great idea for a rom back, gravity goes down until you grab rings or kill bandits which increases it
Thanks Jon! Yes, love this type of thing - but then again all your insights into these games are great. Would like to see crazy things in other games, eg. if enemies moved really fast, or their behaviour changed in other ways, in Sonic 3&K
This is the type of challenge I love to see! That and randomizers.
Yes! of course I like this kind of video. I just love your voice over games I adore
Those first few seconds I was like, "What the heck am I looking at?"
You are a genius and a madman
That was fun! Yeah, do more of these. 💪🏻
Really enjoyed this video, would like to see more of these sort of videos very interesting :-), keep up the good work :-) I really love this channel, content is superb mate
These are the best sourcecode documentation ever published
Nice! I'd love more of this kind of thing!
Lol not exactly how a springboard would work in a low gravity situation
I wonder what Jon considers his magnum opus?
Lol this was cool. Especially the loops still "working" way up high.
1:24 - shifting by 10 is the same as dividing by 1024. I think you meant shift by 11.
Doh!
wow
shift to left by x = divide og number by 2^x
@@Mizu2023, just like in decimal shifting decimal point to the left by one position divides the number by 10.
Absolutely would love a video about oogy boogie bit shift wizardry
I'd love to see more videos like this! Really cool!
thanks for this game and sonic r! they are the synonim of my childhood!
Sonic 3D blast again?
We’re in for a treat
This is great! I would watch you do literally anything tbh... it'd be cool to see how you are compiling all this code, your Dev enviroment. maybe a guide on how to set everything up and begin coding for these consoles!
ROM hacking's easy when you're the guy who made it and you still have a copy of the source code! ;D
I love how the basic gamer instincts of "I wonder if I can get over this fence" kick in even for your own creation.
This one Was really a fun to watch
This was an awesome video. Thank you.
Great video, I'd watch more of this
I absolutely love this. I'm into rom hacks, and would love to see what sorts of modifications you could make to existing games. Even those you never worked on.
I'd love to see if he has the coding genius (and enough of its source code) to make a Dreamcast port of the original LEGO Star Wars. I _know_ it can be done, it's all just a matter of actually doing it that just hasn't happened yet! Surely with enough elbow grease I believe Jon could make it happen.
Any Content would be awesome. Thank you for the information and the entertainment.
That bit shifting seems interesting. I would watch it!
I would like to se video about shifting number in genesis! I was always blown away by the techniques used at a time when processors were incomparably weaker and limited - (no floating point etc.)
Of course we want another video going into more detail!
Hi. Amazing video as always :). If you have more videos ideas lying around with Lego Star Wars The Complete Saga, I would love to see it. One thing I am particular interested in is how you managed to make the game work so well on a Nintendo DS.
The game was my childhood.
That was fun. Bring on the hacks!
Wow, he really made a romhack of his own game, huh...
Really fun video, by the way!
What I wouldn't give for an updated Saturn version.
I feel ya. Man, if I had a few $$$s to spare I'd legit consider hunting down Gems Collection on PS2. Thing is absurdly expensive, but totally worth it to me.
I love this type of content!!
Cool, it almost looks like a floating powerup
I just love your videos!
8:18 After 14-15 years, now I know what happens when you go through the loops on foot
Ulililia must be so excited to play this.
Silly hacks are fun. More, please. XD
would love to hear about more little assembly hacks needed to get past limitations of the system & to make certain things work just a bit faster
Look up "68000 Tricks and Traps" and you'll find a few
I realised the 2nd boss is a statue of a cat knight lol.
So its not only me that likes to break/push games to the limit for my own personal amusement :-D
Amazing watching how much depends on gravity, always thought things like the cannon or badnik bounces were just scripted
Now I’m thinking of a ‘bounce bracelet’ hack of Sonic 3D. Shame there’s no complete disassembly available.
Man, that was a strange beginning
Would be cool to see something with the Crash games or LEGO :)
I want a video going into more detail on how this works. It's sort of why I am subscribed to this channel.
Very interesting to see this hidden stuff.
Any chance of a Puggsy coding secrets, part 2 of the Titan Overdrive coding secrets, or another coding secrets for another game you didn't work on like Panorama Cotton?
One thing you've covered before that I think would be interesting to see a "real time" demonstration of like this is anti-hacking.
Like, using this jump-hack as an example, if you could set gravity to stay normal on legit copies, but make the moon jumping only happen on bootlegs.
Could you please go in to more details about the 2048 bit shift!!
think about shifting numbers in base 10 by moving a decimal point: shift the decimal point on 1.0 to the right and you get 10 - the same as multiplying by 10. shifting left gives you 0.1 - the same as dividing by 10. in binary you're doing the same thing, but with powers of 2. instead of multiplying/dividing by 10^n, you're multiplying/dividing by 2^n. 2^11 = 2048!
Makes you wonder about the unnecessary but probably beautiful love child between Sonic 3D Blast and Sonic 2 XL
I would definitely like to see more shenanigans
I adore your videos
Yes
Oops there goes gravity
Reminds me of every time I start a new game with a jump mechanic and just drop in numbers that seem right to test,
I used to use a game genie to change the gravity in my Sonic games. It was good fun :]
I would really like to know how you guys managed to render the floor and ceiling in that famous toy story 3D level… maybe as a follow up of your first video about the subject!
Did you have to punch your cartridge to skip the first level! Ha ha!
The thumbnail is hilarious 😂
This was awesome!! 👍👍🔥
Man's a legend