Game Development Community

IDs on server and client and how to map them?

by Igor G · in Torque Game Engine · 05/08/2007 (7:21 am) · 4 replies

Hello,

I want to highlight certain objects in the world, but I don't want all clients to see my highlighted objects. For example - my server will tell client A and B to highlight object Z. But I don't want clients C and D to see object Z as highlighted. So this highlight attribute is dynamic and different for each client. Therefore, I can't pack it in the updates.

So, this is a question about how I can map the object IDs on the server to a client. I want to be able to do a commandToClient('SetHighlight', %object), and somehow each client will know this server %object maps to ID ##### locally.

Can this be done, and how can I do this?

Thanks!

#1
05/08/2007 (7:32 am)
You can pack it into the updates. PackUpdate passes the ClientConnection so you can use that to query the state of that object for that client. We use that technique in Crowns of Power and it works well.

Example:

stream->writeFlag(GameConnection->isObjectHighlighted(this));
#2
05/08/2007 (8:37 am)
Is there a simpler way of doing this without using a GameConnection? If I do this, then I'd have to add a list of objects that are highlighted per GameConnection, and it seems like extra overhead.
#4
05/08/2007 (9:11 am)
Peter - thanks a lot! that solved my problem. Great resource.