Game Development Community

Datablocks, SimObjects and Ghosts

by Josh Goldshlag · in Torque Game Engine · 08/10/2001 (9:57 am) · 6 replies

Now that I can actualyl look at the source code, I have a few questions about datablocks, simObjects and ghosts.

Just to make sure i have things straight, is this the relationship:

Datablocks exist on both client and server, as data. They are basically a shorthand for sending static data across the pipe. For example, every player has a bunch of animations. Every time a new player is created, I don't want to send that data down to each client.

SimObjects are a few different things. They are script class-like objects. They can be initialized from datablocks.

Ghosts aren't real things, that is just the terminology that V12 uses to talk about data updates that can come from the server to the client (and the other way?).

Is this all right so far?

Next, an example. Is this roughtly what happens when a player is created?

Server Creates a player. It creates a new SimObject (SO), and initializes that from the datablock (DB). It then fills in the other player info that is not static (position, health, ammo, weapons, whatever). The server then ghosts that down to the client. This consists of the server sending down a DB id and a ghost id. Then the server streams down the dynamic data.

Is that all right?

The reason I am asking is because I want to figure out a few things.
1) The current datablock limit is 2^10th? The id bit size seems to be defined at the top of console/simBase.h. This doesn't really matter though, because I could eith increase this number or share datablocks.
2) The max ghost count is also 2^10th? This is ChostIdBitSize in sim/netConnection.h? There is no way to work around this limit short of increasing it though, right? That means we are currently allowed 1024 dynamic moving objects on the server at a time, right?
3) I haven't looked at the ghost manager yet, but it doesn't ghost all objects on the map, right? I am asking because ghosting all objects is both a waste and bad security for some game types.
4) I remember reading somewhere about dyanmically adding datablocks. Is that currently possible?

Thanks for reading what turned out to be a pretty long post. You get even more thanks fi you anser my questions... :-)

Josh

#1
08/10/2001 (1:44 pm)
Yes, the datablocks are static data sent at connect time from the server to each client.

Yes, sim objects usually (but not always) have an associated datablock for initialization.

A ghost is a copy of a simObject mirrored on a client. A server simObject can have many ghosts.

...You're right on the money.

1. yes 2. yes, 3. yes, only ghosts objects near you. 4. yes.

Well, that was easy :)
#2
08/10/2001 (11:18 pm)
Datablocks are sent each time on connect? Does V12 have a notion of data that lives client and server side that doesn't need to be sent each time? Sending the datablocks is nice for allowing server side modding, but it seems like it would not be needed if you don't want to deal with that.

Whew, good to see i am on the right track with this stuff. And people were complaining about the lack of high level documentation... :-)

Josh
#3
08/12/2001 (7:45 pm)
Datablocks are sent to each client at connect time or sometimes at the start of a mission (if new ones have been added). The SimObjects normally get all their data either directly from their original server object, or from a datablock, but this would be very easy to change. SimObjects do not have to use datablocks and can do any client side data loading or initializing they want.
#4
03/04/2006 (7:03 pm)
Necro loot!
This post helped me a great deal.
I had a problem where it seemed I was running out of dataBlocks in my RPG.
In console/simBase.h I changed DataBlockObjectIdBitSize to equal 12 and everything seems to be working fine.
I haven't changed GhostIdBitSize in sim/netConnection.h to reflect DataBlockObjectIdBitSize.
Do I need to change this also?
And is there any problems with increasing these values?
So far, everything seems to be working as intended.

Ari
#5
03/04/2006 (7:05 pm)
Funny thing.
GhostIdBitSize allready is 12.

Ari
#6
09/17/2009 (12:47 am)
Are SimDataBlocks ghosted in the same manner as Datablocks? My testing has let me to believe that they are not.