About Store Forum Documentation Contact
Donations:
159$/mo



Post Reply 
Trust in clients
Author Message
Dwight Offline
Silver Supporter

Post: #1
Trust in clients
Hi all,

I am currently at the stage where I am coding character stats (such as health and energy/mana). One of the aspects of my game is being able to deal damage, as a player, to a different player.

In general, I learned to "never trust the client", meaning to always validate the incoming data and values and let most calculations be done server side.

What are your best practices approaches here? Is it a common practise to let all data be verified? I know and understand this is a very broad question, but would love to get some insights in how some of you handled it! Do you have any tips to share? How do you handle "health" in a typical online game?
03-26-2021 03:48 PM
Find all posts by this user Quote this message in a reply
Lancer Offline
Member

Post: #2
RE: Trust in clients
You can send an packet that player X attacks player Y, server validates and sends result to eveyone within range a packet which has damage, ... Then player X plays attack animation and on player y you play get damage animation and remove his health.
Every client should have health, movement speed, attack speed and other stats (which are public) from every object.
03-26-2021 07:20 PM
Find all posts by this user Quote this message in a reply
Post Reply