[ENet-discuss] Object unique ID's

Ruud van Gaal ruud at racer.nl
Mon Mar 17 09:29:49 PDT 2008


Hi Martin,

To answer my own questions a bit. :) A semi-unique ID for each client is
available with the peer's incomingPeerID and outgoingPeerID fields.
I've added an object generation scheme which is beginning to work. For the
clients, I set an ID based on the peer ID of enet. That gives the same ID
for each client on each computer, which is good enough. For possible
situations where 1 client disconnects, another comes in and gets the ID of
the previous client, I just assume it won't be that bad in practice. ;-) (if
it happens at all). Mostly it shouldn't be a problem, except for some
statistics perhaps where you use client ID's.

So I now have 2 unique ID generators; 1 for the network clients, 1 for the
objects in the game.

Now onto a seriously revised multiplayer experience. Have some bugs to
figure out.

Cheers,
Ruud

> Date: Sun, 16 Mar 2008 19:38:22 +0000
> From: Martin Sherburn <spacedude at konggame.co.uk>
> Subject: Re: [ENet-discuss] Object unique ID's
> To: Discussion of the ENet library <enet-discuss at cubik.org>
> Message-ID: <47DD772E.1060600 at konggame.co.uk>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Hi Ruud,
> 
> I think this is beyond the scope of what enet is for. But 
> it's really not that hard to implement some ID tracking 
> system yourself once you get your head around it.
> 
> As your are implementing a client/server system, the server 
> should be in charge of creating objects in the game (e.g. 
> cars) and telling all the clients about it. So here is what 
> you can do:
> 
> 1) Server creates car and assigns it a unique ID
> 2) Server tells clients about this new car that was created 
> and sends the ID it assigned to it
> 3) All clients create a copy of the car and assign it the ID 
> the server gave
> 
> So the basic rule is, only the server should generate IDs. 
> The clients will always receive the ID from the server.
> 
> In the case where the client may want to spawn a new car by 
> joining the game. Then the client should send a request to 
> the server to create the car (without generating an ID for 
> it). If the server accepts the request, it will create a car 
> and generate and ID for it and tell all the clients about it 
> including the one that sent the request in the first place.
> 
> Martin.
> 
> Ruud van Gaal wrote:
> > Hi,
> >
> > I'm re-designing part of my multiplayer game to improve 
> object updates.

No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.519 / Virus Database: 269.21.7/1331 - Release Date: 16/03/2008
10:34
 



More information about the ENet-discuss mailing list