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

For all coding issues - MODers and programmers, HTML and more.

Moderators: Jeff250, fliptw

Post Reply
User avatar
Foil
DBB Material Defender
DBB Material Defender
Posts: 4900
Joined: Tue Nov 23, 2004 3:31 pm
Location: Denver, Colorado, USA
Contact:

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

Post 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? :?
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post 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.
User avatar
Foil
DBB Material Defender
DBB Material Defender
Posts: 4900
Joined: Tue Nov 23, 2004 3:31 pm
Location: Denver, Colorado, USA
Contact:

Post by Foil »

Ah, thanks!

I was hoping for something \"quick & easy\" to use, but that should be simple enough to do for debugging.
User avatar
Foil
DBB Material Defender
DBB Material Defender
Posts: 4900
Joined: Tue Nov 23, 2004 3:31 pm
Location: Denver, Colorado, USA
Contact:

Post by Foil »

Well, I have that solved, thanks! :D
Post Reply