🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

realtime multiplayer damage managment between client

Started by
5 comments, last by Giulioni Lorenzo 8 years, 8 months ago
hi all, i'm making a realtime multiplayer game using phaser, node and socket.io.
i managed movements clients side and then emitting to server client coordinates, serve then save them and broadcast to all clients.
Now i have toimplement damage between players.. i was thinking about "hit and be hitted" emit from both clients then server can compare timestamps of emits and validate the attack if both send the message...
Do anyone already approached the problem? I read many guides but all talking about "thory" and i can't find nothing concrete...
Any tip is welcome!!! :D
link dev test: login(bypassed)->play
Advertisement

I just tried an attackerAuthority sistem = if i see i hit you, you take damage even if you was lagging and you don't see it.
temp dev URL:
http://game.pydge.com:6002

Edit: sometimes a black canvas appear, I still have to do some controls in order to load all. just retype url with port, http://game.pydge.com:6002

None already approached the problem or i posted it in the wrong section?

Trusting clients, as you are doing, is one of the easiest solutions and a good place to start.

If you want to prevent cheating, or provide a more fair system in the face of a lagging client, you'll need to stop trusting clients and use client/server with some form of latency compensation.

Moving to Multiplayer and Network Programming.

Have you read our Multiplayer and Network Programming Forum FAQ? There is a lot of good advice there, but in relation to your post question 12, "What should I put in my network packets, and how often should I send them?" is probably the most relevant.

For the best "feeling" in gameplay, make it so that, when I shoot at you, and I hit you on my screen, have my client send an "I hit" message to the server. This will make the game feel un-laggy to players. Unfortunately, it will also open up the game to cheating, if the game is successful enough that someone will want to cheat. Also unfortunately, if anti-cheat is a real goal of yours, the solutions are significantly more complex (and CPU expensive, server-side.)

My suggestion is to go with client-side messages for now, and if the game becomes popular and cheating becomes a problem, implement an update that re-does all of the simulation to be server-side and start combating cheating. 99% of the time, the game never gets that problem, so don't solve it unless you have to :-)

enum Bool { True, False, FileNotFound };

Thanks a lot for all your replys,
I keep saved all players coordinates so I was thinking about adding a simple control server side: when a collision happens i can send its coordinates and then compare them to the server ones. Here i can solve the problem if i'm lagging, i see you stopped, client side my code in running and i kill you.
Another control i can simple add server side could be when i save players coordinates. I can compare the new one with the old one and test if player speed can really do this movement.

I'm gonna read the post rip-off linked me, seems i looked for the wrong key words biggrin.png

About REAL hacking.. yes, i don't care about it too much right now. if the game gets popular i'll have to take some changes smile.png For now.. it's just a lag control.

Thanks a lot! =D

This topic is closed to new replies.

Advertisement