Programming Temple Run for the Game Boy
Ғылым және технология
To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/Inkbox/ . You’ll also get 20% off an annual premium subscription.
I programmed Temple Run for the Game Boy and Game Boy Color systems in assembly using the Rednex Game Boy Development System. The Game Boy, first released in 1989, runs of a custom SoC known as the DMG CPU, with its core SM83 being based off the Intel 8080 and Zilog Z80. It has 8KB of WRAM, 8KB of VRAM, along with various I/O and a 160x144px LCD display. Through clever use of the hardware, the Game Boy can display 4 different shades of "gray" (filtered green through the LCD).
Later in 1998, the Game Boy Color was released and featured a new SoC known as the CGB CPU. It featured a CPU capable of running at up to double the DMG's clock speed (at the expense of using more battery power), increased the system's built in WRAM to 32KB, and VRAM to 16KB (Also moving VRAM directly into the SoC package).
Try Temple Run for the Game Boy: notin.tokyo/gameboy/temple
Try Rock Paper Scissors for the Game Boy: notin.tokyo/gameboy/RPS.html
Hardware Analysis: www.copetti.org/writings/cons...
The Game Boy is programmed using RGBASM, which is based on Z80 assembly syntax. Development resources are found below:
Game Boy PAN Docs: gbdev.io/pandocs/
RGBDS GitHub: github.com/gbdev/rgbds
Assembly Programming Guide: gbdev.io/gb-asm-tutorial/
RGBASM Instructions: rgbds.gbdev.io/docs/v0.4.2/gb...
BGR555 color tool: orangeglo.github.io/BGR555/
Rock Paper Scissors in Japan: archive.org/details/cultureof...
The Culture of Japan as Seen through Its Leisure. pp. 325-326.
Gameboy cartridge by Maxence Béranger from Noun Project
Game Boy by IYIKON from Noun Project
pattern by Yasser Megahed from Noun Project
This video was sponsored by Brilliant
Пікірлер: 213
To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/Inkbox/ . You’ll also get 20% off an annual premium subscription.
@ItzSneakyMinecraft
Ай бұрын
no
@theoneandonly-qs1uw
22 күн бұрын
no
Next thing you know, Inkbox'll be programming a modern os entirely in pure x64 assembly
@arcynic5404
Ай бұрын
Nice one
@InkboxSoftware
Ай бұрын
Would you be satisfied with a video on x86 programming?
@theyoungcoder
Ай бұрын
@@InkboxSoftware that would be actually very cool!
@rockettothejuicewrld
Ай бұрын
@@InkboxSoftwareAbsolutely!
@NoxTuk
Ай бұрын
@@InkboxSoftware Do you even have to ask? That'd be amazing!
For corners, I'd recommend placing a checkpoint. On reaching the checkpoint, the screen will "fade to black", with only the player character on the black screen, before transitioning to reveal the new direction. Since actual turning isn't particularly practical, this would prevent the jarring sharp teleportation and give a moment's respite.
Here's a suggestion to make the turns much less jaring, the player character should rotate and then run off screen and only when it hits the boundry do you refresh with them at the bottom again. As it is, there isnt any real indication you're turning, it just resets. Cool project though i hope you do a follow up with more features from the original!
@InkboxSoftware
Ай бұрын
Very good suggestion, I thought about adding a brief turning animation but decided against it since it would only be briefly shown, I guess in hindsight it would have been better to add it.
@minirop
Ай бұрын
@@InkboxSoftware or continue the game sideway and ask the player to rotate their console. 😅
@me_fault
Ай бұрын
@@InkboxSoftware you don't need an animation, just a copy of the player sprites rotated 90 deg, the hat could just fall off
Despite having a clear voice, thanks for still going through the effort of adding proper subtitles !!
@coolbrotherf127
Ай бұрын
The subtitles are probably more for people who can't hear or need to read English to understand it.
@mischiefthedegenerateratto7464
Ай бұрын
Thanks for forgetting deaf people exist
@daviddelgado5553
Ай бұрын
@@mischiefthedegenerateratto7464 @coolbrotherf127 I am hard of hearing, no need for this pointless passive aggressiveness
Imagine playing Nintendo Switch but with full color
@jaredcramsie182
25 күн бұрын
They already did that, they called it the OLED Switch.
THE I OPERATING SYSTEM OH MY GOD IM DYING
@sofia.eris.bauhaus
Ай бұрын
reminds me of Tom7's "Mister Eye" machine. XD
You using Pokemon Gold as the tilemap example really had me look up if I didn't misremember it coming out on the GBC. I wasn't aware it was GameBoy compatible!
@LightTheMars
Ай бұрын
Interestingly enough I see no mention of it on the Wikipedia page of the game, which is kind of misleading.
As a pixel artist and chiptuner, I'm *Very Fond* of the GBC's hardware, it feels to me on the non-coding side like a NES but better in damn-near every way! I don't even mind the lower resolution, if anything, the biggest bottleneck is the 40 sprites limit, as for that soundchip, lemme tell ya, channel 3, that DAC, that's where its true potential lies! You can do Wonders with it!
I've been lately consuming so much Terry Davis' content and on the first sight i've read title as "I made temple OS [...]". Man... Still cool video tho, keep up the good work.
@polocatfan
Ай бұрын
rip terry
@tech6hutch
Ай бұрын
Temple OS Run You have to collect random words as a message from God, while avoiding, uh, CIA fellers
This is absolutely insane. The explanation as well as the game are both top notch. Well done!
I took a look at your temple run game and I think the reason it won't work on the original GameBoy is because you call the OAM DMA when you are in ROM. On the DMG, you can only access High RAM during the DMA transfer. You need to copy a routine into HRAM on boot that will call the DMA transfer and will wait for it to finish. There's more details about it in the pandoc.
@InkboxSoftware
Ай бұрын
Thank you so much. I hadn't noticed that part in the pandoc before. I've fixed my code and updated it on my website, with it now being completely compatible with the original Game Boy. Version 1.01 is all because of you.
Definitely one of my favorite channels now! Love the clear focus on dev while providing some insight into the hardware.
Maybe you could do what sonic 1's special stages do and simply fake the rotation by using pre-rotated versions of the tiles and just arranging them in a way that it looks right? You could probably get away with having just one frame of "rotation" just to make it look less abrupt
Finally moving up the ladder, 20 more years and bro will finally find x64 and Unity and unreal :D Love your content man, your NES tutorials got me into learning 6502, I changed my college courses to learn more embedded and low level programming, something so beautiful about the constraints that forces you to be a better coder
Why do you only put the music in the left ear?
@graydhd8688
Ай бұрын
check your ears bro, it's in both
@jacklawsen6390
Ай бұрын
@@graydhd8688 It's only on the left from about 3:24 to 6:42.
@JoBot__
Ай бұрын
@@graydhd8688 Check the video before you talk to people like that.
@graydhd8688
Ай бұрын
@@JoBot__ I mean I saw the comment, checked both speakers, and noticed it was in both. skimmed the vid so I didn't notice it was only in one portion of the vid, kinda weird issue lol but my bad
@JoBot__
Ай бұрын
@@graydhd8688 Thank you.
I reently got into programming for GB is assembly too! It's a really fun challenge, and I'm particularly attracted to the special features you can use when programming with the Super Game Boy in mind!
I think it's fair to call the GameBoy Color a GameBoy 2. The Pocket would have been 1.5 and the Light a 1.75.
@stereokuuji
Ай бұрын
And the GBA would be a Gameboy 3?
@rightwingsafetysquad9872
Ай бұрын
@@stereokuuji Yep
@ZipplyZane
28 күн бұрын
I think it really works more as a Game Boy Pro. Or, to use the portable branding, a GBi or New Game Boy.
this is definitely a neat little project! one alternative I'm curious about is whether you could've possibly had sprite room to make the game use vanishing lines instead like the original on phones did, with an extra couple sprites for rotating so you could rotate when you get to a corner... but based off of what you've said so far about the GBC's vram, this definitely seems like it wouldn't have been a thing unless you targeted making the graphics more simplistic
you posted this as soon as i started getting into gb development
Please do more Gameboy assembly dev videos. I am working on a game and it's hard to find anything gameboy related that isn't GBDK or Gameboy studio. I have a basic adventure style game so far with a animated walking 16x16 character. No collisions yet. I would love to see more in depth on the interrupts and tricks like the scrolling scenes in links awakening or Pokemon splash screen. I think I have watched all videos on youtube about ASM coding on the gameboy. Waiting on that next video from Nes Hacker as well. Great video, it helped to solidify some concepts for me.
You could argue that the OLED switch is the switch color
@mr.cantillasz1912
Ай бұрын
I can't argue with that,but true,they are the switch color😂
Cool. Good job!
Fantastic video. Thanks
I would love to see this game finished!
Great video!
I just know this gonna be a banger
I loved this project, there are several places to, not necessarily improve, but put your signature since it's your version of Temple Run. The corners always give the impression of being artificial, it would be interesting to put a more elaborate scenario, as if the bridge was still being built (perhaps by crodiles?) and signs as the end of the line or crodiles working or location as an obstacle (another Kirby reference ?) or object like a stranded ship... I don't know if it's a technical obstacle but if you choose wrong side, does it have a unique death animation? And to always get it right, you would have to see the implicit hints present in the scenario. Congratulations on your game!
oh look you’re back
A simple fix for turning might be to adjust the current setup to start on a clone of the corner tile but rotated 90 degrees as appropriate, adjusting the player position to match roughly where they hit the button. Probably still a bit jank but it would probably be less jarring.
I love your videos, you're so talented!
My eye twitched when you said “i operating system”
Alright, so where is the part where you make the actual game?
Great video! Makes me want to give it a go! GB is so much fun
Fun fact: In the GDR, a clone of the Zilog Z80 was also produced under reverse engineering. This chip was called the MME U880.
Gen 1 Pokemon has ACE, Temple Run/Subway Surfers would be a good meme
3:23 my left ear is loving this
How goes the progress for 8-bit Minecraft?
The content in the video is very good and I liked the video, but please consider turning down the volume of the music. The high pitched music around 4:00 makes it hard to listen, at least while watching on phone. Great video anyway!
You could make Kirby do a front flip when he jumps to add some clean animation
Actually the Gameboy could connect to up to other 15 Gameboys for a 16-player game, only ever used by one single game
Great vid!
Very interesting!
Can't wait for for some bit music in there
Very cool
Bro your a goat of making games
Man damn good job.
Left ear loved the music! Good video, but, man, that drove me insane.
2:40 okay, that just gave me a weird idea: GB link cable adapter for the NES, so you can have games where you play NES vs NES or NES vs GB 😅.
I really love the idea of doing mobile games on the Gameboy, games like Jetpack Joyride, and fish out of water would be really cool to see, but main point being, this is Outstanding keep up the great work 😎👍
so cool!!!!
Does the Switch OLED count as the Gameboy Color version of the Switch?
Would this run on an older Drag n Derp?
Great game, but it starts to strain ones eyes after like 5 minutes And the hitboxes are a little sensitive, but otherwise great work, looking forward to more content!
@Francium215
Ай бұрын
and you cant do anything with the coins but you already know that
Idea: instead of having the coin logic detect hazards, make them transparent on the yellow parts, so that it would be black on black for the pits. Not necessarily a permanent fix, but might look okay as a stop gap.
Hello, could you say something about the progresson 8 bit blocks? I'm wondering if you still work on that. If you abandoned it, please be honest
@InkboxSoftware
Ай бұрын
It's on the back burner for now
@Adiee5Priv
Ай бұрын
@@InkboxSoftware Ok, thanks for responding ^_^
Is this a video how the game boy works (one of thousands) or how you created the game?
thank you so much, legitimately, for not following the absolutely false claim that the Game Boy's CPU is a Z80.
Underrated as hell
Careful nintendon't doesn't fuck you over like the portal port to n64...
@UltimatePerfection
Ай бұрын
That was Valve.
@mrb692
Ай бұрын
@@UltimatePerfectionWho was scared pantsless by Big N
@JoBot__
Ай бұрын
It was actually Valve who shut down that project, and they did it out of fear of Nintendo.
@minirop
Ай бұрын
@@mrb692 because James was using the leak SDK, which is still Nintendo's property. If he had used libdragon from the get go there wouldn't be any issue.
@UltimatePerfection
Ай бұрын
@@JoBot__ I heard it was done by one Ben Dover-Backwards.
Now we just need an update to that rock, paper, scissors game to support 2 player mode with a link cable
It would be cool if you could make a version of this that is gyro controlled on original hardware like Kirby’s tilt & tumble
@sofia.eris.bauhaus
Ай бұрын
are there flash carts with gyros built in 🤔?
OK, the melody on the background, I know it by heart, but I can't cant figure out which game it comes from... it's driving me nuts!
i never heard of temple run before today
oh nice, didn’t think you’d pivot to Elden Ring content
Anyone know the song playing at 14:36?
That's so cool, I assumed you could use C to develop on the GB lol
@InkboxSoftware
Ай бұрын
GB was released a bit before C became practical for programming consoles, so it was assembly during it's ~12 year long run
@Michirin9801
Ай бұрын
You can though, GBDK is a thing!
@minirop
Ай бұрын
@@Michirin9801 but it's quite """bad""". because of the differences between the GB's arch and the assumption in the C standard/by GCC, you'll hit a wall way faster. so for most project it's probably enough, but if you want to push the GB to its limit, assembly is the only way.
@Michirin9801
Ай бұрын
@@minirop I don't doubt in the slightest that assembly is better, I mean, I have to do A LOT of convincing to get the programmer to do a single H-blank interrupt in GBDK... Meanwhile I know the GBC has HDMA which should help with that? I'm pretty sure? (I just do the graphics, sound and music)
@TurtleKwitty
Ай бұрын
@@Michirin9801 The issue with using C is that it has no concept of memory banks, so all code is limited to one bank without some absolute wizard level hackery so assembly is just plain better since it can handle that correctly
Isn't the OLED basically the Switch Color?
The Intel 8080 and Zilog Z80 were both 8-bit CPUs.
Cool vid
Snes's mode7 is a good graphics for making temple run 32-bit
Why is the audio quality worse than your previous videos?
Use bgb for GB emulation, it's very accurate
Hypothetically, if someone with very little programming experience wanted to learn how to program Gameboy games, where would you reccomend they start? I'm aware that GB Studio is a thing, but I'm more interesting in learning how to code myself rather than using a visual system.
@InkboxSoftware
Ай бұрын
I would recommend you don't start with Game Boy programming, since it is quite complex. Try focusing on a language like Python, C#, or C for a bit, make a couple projects in one of those languages, then check out the programming tutorial I linked in the description of this video to get started on Game Boy programming. If you need any help, then feel free to send me an email.
My left ear really loved 3:24
The Nintendo Switch Color technically already exists, it’s the Switch Oled. It just doesn’t have any exclusive games. Now we wait for the Nintendo Switch Advance.
is the source code available?
Why not use the Pokemon Pinball accelerometer?
@InkboxSoftware
Ай бұрын
That accelerometer chip was included with one of the mapper chips for the Game Boy, but it doesn't translate to emulation or flash carts well, so I decided against it.
"This KZread was made entirely on the N64!"
Can you next make Temple Run on a CGA computer.
First the NES, now the Game Boy, stay tuned for SNES next
"…while i have a lot to learn before i MASTER this SYSTEM…" ah, so you're looking into SEGA development next 😏.
would it be easier to do it in gb studio?
@mayo201
Ай бұрын
Gb studio is a kids toy..
If Nintendo names their next console "Nintendo Switch Color" I'm buying one day one.
you did not call it the i operating system
@kinglycrimson
19 күн бұрын
That's what it is
@UnoFlussy
12 күн бұрын
Thats its name
i barely understand anything but your videos are still entertaining lol
Bro this is so fucking cool
Make a version for the Atari Lynx!
why was 12 minutes of this video dedicated to just talking about the game boy lol 🐈
Do subway surfers next
After your Game Boy Color code didn't run on a Game Boy, you'd think you would have realized that they're not the same. It would be equally accurate to program a Super Nintendo game and say it's a Game Boy game, since the Super Nintendo can also play Game Boy cartridges.
@InkboxSoftware
Ай бұрын
There are hardware differences yes, but the same program can run on these two systems. The reason my code didn't work on the original Game Boy was that I hadn't accounted for the way DMA is handled on the original system. Now that it's patched, the exact same program works on both the GB and GBC. The device used to play Game Boy cartridges on an SNES is the Super Game Boy, which itself is basically a Game Boy, so the SNES is really only really being used as a fancy I/O device.
@ZipplyZane
28 күн бұрын
@@InkboxSoftware Though Super Game Boy games can in fact tell the system to run SNES code. There's one game in particular that lets you load a mulitplayer SNES version. I believe it's a version of Space Invaders. The color of Super Game Boy leaves a lot to be desired. As I understand it, it uses palettes for different parts of the screen, rather than at the sprite level, and is relatively slow to update. It doesn't even have the ability to have sprites and backgrounds to use different palettes, which is what the GBC used. AFAIK, there was never a game that really attempted to use both types of color. SGB compatible GBC games would just have a border and a single palette for the whole screen that never changes (e.g. Link's Awakening DX). But I'd love to be wrong.
Minecraft part 3 when?
It is dumb to count EVERY Game Boy sold and compare that to individual generations of consoles. No matter what Nintendo wants to say, it is a different generation of handheld devices. More powerful in every way as the original.
I didn't except this
I couldn't handle the song only playing in my left ear so I tried to skip ahead but I missed too much to still follow it :(
the switch OLED is to the switch what the gameboy color is to the gameboy
3/4s the way through the video, I finally get what I came for. (Jk, w video)
Still waiting for 8-bit Minecraft
Half the video is just gushing about how good Nintendo is And I totally forgot what the original goal was till half way through
Yo was that MajiNation?!
@InkboxSoftware
Ай бұрын
Had to sneak it in there somehow