Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Multisync - server assigned player number

Author
Message
petethesparky
15
Years of Service
User Offline
Joined: 18th Mar 2011
Location:
Posted: 2nd May 2011 15:32
Hi,

I remember in Tempest there was a command to return the player number that had been assigned to a client by the server. Of course the server itself was always player 1. Now in Multisync, the server is no longer player 1 as the plugin handles things a bit differently.

Is there an easy way of finding out which player number has been assigned to a client, or am I missing something blindingly obvious?

Thanks in advance for any help.
Agent
21
Years of Service
User Offline
Joined: 7th Sep 2004
Location: Sydney, Australia
Posted: 3rd May 2011 08:07
Allow me to clarify: You want the client to be able to determine what player ID number the server is using to identify him?

I am unaware of any command that determines this directly, but you could just as easily have the server send the information to the client as soon as he connects:



The first line determines whether or not anyone has joined (a zero result means nobody has joined since the last time we called NET PLAYER JOINED).

If someone has joined, we stick the new connection number into the send buffer, and then send that number to... well, to that connection number.

The client can just IAmPlayerNumber = NET GET INT() on his side, and he knows what connection number the server has assigned him.

Qqite
16
Years of Service
User Offline
Joined: 28th Feb 2010
Location: Florida, U.S.
Posted: 3rd May 2011 16:18
You do know that the clients can not communicate in multisync, right? If you call net send 0 on the client it will send to the server. Only the server has access to send to all clients. Thus the server does not need an id, as the only destination of messages coming from clients is the server.

Ventures of the worlds around us are only limited by imagination.
petethesparky
15
Years of Service
User Offline
Joined: 18th Mar 2011
Location:
Posted: 4th May 2011 00:48
Cheers for the replies guys. I already have this code...

client...


and server...


...which is pretty much what you suggested, but I was just wondering if there was a single, more efficient command to achieve this.

For example, in Tempest (the fore-runner to Multisync), calling the single command "TGetThisID" would return the exact same thing, without all those lines, and without any additional interaction between the client and the server.

I can't understand why Benjamin would leave something like that out, but I guess he had his reasons.

Thanks for the support nonetheless

Login to post a reply

Server time is: 2026-07-10 21:41:10
Your offset time is: 2026-07-10 21:41:10