Game Theory

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Game Theory

Post 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?
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Game Theory

Post 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.
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Game Theory

Post 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.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Game Theory

Post 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.
User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Re: Game Theory

Post 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.
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Game Theory

Post 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.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
trufun202
Game Developer
Game Developer
Posts: 1105
Joined: Sun Sep 21, 2008 12:27 am
Location: Dallas, TX
Contact:

Re: Game Theory

Post 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...
-Chris

YouTube | Twitter | Rad Raygun

“REAL ARTISTS SHIP” - Steve Jobs
Post Reply