Clientside maps or send-on-request?

Started by
13 comments, last by kaysik 19 years, 5 months ago
hi guys,

thanks for your replies, and to the OP, sorry if you feel im hijacking your thread.

@ Paladine

hmm.. that makes sence [smile]. however, it would be nice to somehow detect if the client has a tampered map. at least in my situation.

for example, in my game (a 2D persistant online RPG), i use the mouse for movement. when a player clicks, he tells the server " this is where i am, this is where i clicked". the server then calculates velocity, makes up for lost time using the timestamp, and then moves the player at this rate.

now, this system will work perfectly if no one cheats. however, if for example a player decides to go into the map file and start removing walls, there will be some major problems. the solution to this is simple - every once in a while, the server sends "this is where you are" to the client. the client will then lock to this position. voila, what the client sees no longer effects where he can move, since the server is now boss over his movement.

however, the "once in a while" part is the issue here. hplus recommended 30 seconds for a good time. this sounds pretty good to me too. however, 30 seconds seems a little too long, for example, 30 seconds is more then enough time to walk through a wall, kill someone, and then have the server bounce me back to where i am supposed to be. if i changed it to something like every 5 seconds, this would increase bandwith.

i was thinking if i had a way to verify the clients map is not corrupt, i could keep it at 30 seconds.

EDIT: hmm, i just figured out something. let's say im a player of my game and decide to go into all the map files and remove all the walls. now, im standing at the edge of a wall... i click the other side of that wall, and proceed to move through this wall... now that im on the other side, i quickly click somewhere else to move - now where i am and where i clicked is a legitamate spot, and when the server sends me my position, i will still be on the other side of the wall... i guess i will somehow have to immediately see if they are walking through a wall, and if so, then send a packet saying "hey you cheating bastard, you can't do that, go here". again, veryfing map integrity could help here.

@ BradDaBug

could you please explain what a hash is, and how it works? i'll google now, but it doesn't sound like a very nice keyword [smile].

about sending the map data, this seems to me like a bad idea. my map files are actually rather large - each tile can have up to 5 different layers, and each layer has about 6 different members. my map files are pretty big - close to or more then a MB on a decent to large sized map. yeah, this seems way too big for a 2d game map, but, a .zip compression of one of these map files works wonders - reducing a 700k map file to 1.4k !

theres one huge advantage i see about this method though. if the client never has a copy of the map files, then maps could be dynamic - players could buy houses and place them for example. hell, there could even be destroyable terrain. but, like i said, isn't sending these map files just way to expensive?

one way around it that i could see, is have a "base" map that clients stored on their machines. the base map contains a basic map, without the dynamic parts - the dynamic parts are then streamed to the clients when they are within range, things like player palced houses and stuff. this could reduce bandwith and still allow dynamic maps.

thanks again everyone (and sorry again to the OP).

[Edited by - graveyard filla on November 10, 2004 4:19:42 PM]
FTA, my 2D futuristic action MMORPG
Advertisement
Quote:Original post by graveyard filla
@ BradDaBug

could you please explain what a hash is, and how it works? i'll google now, but it doesn't sound like a very nice keyword

This ought to get you started.
I like the DARK layout!
Quote:Original post by graveyard filla
hi guys,

thanks for your replies, and to the OP, sorry if you feel im hijacking your thread.


It's only bad if *you* feel that you're hijacking my thread. :)

Quote:EDIT: hmm, i just figured out something. let's say im a player of my game and decide to go into all the map files and remove all the walls. now, im standing at the edge of a wall... i click the other side of that wall, and proceed to move through this wall... now that im on the other side, i quickly click somewhere else to move - now where i am and where i clicked is a legitamate spot, and when the server sends me my position, i will still be on the other side of the wall... i guess i will somehow have to immediately see if they are walking through a wall, and if so, then send a packet saying "hey you cheating bastard, you can't do that, go here". again, veryfing map integrity could help here.


This won't be a problem if your server is doing the check-work when it receives a movement request from the client. The server will check the pathway between his position and where he clicked, and if a wall blocks the way than the server won't give the client the signal to move there. Simple as that; just don't let the client make decisions on its own. ;)
Why would matter if the client tries to walk through a wall? As long as the wall is there on the server the character shouldn't go through the wall; that's why you check everything. They might be able to walk through a wall on their machine, but the server and other clients should have it right no matter what.

Sending maps on request wouldn't work by itself because they could still hack the client to use whatever data they want. (Am I overestimating the hackers? It doesn't matter because the more you assume that they can do the more you protect against.)

There may be other reasons to send map data, though; this just isn't the solution to that problem.
Quote:Original post by graveyard filla
EDIT: hmm, i just figured out something. let's say im a player of my game and decide to go into all the map files and remove all the walls. now, im standing at the edge of a wall... i click the other side of that wall, and proceed to move through this wall... now that im on the other side, i quickly click somewhere else to move - now where i am and where i clicked is a legitamate spot


The client should NEVER tell the server where he/she is. The server should always know and TELL the client whenever the client wants todo something. If its just a hobby game then probably not worth worry about but if your seriouse I would change your game to work like so. The server runs the simulation and the so does the client, but whenever the client does something (or every 30 seconds) the server TELLS the client where he/she is. So for your walk example the client says "walk past that wall" on the server the client stops at the wall but on the clients maching he keeps going. Now the client clicks "kill that guy" but the server says "your here, your not close enough" and the client will snap back to the right position and never be allowed to kill anyone. The client makes requests to the server and the server TELLS the client whats actually going on.

This topic is closed to new replies.

Advertisement