Game Theory
Moderator: Coders of Rage
Game Theory
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?
- Falco Girgis
- 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
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.
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.
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: Game Theory
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.
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.
- Falco Girgis
- 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
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
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.
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.
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: Game Theory
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. :)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.
It does that last one there.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.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
- trufun202
- Game Developer
- Posts: 1105
- Joined: Sun Sep 21, 2008 12:27 am
- Location: Dallas, TX
- Contact:
Re: Game Theory
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...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.
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...