Re: [Opentnl-general] Persistant ghosts and bullets
Brought to you by:
mark_frohnmayer,
s_alanet
From: Mark F. <ma...@ga...> - 2004-05-10 20:06:09
|
Benjamin Deutsch wrote: > 1) If I understand correctly, gosts are created "on demand" on the > clients. If an object falls out of scope, however, it is possible that > the client-side version is deleted, right? In my game, however, each > client basically knows of all the ghostable objects anyway, so > deleting and reallocating seems kind of like a waste. Is there a way > to avoid this, and just tell a ghost "you've fallen out of scope (at this > timestamp), so forget about getting updates for now"?. There is currently no way to tell the GhostConnection that an object is out of scope but should not be deleted. If you have a lot of static instance data that is sent with the creation of the ghosts, it might make sense to send that data over as events, and then just use a token value as a lookup for that data. On the whole, however, it's really not that much overhead to create a new ghost as opposed to updating an existing one. The ghosting system uses log2(total netobject classes) bits to send a class id, so even if you have 64 different NetObject classes you'll only be spending 6 extra bits to create the new object. > > Incidently, what's with the "GhostAlways" methods? They're not really > documented. GhostAlways objects are objects that are always in scope. They are sent to each client before any other objects are ghosted. Zap uses ghost always objects for the current game type as well as the barriers surrounding the level. > 2) There will be bullets / shots from one player to another, which are > created at one point in the world, travel in real time, and then are > destroyed. The server takes care of these, and informs the clients > about creation and destruction. Since the state of each shot (time > created, direction and speed of travel) don't change, I assume a > NetObject / ghost is overkill. My idea wold be to implement these in a > NetEvent, as a list of current create/destroy sub-events, and send > them GuaranteedOnly. I may have to add my own scoping, but that's not > so important now. I would still use the NetObject framework for projectiles - the overhead of creation is very low and you have the added benefit that projectiles can be prioritized along with all the other NetObjects that are currently in scope. > My question is: how are other people handling such "linear unchanging > objects"? Is the use of ghosts fast/convenient enough that I should > consider them? Or is there another, even better way? See Zap's projectile.cpp/.h as an example of this. |