Game Development Community

Making PlayerList with NetEvent.

by HoSung,Kim · in Torque Game Engine · 08/16/2006 (2:41 am) · 7 replies

I want PlayerList Packet with NetEvent.

but PlayerList is variable.

my PlayerList protocol like this.

TNL::U32 serialNum ;
string uid ;

protocol strucrue like this:
playerCnt serialNum uid

if playerNum == 1
1 12345 test01


if playerNum == 2
2 12345 test01 12346 test02


How can I make PlayerList like above ?

#1
08/16/2006 (8:11 am)
TNL has a Vector class that allows you to send arrays of information across the network. TNL::Vector<> - it is templated. Maybe that helps? I don't understand your question too well.
#2
08/16/2006 (9:04 am)
HoSung... two other choices:

1. You could use a NetObject for each player, and "ghost" them to the client connections.
2. You could use RPC calls (one to add a new player to the list, one to remove a player from the list)

Either may be less work in the end.

I had trouble getting Ghosting to work, myself, but now I have it working fine.
I am going to make another post with some details.

tone
#3
08/16/2006 (2:17 pm)
Ahaaaa, ok.

It's always good answers.

Thank you very much.

I'll try those method, report my result.

thank you again.
#4
08/16/2006 (2:29 pm)
How do I send TNL::Vector ?
#5
08/17/2006 (8:14 am)
Apparently, you can sent them as parameters through RPCs:

http://opentnl.sourceforge.net/doxytree/rpcdesc.html

tone
#6
08/17/2006 (10:50 am)
An example RPC implementation copied directly from my code. I am sending a vector of strings:

TNL_IMPLEMENT_RPC(networkConnection, rpcOnJoinServerToClient,
      (TNL::StringPtr ownerID, TNL::Vector<TNL::StringPtr> deviceNames),
      (ownerID, deviceNames), TNL::NetClassGroupGameMask,
      TNL::RPCGuaranteed, TNL::RPCDirServerToClient, 0)
#7
08/17/2006 (5:25 pm)
OK, I'll try.

That's good Example and Link.

Thank you.