Page 1 of 1

Game Theory

Posted: Mon Sep 22, 2008 3:56 am
by dejai
Would it be a good idea to make a game that uses game states and singleton pattern like http://irrwizard.sourceforge.net/wiki/i ... /Main_Page somewhat modified to build a game? Or is there a better more effective way?

Re: Game Theory

Posted: Mon Sep 22, 2008 8:59 am
by Falco Girgis
I looked at that, and it looks pretty nice. I'm guessing that you aren't looking to build your own engine from ground up.

There are people out there who will bitch that Singletons are an abuse of the OO nature of C++, but I don't really agree. People spend so much time worrying and bitching about what is and isn't a good OO design structure for a game and so little time actually making a game.

Pick what works for you. Objectively you're here to make a game. Do you think that the player really gives a fuck if your Level and Render functions are global or not? Do you think the player is going to care if your objects don't all have private members with a bunch of accessors? Do you think your player really cares if your System class has a dependency on the Render class? No. What's important is that you can build a game with what you decide to use.

Re: Game Theory

Posted: Mon Sep 22, 2008 11:43 am
by MarauderIIC
On the 'bitching about violating OO structure' topic, the same thing happens to gotos. They have their uses.
Do you know of a cleaner way to exit say some nested loops? I don't.

Re: Game Theory

Posted: Mon Sep 22, 2008 11:59 am
by Falco Girgis
Yeah, that's true. You'd have to set a variable like bool exitSecondLoop to true before you break the first then check to see if the second one should be broken after the first break and... Damn, I never even thought about that to be honest.

Re: Game Theory

Posted: Tue Sep 23, 2008 1:43 am
by dejai
Well the player may not care about how the game renders but I am sure the code maintainers will. Programmers especially in the game industry have a tendency to write spaghetti code as the results appear the same or similar no matter how the code is written. I am a big enthusiast on writing the best code I can within the constraints. Would you say that IrrWizard is a game engine? I suppose it is it provides graphics, ai and horrible physics.

Also does your project compile as a .lib or .a and that API is used in the level editor? Or does the level editor just save to some file type that the engine reads? Thanks.

Re: Game Theory

Posted: Tue Sep 23, 2008 10:53 am
by MarauderIIC
dejai wrote:Well the player may not care about how the game renders but I am sure the code maintainers will. Programmers especially in the game industry have a tendency to write spaghetti code as the results appear the same or similar no matter how the code is written.
Singletons != spaghetti code. Still easy to understand. We stay away from spaghetti code, here, we just have the view that when breaking the rules makes code easier to understand and follow, we break them. :)
Also does your project compile as a .lib or .a and that API is used in the level editor? Or does the level editor just save to some file type that the engine reads? Thanks.
It does that last one there.

Re: Game Theory

Posted: Tue Sep 23, 2008 3:34 pm
by trufun202
GyroVorbis wrote: There are people out there who will bitch that Singletons are an abuse of the OO nature of C++, but I don't really agree. People spend so much time worrying and bitching about what is and isn't a good OO design structure for a game and so little time actually making a game.

Pick what works for you.
Amen brotha. That translates to all programming architectures, not just gaming. It drives me nuts when ppl at work want to completely reinvent the wheel every time there's an enhancement. We end up spending countless design hours on how to build things "the right way," only to end up in the same position 6 months later...

The fact is, we learn and grow with each new project. So designing an architecture that will stand the test of time isn't very realistic. Technologies change, skill levels change, and requirements change. Its best to find a happy medium, imo.

Bitter? Me? Naa...