Sonic R's code the Hardest in the World?

  Рет қаралды 101,127

Coding Secrets

Coding Secrets

Күн бұрын

Пікірлер: 319
@xravenx24fe
@xravenx24fe 4 жыл бұрын
I'd be shocked to learn that any other videos of this depth concerning programming on older consoles even exist on KZbin. These videos are gems even as a layman and it's extraordinary what you're capable of sharing with the world about gamedev programming from a time before the internet was used to share these secrets. The video editing is top notch and I appreciate that you can explain complex stuff without filler or unnecessary details beyond the exact topics you're addressing. Something tells me that you've got experience and knowledge to make content with for a long time and I can't wait!
@rayredondo8160
@rayredondo8160 4 жыл бұрын
See "Retro Game Mechanics Explained"; a few other channels exist too. I think this series (on the GameHut channel originally) may have been one of the first though.
@jc_dogen
@jc_dogen 4 жыл бұрын
check out chibiakumas. he's been doing 6502 and z80 programming videos for years. he also covers graphics and sound hardware for various computers and consoles of the time.
@stevenschiro1838
@stevenschiro1838 4 жыл бұрын
Was going to suggest retro video game mechanics. His series on the SNES is amazing
@beddyboy
@beddyboy 4 жыл бұрын
Well said.
@Prizm44
@Prizm44 4 жыл бұрын
I was dying to learn assembly as young teen in the mid 90s but I had no resources 🙁 There was no one to teach me, libraries were useless, and all cracking/demo groups were overseas. The closest I got was a couple cracking tutorials downloaded from an old warez site, but they generally required prerequisite knowledge. It was so frustrating. The information available online today would’ve been such a godsend, even if it is still a bit lacking.
@ToonLittleCat
@ToonLittleCat 4 жыл бұрын
Still waiting for that "Impossible DSP" video. Amazing work!
@squelchedotter
@squelchedotter 3 жыл бұрын
Ha, your wish was granted!
@ToonLittleCat
@ToonLittleCat 3 жыл бұрын
@@squelchedotter I saw! :D
@stinkyox
@stinkyox 4 жыл бұрын
Oh this sounds very familiar to me. I coded on the Nuon platform whose CPU was a small array of what were called "processor elements", each a VLIW processor allowing the coder to specify up to 7 operations per tick; I remember days spent trying optimally to load each instruction so that all function units were maximally occupied for inner loop code. So you had the fine-grained parallelism inherent in the VLIW code, plus the coarse-grained parallelism of it being a processor array; four of these things banging away at the same time. Plus they each had 4k of data RAM and 4k of instruction RAM each, and they did duty for ALL the graphics stuff, so you also had to orchestrate a complex dance of DMAing in chunks of screen RAM and code overlays to instruction RAM to have the right code to hand to process the chunk... happy days. I think only a handful of us were ever mad enough to code it to that level. I'd been an assembler nerd for years at that point so I actually loved it in a perverted kind of way. But I fully appreciate that saner developers would much prefer to bosh out a bit of C and let hardware do the heavy lifting!
@RoloTonyBrown
@RoloTonyBrown 4 жыл бұрын
Why hasn't anybody noticed that our lord and saviour Mr. Minter has commented on this video. Love hearing old coding tales from the old days. Cheers Jeff!
@alexanderwingeskog758
@alexanderwingeskog758 Жыл бұрын
How cool! Jeff Minter the man and the legend! I wonder if it was game Tempest 3000?
@wandersgion4989
@wandersgion4989 4 жыл бұрын
I feel so spoiled to have floating point numbers in modern game engines.
@finnabon
@finnabon 4 жыл бұрын
Indeed
@madokalover
@madokalover 4 жыл бұрын
Floats are not a feature of game engines! Modern processors have Floating Point Units that handle floating point calculations in hardware; but yes, they are extremely useful!
@wandersgion4989
@wandersgion4989 4 жыл бұрын
171 So to be more precise, I feel fortunate that the engines can leverage this capability of modern hardware.
@gyroninjamodder
@gyroninjamodder 4 жыл бұрын
@@vlc-cosplayer They make different tradeoffs. One prioritizes speed and memory by giving up arbitrary precision and the other prioritizes arbitrary precision by giving up constant time operations and consonant space. Depending on your use cases one is better suited than the other.
@davidbanan.
@davidbanan. 4 жыл бұрын
Well they had floating point Numbers on N64 at least
@MrEightThreeOne
@MrEightThreeOne 4 жыл бұрын
I still remember the first time I watched this video and my eyes absolutely lit up that my favorite class during my electrical engineering degree (computer architecture) actually came in handy for this. This is still so cool to see and it amazes me how you didn't look at the difficult architecture as a hindrance, but a challenge to overcome. It paid off, Sonic R is still one of the most amazing looking games on the Saturn.
@ralphhoskins2115
@ralphhoskins2115 4 жыл бұрын
Mr. Eight-Three-One it is a amazing game...,.
@slathian1223
@slathian1223 4 жыл бұрын
That class during my Computer Science degree was terrible.... I think it mostly comes down to the effort that the professor puts into the class. I bet yours was awesome!
@dirkvandijk6112
@dirkvandijk6112 4 жыл бұрын
Art game dev, Sega boy at heart, worked on ps1 and despite my allegiance I feel like I dodged a bullet not having to deal with the Saturn's idiosyncrasies... Massive respects, I feel like i got away light hahaha
@darkcoeficient
@darkcoeficient 4 жыл бұрын
This is the type of thing that gives appreciation to what was achieved before. And to think all of this was to sell games...
@mark030a
@mark030a 4 жыл бұрын
@@darkcoeficient At least back then video game companies (and console manufacturers for that matter) gave a shit about the quality of their products. Erm, mostly. There were bad games, and failed consoles, yes, you can't avoid that but I kind of feel like it was a passion for Nintendo when they rised up in 1985, they didn't just make games for profit, they had passion for it and cared about it, same would go for SEGA if they hadn't fucked up hard. Sony hopped onto their own bandwagon of the PS1 and I'm not sure what to say about that, it's been a good ride yeah but I think Sony felt a little bit "entitled" afterwards. Now it's just "fuck-all gameplay go for graphics" type of viewpoint foe videogames. Sure, games have moved on in time but when you get your junk blown off by the graphics in a trailer, you know you're in for a shitty ride. And for Nintendo, they have become a multi million company and I feel like the passion is gone, not completely though (they're still a good company that makes a masterpiece of anything they release) but it's not the same as it was.
@mark030a
@mark030a 4 жыл бұрын
@General Jiggler Exactly! Well said, very well said.
@foxymetroid
@foxymetroid 4 жыл бұрын
@General Jiggler Nintendo's not afraid to experiment from time to time. Breath of the Wild was the biggest gameplay departure from the Zelda norm since Zelda 2. Splattoon was also pretty unique when it came out, with your ammo doubling as both an attack and a means to greatly increase mobility. Games are expensive, so it makes sense they'd rely on profitable formulaic games as a way to fund their riskier ideas.
@FranciscoFJM
@FranciscoFJM 3 жыл бұрын
@@mark030a That is extremely narrow minded, videogames today have as much if not MORE passion put into them than ever before, you just gotta find the right games, just like back in the day
@AesculapiusPiranha
@AesculapiusPiranha 4 жыл бұрын
Still waiting for The Impossible DSP, and I don't mean the annoying streamer who blames his controller for everything he does wrong.
@orderofmagnitude-TPATP
@orderofmagnitude-TPATP 4 жыл бұрын
"Bugged game mechanics dood!"
@yungchop6332
@yungchop6332 4 жыл бұрын
And he whacked the dough on stream! Pretty swagg
@slashrose3287
@slashrose3287 4 жыл бұрын
Me too, PLEASE do it Jon, THANKS!!!!
@animeknightx
@animeknightx 4 жыл бұрын
even tho about 2% of his viewers would actually understand it but I wanna see rofl
@FreezepondMapping
@FreezepondMapping 4 жыл бұрын
Ack ack ack ack, WOW, what an AMAZING CODE! Nobody will ever figure this out! Great job, Sega! Wow! [seal clap]
@CountDrunkula
@CountDrunkula 4 жыл бұрын
Oh god - I remember doing similar things on the pentium to get other things happening while waiting the the cycles a divide or multiply would take. I loved it and hated it.
@TheZaaz
@TheZaaz 4 жыл бұрын
Honestly, this video went up MUCH faster than I thought. I don't understand every single bit of your content, but I do fine it very interesting regardless! Thanks for the cool information. :)
@skyletoft
@skyletoft 4 жыл бұрын
It's a reupload from his original channel
@yungchop6332
@yungchop6332 4 жыл бұрын
Gamehut documents all of HIS work. Coding Secrets documents any coding secrets from any game he feels like.
@elooflskhu5358
@elooflskhu5358 4 жыл бұрын
haha butt
@alancaX
@alancaX 3 жыл бұрын
As an inspired Genesis and Saturn owner these videos answer a lot of questions I've had for years. I can barely muster Visual Basic sometimes; but this is the work of legends. I'm assuming you had a lot of fun at Traveler's Tales? Keep these great videos coming!
@DerrickJolicoeur
@DerrickJolicoeur 4 жыл бұрын
That was honestly far more straightforward than I anticipated. You had me ready for some weird shit
@pixeldragon6387
@pixeldragon6387 4 жыл бұрын
“And this is where it gets a lot more complicated” *me with my brain leaking out* “oh really!?”
@ansonx10
@ansonx10 4 жыл бұрын
I think a lot of people using free engines like Unity or Unreal don't realize how easy they have it. lol
@boomgoesthedynamite69
@boomgoesthedynamite69 4 жыл бұрын
I mean theyre advertised as free, relatively easy-to-use programs
@onkelberra3166
@onkelberra3166 4 жыл бұрын
I think most knows that. There's a reason people use premade game engines then making their own.
@gyroninjamodder
@gyroninjamodder 4 жыл бұрын
People have outsourced engine development for decades.
@WingedAsarath
@WingedAsarath 4 жыл бұрын
@General Jiggler Yes Crystal Tools is no longer in use as it was no longer able to meet the demands of the games they wanted to make with it. FFXIV and FFXV both use Square Enix's own Luminous Studio engine, while the FFVII Remake used Unreal Engine 4. It's a similar story behind the collapse of Telltale (well, part of the story). They stayed using their in-house Telltale Engine for so long even after it was clearly struggling to cope with the ever increasing complexity of their cutscenes and games.
@FoxUnitNell
@FoxUnitNell 4 жыл бұрын
@@WingedAsarath kingdom hearts 3 also uses the ut engine too i believe.
@danielm2142
@danielm2142 4 жыл бұрын
It's a wonder why demosceners aren't falling over themselves to prove their skills by coding for the Saturn's DSP.
@brucemalis1728
@brucemalis1728 4 жыл бұрын
Dang is the demo scene still a thing? Haven't heard much about them since early 2000's
@bangerbangerbro
@bangerbangerbro 4 жыл бұрын
@@brucemalis1728 i thought it always has been?
@gregorybecker2344
@gregorybecker2344 4 жыл бұрын
I want to see more dsp code. I really liked your explanation on how each piece of code does it's thing near the end, and I wouldn't be at all disappointed if you did it more, or a video where all you do is go through code and explain how specific lines work. I've always loved coding, but never had the patience to really sit and learn, and this channel, and especially this video, are scratching that itch very nicely.
@raf.nogueira
@raf.nogueira 4 жыл бұрын
This video is a complete MASTERPIECE, This stuff is so cool, why there is no others channels like this before ?
@segaboy128
@segaboy128 4 жыл бұрын
Awesome vid! Thank u for sharing! When i played sonic r on ss back in 1997 i knew that graphically you made the saturn sing! I appreciated the amazing results and its really cool to hear about your work now in detail!
@MatthewBester
@MatthewBester 4 жыл бұрын
That is fantastic visual representation. Good example of knowing how something works as opposed to why.
@WelshProgrammer
@WelshProgrammer 4 жыл бұрын
Nice, I believe the SIMD extensions for x86/x64 were the equivalent to this where they could do mass matrix multiplications in parallel to speed up this kind of polygon processing. The whole Saturn configuration reminds me of programming on the GP2X where you had 200MHz ARM920T host processor and 200 MHz ARM940T programmable coprocessor and if you were clever, could fully utilise both CPUs to do tasks in parallel since they had the same instruction set/bus/register size and make the code significantly faster for 3D related things. Payback (a GTA clone) used this to maximise frame rates to great effect.
@raziyatheseeker
@raziyatheseeker 4 жыл бұрын
Well, it is complex code for a reason. It must seal away the Tails Doll somehow. Even then, it's still able to release him with a certain caveat.
@ASuddenRose
@ASuddenRose 4 жыл бұрын
My brother just bought the saturn version a few days ago. I wish you internet people would stop proving I live in a simulation with your impeccable timeliness.
@mercuriete
@mercuriete 4 жыл бұрын
This VLIW assembly is more like microcode of the microprogramable control unit and make sense. Its almost that you have the control to turn on and off all tristate buffers on that DSP. Sorry if I am wrong. Nice video and waiting for the next DSP video.
@Sauraen
@Sauraen 4 жыл бұрын
As someone who does GPU programming for a living... this really isn't that bad. It's more like microcode than normal code, but if you look at each of those columns vertically, each unit is basically either doing its one thing in a particular cycle or not doing anything (with a couple exceptions). If you understand the hardware--and that DSP does not look very difficult to understand, compared to modern GPUs--it would only take a few minutes to write that matrix multiply routine.
@Sauraen
@Sauraen 4 жыл бұрын
Basically each line of code here is the equivalent of one fused-multiply-add instruction on a modern CPU or GPU, plus a little memory indexing. It's just written in a complicated-looking way.
@RetroBreak
@RetroBreak 4 жыл бұрын
It looks complicated but it actually makes sense, thanks for the well presented video! Very interesting!
@OggyP123
@OggyP123 4 жыл бұрын
Just discovered your channel yesterday and it is amazing
@CrossoverGameReviews
@CrossoverGameReviews 4 жыл бұрын
Did you check out GameHut? His original channel?
@edwin3928ohd
@edwin3928ohd 4 жыл бұрын
The hardest "cheat code" is from Star Wars : Shadows of the Empire (N64). You need both hands and your mouth to enter it.
@yungchop6332
@yungchop6332 4 жыл бұрын
Swallow the controller
@Akuajin
@Akuajin 3 жыл бұрын
Basically the Saturn was very untapped and never even was close to showing its full potential at all, Sonic R was super impressive always thought that game looked better then majority of the 3D rendered games, Burning Rangers as well! Love the channel!
@AspieGamer1986
@AspieGamer1986 4 жыл бұрын
The Sega Saturn is a very complex system that is still being cracked in order for people to figure out how it works. 20 years later it's more complex than I ever knew.
@RockmanExecute
@RockmanExecute 4 жыл бұрын
This is interesting stuff. Also, I LOVED SonicR, it's arguably one of my most favorite Sonic games.
@rubiskelter
@rubiskelter 4 жыл бұрын
I loved the fact that i had to learn in depth on how to use the OpenGL library. It doesn't serve me any purpose now, but still was lots of fun! Your C code resembles the transformations we make using OpenGL indeed. Great video , keep them coming !
@Stoned_Penguin
@Stoned_Penguin 4 жыл бұрын
I just love your videos. Always interesting videos that goes straight to the point. Please keep doing this awesome work.
@RetroGamerBB
@RetroGamerBB 4 жыл бұрын
The 3do uses some neat matrix tricks for 3d as well. Take a look if you care to go further down the rabbit hole...
@katsuragi2110
@katsuragi2110 4 жыл бұрын
Did you ever have problems with debugging race conditions on the DSP?
@CodingSecrets
@CodingSecrets 4 жыл бұрын
As far as I know, there was no debugger as such
@madokalover
@madokalover 4 жыл бұрын
@@CodingSecrets I don't think Katsuragi was asking about a debugger specifically, but more of if you had any problems fixing bugs or solving problems that had to do with race conditions on the DSP.
@mk72v2oq
@mk72v2oq 4 жыл бұрын
Race conditions appears only in a multithreaded environment and only for a complex memory operations. There was no multithreading in Sega Saturn times. Also all of the described operations are atomic (done in 1 cycle). So there is no concurrency and no reasons for race conditions at all.
@criticality2056
@criticality2056 3 жыл бұрын
@@mk72v2oq do the CPUs not perform parallel operations?
@Brahvim
@Brahvim 5 ай бұрын
@@mk72v2oq Nope! Concurrency errors can occur in _any_ code on _any_ hardware that has _any_ asynchronous parts. Yes, that does includes _even_ hardware with inputs and outputs. Anything that doesn't follow the CPU's clock, basically. ...And as @criticality2056 mentioned, there were parts that dd things in parallel. That itself requires very good synchronization.
@patrickmayer9218
@patrickmayer9218 Жыл бұрын
Game dev is hard enough as it is, but what you guys did in those days was incredible. People who program that low-level are legends!
@viniciusgomes5147
@viniciusgomes5147 4 жыл бұрын
This guy: Makes extremely complex coordinate algorithms Me: Almost failed my first Java test. lol.
@DDL4Blue
@DDL4Blue 4 жыл бұрын
Those chips with more parallel instructions are fun :D. I was programming one like 2 years ago and I've literally used Excel as a code editor :D
@Alche_mist
@Alche_mist 4 жыл бұрын
Seems like you can make a makeshift debugger/code-flow-tracker on the side there as well.
@jaspercochran1535
@jaspercochran1535 4 жыл бұрын
Love learning more about the Saturn. Very interesting stuff! (Also still waiting out for that new dsp video 😉)
@lost4468yt
@lost4468yt 4 жыл бұрын
"hardest piece of silicon to code for" - try properly coding for IBM's CELL architecture. If you use the SPEs and EIB properly you can get crazy good performance out of it. But that's very complex. If you're seriously interested in coding for it you can buy an IBM QS20, QS21 or QS22 blade for their relevant blade server, they pop up on eBay for relatively cheap these days. Or you can pick up a GigaCell 180 PCIe card which has the second version of the CELL processor on it. Or alternatively you can pick up a PS3 and hack it to run Linux (or find an old fat one on an old firmware), but that one is certainly the most clumsy route.
@bangerbangerbro
@bangerbangerbro 4 жыл бұрын
What is it exactly that makes it so hard?
@wton
@wton 3 жыл бұрын
@@bangerbangerbro im no expert but i read the CELL is like 7 processors in one and the shit is so hard to synch between them that gives programmers a pretty hard time.
@bangerbangerbro
@bangerbangerbro 3 жыл бұрын
@@wton ok.
@TheSuperuser49
@TheSuperuser49 4 жыл бұрын
Computer chips and what they do absolutely baffles me
@wompastompa3692
@wompastompa3692 4 жыл бұрын
This is voodoo magic, the question is, "Is this too much voodoo for our purposes."
@FoxUnitNell
@FoxUnitNell 4 жыл бұрын
when 3d dediicated cards were made for pcs, they called some of the first set voodoo 3dfx cards because all of the magic these cards did.
@danielszemborski
@danielszemborski 4 жыл бұрын
Nice username. Haven't used it in decades.
@inzabuhd8673
@inzabuhd8673 3 жыл бұрын
Wise words from the best programmer in the world
@OdaSwifteye
@OdaSwifteye 4 жыл бұрын
Imagine putting that together. That was someone's migrane.
@Gredran
@Gredran 4 жыл бұрын
0:42 SoftImage!! :D These vids are great man, keep em coming!
@cheater00
@cheater00 4 жыл бұрын
Really interesting video. Nowadays if you wanted to code something like this you could get help by using a reactive programming DSL (domain specific language) - probably one you'd write yourself in something like Haskell - and that would output the code. It could output stats on the utilization of the different units, on the amount of time calculations would take, and even the loss of precision.
@wojiaobill
@wojiaobill 4 жыл бұрын
I got lost at around 0:00
@GraveyardWarden
@GraveyardWarden 4 жыл бұрын
I want to see sonic R records. I swear I probably have a few, I have some crazy times in that game. I played since I was a child and have always loved it even though mostly everyone hates it I guess lol
@jollyrogerxp
@jollyrogerxp 3 жыл бұрын
What a really great explanation of the Saturn's SCU DSP operation. I admit the title of the video is a little bit off, as the code explained here is pretty much a verbatim copy of SEGA's own example SCU DSP matrix transformation code that can be found in the Saturn SDK, so I would have titled the video "SEGA Saturn DSP code the hardest in the World?", rather than "Sonic R's"... oh well, anyway a very good video.
@robotnikkkk001
@robotnikkkk001 4 жыл бұрын
=NEED A COMPARISON ABOUT HOW "NORMAL" CONSOLES DO WORK WITH THAT =..........BUT YEAH,SONIC R WAS THE PROGRAMMER'S NIGHTMARE FOR SURE....OR SATURN WAS LIKE CREATED ONLY TO RUN SONIC R AND SOMTHIN ELSE,WHO KNOWS
@dyscotopia
@dyscotopia 3 жыл бұрын
This was a lovely reminder of trying to wrap my head around 68000 asm on the amiga. I think I got some scrolling copper bars as my crowning achievement. Can't imagine trying to program 6 at once.
@Yupppi
@Yupppi 3 жыл бұрын
Nice to notice this was already done. Now searching for that next impossible video.
@bigalejoshileno
@bigalejoshileno 4 жыл бұрын
Well, formally, driver-less, programming a PC video card like 3dfx, nvidia or matrox worked this way in some parts.
@Fogmeister
@Fogmeister 4 жыл бұрын
I feel like I've seen these videos before. This and the transparent mountains.
@ralphhoskins2115
@ralphhoskins2115 4 жыл бұрын
You are just amazing,,, I can’t grasp how in the world,, you guys turn all this code into works of art. I’m a huge Saturn fan and love your games ,, hands down some of if not the best stuff on the platform,,, my question is ,, how much money would it take to get you to port doom 1&2 to the Saturn?? It needs to be given the doom port it ,and Saturn doom fans deserve..... let’s do a go fund me...the community would love this!!!
@lemagreengreen
@lemagreengreen 4 жыл бұрын
It's incredible, isn't it? Assembly language programmers always impressed me. How the hell you get from simple individual instructions like this to a full blown 3D game engine is of course way beyond my ability or even understanding. I understand it's lots of little pieces but it's how they all fit together and produce something beautiful in the end and the process of bringing all these little pieces together that is really hard for mortals to get their heads around.
@WagnerSilva-fq2tu
@WagnerSilva-fq2tu 4 жыл бұрын
Amazing! Great old console programming KZbin channel. If Sega had designed DSP to be a 3D coprocessor like GTE, Saturn should be more friendly to programmers and I believe that second SH2 it was not be necessary. This really shows how Saturn was not designed to be a 3D console.
@5371W
@5371W 4 жыл бұрын
I have no idea what I just watched, but very interdasting.
@spudd86
@spudd86 4 жыл бұрын
Any Very Long Instruction Word thing would be this hard to program because they are all kinda like this. Current AMD GPUs are a bit like this. You just don't have to assembly to do it anymore (Though I imagine there's a few things that the hardware vendor writes that end up coded in ASM to support GL/DirectX/Vulkan workloads or some specialized workload).
@NullUndefined1337
@NullUndefined1337 4 жыл бұрын
It can´t get harder when I look back at my own code.... when I started coding.... Not because it isn't easy to read, because I don´t know what crap I was thinking back then XD
@davy_K
@davy_K 3 жыл бұрын
When I was a student (back in 1989-90) my year in industry had me coding in parallel but it was in 3GL. (I can't really say where that was). There was a special version of FORTRAN that ran matrix operations in parallel but it ran on a beast of a custom built computer that could operate on large matrices in parallel (it might have been up to 64x64 but I can't remember). It was a monster - liquid cooled - and they used to just turn it on to keep the room warm!! Some guy just for fun had it calculating Mandelbrot sets and you could zoom in and out in real time. Blew my student mind! Amazing to think a few years later this sort of tech had made it into a console. Doing this in assembler though? Head banging!
@r603burakkusuta2
@r603burakkusuta2 4 жыл бұрын
One of many reasons as to why I don't code.
@artiumnihamkin9206
@artiumnihamkin9206 4 жыл бұрын
Here is the link to that SCU user manual: archive.org/details/SCU_Users_Manual_Third_Version_1994_Sega/
@Known_as_The_Ghost
@Known_as_The_Ghost 4 жыл бұрын
Great video!
@poalcm
@poalcm 4 жыл бұрын
I'm ready for the next class!
@rayredondo8160
@rayredondo8160 4 жыл бұрын
I'm thinking of designing a custom chip like this myself; particularly, one really fast at processing a lot of logic and a minimal amount of math. It'll be much less ridiculous to program though ;) Love these videos! Keep it up!
@talldie3607
@talldie3607 4 жыл бұрын
Now would be a good time to do it, Googles doing a print of 40 custom ASICs using the new open source skywater PDK if they use your design you'll get 100 made for free
@aspinia
@aspinia 4 жыл бұрын
I guess Sonic R was the game that reached the peak of saturn development, what I mean is what if after what they learned SEGA would have developed more hardware pusher games and enlarged saturn's lifespan a little.
@poalcm
@poalcm 4 жыл бұрын
I feel so smart just for understanding all of this.
@khandarwilliam5439
@khandarwilliam5439 4 жыл бұрын
everything that low level would be complicated
@Dirk1Steele
@Dirk1Steele 4 жыл бұрын
Err... Impossible DSP video? Yes please and it has been a while now.
@marioe.4400
@marioe.4400 4 жыл бұрын
I know that precise assessments aren't possible without the source code, but just by analyzing the footage, would you say that the Saturn version of the Shenmue prototype was even "more impossible"? Could it run at a slightly higher frame-rate or even use Gouraud Shading?
@BuryEdmund
@BuryEdmund 3 жыл бұрын
I stopped this halfway because I'm really confused, but I liked it anyway because it's so well done
@Galva101
@Galva101 4 жыл бұрын
Very interesting video, thank you for making it! I still have one question; when these 6 operations occur at the same time, which X and Y are then multiplied together? I assume the multiplication happens "at the same time" as the overwriting of X and Y, in practice meaning that the result is stored to PH(16) and PL(32) and at the same time, a new set of X and Y is written to RX(32) and RY(32)?
@sentry4944
@sentry4944 4 жыл бұрын
One of the important things to understand about assembly is that one instruction doesn't equal one clock (CPU) cycle. The assembly code you're looking at does show all the instructions on one line, so the instructions will start in parallel at the same time, but instructions take different numbers of cycles to complete. If you take a look at the second instruction of the complex DSP code: MOV MC1,X will take a few cycles because the move instruction will have to read the address pointer in M1 first, then the address lines have to be set, then the read data line will go low to read that memory into the X register. So you're not moving data into the X and Y registers until maybe cycle 2 or 3 at the earliest. (I'm making MAJOR assumptions about the DSP's instruction set and have no clue how its instructions are set up, so it could be earlier or later). At the same time, the instruction telling the multiplier to do it's thing is called. The data for the previous X and Y are already in the X and Y registers, so on the first clock cycle of the instruction, X and Y are read by the multiplier. This happens before the X and Y registers are updated by the MOV instruction in parallel. The following cycles will do the math and put the result out on the P register. The programming is very clever and I can only imagine my brain melting trying to program in parallel like that. If you want to go down the rabbit hole of assembly and machine level processing, I suggest watching some of the videos that Ben Eater has put out recently about building a computer from scratch. For example: kzbin.info/www/bejne/r52bp4ONas2smrM
@3rdalbum
@3rdalbum 4 жыл бұрын
@@sentry4944 Thanks for the explanation. I just get the mental picture of the multiplication unit multiplying the old values while the new values are screaming down the copper lines toward it.
@daneast
@daneast 3 жыл бұрын
In 2001 I spent a lot of type optimizing the Quake 1 and Quake 2 software renderers to run on Pocket PC processors back in the 90s. They did not have a coprocessor / floating point math at the hardware level, so a great deal of the optimizing was converting floating point operations to fixed point integer math. Seeing the bitwise AND (&) with 4095 to mask it to 12 bits for the lookup table immediately jumped out at me. Although that isn't directly fixed point math, it is similar (using integer degrees where 360 degrees is 4096, allowing around 1/10th of a degree precision using only integer math / lookup tables).
@ojmbvids
@ojmbvids 4 жыл бұрын
Multiplying two 32-bit numbers could result in a number requiring 64-bit. What happens if you need more that 48-bits? is it just an overflow?
@ElementalAer
@ElementalAer 4 жыл бұрын
Probaly this or data loss. Time to read the documentation
@solonsaturngaming3727
@solonsaturngaming3727 4 жыл бұрын
Whens the Impossible DSP video? As seeing a lot of people saying that now i am interested
@skillsharekirby2048
@skillsharekirby2048 4 жыл бұрын
I... I actually understood that... *help me*
@benjiroberts4434
@benjiroberts4434 4 жыл бұрын
Could just rename the video "why 100% accurate saturn emulation wont happen for 30 years" and its still right. Excellent content.
@JoeServo
@JoeServo 3 жыл бұрын
Who knew Carl Benjamin was such a talented coder!? Love the channel!
@najalala
@najalala 4 жыл бұрын
you are very good at explaining this kind of stuff
@miasuke
@miasuke 4 жыл бұрын
3:30 = Taking breath moment... 😤 4:31 = Taking breath moment #2... 😤 😤 Jon, you are breath taking... 😂
@tannens
@tannens 4 жыл бұрын
almost like he is a human or something
@Itsmuchmore
@Itsmuchmore 4 жыл бұрын
Great video as always, just subscribed and a big fan of Sonic R (we own it on the Sega PC) keep up the amazing videos
@SilentVinyl
@SilentVinyl 4 жыл бұрын
Fascinating and complex
@parodysam
@parodysam 4 жыл бұрын
Who would’ve thought all the greatest coding feats in 80’s-90’s games were sonic.
@danielszemborski
@danielszemborski 4 жыл бұрын
Thank you, because without the code we don't have the best video game soundtrack since Violent Storm.
@jordanscherr6699
@jordanscherr6699 4 жыл бұрын
So the idea of parallel instruction made sense "in theory" when Sega developed the Saturn. What they didn't account for was those instructions running into each other. It only works if you've got a smooth flow of well timed instructions. Game engines naturally want to be chaotic, especially when supporting an actual game. Sonic R was a very straightforward racing game. Can you imagine this in an unpredictable open world like Mario?... ouch!
@BSGofficial001
@BSGofficial001 4 жыл бұрын
This is incredible!
@FrappuccinoAlfredo
@FrappuccinoAlfredo 4 жыл бұрын
I have never programmed before, is this what all of it is like? Lol
@Xitrial
@Xitrial 4 жыл бұрын
That was a nice explanation of how dsp works
@krystostheoverlord1261
@krystostheoverlord1261 3 жыл бұрын
I would love to see a series on coding for the sega!!! I love your videos btw!!!
@poalcm
@poalcm 4 жыл бұрын
just imagine if all the developers use this low level of programing to make the most the technology nowadays... that's why I think Nintendo switch games are amazing, because they use dated hardware to port modern games.
@fallingintime
@fallingintime 4 жыл бұрын
Switch is arm based?
@formerlycringe
@formerlycringe 4 жыл бұрын
It's using a fairly well documented arm soc + the only reason why some ports exist is because a lot is taken out or the game looks like a watercolor painting. It's not THAT dated, unless we're talking in terms of mobile phone computing of course.
@darltrash
@darltrash 2 жыл бұрын
It's not really possible anymore, it would just make things very complex nowadays with the way we handle everything i think it's more about the way the code is organized and the algorythmic complexity, as decent compilers tend to be VERY GOOD at compiling code into super fast assembly What makes nintendo special is that they cannot just say "yeah make them buy more ram LMAO" because they CANT provide it properly, so they HAVE to optimize their software so their hardware doesnt go useless instantly, unlike game companies making their games super slow and big because of DRM, Anti-Cheats, Terrible code and a capitalism-centered gameplay loop with microtransactions over anything else.
@DarkDyllon
@DarkDyllon 4 жыл бұрын
Bungie with Destiny 2 development: it's hard to make new content Developers of the 16bit+ era: it's a challenge and we'll do the impossible
@Humbird00
@Humbird00 4 жыл бұрын
This is like manual hyper-threading.
@bigalejoshileno
@bigalejoshileno 4 жыл бұрын
is like a standard DSP, but without helper libraries.
@orderofmagnitude-TPATP
@orderofmagnitude-TPATP 4 жыл бұрын
Please please do the impossible DSP.... you were a very big part of my childhood along with the saturn so please sir!
@KameariKillScreen
@KameariKillScreen 3 жыл бұрын
I like the "world's hardest" genre. I too have the world's hardest of something.
@devhonking721
@devhonking721 4 жыл бұрын
*starts making a VM with the worst instruction set*
@big0bad0brad
@big0bad0brad 3 жыл бұрын
I may have beat you to it, I created a VM that runs on 8 bit PIC18 architecture and creates a bastardized "16" bit architecture with a stack that is only sometimes a stack and no dedicated flag register or interrupts. To get 16 bit memory performance, you can only use pushes and pops, but all of the pops can offset SP within the current 256 byte page prior and some special push opcodes can too. So for optimal memory performance, your program needs to know where SP is and move it around offset style to reach its next address continually. It makes stack frame local variables "okayish" to use but then you also have to be concerned that your stack frame doesn't cross a page boundary or the offsetting will blow up. Needing to track SP positioning gets really weird when you have loops or conditional execution. For random 8 bit RAM reads, the opcodes are constructed so that you can load part of the addressing to the destination register and then the read instruction operands select the destination as the memory address register in one operand and a literal 4 bits for the rest of the address in the other operand. So by that trick you can do any constant address 8 bit RAM read in 2 instructions to any supported destination register without needing another temporary register for the address. Byte translations from RAM are a single cycle operation. Sounds good so far, but writing has a different shadow register for the upper 4 bits so you have to treat it a little differently and you will need either 1 or 2 bytes of separate address register to do it. There is no mechanism built in for constant data address offsets, so for reading/writing 16 bit data values you'll find yourself incrementing an address register to get to the next byte unless you can use the stack mechanism. If reading from flash, you can't use the stack mechanism at all and all addresses must come from a 16 bit register. So if you are dealing with pointers that only go to RAM, you have more coding options than if the pointer could point to flash, since not only can you not write to flash, some ways of reading it won't work either. Mercifully, the mechanism to read flash via pointer can also read RAM. Conditional branches require you to load the magnitude of the jump offset into an 8 bit register, which is multiplied by 2 and added or subtracted during the conditional jump. To reduce how often this must be done, hardcoded skip 1, skip 2, and skip 3 instruction jump targets are also there, plus subroutine return is also a conditional jump target. If you are using the multiply and accumulate instructions, it will clobber most or all of the conditional jump offset registers, so those skip1-3 targets become really important or maybe you aim SP at the target address pointer and use return. The conditional branches compare two registers for A>B, A=B, or (A AND B)=0. It is a bit of a challenge to think about how to do some of the usual conditional jumps - for example comparing two 32 bit values is tricky because it can only do a 16 bit comparison and you have no flags. So the code flow path has to hold some flag information itself so that you can chain two compares together. Getting the carry out from an addition is similarly weird - you compare that the result is less than one of the operands. It makes sense after you think about it but most assembly programmers are used to having flags and it feels a bit unnatural. If you need to check a sign bit, you have to burn an 8 bit register and an instruction to set up the 0x80 constant to do it. On the plus side, jumps have +/-255 instruction range and calls have +/- 3.25K instruction range and everything including the calls are single cycle. It also has per-thread, per-256 byte page memory write protection. Sort of a "just because it can" sort of thing, but it does open the option to having isolated threads for redundancy/high reliability/validating actions of a received RAM resident program, etc. The whole point behind it is that every interpreted instruction runs in exactly 68 real instruction cycles so that it can be used to run general control code fully isolated from the timing of a cycle exact main loop. If you have even less time than 68 cycles free at once, you can split the interpretation into a front half that fetches the instruction word, updates IP, and decodes operands (which always happen identically timing wise), and a back half that runs the rest of the instruction. It's not a portable interpreter and many PIC-specific tricks were used. Porting it would be a medium nightmare. A cornerstone of its design is the large number of 16-way branches used in the interpreter, which make almost all of the opcode field sizes 4 bits. PIC can do these kind of branches very quickly when the destination addresses are spaced 8 instructions apart. No one single part of this ISA is completely horrible but taken together it is an amalgam of "here's 3 different ropes, find the best one to hang yourself with" type situations. But I did attempt to at least have an "okay" approach to most common programming tasks, though one is likely to struggle through bad approaches before finding it.
@solonsaturngaming3727
@solonsaturngaming3727 4 жыл бұрын
Well easy as all coders weren’t Super Sonic Racing good enough is way. 😂
@googleuser4720
@googleuser4720 4 жыл бұрын
Still waiting for The Impossible DSP
@zomega4075
@zomega4075 4 жыл бұрын
Wait so it reads from the exact spot it's currently writing to?
@SkyboxMonster
@SkyboxMonster 4 жыл бұрын
so the DSP was effectively a 2 core processor. except that it was a ALU and a multiplier working at the same time.
@XENON2028
@XENON2028 Жыл бұрын
more like 6 core
@WilliamGalindo
@WilliamGalindo 4 жыл бұрын
I’m not a coder but I love all your videos!
@kainpwnsu
@kainpwnsu 3 жыл бұрын
Explaining 3D rotations to newcomers: "You know where the model is and where you want it to go. Compose their matrices to know at what angle to jam a stick I to the center of the model and how far to rotate the stick." Done. They understand it every time. Alternatively, the principal engineer would give a 15 minute technical explanation and they still don't get it.
@randylahey1232
@randylahey1232 4 жыл бұрын
Of course i knew that line of code had 3 instructions on it 🙃
@kwfunchannel170
@kwfunchannel170 4 жыл бұрын
why isn't anyone talking about 1:14 with the matrix looney tunes? I LOVE THAT PART!
Secrets of Sonic 3D's "Impossible" scrolling
8:43
Coding Secrets
Рет қаралды 210 М.
The Mystery of Sonic R's Impossible Code - Coding Secrets
6:16
Coding Secrets
Рет қаралды 161 М.
Players push long pins through a cardboard box attempting to pop the balloon!
00:31
What type of pedestrian are you?😄 #tiktok #elsarca
00:28
Elsa Arca
Рет қаралды 36 МЛН
За кого болели?😂
00:18
МЯТНАЯ ФАНТА
Рет қаралды 3,3 МЛН
Sonic & Knuckles | Locked and Loaded - Scott The Woz
15:36
Scott The Woz
Рет қаралды 2 МЛН
SONIC Torn Apart to Expose SEGA's Insanity With Multichip Madness
5:11
Sonic R's "Impossible" Fading
5:15
Coding Secrets
Рет қаралды 104 М.
"Hello, World" in 5 CURSED languages that no one should use
13:08
Dreams of Code
Рет қаралды 554 М.
Is super-fast Pixel Perfect Collision Possible?
5:07
Coding Secrets
Рет қаралды 74 М.
LEGO Developer answers your Coding Questions - One is very awkward!
7:21
Sonic R's "Impossible" Fading - CODING SECRETS
5:17
GameHut
Рет қаралды 303 М.
What is the Smallest Possible .EXE?
17:04
Inkbox
Рет қаралды 521 М.
When Optimisations Work, But for the Wrong Reasons
22:19
SimonDev
Рет қаралды 1,1 МЛН