gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Creating a complete game question.

#46263 - whodoo - Wed Jun 22, 2005 3:21 pm

I've been creating lots of graphic engines and stuff during the last years (mainly for the PC) and now I want to make a complete game for the first time(for the GBA). What's best?

Should I create lots of classes with "easy" functions to handle the graphics/sound ect. This will make the programming of "the game" very simple and easy,and I will not have to care about the fact that I'm making a game for GBA since it will be so easy to use the hardware, but it will probably be a little bit slow and it will take some work before I can use it.

Or, should I make the game very "hardcoded" and use lots of GBA-code everywhere in my code? (e.g. suppose I want a new sprite to appear. The first strategy will allow me to do this by a simple function call like createSprite(x,y, size, imagedata). The other strategy would be more "setting the attribute0 to blabla, copy the sprite into the OAM". Thus, the second strategy will be faster but it will result in more code that is harder to read and change.

Making games by using the second strategy (3D-games mainly) for a PC is a bad idea since the games are so complex, but how is the GBA generally programmed? Any suggestions/ideas.

#46273 - Miked0801 - Wed Jun 22, 2005 5:47 pm

Never optimize before it's time to optimize :)

The GBA is plenty fast for correct use of function calls and such. don't shoot yourself in the foot before even starting. What type of game were you thinking? Even a quick Tic-Tac-Toe would give you all the basics of a game: UI, AI, graphics programming, SFX if you wish, not CPU untensive.

#46342 - whodoo - Thu Jun 23, 2005 2:18 pm

I'm about to create a bomberman clone. I've been writing a working engine but I realized that the code became very messy, so I'm about to re-write the entire project with this in mind, and this time I will write it in a more organized way. I've created classes for sprite/tiles, which mean I can write something like

OAM.drawSprite(x,y,size, shape, rotation, scaling blah blah)

and then the method will translate the arguments into sprite-attributes and draw the sprite. But I don't have to worry about the speed? The game isn't very complex and almost no calculations are performed.

#46344 - NoMis - Thu Jun 23, 2005 2:38 pm

I prefer the way of creating a lot of classes and would use ASM for the speed critical parts. Also optimize if you need and not beforhand.

There were lots of discussions about C vs C++ in the past and the opinions of the forum Members differ.

The only thing you should avoid when using classes on a slow machine like the GBA is the use of virtual functions.

NoMis

#46363 - sajiimori - Thu Jun 23, 2005 6:28 pm

Such blanket statements about virtuals amount to: "Never, ever use a pointer to an array of function pointers on GBA!" It's patently silly. If it's the best solution to a problem, then do it.

#46405 - NoMis - Fri Jun 24, 2005 7:48 am

sajiimori wrote:
Such blanket statements about virtuals amount to: "Never, ever use a pointer to an array of function pointers on GBA!" It's patently silly. If it's the best solution to a problem, then do it.


I actually agree on that. However you should at least avoid virtuals in functions that are executed very frequently in loops. It really depends on the situation.

NoMis
_________________
www.gamedev.at - The austrian gamedev site
hde.gamedev.at - The Handheld Dev Env plugins for Eclipse

#46427 - Steve++ - Fri Jun 24, 2005 5:22 pm

Avoiding virtuals is avoiding polymorphism, which is a key aspect of object oriented programming. Any half-decent compiler will optimise out the virtuals that aren't overridden.

This guy is talking about a bomberman clone, not a quake clone. Speed is not an issue here.