d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Generic Structure For Socket Programming > And Structure Especially For Games
Add Reply New Topic New Poll
Member
Posts: 3,808
Joined: Jun 23 2008
Gold: 19,037.50
Apr 17 2013 12:47pm
So basically i need some instructions on the structure of a Server and Client.
For example how should i manage player movements, so that people see eachother moving on the screen etc.
So far ive got basic server with threading, so i can handle multiple clients, but im not sure how is it efficient to transfer the state of the game for the clients in the same sector.
(Players on the same map).

I was thinking about sending messages every X miliseconds but that sounds like too much data being transferred.
I also tought about only sending the players direction when he/she is moving, then sending another when he/she stops(so the client would handle all the movements), but that could end up showing wrong stuff on the clients.
Is there any ordinary solution for this?

also looking for tutor in lwjgl + open gl

This post was edited by Rune_Warhammer on Apr 17 2013 12:47pm
Member
Posts: 4,605
Joined: Sep 15 2011
Gold: 9,464.00
Apr 17 2013 02:57pm
there's a ton of literature about this if you just google for it

but generally, most multiplayer games have either the server maintaining most of the state while clients have a "slice" of the game, or clients maintaining the state with the server acting as an intermediary between the clients

depending on the kind of game you're making, depending on your concerns about security (i.e. cheating, hacking, exploits), depending on the overall requirements, it may be more worthwhile to use one approach or the other
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Apr 17 2013 03:37pm
Quote (irimi @ Apr 17 2013 04:57pm)
there's a ton of literature about this if you just google for it

but generally, most multiplayer games have either the server maintaining most of the state while clients have a "slice" of the game, or clients maintaining the state with the server acting as an intermediary between the clients

depending on the kind of game you're making, depending on your concerns about security (i.e. cheating, hacking, exploits), depending on the overall requirements, it may be more worthwhile to use one approach or the other


to add onto this i would avoid making the clients handle most of the data. it literally takes me 30 minutes to find memory addresses and control the entire client from an injected dll. if you had the client handle say player position and such i could simply teleport the user how ever far i want and the server would agree with it.

what i would do is have the server handle most of the positions and have the client be its slave. so if the client trys to say jump forward 200 meters the server would spot that say "nope" and rubber band them back to where they should be.

This post was edited by AbDuCt on Apr 17 2013 03:37pm
Member
Posts: 3,808
Joined: Jun 23 2008
Gold: 19,037.50
Apr 18 2013 02:11am
i understand all of those, but should the server bomb the clients with all the data at every milliseconds when something happened on the map on which the client's player is on?
for example send a packet after every pixel moved on any entity?
Member
Posts: 20,413
Joined: Dec 16 2006
Gold: 27,171.00
Apr 18 2013 09:11am
nope i think you should not send the pixel position but the command.
as commands you could use: increase acceleration, decrease acceleration, change direction
then in a larger interval you can request the real position and update it to avoid desynchronization.

thats how i would do it, dunno if its any good or safe but sounds most simple to me


that would work like this:

player 1 wanna accelerate from 10 to 20 pixel per second -> send information to server -> server accepts or declines -> server sends the command to all clients -> clients change the acceleration property for player 1 from 10 to 20.

This post was edited by Koryu on Apr 18 2013 09:17am
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll