#1 2017-06-12 16:57:16

gaya
Member

Game logic changes in client/server

So, i'm starting to mod my game and create small changes like weapon reload, new firing modes, etc. However, i'm confused about the client/server separation in the code. When i change something in the client, where exactly should i change in the server?

Offline

#2 2017-06-22 18:44:47

Hypernova^
Member

Re: Game logic changes in client/server

Hello,
  There's 3 potential places where you could see game logic code: In the client, in the server, and in the messages being sent back and forth. The client code exists to allow the client to make decisions independently of the server. The server (game code) exists to "validate" the messages being sent by the clients (for example, if you modify your client to send shot packets faster than the server will allow, they simply won't get processed). The game code in messages is to update other clients on your client's local gamestate. This game code comes from a bunch of different sources, game.h being used by both client/server. To change a reload, you'd only need to change the int variable in game.h. You must then recompile the client and server. I'm not sure what you mean by "firing modes", but keep in mind that new features can be implemented clientside, and made to work with the existing server structure. If your features are small, you can implement them on the client side, then check to make sure no server code will restrict the new behavior of your client.
  Hope this helps a little bit :)

Offline

#3 2017-07-03 15:29:20

gaya
Member

Re: Game logic changes in client/server

Thanks for the help. I'm not sure if i get it, but i'll keep trying. The biggest problem i see is that i end up with lots of code duplication to validate logic that is the same on the client and on the server.

Offline

#4 2017-07-30 17:48:55

lxqueen
Member

Re: Game logic changes in client/server

The other place you may need to change things is in the ai.cpp file, as that defines what weapons they can select and how much their aim is skewed.

Offline

Board footer