News:

11 March 2016 - Forum Rules

Main Menu

Some Questions About Gameboy Programming

Started by Dr. Chill, March 28, 2016, 05:22:38 AM

Previous topic - Next topic

Dr. Chill

Hello everyone. I've always had an interest in developing a Game Boy game from the ground up, and I am not talking about hacking my favorite Game Boy games. The game I'm working on is very basic, and is a twist on a traditional strategy board game(that's all I'm revealing until I have something to show for it other than ideas and graphics). Unfortunately, I have never developed a game specifically for video game hardware, and I think this is where I'm going to run into most of my problems when making this game.

Before I can get started, I'm going to need to ask a question or two.
-First of all, do I make a rom or do I work off some blank rom, and if it's either of those, how do I make/find said rom?
-Also, what tools would I need to create my game?

I'll come back here if I have any further questions.

FAST6191

Even if stealing ideas was a thing (it is not and probably never will be) it is not like it would matter, however as you did not ask for help with any of that then I will leave it.

If you are asking these sorts of questions then you are probably quite new to all this, what sorts of programming experience do you have?

For the GBA on up then there are nice dev kits you can use for a variety of languages, though for the most part people do not go beyond http://devkitpro.org/ and C (maybe C++ on later systems) unless they are using an interpreted languages (lua made a fair dent in some newer consoles). There are also lots of nice libraries for everything from sound decoding to graphics handing, to I/O handling and beyond. Most will still learn the hardware but it is absolutely mandatory.

