Toy Story's Hardware Defying Music - How We Did It
ฝัง
- เผยแพร่เมื่อ 23 ส.ค. 2024
- In this episode of Coding Secrets I explain how we achieved possibly the only ever example of four channel PCM music on a Sega Genesis.
Is That You or Are You You by Chris Zabriskie is licensed under a Creative Commons Attribution license (creativecommon...)
Source: chriszabriskie....
Artist: chriszabriskie....
Surprised this much care went into a licensed game.
This is back when alot of licensed games were actually GOOD games.
@@KGR7Gamer Yeah, that's gonna be a no from me. They were decent at best.
KGR.7 haha noooo there were tons of bad licensed games even back then. You never heard of LJN?
@@retro_boy_advance oh yeah LJN no thank you. Yeah looking back at my comment a lot of licensed games were horrible but there are some pretty great licensed games from that time.
it's why the lego games took off
Man these videos make the engineers at sega seem like absolute rocket scientists
I'm pretty sure it would have been Jon and/or his cohorts who figured this out.
If tricks like this were in the documentation from Sega, the Genesis would likely have had a lot fewer garbage-sounding titles.
*the engineers at Traveller's Tales
I'm watching this, and I'm thinking why isn't this guy (and the hardware engineers) curing cancer?
@@Electrify85 Completely different field of expertise?
@B3ro1080 Sonic 3D Blast was coded by the same very guy who's speaking on this video....... it was also made by Traveller Tales, as Toy Story was.
I'm always impressed by how innovative programmers got around the hardware and memory limitations of the early systems. Their ability to coax consoles to do so much more than they were ever designed to do, seems miraculous. Modern programmers really are spoiled by comparison.
Having programmed through all these years the changes have been incredible. Almost everything I learned is now wrong.
I remember when memory was precious and fast, running synchronously, or almost, with the CPU. Lookup tables could speed up complicated operations (like here the pitch and volume LUTs saved a number of divisions and multiplications), but each LUT took up a lot of your precious memory (only handful of megabytes!). Now you have all the memory you could want to make look up tables, but memory is glacially slow and lookup tables blow your CPU caches, so it's faster to do complex math than look up a number in a big array!
I remember when software implemented fixed point math was faster than even the built-in FPU math on a 486 (let alone simulated FPU math on a 386). Now floating point math is much faster thanks to better FPUs, pipelining and SIMD instructions (SSE).
I remember when colour change effects were practically free (because you could do them by changing the on-screen palette), then they became really expensive when lost the palette in exchange for true-colour images, and then we gained GPU shaders and now we can do more calculations on every single pixel on screen than a game used to spend to draw the entire frame...
A prototype I made back in the DOS days (that unfortunately never turned into a full game): th-cam.com/video/d6gLhPaLnAs/w-d-xo.html
I pulled so many rabbits out of my hat to make that happen. Probably half of my available memory was used up for various look up tables and caching the lighting to make it all happen...
@@tylisirnthe lighting effects really are impressive for a DOS game.
@@tylisirn These guys are just doing reactionary comments because they think modern workers are lazy you are bringing actual experience lol
@@tylisirn that looks awfully a lot like a simplified version of Alien Breed?
@@BradleyQuerruel The graphics were very much inspired by Alien Breed, you are correct. That's one reason why I never moved further than prototype stage (the graphics weren't stolen, they were custom drawn, but heavily inspired by.) The lighting system is much more complicated than AB ever had, but the gameplay and of course levels are mostly not implemented.
I love watching these, Not understanding them and then coming back and understanding them completely. Dunno why
its been nice going through them as he reuploads them!
a lot of it gets caught in your memory buffer and by the time you've come back
your brain has fully uploaded the data into a data bank that is easily addressed.
I think if we upgraded to USB3.0 we would allow a higher bit rate transmission.
Sadly I think our brains would then need upgraded to handle USB3.0.
dude TL;DR: BLAST PROCESSIN
Olosnah Crafts and More Personally I would love to one day upgrade to an NVMe brain interface but for the foreseeable future I will have to be content operating on a 56k modem instead.
Nvidia brain
1:39 Blast Processing!
Is that a reference to a Sega Genesis-esque remixing channel?
You didnt have to make that reference.
@@lev7509 No it's a gimmic Sega used to sell to kids. "Blast Processing" Which isn't a real thing, was just saying that the sega games moved faster then nintendo. (Sonic)
@@John231984 DF Retro Extra: Sega's Blast Processing Was Real - But What Did It Actually Do? th-cam.com/video/rvvL6S5Buiw/w-d-xo.html
At Psygnosis Liverpool back in the 90s, I composed Tracker music on my Amiga A1200 for several MegaDrive games... far more preferable to using the internal soundchip FM channels, as I was never a fan of all those harsh and bell like sounds. 😉
you are a legend sir!
I really appreciate how clever devs were able to get more out of less back in the day. These days you see popular games that are horribly optimised and only take advantage of the barebones aspects of a premade engine.
now it's just GrApHiCs which always end up looking outdated a few years down the line whereas a more stylised game will always look good
The current consoles are PC architecture because devs blamed the exotic hardware for not producing a quality game. But today we still have bad performing games(crashes, 20FPS, missing textures, etc.) - overall unenjoyable experience. Still even today there're some really good devs out there who are able to create amazing games on this limited hardware. As a gamer I wish more of them to show up and raise the bar.
If games today often are poorly optimized it's because the effort it takes to optimize them will only reduce loading times by a few seconds. More effort can instead be spent on the game which is why a lot of the best games made today are far superior to these old shitty games that were made in the 90s.
The one issue I see are games that take up half of your computer's disk space. Like wtf is all that shit, uncompressed textures??
@@DanIel-fl1vc is this even bait anymore
This reminds me of how Tales of Phantasia and Star Ocean on the SNES got around audio memory limits to stream vocal music, yet more complicated than even that. Very impressive!
Being a software engineer is so different now than what it used to be
Yeah now you just throw some shitty css into electron and tell people to install more ram :/
That's not always a bad thing. Do you think modern games like Minecraft would exist if we didn't invent the simpler platforms that ran them? Developers don't just innovate to work around restrictive hardware. I like learning about these tech details as much as the next guy, but letting developers focus their attention on advances that players (and not just us nerds) can actually enjoy is a boon to the industry.
I love this game so much (Genesis version specifically), and the music is a huge part of it! The soundtrack has the appropriate the Randy Newman vibes, but also offers more "video-gamey," higher tempo stuff. About 13 years ago there was a couple weeks' period when I completed this game at least once per day (always starting with 1 life, which is the "hard mode" despite nothing else being affected).
As someone with an audio engineering degree who enjoys making sample based music and retro gaming, this was right up my alley! Keep em coming!
You should ul some of ur music if you've not already
The "Doom style" stage in this game is pretty amazing! Better than Zero Tolerance.
AtGames hates that stage because its too complex LOL
I wonder what could be done with a slightly more capable 68k-based processor like the 68332 etc. They have a bunch of extra addressing modes that significantly boosts data transfer speed :)
In this scenario having a much larger sound buffer that was dual ported would make all the difference. But that would have cost a lot of money in 1989
@7MGTESupraTurboA I can certainly agree that they did the right choice. It was more a "what if" these days since it's a fairly simple processor to transplant and hack into systems. One can even remap the address base for internal devices in them. Quite fun little processors
@MageLocc
Question: How much would that have increased the price?
Not sure if that can be verified or not.
OMG, the soundtrack on the Genesis is surprisingly good.
VGM has always held a soft spot in my heart. I've even managed to contact a few of my favourite producers over the years, including the Fat Man of Team Fat, which rocked my socks. A few games have really stood out in my brain, Jazz Jackrabbit being one of the biggest stand-outs from that era. Most games had General MIDI, which on an OPL FM MIDI synth… uh… *could* be… acceptable? Some had Roland MT-32 support, which actually entered the realm of sounding great.
It's Jazz Jackrabbit that introduced me to the idea of a tracker not just being used for music creation or playback in isolation, but that a full 4- or 8-track MOD or S3M tracker could be used as *background music* just blew me away. There was nothing else quite like it that I could manage to get my hands on, other than dedicated demoscene demos. How on Earth was there time for this on my 386, I would think, while the fluid animation and scrolling of the game seemed entirely unaffected?
(After nearly 30 years programming, of course, I'm now well familiar with terms like "thread quanta", "interrupts", "time slice", and "DMA". 😉)
Yay. Nice to see another Jazz Jackrabbit fan in the wild. It was the first game I ever played as a kid. The music is definitely the best thing about it.
Funny enough i had lunch last year with george, funny reading about him here!
Paula is a amazing sound chip and is actually 16bit and can do really high sample rates way ahead of its time and used in every amiga
So part of the development process is figuring out how to manipulate the samples to do what you need for the sound, then using that knowledge as your "instrument" to make the sound happen the way you wanted to. Incredible.
As a kid I didn't notice but going back holy crap Sega had a distinctive/horrifying often sound
4:04 The result is peaking, I don't think there was anything other than summing going on there :D
Then: great idea, now make it fit
Now: decent idea, make it 55GB on launch and 100+ GB with everything that you need to fix it
Was this sound code possible during gameplay or only on menus and other "idle" moments of the game?
Good question
It’s only on menus - the actual music during gameplay is awful in comparison.
@@Jimmy42222 Or nonexistent. This game really pushed the Genesis to the max and it shows.
I think it was using most (if not all) of CPU power back then, so answer is most likely no = )
There was always something special about Toy Story, and the Genesis game is no exception. I love these videos, because I learn about what made the game special. It was easy to overlook as a licensed game, but it stands out as a technical marvel not just among licensed games, but in the entire Genesis/Mega Drive library.
Coming from Genesis Music Deconstructions, the DAC is legendary for producing amazing drum lines, then coupled with either channel 0 or 1, you get the fantastic Drum and Bass line for the level music. Also Panic Puppet Zone Act 1 is one of my favourite tunes and it's drum line is awesome
Just found your content. I LOVE this. I've wondered why there weren't more TH-camrs doing this kind of thing.
Going back to this video, I think a Sonic hack called "Sonic the Next Level" have used this method for its soundtrack and it is really good. You should look it up
sounds Great!...Wish they'd spent a little more time on color choice. However, level design, gameplay, and animation look superb!
Maybe you should do a more technical video dedicated to horizontal interrupts, what they are, how they work, and what exactly they do. Just a thought.
The Z80 blasts data to the Yamaha sound chip? Maybe all those "blast processing" commercials I saw for the Genesis as a kid had some validity 😆
they sorta did the "debunking" was a nintendo ad
Having this in first person adds so much
(That you know what you are talking about)
Great minds like you do not exist anymore in the videogame industries... Every body just recipe the existent engines and tools... Nobody going over the limit of the existent with tricks . All following the big engines and just tuning them a little... So we have "flat" quality games.. Wich just try to become movies or tv shows.. instead impress visually the player with something never seen before and that essentially was impossible, but made it real by a great mind, those times are unfortunately gone
Thanks for sharing your technical explanations and coding tricks.
Holy shit, dude. This is an insane amount of effort just to get some subpar samples running through one channel of a Yamaha synth that can already play synthesized music over 6 channels.
I love it. 10 stars, much respect.
It really is fascinating how you pulled some of these ideas off. I only discovered your channel yesterday and even though it's really not for everyone, I reckon it's bloody incredible stuff.
I love how straight to the point and interesting these videos are! Subscribed.
The horror. All these operations should be hardware functions with the code run on the CPU only having to call with a few bytes each. Then again, it is always great to see a clever mind at work. So I suppose that due to the sheer CPU load involved here, this music was only played in the intro when the CPU has got nothing else to do?
I really appreciate th soothing quality of your videos, it makes for a very nice learning experience!
Next video: *How I made “LEGO Star Wars: Potato Version” run on a microwave*
in HolyC xD
That's awesome, and really in depth. The double buffer was a great aspect I didn't take the time to consider yet too. It's great to see this sort of thing in practice and appreciate all the nuances involved.
Coincidentally, you also helped confirm my idea for a sound system I had geared towards the Virtual Boy. It was following similar principles of handling audio mixing by the main processor, so I could just send combined wave forms over for direct play by the sound hardware. The VB also had similar issues with needing to halt audio playback to update PCM. I didn't think to write it in small chunks though! Instead I was getting around it by leaving a "max note" constantly looping in PCM, and adjusting the volume according to what the current sample should be to fake frequency. This would include sound effects in the audio mixing so they aren't affected by the volume changes.
Granted that is all on paper though and I haven't gotten to the actual code yet, but I believe it should be in the clear and your video helped give me confidence in it. To put my approach into the Genesis though I'd have to take a closer look at some specifics, such as if there is a global volume that could still adjust the PCM volume indirectly. And of course, if you have more insights on potential issues with this approach (for Genesis or otherwise), I'd really appreciate hearing it!
But definitely digressing here, sorry haha. Very cool video and overall channel.
Now imagine if this was on the 32X which has 4 PCM sound channels driven by 2 SH2 processors
Amazing video! Can we have a video on how the music for Sonic the Hedgehog was composed and then re-programmed in Sega's proprietary software?
It sounds a lot like SNES music! Amazing
I love how close to the (limited) hardware old game dev was. I develop is Javascript, which has got to be at least 6-7 layers of abstraction removed from the hardware. So cool!
TL;DR:
"We used BLAST PROCESSING to get dat sweet PCM music in! Click on the ads to find out how!"
Is that a reference to a Sega Genesis-esque remixing channel?
Nicely done as always! I wonder if it's possible to do this (with less channels) during gameplay... hmm...
Actually, there are a few games that do 4 channels of pcm during gameplay. Skitchin is one example from back in the day, and nowadays you have games like Xeno Crisis (and probably some others that use SGDK). They aren't playing amiga mods though.
@@jc_dogen Pretty sure Skitchin uses 1 or at most 2 channels of PCM. The rest of the instruments are standard Genesis FM synthesis I think
@@CodingSecrets You could be right, I'm only passing on what I've read. But I do know SGDK does have a 4 channel PCM driver, with some limitations.
@@jc_dogen Just had a quick look at SGDK and it can do 4 channels of PCM but you are right about limitations as no pitch changes, so useless as a tracker. I'd imagine all the samples have to fit in the 8K Z80 memory too, but I might be wrong
Savaged Regime himself made a video on the subject of Mega Drive PCM quality: th-cam.com/video/2W4yTL-9gZE/w-d-xo.html You could also go the route of Titan Overdrive 2 by playing separate high-quality samples in sequence without any sort of channel trickery, but not everybody has eight megabytes of storage space to burn (with the majority just for sound). The YM2612 was very much a stripped-down version of the YM2608, and lost its ADPCM and most of its PCM capabilities in the transition. As to the Amiga, it was a great sounding system, but having two left and two right channels is a bit of a bind - it reminds me of 60s stereo recordings where singing would come from the left, and drums from the right.
Ingenious digital amplitude and frequency modulation
I love these hardware tricks. Please don't ever spare the details
I only ever programmed a MUD but I understand just enough that every video you make is really interesting and riveting!
I love these videos and this channel.. It would be very nice if you cover some 3d games also, like explaining how StarFox uses FX chip or how the Virtua Racing works using the co-processors to help handle the 3d rendered (or to render all the 3d at all and pass to the console)..
I am 1:18. When I first heard the music I thought "sounds like a mod player." A quick skimming of the comments suggests I might be right.. Continuing the video.
This is some next level problem solving almost lost me towards the end but overall very impressed
Kinda sucks that computers have evolved to just use MP3s, OGGs, and WAVs.
I like seeing how people stretched old consoles to their limit.
This is how I feel about "streamed" (or "pre-rendered" as I call it) music. I kind of hate how those boring, basic sound files have taken over in most modern games. Even if it sounds "cheap" at times, I find it way more impressive when I listen to sequenced music in older games (or in a lot of cases, DS games) and think about how it's playing every single note in real time instead of lazily going through a single sound file...
I don't like how CDs and stuff made it easier for developers to rely on their DAWs and recordings, playing them during gameplay instead of programming the game to do it manually. Some CD-based games still used sequenced music, but it was usually due to technical limitations, such as having to stream other data like voice samples or level data in the background; To think streamed audio would've taken over sooner if CDs weren't so slow to access back then...
Surprisingly, there are games on the PS2 and Gamecube that used sequenced music for seemingly no technical reason, and at times, it sounds amazing, almost pre-rendered sound quality... It annoys me to think that sequenced audio was starting to sound really good, then that *stupid streamed audio* had to ruin it.
On PS2, _Graffiti Kingdom_ (level music, not bosses for some reason) and _Harvest Moon: Save the Homeland_ have sequenced music, and they sound really nice! On Gamecube, they're _Harvest Moon: A Wonderful Life_ (most songs sound cheap and "MIDI", but Breeze is good), _Pokemon Colosseum_, and _Tales of Symphonia_ use sequenced MusyX music.
Personally, I want to bring sequenced music to a platform that seemingly doesn't use it, Roblox, but I haven't worked on my library enough...
Is it weird that I can play the lion king on the SNES without any difficulty except the logs and the maze?
This is an amazing idea. We used GEMS for our Megadrive games.
what company were you in?
@@xddstudiosbywr3cked845 Apache Software, making games for Sega Europe
Definitely easier than bit banging the pc speaker on x86, but far more useful.
Finally an episode I could follow 😎 - quite in contrast to all the graphics stuff 😑😂
But only because I've studied a lot of that audio stuff before.
I absolutely love your channel 🥰
So, he emulated a basic sound chip in software?
I'm proud of myself, I guessed this is how you did it when I heard the track lol. Love your videos btw.
It's amazing how programmers could get such limited hardware to do so much.
As soon as you said the Yamaha chip only has one PCM channel I was like: they made their own modplayer that mixes the music on the main processor and sends it to the Z80.
I feel bad knowing that our modern technology doesn't always beg for programming this smart. It's made devs really lazy when it comes to larger projects.
Are the devs lazy, or are the bosses cheap? Genius hard work also takes time...
@@Jchot both really.
Magicians of code.
The information here is amazing but please lower the volume of the bg music because it is too loud. Please.
I agree. The videos are brilliant, but the background music is far too loud.
That's truly impressive, and now I wonder if a similar method can be used with the DPCM channel available in the 2A03/2A07 on the NES
The nes hasn't got an independent cpu to drive the sound chip. Nor any independent sound buffer as far as I know. It would be driven directly by the main cpu and essentially streamed right from the cart or main memory block.
There is indeed a homebrew soundtrack cartridge from a couple of years back, that does exactly that!
I can't remember what it was called, though.
It's kinda a mess to do this on NES because you only have one CPU and the playback mode which automatically streams data doesn't use a format that's conducive to adding samples together. You'd end up having to manually write all the bytes, and it could probably be done for the case of just playing music with carefully written code, but running any other game code would probably mess up the timing.
Well, this is pretty much genius.
Wonderful explanation! Thank you for sharing
This man knows his shiz.
In case someone is reading this comment, the reason the Z80 is there is because the whole unit is backwards compatible with the Sega Master System. Yep, you can play Master System Games on your Megadrive / Genesis.
Now do it through an FM chip on a system that doesn't have any native support for PCM. ;)
These videos are great.
This reminds me of the sound technology used in Starcontrol II.
Want something decent from a programmer? Take away from them the luxuries (for example memory)
This is the greatest channel on TH-cam. I love every single one of these videos.
So, the 1988, 16 bit Sega Genesis had a crappy 1 channel audio system that required insane amounts of juggling to get good audio, yet in 1982, the 8 bit Commodore had 3 voice channels, and a white noise channel, and blew Sega out of the water before Sega was even thought of. Someone didn't think that one through.
The Genesis had a bunch of FM channels so easily capable of outgunning a C64, but, like the C64, only had one mono sample channel. So if you want multi channel sampled sound you need to get creative...
@@CodingSecrets So why did the Genesis coders have to juggle the impossible to get passable music on a newer more powerful unit, but some Russian dude creates a four channel, 12 minute long track to his game (Tetris, in case no one remembers.)with no effort? Damn, I knew nothing about coding (Still don't.) when I owned a C64, yet with basic, slow old basic, I could generate 7 distinct voices with a few tips I picked up from magazines. Apparently the C64 didn't have one sample channel like the Genesis. I have to say, what you were capable of pulling off with that one channel and it's limitations was impressive.
This dude is a genius
Brilliant! Continue the awesome work on the videos!
pretty clever, nice work
Such clever technology should,ve been used in all genesis games because then games wouldn’t have scratchy voices, if those scratchy voices has all to do with those start and stop cycles and not with the audio recording, then no wonder most genesis game’s voices sounding soo scratchy, if such simply ingenious trick could make those scratchy voices sounding much cleaner, why not,
Street fighter 2 ce is a prime example of such fix.
new channel for cs only
Where is my next coding secrets!
This one is my favourite
Genesega does it all! Use blast processing on the music to take it to the next level!
Do you think you'd ever post any Toy Story 2 Action Game videos? I'm interested in that game and I'm wondering how involved with it you were.
like wise I loved that back in the day
i don't understand this but its fun to watch
i mean, i understand some of it but not much
i sorta understand most of it
All a sound sample is, is a sequence of samples.
That's why they're called samplers and why, stupidly, the resulting list is called a sample. Because it's made by a sampler.
Even though the sample is actually a sample of samples sampled by the _oh dear I've gone cross eyed_
For me the biggest "hack" is to use the FM chip like a FM keyboard. Hitoshi Sakimoto and Tecnoforce did it briliantly.
EDIT for 4Mb Devisilsh and Devil's Crash, TF 3 and 8 Mb Thunder Force IV and gauntlet IV.
On the Amiga, OctaMED used this same technique to play an 8 channel MOD on the 4 channel hardware (with the same 68000 CPU).
I'm kinda sad that you didn't include any musical samples of the things you talked about along the way, but in all of your graphics videos you show us examples of everything along the way.
console game development back in the day was a whole different level
Have you ever toyed with developing any programs for the Sega 32X add-on?
The Z* memory chip is small buy can be used for many things inlcludin a drum track CODING SECRETS DIPLO COMFIRME
I love toy story so much . Wish it came in a plastic box not paper tho
1.question
What would have been the outcome if sega had a 24k of memory for the z80 .?
I am the only one still waiting to see the Amiga playing that track though some soldering hardware hacking? lol
I was actually listening to this in 1920 through a time trumpet so I'm actually the coolest out of all of you by a hundred years. Ok?
Which is kind of a shame, because I prefer the SNES music more.
Which is also kind of funny, because I prefer the Genesis Mickey Mania OST.
was this actually a full mod player? if you hadn't required pitch shifting and pre-scaled the volume level could it have been possible to play multiple samples like this during gameplay? a couple short loops of differing length overlaid can make pretty decent bg music.
that was fascinating
Impressive!
👋, how did you make your intro music? That would be quite nice to learn. Thanks for telling us all this child hood memories of how the game and music was done.
Awesome, totally awesome!
Not directly related, but have you seen Stef's Z80 audio driver? Pretty impressive, I think they used it in Xeno Crisis.
When are you going to make a homebrew game for one of the classic systems? I'd buy anything from the Genesis to the Dreamcast.
Can you do a video about the Nintendo GameCube? Especially on its polygons per second count. Back in gen 6, Sony said PS2 could do 66 m polygons second, Xbox 100 m a second and Nintendo 12 m second. GameCube 12 m polygons is in real world simulation including all effects like HW Lighting, complex models, full texture etcetera. The numbers from Sony and Microsoft are without any effect, so a blue or green screen. It was said that with every effect the Poly count was on half again and again. So Xbox with 5 effects: 50m-25-m-12.5m-6.25m-3.125 m polygons second all five effects applied. GameCube release game Star Wars Rogue Squadron 2 pushes over 20 million polygons second on screen with multiple effects and 60 fps. Still looks awesome.
Love your channel mr. Burton
Was the amiga 6800 different Than the genesis 6800? Would be cool if somone made a playable game for the amiga pushing it to the limits.