Game Development Community

GameBase and GameBaseData

by Bill Henderson · in Torque Game Engine · 12/17/2001 (6:27 pm) · 6 replies

I was looking throughthe code for explosions in the game/ directory, and noticed that explosion data was seperated into the ExplosionData class derived from GameBaseData, and the Explosion class was derived from GameBase...

My question is this:

Are the GameBaseData and GameBase classes sperated like that to keep the data packaged neatly into one class, and the functionality into another??

#1
12/18/2001 (8:49 am)
could someone please reply to this?

I really need some help
#2
12/18/2001 (10:32 am)
Hmmm... I had the same question earlier. I wanted to know why there was a difference between ShapeBase and ShapeBaseData.

Seems it should be an easy thing to answer for any of the GG guys.

Dunno why they haven't restponded yet.
#3
12/18/2001 (1:00 pm)
The Datablocks (ShapeBaseData, GameBaseData) are objects which store static information about what they store data for... For example, your explosion's datablock might store information such as what sprite the explosion should use, what sounds it would play or initial size, things that don't change while you're playing the game. In the actual Explosion class though, the functionality would be there for making it work, and all the variables needed to work it. For example, it might have functions like PauseExplosion, or something to that effect. When the explosion is created, it will extract the data from the appropriate datablock, so it will read in values like what sprite it should use, and what sound it will play, or initial size. It might read initial size into a new variable, size. And from there, it might continual change the size, but the initial size is static, and that's why it's put in the datablock.

Hope this helps!
#4
12/18/2001 (1:10 pm)
that actually clears up a lot!

Thanks :)
#5
12/18/2001 (9:32 pm)
thank you very much

that helps out quite a bit
#6
12/21/2001 (4:47 pm)
Datablocks are also transmitted from the server to each client, so the datablocks also represent all the "static" information that a client needs to construct an instance of a particular object.