Game structures, Design patterns

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
Spkka
Posts: 32
Joined: Fri Jan 02, 2009 8:30 am

Game structures, Design patterns

Post by Spkka »

I've been reading this and other articles on gamedev about program structures etc.. Its a really interesting article but advanced aswell.

http://www.gamedev.net/reference/progra ... nginuity1/

Now im curious how you are handling all your components to keep all game parts communicating with eachother?
How are you handling memory management?

Any tips i should follow, any articles i should read?
Thanks spkka
skumar
Posts: 201
Joined: Thu Feb 14, 2008 6:24 pm
Location: kerala state india
Contact:

Post by skumar »

For programming...little reading more coding is the best thing...

More than that ...you should study others examples to see how things are done...

For games ...you can start from finite state machines....

Go for it....

http://irrwizard.sourceforge.net
skumar
Spkka
Posts: 32
Joined: Fri Jan 02, 2009 8:30 am

Post by Spkka »

Thanks a lot! Appreciate that link!
Yes i know i need to practise more and read less, but i still like to expand my knowledge about such things before i actually start working on them!

I started using this example first to use gamestates within my gamë
http://gamedevgeek.com/tutorials/managi ... ates-in-c/

I'll check out the link tonight when im back home from work
Cheers! Any feedback is appreciated!
Spkka
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

I'm using a pretty similar approach to the one described in ur first link Spkka. Only difference is that the engine has no extra tasks for input, video, sound and stuff. Because these are hardcoded into the engine actually. So in my engine the only tasks that are added are actual gamestates, like server/client and so on. And my log system works different to. Its a Singelton class where u can add LogReceiver which then get the log events.
And my gamestates are hadeled different to. When u add two gamestates only the second one (the newer) will be updated unless u state that the other state should be updated even if it isn't the main State. The mem system described there is actually interesting but also kinda useless. Its not avoiding memory leaks it just tells u if there are any. The real interesting part of this whole thing is the Profiler thats something my engine is missing and i guess i will implement that.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Spkka
Posts: 32
Joined: Fri Jan 02, 2009 8:30 am

Post by Spkka »

Sudi: i think your wrong about the memory receiver to behonest. I'd read the full article and if im right the "garbage collection" checks for variables that aren't used anymore and thus deletes them. ( i can be wrong )

Basicly what i want is to clear up things a little for myself. I have a small feeling what im doing now is just a collection of different classes smashed togethor not communicating with eachother like it should. I think if i proceed this way, ill get into problems later on.

Anyways ill figure out the IrrWizard tonight ( see what it does ) and think about some framework to wrap my project in!

I've also been reading some things about using singletons last night. Basicly what i think from reading is that a lot of people misuse them for the right things ( if im right )

Cheers spkka
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

I'm sorry, but IrrWizard is a very bad base for learning. It is old, badly written and unmaintained. You can probably get some pseudocode from most game programming site that will be way more advanced and you'll only need to fill in the blanks/convert the term (thus actually making you DO it)

Also, even the best of the best garbage collectors usually don't come close to properly managed memory. Why? Simple, it is written to take many things into account and to adapt to various situations, hence, good (hopefully) in many, excellent in none. And if you tell me you create so many garbage collector's variant for every possible size, use, etc. of variables used in your app., well, congratz, you now have a bloated memory management system ;)
Spkka
Posts: 32
Joined: Fri Jan 02, 2009 8:30 am

Post by Spkka »

Dorth i didn't plan to use it, i just want to know how to build up my project nicely to make sure all separate components that need to communicate with each other really do.

I dont really get the point of memory management / garbage collection i think. I mean if your carefully creating/destroying things this shouldn't be necessary?
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

Spkka wrote:I dont really get the point of memory management / garbage collection i think. I mean if your carefully creating/destroying things this shouldn't be necessary?
Haha jepp thats right. But since no one does there are things like garbage collectors. I gave up on that topic and i stay with a simple reference counting. And I'm not using the destructor to actually free the memory and stuff to do that i use a other. In my case simply "del" after i called that function i drop the pointer when i either grabed or created it. That way i have no stuff floating around ;)

Oh btw what classes do u have that don't communicate? do they have to communicate? Functors are a great way of making a connection between abitrary classes.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Spkka
Posts: 32
Joined: Fri Jan 02, 2009 8:30 am

Post by Spkka »

I think i will just continue what i was doing and rethink/redesign the plans i had.
johnm23357
Posts: 2
Joined: Mon Jul 06, 2009 8:58 am

Post by johnm23357 »

Sudi wrote:
Spkka wrote:I dont really get the point of memory management / garbage collection i think. I mean if your carefully creating/destroying things this shouldn't be necessary?
Haha jepp thats right. But since no one does there are things like garbage collectors. I gave up on that topic and i stay with a simple reference counting. And I'm not using the destructor to actually free the memory and stuff to do that i use a other. In my case simply "del" after i called that function i drop the pointer when i either grabed or created it. That way i have no stuff floating around ;)

Oh btw what classes do u have that don't communicate? do they have to communicate? Functors are a great way of making a connection between abitrary classes.
There is an O'Reilly book "Head First Object Oriented Design" which is very easy actually explains the whole problem of classes communicating. The only thing is that the examples are in Java.
Post Reply