For the GB/GBC then there is not a lot in the way of usable development tools. Most of what there is ( http://devrs.com/gb/software.php ) is proof of concept, beyond assemblers for which there are a few nice ones. Perhaps not as bad any C compilers you might see for the SNES but still nowhere close to the devkitpro stuff on later consoles.
I have some nice links
http://gbdk.sourceforge.net/
http://www.darkfader.net/gbc/
http://gbdev.gg8.se/wiki/articles/Tutorials
http://www.loirak.com/gameboy/gbprog.php

The only time the term blank ROM makes any sense really is if you count a blank file with the header for the system you want. The GB/GBC does indeed have such a header format ( http://problemkaputt.de/pandocs.htm#thecartridgeheader ) and I am afraid it has been a few too many years since I needed anything to sort headers for the GB/GBC (GBA and DS stuff is http://www.no-intro.org/tools.htm and http://www.gameboy-advance.net/rom_tools/flash_advance_toolkit.htm and most older stuff is in the utilities section of this site) so I am not sure what the kids are using these days.

Tools. Hope you like assembly programming. Tools wise then whatever you can use to create GB/GBC compatible graphics, some of the tile editors are not that bad actually, as I would not want to go in for writing a PNG or JPG decoder for the GB/GBC and have it do anything remotely fast. Straight BMP would probably still be a bit too slow. Music wise you have some code samples on some of those links for decoding audio, though I have not tried them to see what goes, so you might be able to avoid major fun and games.

Dr. Chill

#2
Thank you so much! I'm glad I have somewhere to start with this!

Just to answer some questions, I have little to no experience with programming video games outside of when I used Scratch several years ago, and the remaining NES romhacking knowledge that I currently have. I may have tried out Game Maker for a very brief amount of time, but other than that, I am a complete stranger to the homebrew development scene.

As for the "traditional strategy board game" thing, I didn't want people thinking I was being too ambitious with my project, especially with my lack of understanding on how to develop games. I would not want to try to push the Game Boy(and yes I do mean the GB, not the GBA, just to clear things up) to it's limits and end up not delivering.

I used the term "blank ROM" because I thought for a moment that a blank ROM would exist for development purposes.

Graphics. I've already drawn a lot of the game's graphics and they look nice if I do say so myself. When it's time to add said graphics into the game, I'll see if I can use YY-CHR for that. It's my tile editor of choice and I've been using it since 2013. I won't have any problems with image decoding because almost all of the in-game graphics are 16x16. This way, I can easily redraw all of my graphics into the file.

Sound. I'm debating on whether or not I should add a soundtrack to the game. Music composition has never been my thing, and probably never will, but I might end up making one track for the game if I find out how to use them in my game.

Like I said earlier, if I have anymore questions I'll come back to this thread. Until then, I'll work with what you have provided.

March 31, 2016, 02:11:16 AM - (Auto Merged - Double Posts are not allowed before 7 days.)

Hello, back again, and this time I actually did start programming, kinda. I started by following this tutorial(https://www.youtube.com/watch?v=MOKq3gSkQE4), which was doing nicely until after I was halfway through the video. After I copied the Hello World code from the video for the main.c file, I use the "lcc -o game.gb main.c" command in Command Prompt to create a Hello World program for Game Boy, just like in the video. However, when I press enter after entering the command, Command Prompt tells me that "lcc can't find main.c", even though main.c is in the bin folder as shown in the video! I noticed there were some errors in my version of the Hello World code, but when I fixed them the same error still gets me! How do I get Command Prompt to recognize my main.c file?

henke37

Use make and don't put the build tools in the same folder as your sourse coder.

elmer

Quote from: Dr. Chill on March 28, 2016, 05:22:38 AM
Before I can get started, I'm going to need to ask a question or two.
-First of all, do I make a rom or do I work off some blank rom, and if it's either of those, how do I make/find said rom?
-Also, what tools would I need to create my game?

IMHO, don't even think about developing a GMB (Classic GameBoy) or GBC (GameBoy Color) game in C ... either learn assembly or pick a more powerful platform like the GBA (GameBoy Advance), with is basically a handheld SNES with an ARM processor.

If you are willing to program in assembly, and want to know what it was like back-in-the-day, then I can recommend using RGBDS for the assembler/linker, and Martin Korth's NO$GMB for the emulator/symbolic-debugger (he's a nice guy ... don't forget to register it if you use it, it's totally worth it).

I shipped a couple of games back-in-the-day using that combination in preference to Nintendo's official devkit.

Final testing can be done on real hardware with a flash-cart.

Good luck!

zonk47

Hacking is one thing... but a GBC game makes no sense to me. You still have basically the same sprite limits as the NES, and those are pretty serious. GBA, on the other hand, still has a large install base AND you have the benefit of tools in several different languages.
A good slave does not realize he is one; the best slave will not accept that he has become one.

Dr. Chill

Quote from: elmer on April 01, 2016, 12:05:37 PM
IMHO, don't even think about developing a GMB (Classic GameBoy) or GBC (GameBoy Color) game in C ... either learn assembly or pick a more powerful platform like the GBA (GameBoy Advance), with is basically a handheld SNES with an ARM processor.

If you are willing to program in assembly, and want to know what it was like back-in-the-day, then I can recommend using RGBDS for the assembler/linker, and Martin Korth's NO$GMB for the emulator/symbolic-debugger (he's a nice guy ... don't forget to register it if you use it, it's totally worth it).

I really appreciate the suggestion to use RGBDS and NO$GMB, but do you know of some good guides on how to work with ASM(for Game Boy as well as just general programming)? The only "experience" I have with programming ASM is knowing how to add ;@xkas to the first line of a SMW patch to make it work with ASAR.

zonk47

A good slave does not realize he is one; the best slave will not accept that he has become one.

dACE

Quote from: zonk47 on April 01, 2016, 05:08:05 PM
Hacking is one thing... but a GBC game makes no sense to me. You still have basically the same sprite limits as the NES, and those are pretty serious. GBA, on the other hand, still has a large install base AND you have the benefit of tools in several different languages.

With that kind of logic you wouldn't make a new game for GBA either - you would make it for PC (Since a modern computer have less limitations than a antique handheld).

/dACE

zonk47

GBA is emulated on pretty much every device; has excellent color options; and a BASIC compiler and a professionally written textbook available for free.
A good slave does not realize he is one; the best slave will not accept that he has become one.

Dr. Chill

Alright, I am going to say this once and only once: I am not moving this project to the Game Boy Advance.

I've been drawing sprites using the 3 color limit of the Game Boy for a while now. I'm alright with not being able to use 16 colors per sprite. Also, I have a list of Game Boy-compatible platforms(http://shorttext.com/76ed655e) including non-Nintendo platforms, so compatibility is not an issue to me. And just to clear things up, I chose to develop for the Game Boy knowing that it's not as powerful as it's successors.

dACE

Of course you are going to make a gb or gbc game, I was just commenting on faulty logic.

Get the emulator BGB and start debugging games - that's the way I learned the modest amount of asm I know today.

Good Luck!

/dACE

FAST6191

Quote from: dACE on April 02, 2016, 11:35:16 AM
With that kind of logic you wouldn't make a new game for GBA either - you would make it for PC (Since a modern computer have less limitations than a antique handheld).

/dACE

Continuing the off topic then the GBC is mostly assembly and somewhat clunky 10 year old tools (pretty usable unlike some of the SNES stuff but still old and clunky), to that end writing a game would be an exercise in learning the hardware. For the GBA you have modern tools that can write modern languages, with nice libraries, well documented and well supported by many programmers to this day.
Personally I would bump that one more time and end up on the DS (if nothing else it has a decent lua interpreter which would do well for a simple game) but the GBA still does well.

In either case it looks like masochism compared to doing something on a PC where you get to say "meh it has gigabytes of storage, gigabytes of RAM and a processor that clocks in the Gigahertz" but the GBA could make for a fairly normal project (realistically the only hardware knowledge I would expect is knowing that you have low RAM and the idea behind the vblank cycle) for a C programmer where the GB/GBC is start  by reading http://problemkaputt.de/pandocs.htm and it only gets worse from there.

I am the last person that would be able to fault anybody their hobbies but when I see a post like the OP's it makes sense to say something.

zonk47

Chief advantage of a GBA game is that GBA has:
- plenty of speed (for sprites) and little need, therefore, for a lot of optimization
- can be played on practically anything (via emulation)
- plenty of colors
- decent sound if you use high quality samples
- really easy development tools, excellent documentation, and fairly intuitive hardware

And did I mention people born after 2000 will play it? No seriously, the new generation does not look back... this fascination with 3 color sprites we developed... the up-and-comers don't know it, do not understand it. My 17-year old sister reminds me of this every day.
A good slave does not realize he is one; the best slave will not accept that he has become one.

elmer

There is plenty of good advice here about choosing a different platform is you want an easier time in making your game.

Frankly, IMHO, if ease-of-development is your primary concern, just download Unity and develop your game for iPhone/Android/PC.

If, OTOH, you have some particular attachment to the GMB/GBC, and want to learn what it's really like to create a game from scratch, and want to feel the immense sense of accomplishment that will follow from doing so ... then by-all-means, go ahead.

The GMB/GBC is a nice simple platform with no huge nasty design mistakes to trip you up.

You'll learn more about how computers work from attempting to do it, even if you give up, than you will from just picking a more modern target to start with.

If you need a primer into assembly language (the GMB/GBC uses a processor that's very similar to the classic Zilog Z80), then Rodnay Zaks's "Programming the Z80" will teach you what you need to know (http://www.amazon.com/Programming-Z80-Rodnay-Zaks/dp/0895880695/).

Once you've learned the assembly language for one processor, you'll find that it'll be easy to jump over to any processor that's been designed in the last 40 years, and you'll have a whole new understanding of how your computer works, and what all the "magic" is that goes on underneath that some people here seem to feel is arcane and difficult.

But then again, what do I know? I'm just a miserable old curmudgeon that thinks that there are too many folks these days that are unable to program anything unless there's a library function already written to do it, and that those are the same kind of folks that can bring a multi-gigahertz Xbox One or PS4 to its knees with a poorly written 2D Unity game that any old-school programmer could have done on an 8MHz ST or Amiga in 68000 assembly language.

zonk47

You know the popularity of Unity is something I fail to understand. It uses basically the same technology as Flash and Java (and if you want to get technical, VB6 p-code), but it's more popular. Why is this?
A good slave does not realize he is one; the best slave will not accept that he has become one.

dACE

Take a look at this game Chill: http://www.romhacking.net/forum/index.php/topic,21807.0.html

Maybe you could get some tips from the author of that homebrew...?

/dACE