Page 1 of 1

Client-side vs. Server-side code in a D3-SDK gametype mod

Posted: Mon Jul 09, 2007 2:32 pm
by Foil
I am (finally!) alpha-testing and working out the bugs in a new gametype mod I'm developing.

One of the issues I'm having is with controlling which pieces of code run for clients vs. which pieces run for the server. Specifically, I created a couple of custom packet types to go from the server to clients on certain events, but I think one of the client packet-receiver functions is running on the server (which causes all kinds of problems).

Am I correct in my understanding of the following?

- A dedicated server acts as \"Player 0\".
- A player server (i.e. a player starts the server through the D3 menu) acts as both a client and the server.

I'm using the DMFCBase->GetLocalRole() function (I think that's the one, I don't have my code in front of me at the moment) to distinguish between them. Or am I missing something? :?

Posted: Mon Jul 09, 2007 8:31 pm
by DCrazy
I don't think you can rely on the player number to provide information about the player's role, if I recall correctly, for the very reason you mention: non-dedicated servers.

The best thing you can do is run a dedi and verify which machine is playing what role by using DMFCLog (?). The dedi will print to the server console, and the client should print as a HUD message.

Posted: Mon Jul 09, 2007 9:16 pm
by Foil
Ah, thanks!

I was hoping for something \"quick & easy\" to use, but that should be simple enough to do for debugging.

Posted: Mon Jul 09, 2007 11:33 pm
by Foil
Well, I have that solved, thanks! :D