Server/Client variable passing...

02-13-2002, 08:30 PM
Alright. I've begun programming this very basic, tile-based, 2D multiplayer RPG, in which up to 100 people can connect to a central server, and thus, play with each other.

But while the server/client structure has already been programmed... I'm not sure where to go from here. Rather, I'm not sure what sort of variables the server and client should be exchanging, and how often.

Right now, I have it set up so that whenever a player types a message, the server recieves it and sends it out to all the intended recipients. But what should I do if a player moves? Should I send a string to the server telling it "Player.11 moves 1 square north"? And how often should the server send data to the player clients? Every time someone moves? Or once every second? Or something else...

Gah... so... confused. Some help would be appreciated. :)

02-13-2002, 09:22 PM
Well, you need to send whatever information you need other players to see. For example, location, weapons, status, or anything else. You should send the data as soon as it change. (Eg. if the player aquires a new weapon, send that information.) Sending information every second would be much easier code, but would result in a lot more data being sent than had to.

wild wolf
02-13-2002, 10:50 PM
ill give u an idea on sending variables for location, put flasg on both ur X-Axis and Y-Axis, these flags will act like counters, once the user moves up or down the value of flag will increase or decrease respectively and the same for y-axis, send the value of these flags to the server which will in return send to other players, put a check, if other player is within the flag region of other players, set the player as visible (initially it is set to visible=false), make any sense? i used to send small packets of data to the sever every second as u can never know a player may enter ur region within a second also, but i had a limit of four players noly, i wonder if it works for 100 players, (ofcourse it will work but iam not sure of the speed of the game)

hope this is of some help, if not let me know ill try to post a small section of my game where the sever client stuff comes in for u ref

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum