Should damage calculation in a competitive multiplayer game be done client-sided or server-sided?The state that is synced when a window is broken in a FPS gameClient and Server game update speedShould Client->Server/Server->Client packets be separate?RTS game unit damage & defense calculationClient Server Multiplayer ProjectLimitations of p2p multiplayer games vs client-serverGame server/client like wordfeudWhere should multiplayer games start? Client or server?Multiplayer client-server architecture sending inputPrecalculate/Validate auto battle game outcome on client/server?How to interpolate server updates on the client for multiplayer?
As programers say: Strive to be lazy
Can 'sudo apt-get remove [write]' destroy my Ubuntu?
What are the implications of the new alleged key recovery attack preprint on SIMON?
Make all the squares explode
How are Core iX names like Core i5, i7 related to Haswell, Ivy Bridge?
Two researchers want to work on the same extension to my paper. Who to help?
Was there ever any real use for a 6800-based Apple I?
How to minimise the cost of guessing a number in a high/low guess game?
How to make a language evolve quickly?
What is Plautus’s pun about frustum and frustrum?
Does the 500 feet falling cap apply per fall, or per turn?
Early arrival in Australia, early hotel check in not available
What does "Ich wusste, dass aus dir mal was wird" mean?
Reaction of borax with NaOH
Can I use my laptop, which says 100-240V, in the USA?
What is the significance of 4200 BCE in context of farming replacing foraging in Europe?
When a land becomes a creature, is it untapped?
Why does getw return -1 when trying to read a character?
How to select certain lines (n, n+4, n+8, n+12...) from the file?
Why do Thanos's punches not kill Captain America or at least cause some mortal injuries?
tikz: not so precise graphic
What are the components of a legend (in the sense of a tale, not a figure legend)?
Drawing lines to nearest point
Why is “Ich wusste, dass aus dir mal was wird” grammitally correct?
Should damage calculation in a competitive multiplayer game be done client-sided or server-sided?
The state that is synced when a window is broken in a FPS gameClient and Server game update speedShould Client->Server/Server->Client packets be separate?RTS game unit damage & defense calculationClient Server Multiplayer ProjectLimitations of p2p multiplayer games vs client-serverGame server/client like wordfeudWhere should multiplayer games start? Client or server?Multiplayer client-server architecture sending inputPrecalculate/Validate auto battle game outcome on client/server?How to interpolate server updates on the client for multiplayer?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
I'm interested in creating a moba style game like League of Legends and need help with a situation.
More exactly: I have an item that gives the player 50 Attack Damage or an ability that does 50 Attack Damage. Is the information about how much damage the items/ champion abilities do kept in client side of the game or the server.
Option 1: I hit the enemy and the client tells the server to deduct 50HP from the enemy i hit
or
Option 2: I hit the enemy and the client tells the server only that I hit the enemy, then the server looks at the item I have/ ability used and based on code on the serves side deducts the 50HP
networking rts
New contributor
$endgroup$
add a comment |
$begingroup$
I'm interested in creating a moba style game like League of Legends and need help with a situation.
More exactly: I have an item that gives the player 50 Attack Damage or an ability that does 50 Attack Damage. Is the information about how much damage the items/ champion abilities do kept in client side of the game or the server.
Option 1: I hit the enemy and the client tells the server to deduct 50HP from the enemy i hit
or
Option 2: I hit the enemy and the client tells the server only that I hit the enemy, then the server looks at the item I have/ ability used and based on code on the serves side deducts the 50HP
networking rts
New contributor
$endgroup$
9
$begingroup$
Imagine you're the server, and I tell you I just dealt 9999999999999 damage to my opponent. Should you believe me? How will you know if I'm telling the truth?
$endgroup$
– DMGregory♦
May 7 at 19:18
2
$begingroup$
I would argue that you do not even tell the server you hit the enemy, you just tell it what attack you do and the server decides if it hits.
$endgroup$
– Theraot
May 7 at 21:01
$begingroup$
See also The state that is synced when a window is broken in a FPS game
$endgroup$
– Theraot
May 7 at 21:19
2
$begingroup$
@DMGregory The answer to that is simple: the opponent will develop a better cheat program that will tell the server that they have 9999999999999+1 armour.
$endgroup$
– Alexandre Vaillancourt♦
May 8 at 1:06
$begingroup$
sidenote - a good example for a serverside game is World of Tanks, if you want to check out an existing game.
$endgroup$
– Baldrickk
May 8 at 11:08
add a comment |
$begingroup$
I'm interested in creating a moba style game like League of Legends and need help with a situation.
More exactly: I have an item that gives the player 50 Attack Damage or an ability that does 50 Attack Damage. Is the information about how much damage the items/ champion abilities do kept in client side of the game or the server.
Option 1: I hit the enemy and the client tells the server to deduct 50HP from the enemy i hit
or
Option 2: I hit the enemy and the client tells the server only that I hit the enemy, then the server looks at the item I have/ ability used and based on code on the serves side deducts the 50HP
networking rts
New contributor
$endgroup$
I'm interested in creating a moba style game like League of Legends and need help with a situation.
More exactly: I have an item that gives the player 50 Attack Damage or an ability that does 50 Attack Damage. Is the information about how much damage the items/ champion abilities do kept in client side of the game or the server.
Option 1: I hit the enemy and the client tells the server to deduct 50HP from the enemy i hit
or
Option 2: I hit the enemy and the client tells the server only that I hit the enemy, then the server looks at the item I have/ ability used and based on code on the serves side deducts the 50HP
networking rts
networking rts
New contributor
New contributor
edited May 8 at 19:22
Philipp
83.4k20197250
83.4k20197250
New contributor
asked May 7 at 19:04
NameHereNameHere
262
262
New contributor
New contributor
9
$begingroup$
Imagine you're the server, and I tell you I just dealt 9999999999999 damage to my opponent. Should you believe me? How will you know if I'm telling the truth?
$endgroup$
– DMGregory♦
May 7 at 19:18
2
$begingroup$
I would argue that you do not even tell the server you hit the enemy, you just tell it what attack you do and the server decides if it hits.
$endgroup$
– Theraot
May 7 at 21:01
$begingroup$
See also The state that is synced when a window is broken in a FPS game
$endgroup$
– Theraot
May 7 at 21:19
2
$begingroup$
@DMGregory The answer to that is simple: the opponent will develop a better cheat program that will tell the server that they have 9999999999999+1 armour.
$endgroup$
– Alexandre Vaillancourt♦
May 8 at 1:06
$begingroup$
sidenote - a good example for a serverside game is World of Tanks, if you want to check out an existing game.
$endgroup$
– Baldrickk
May 8 at 11:08
add a comment |
9
$begingroup$
Imagine you're the server, and I tell you I just dealt 9999999999999 damage to my opponent. Should you believe me? How will you know if I'm telling the truth?
$endgroup$
– DMGregory♦
May 7 at 19:18
2
$begingroup$
I would argue that you do not even tell the server you hit the enemy, you just tell it what attack you do and the server decides if it hits.
$endgroup$
– Theraot
May 7 at 21:01
$begingroup$
See also The state that is synced when a window is broken in a FPS game
$endgroup$
– Theraot
May 7 at 21:19
2
$begingroup$
@DMGregory The answer to that is simple: the opponent will develop a better cheat program that will tell the server that they have 9999999999999+1 armour.
$endgroup$
– Alexandre Vaillancourt♦
May 8 at 1:06
$begingroup$
sidenote - a good example for a serverside game is World of Tanks, if you want to check out an existing game.
$endgroup$
– Baldrickk
May 8 at 11:08
9
9
$begingroup$
Imagine you're the server, and I tell you I just dealt 9999999999999 damage to my opponent. Should you believe me? How will you know if I'm telling the truth?
$endgroup$
– DMGregory♦
May 7 at 19:18
$begingroup$
Imagine you're the server, and I tell you I just dealt 9999999999999 damage to my opponent. Should you believe me? How will you know if I'm telling the truth?
$endgroup$
– DMGregory♦
May 7 at 19:18
2
2
$begingroup$
I would argue that you do not even tell the server you hit the enemy, you just tell it what attack you do and the server decides if it hits.
$endgroup$
– Theraot
May 7 at 21:01
$begingroup$
I would argue that you do not even tell the server you hit the enemy, you just tell it what attack you do and the server decides if it hits.
$endgroup$
– Theraot
May 7 at 21:01
$begingroup$
See also The state that is synced when a window is broken in a FPS game
$endgroup$
– Theraot
May 7 at 21:19
$begingroup$
See also The state that is synced when a window is broken in a FPS game
$endgroup$
– Theraot
May 7 at 21:19
2
2
$begingroup$
@DMGregory The answer to that is simple: the opponent will develop a better cheat program that will tell the server that they have 9999999999999+1 armour.
$endgroup$
– Alexandre Vaillancourt♦
May 8 at 1:06
$begingroup$
@DMGregory The answer to that is simple: the opponent will develop a better cheat program that will tell the server that they have 9999999999999+1 armour.
$endgroup$
– Alexandre Vaillancourt♦
May 8 at 1:06
$begingroup$
sidenote - a good example for a serverside game is World of Tanks, if you want to check out an existing game.
$endgroup$
– Baldrickk
May 8 at 11:08
$begingroup$
sidenote - a good example for a serverside game is World of Tanks, if you want to check out an existing game.
$endgroup$
– Baldrickk
May 8 at 11:08
add a comment |
5 Answers
5
active
oldest
votes
$begingroup$
Rule number one for multiplayer netcode design: Anything that matters for gameplay should be calculated server-sided. Never trust the client. The client is in the hands of the enemy. You can not efficiently prevent players from modifying their game client to gain an advantage.
The only reasons why you would do damage calculation on the client are:
- Your game is completely deterministic, so cheating can be detected by the other clients (but this usually only applies to turn-based games - with real-time games, the network latency alone will introduce a certain degree of randomness which makes remote cheat detection difficult)
- You do it both server-sided and client-sided so you can show the player the results the server is very likely going to conclude as well without latency (but the server-sided results count when there is a disagreement).
- You don't care about cheaters ruining your game and consider it more important to minimize your server cost.
$endgroup$
$begingroup$
RTS games are typically deterministic and simulated in parallel by all players.
$endgroup$
– Kromster
May 8 at 7:13
1
$begingroup$
A fourth option: calculating is somehow more expensive than verifying. Then you could leave the calculating to clients, and do verification only on the server. Doesn't seem very likely for damage calculations to be honest, but still.
$endgroup$
– Mark
May 8 at 9:27
$begingroup$
@Philipp This answer would benefit from describing specifically what should happen server side in this situation. (Presumably both the damage and the hit/miss determination.)
$endgroup$
– doppelgreener
May 8 at 16:38
add a comment |
$begingroup$
Option 3: The client sends a click event to the server, the server decides where this click event has landed, decides if there is a hit or a miss, then applies the damage and sends the updated world state back to the client.
Don't even trust the client to tell if there is a hit or a miss.
$endgroup$
add a comment |
$begingroup$
It depends on what security level you want to implement. The games you mentioned surely have all that code on the server side to make the game more secure against hackers. Because now the hackers have to attack the server, which are highly guarded against attacks instead of hacking the client, which would be much easier.
$endgroup$
$begingroup$
This is the reason I asked is I was talking to a friend of mine that plays CS GO and knows game programming and how to make cheats for SC GO. He was showing me how he makes the enemy team render when they aren't in front of him and told me that he can not mess with the HP and damage dealt because is on the server side. He actually modified the HP that he had after intentionally taking damage and immediately after the game changed it to what it was before he modified it
$endgroup$
– NameHere
May 7 at 19:32
add a comment |
$begingroup$
Option 4: Send the individual input events to the server to let it make authoritative decisions, but also process and display those actions locally so the local user doesn't see any lag. Both client and server messages about this stuff need time stamps, mostly so the client can fudge things to make it look smoother.
(it turns out this is just a combination of things others have already mentioned... bah!)
The client and server code should be shared to the degree possible. Any time the client and server come to different decisions, it should be due to lag, not code.
$endgroup$
add a comment |
$begingroup$
Calculate everything on the server
That is: you tell the server where you want to move and who you want to attack (if abilities are targeted, as many are with MOBAs) or in which direction (if the ability is aimed directionally, like in most first-person shooters on PC). The server will then calculate whether your move is valid (i.e. it's actually possible to move that far) and whether your attack hits, how much damage is done (including critical hits) and whether anything else needs to happen (e.g. an attack could freeze the target or push them away).
Why?
Cheating
People might try to cheat by telling the server they're doing a lot more damage than possible. The server keeping track of this information is required to prevent this.
Multiple clients doing their own calculations would be messy
Let's say I try to attack you, but I have latency of a few seconds. You moved out of range a while ago, but I still see you next to me, so that attack would be valid from my point of view.
Now I tell the server to subtract some of your health. Now what? Should the server do that and suddenly you take a bunch of damage despite no-one being around you any more? Or should the server realise the attack isn't valid any more and send back to me that you suddenly regain the health I already subtracted? Neither option would be a good user experience (you shouldn't be playing with that much lag, but lag spikes happen, and the problem also exists with lower latency).
The above applies to whether or not you hit, but a similar problem happens with regard to how much damage is done: We're attacking each other and I see you lose all your health while I still have a bunch. So I won that fight, right? But you, on the other hand, see the same (due to the update delay between us, and each of us only know about the damage we're dealing). So you also won? There isn't a good way to resolve that either.
Footnote regarding calculating on both the client and server:
In some cases in these games, some calculations happen on the client as well as the server, to reduce lag (so the client can update without waiting for the server). The states would then be synchronised between the two (which sometimes results in "desync", where you jump backwards to where you were a few seconds ago - you may have seen this in one of many popular games).
For your own movement, this could make sense, as you know where you're currently busy moving and there isn't (much) probabilities involved in how that happens. It would only a big problem when there's a significant delay, which is assumed to be an exception rather than the norm, and the alternative would having a very irritating delay on every single move you make (even if your latency is fairly low).
Damage, on the other hand, needs to consider where the target is, whether they're still alive, whether you actually hit them (if I generate a number, or roll some dice, which says I hit and the server does the same to determine that I miss, there is a problem), or did a "critical hit" , any modifiers that might be affecting how much damage is done and possibly other factors. If you try to do the calculation on both the client and server, health counters would constantly jump up and down when the client guesses some of these things wrong, which would arguably be a much worse experience than just having the damage take a little while to show up on the target.
That's not to say it's completely nonviable to do the calculation on both in some scenarios, it's just quite a bit harder in a lot of cases than doing the same for movement (which is already nontrivial).
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "53"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
NameHere is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgamedev.stackexchange.com%2fquestions%2f171706%2fshould-damage-calculation-in-a-competitive-multiplayer-game-be-done-client-sided%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Rule number one for multiplayer netcode design: Anything that matters for gameplay should be calculated server-sided. Never trust the client. The client is in the hands of the enemy. You can not efficiently prevent players from modifying their game client to gain an advantage.
The only reasons why you would do damage calculation on the client are:
- Your game is completely deterministic, so cheating can be detected by the other clients (but this usually only applies to turn-based games - with real-time games, the network latency alone will introduce a certain degree of randomness which makes remote cheat detection difficult)
- You do it both server-sided and client-sided so you can show the player the results the server is very likely going to conclude as well without latency (but the server-sided results count when there is a disagreement).
- You don't care about cheaters ruining your game and consider it more important to minimize your server cost.
$endgroup$
$begingroup$
RTS games are typically deterministic and simulated in parallel by all players.
$endgroup$
– Kromster
May 8 at 7:13
1
$begingroup$
A fourth option: calculating is somehow more expensive than verifying. Then you could leave the calculating to clients, and do verification only on the server. Doesn't seem very likely for damage calculations to be honest, but still.
$endgroup$
– Mark
May 8 at 9:27
$begingroup$
@Philipp This answer would benefit from describing specifically what should happen server side in this situation. (Presumably both the damage and the hit/miss determination.)
$endgroup$
– doppelgreener
May 8 at 16:38
add a comment |
$begingroup$
Rule number one for multiplayer netcode design: Anything that matters for gameplay should be calculated server-sided. Never trust the client. The client is in the hands of the enemy. You can not efficiently prevent players from modifying their game client to gain an advantage.
The only reasons why you would do damage calculation on the client are:
- Your game is completely deterministic, so cheating can be detected by the other clients (but this usually only applies to turn-based games - with real-time games, the network latency alone will introduce a certain degree of randomness which makes remote cheat detection difficult)
- You do it both server-sided and client-sided so you can show the player the results the server is very likely going to conclude as well without latency (but the server-sided results count when there is a disagreement).
- You don't care about cheaters ruining your game and consider it more important to minimize your server cost.
$endgroup$
$begingroup$
RTS games are typically deterministic and simulated in parallel by all players.
$endgroup$
– Kromster
May 8 at 7:13
1
$begingroup$
A fourth option: calculating is somehow more expensive than verifying. Then you could leave the calculating to clients, and do verification only on the server. Doesn't seem very likely for damage calculations to be honest, but still.
$endgroup$
– Mark
May 8 at 9:27
$begingroup$
@Philipp This answer would benefit from describing specifically what should happen server side in this situation. (Presumably both the damage and the hit/miss determination.)
$endgroup$
– doppelgreener
May 8 at 16:38
add a comment |
$begingroup$
Rule number one for multiplayer netcode design: Anything that matters for gameplay should be calculated server-sided. Never trust the client. The client is in the hands of the enemy. You can not efficiently prevent players from modifying their game client to gain an advantage.
The only reasons why you would do damage calculation on the client are:
- Your game is completely deterministic, so cheating can be detected by the other clients (but this usually only applies to turn-based games - with real-time games, the network latency alone will introduce a certain degree of randomness which makes remote cheat detection difficult)
- You do it both server-sided and client-sided so you can show the player the results the server is very likely going to conclude as well without latency (but the server-sided results count when there is a disagreement).
- You don't care about cheaters ruining your game and consider it more important to minimize your server cost.
$endgroup$
Rule number one for multiplayer netcode design: Anything that matters for gameplay should be calculated server-sided. Never trust the client. The client is in the hands of the enemy. You can not efficiently prevent players from modifying their game client to gain an advantage.
The only reasons why you would do damage calculation on the client are:
- Your game is completely deterministic, so cheating can be detected by the other clients (but this usually only applies to turn-based games - with real-time games, the network latency alone will introduce a certain degree of randomness which makes remote cheat detection difficult)
- You do it both server-sided and client-sided so you can show the player the results the server is very likely going to conclude as well without latency (but the server-sided results count when there is a disagreement).
- You don't care about cheaters ruining your game and consider it more important to minimize your server cost.
answered May 7 at 20:13
PhilippPhilipp
83.4k20197250
83.4k20197250
$begingroup$
RTS games are typically deterministic and simulated in parallel by all players.
$endgroup$
– Kromster
May 8 at 7:13
1
$begingroup$
A fourth option: calculating is somehow more expensive than verifying. Then you could leave the calculating to clients, and do verification only on the server. Doesn't seem very likely for damage calculations to be honest, but still.
$endgroup$
– Mark
May 8 at 9:27
$begingroup$
@Philipp This answer would benefit from describing specifically what should happen server side in this situation. (Presumably both the damage and the hit/miss determination.)
$endgroup$
– doppelgreener
May 8 at 16:38
add a comment |
$begingroup$
RTS games are typically deterministic and simulated in parallel by all players.
$endgroup$
– Kromster
May 8 at 7:13
1
$begingroup$
A fourth option: calculating is somehow more expensive than verifying. Then you could leave the calculating to clients, and do verification only on the server. Doesn't seem very likely for damage calculations to be honest, but still.
$endgroup$
– Mark
May 8 at 9:27
$begingroup$
@Philipp This answer would benefit from describing specifically what should happen server side in this situation. (Presumably both the damage and the hit/miss determination.)
$endgroup$
– doppelgreener
May 8 at 16:38
$begingroup$
RTS games are typically deterministic and simulated in parallel by all players.
$endgroup$
– Kromster
May 8 at 7:13
$begingroup$
RTS games are typically deterministic and simulated in parallel by all players.
$endgroup$
– Kromster
May 8 at 7:13
1
1
$begingroup$
A fourth option: calculating is somehow more expensive than verifying. Then you could leave the calculating to clients, and do verification only on the server. Doesn't seem very likely for damage calculations to be honest, but still.
$endgroup$
– Mark
May 8 at 9:27
$begingroup$
A fourth option: calculating is somehow more expensive than verifying. Then you could leave the calculating to clients, and do verification only on the server. Doesn't seem very likely for damage calculations to be honest, but still.
$endgroup$
– Mark
May 8 at 9:27
$begingroup$
@Philipp This answer would benefit from describing specifically what should happen server side in this situation. (Presumably both the damage and the hit/miss determination.)
$endgroup$
– doppelgreener
May 8 at 16:38
$begingroup$
@Philipp This answer would benefit from describing specifically what should happen server side in this situation. (Presumably both the damage and the hit/miss determination.)
$endgroup$
– doppelgreener
May 8 at 16:38
add a comment |
$begingroup$
Option 3: The client sends a click event to the server, the server decides where this click event has landed, decides if there is a hit or a miss, then applies the damage and sends the updated world state back to the client.
Don't even trust the client to tell if there is a hit or a miss.
$endgroup$
add a comment |
$begingroup$
Option 3: The client sends a click event to the server, the server decides where this click event has landed, decides if there is a hit or a miss, then applies the damage and sends the updated world state back to the client.
Don't even trust the client to tell if there is a hit or a miss.
$endgroup$
add a comment |
$begingroup$
Option 3: The client sends a click event to the server, the server decides where this click event has landed, decides if there is a hit or a miss, then applies the damage and sends the updated world state back to the client.
Don't even trust the client to tell if there is a hit or a miss.
$endgroup$
Option 3: The client sends a click event to the server, the server decides where this click event has landed, decides if there is a hit or a miss, then applies the damage and sends the updated world state back to the client.
Don't even trust the client to tell if there is a hit or a miss.
answered May 7 at 20:25
Alexandre Vaillancourt♦Alexandre Vaillancourt
13k114149
13k114149
add a comment |
add a comment |
$begingroup$
It depends on what security level you want to implement. The games you mentioned surely have all that code on the server side to make the game more secure against hackers. Because now the hackers have to attack the server, which are highly guarded against attacks instead of hacking the client, which would be much easier.
$endgroup$
$begingroup$
This is the reason I asked is I was talking to a friend of mine that plays CS GO and knows game programming and how to make cheats for SC GO. He was showing me how he makes the enemy team render when they aren't in front of him and told me that he can not mess with the HP and damage dealt because is on the server side. He actually modified the HP that he had after intentionally taking damage and immediately after the game changed it to what it was before he modified it
$endgroup$
– NameHere
May 7 at 19:32
add a comment |
$begingroup$
It depends on what security level you want to implement. The games you mentioned surely have all that code on the server side to make the game more secure against hackers. Because now the hackers have to attack the server, which are highly guarded against attacks instead of hacking the client, which would be much easier.
$endgroup$
$begingroup$
This is the reason I asked is I was talking to a friend of mine that plays CS GO and knows game programming and how to make cheats for SC GO. He was showing me how he makes the enemy team render when they aren't in front of him and told me that he can not mess with the HP and damage dealt because is on the server side. He actually modified the HP that he had after intentionally taking damage and immediately after the game changed it to what it was before he modified it
$endgroup$
– NameHere
May 7 at 19:32
add a comment |
$begingroup$
It depends on what security level you want to implement. The games you mentioned surely have all that code on the server side to make the game more secure against hackers. Because now the hackers have to attack the server, which are highly guarded against attacks instead of hacking the client, which would be much easier.
$endgroup$
It depends on what security level you want to implement. The games you mentioned surely have all that code on the server side to make the game more secure against hackers. Because now the hackers have to attack the server, which are highly guarded against attacks instead of hacking the client, which would be much easier.
answered May 7 at 19:13
iQewiQew
1293
1293
$begingroup$
This is the reason I asked is I was talking to a friend of mine that plays CS GO and knows game programming and how to make cheats for SC GO. He was showing me how he makes the enemy team render when they aren't in front of him and told me that he can not mess with the HP and damage dealt because is on the server side. He actually modified the HP that he had after intentionally taking damage and immediately after the game changed it to what it was before he modified it
$endgroup$
– NameHere
May 7 at 19:32
add a comment |
$begingroup$
This is the reason I asked is I was talking to a friend of mine that plays CS GO and knows game programming and how to make cheats for SC GO. He was showing me how he makes the enemy team render when they aren't in front of him and told me that he can not mess with the HP and damage dealt because is on the server side. He actually modified the HP that he had after intentionally taking damage and immediately after the game changed it to what it was before he modified it
$endgroup$
– NameHere
May 7 at 19:32
$begingroup$
This is the reason I asked is I was talking to a friend of mine that plays CS GO and knows game programming and how to make cheats for SC GO. He was showing me how he makes the enemy team render when they aren't in front of him and told me that he can not mess with the HP and damage dealt because is on the server side. He actually modified the HP that he had after intentionally taking damage and immediately after the game changed it to what it was before he modified it
$endgroup$
– NameHere
May 7 at 19:32
$begingroup$
This is the reason I asked is I was talking to a friend of mine that plays CS GO and knows game programming and how to make cheats for SC GO. He was showing me how he makes the enemy team render when they aren't in front of him and told me that he can not mess with the HP and damage dealt because is on the server side. He actually modified the HP that he had after intentionally taking damage and immediately after the game changed it to what it was before he modified it
$endgroup$
– NameHere
May 7 at 19:32
add a comment |
$begingroup$
Option 4: Send the individual input events to the server to let it make authoritative decisions, but also process and display those actions locally so the local user doesn't see any lag. Both client and server messages about this stuff need time stamps, mostly so the client can fudge things to make it look smoother.
(it turns out this is just a combination of things others have already mentioned... bah!)
The client and server code should be shared to the degree possible. Any time the client and server come to different decisions, it should be due to lag, not code.
$endgroup$
add a comment |
$begingroup$
Option 4: Send the individual input events to the server to let it make authoritative decisions, but also process and display those actions locally so the local user doesn't see any lag. Both client and server messages about this stuff need time stamps, mostly so the client can fudge things to make it look smoother.
(it turns out this is just a combination of things others have already mentioned... bah!)
The client and server code should be shared to the degree possible. Any time the client and server come to different decisions, it should be due to lag, not code.
$endgroup$
add a comment |
$begingroup$
Option 4: Send the individual input events to the server to let it make authoritative decisions, but also process and display those actions locally so the local user doesn't see any lag. Both client and server messages about this stuff need time stamps, mostly so the client can fudge things to make it look smoother.
(it turns out this is just a combination of things others have already mentioned... bah!)
The client and server code should be shared to the degree possible. Any time the client and server come to different decisions, it should be due to lag, not code.
$endgroup$
Option 4: Send the individual input events to the server to let it make authoritative decisions, but also process and display those actions locally so the local user doesn't see any lag. Both client and server messages about this stuff need time stamps, mostly so the client can fudge things to make it look smoother.
(it turns out this is just a combination of things others have already mentioned... bah!)
The client and server code should be shared to the degree possible. Any time the client and server come to different decisions, it should be due to lag, not code.
answered May 7 at 20:52
Mark StorerMark Storer
1546
1546
add a comment |
add a comment |
$begingroup$
Calculate everything on the server
That is: you tell the server where you want to move and who you want to attack (if abilities are targeted, as many are with MOBAs) or in which direction (if the ability is aimed directionally, like in most first-person shooters on PC). The server will then calculate whether your move is valid (i.e. it's actually possible to move that far) and whether your attack hits, how much damage is done (including critical hits) and whether anything else needs to happen (e.g. an attack could freeze the target or push them away).
Why?
Cheating
People might try to cheat by telling the server they're doing a lot more damage than possible. The server keeping track of this information is required to prevent this.
Multiple clients doing their own calculations would be messy
Let's say I try to attack you, but I have latency of a few seconds. You moved out of range a while ago, but I still see you next to me, so that attack would be valid from my point of view.
Now I tell the server to subtract some of your health. Now what? Should the server do that and suddenly you take a bunch of damage despite no-one being around you any more? Or should the server realise the attack isn't valid any more and send back to me that you suddenly regain the health I already subtracted? Neither option would be a good user experience (you shouldn't be playing with that much lag, but lag spikes happen, and the problem also exists with lower latency).
The above applies to whether or not you hit, but a similar problem happens with regard to how much damage is done: We're attacking each other and I see you lose all your health while I still have a bunch. So I won that fight, right? But you, on the other hand, see the same (due to the update delay between us, and each of us only know about the damage we're dealing). So you also won? There isn't a good way to resolve that either.
Footnote regarding calculating on both the client and server:
In some cases in these games, some calculations happen on the client as well as the server, to reduce lag (so the client can update without waiting for the server). The states would then be synchronised between the two (which sometimes results in "desync", where you jump backwards to where you were a few seconds ago - you may have seen this in one of many popular games).
For your own movement, this could make sense, as you know where you're currently busy moving and there isn't (much) probabilities involved in how that happens. It would only a big problem when there's a significant delay, which is assumed to be an exception rather than the norm, and the alternative would having a very irritating delay on every single move you make (even if your latency is fairly low).
Damage, on the other hand, needs to consider where the target is, whether they're still alive, whether you actually hit them (if I generate a number, or roll some dice, which says I hit and the server does the same to determine that I miss, there is a problem), or did a "critical hit" , any modifiers that might be affecting how much damage is done and possibly other factors. If you try to do the calculation on both the client and server, health counters would constantly jump up and down when the client guesses some of these things wrong, which would arguably be a much worse experience than just having the damage take a little while to show up on the target.
That's not to say it's completely nonviable to do the calculation on both in some scenarios, it's just quite a bit harder in a lot of cases than doing the same for movement (which is already nontrivial).
$endgroup$
add a comment |
$begingroup$
Calculate everything on the server
That is: you tell the server where you want to move and who you want to attack (if abilities are targeted, as many are with MOBAs) or in which direction (if the ability is aimed directionally, like in most first-person shooters on PC). The server will then calculate whether your move is valid (i.e. it's actually possible to move that far) and whether your attack hits, how much damage is done (including critical hits) and whether anything else needs to happen (e.g. an attack could freeze the target or push them away).
Why?
Cheating
People might try to cheat by telling the server they're doing a lot more damage than possible. The server keeping track of this information is required to prevent this.
Multiple clients doing their own calculations would be messy
Let's say I try to attack you, but I have latency of a few seconds. You moved out of range a while ago, but I still see you next to me, so that attack would be valid from my point of view.
Now I tell the server to subtract some of your health. Now what? Should the server do that and suddenly you take a bunch of damage despite no-one being around you any more? Or should the server realise the attack isn't valid any more and send back to me that you suddenly regain the health I already subtracted? Neither option would be a good user experience (you shouldn't be playing with that much lag, but lag spikes happen, and the problem also exists with lower latency).
The above applies to whether or not you hit, but a similar problem happens with regard to how much damage is done: We're attacking each other and I see you lose all your health while I still have a bunch. So I won that fight, right? But you, on the other hand, see the same (due to the update delay between us, and each of us only know about the damage we're dealing). So you also won? There isn't a good way to resolve that either.
Footnote regarding calculating on both the client and server:
In some cases in these games, some calculations happen on the client as well as the server, to reduce lag (so the client can update without waiting for the server). The states would then be synchronised between the two (which sometimes results in "desync", where you jump backwards to where you were a few seconds ago - you may have seen this in one of many popular games).
For your own movement, this could make sense, as you know where you're currently busy moving and there isn't (much) probabilities involved in how that happens. It would only a big problem when there's a significant delay, which is assumed to be an exception rather than the norm, and the alternative would having a very irritating delay on every single move you make (even if your latency is fairly low).
Damage, on the other hand, needs to consider where the target is, whether they're still alive, whether you actually hit them (if I generate a number, or roll some dice, which says I hit and the server does the same to determine that I miss, there is a problem), or did a "critical hit" , any modifiers that might be affecting how much damage is done and possibly other factors. If you try to do the calculation on both the client and server, health counters would constantly jump up and down when the client guesses some of these things wrong, which would arguably be a much worse experience than just having the damage take a little while to show up on the target.
That's not to say it's completely nonviable to do the calculation on both in some scenarios, it's just quite a bit harder in a lot of cases than doing the same for movement (which is already nontrivial).
$endgroup$
add a comment |
$begingroup$
Calculate everything on the server
That is: you tell the server where you want to move and who you want to attack (if abilities are targeted, as many are with MOBAs) or in which direction (if the ability is aimed directionally, like in most first-person shooters on PC). The server will then calculate whether your move is valid (i.e. it's actually possible to move that far) and whether your attack hits, how much damage is done (including critical hits) and whether anything else needs to happen (e.g. an attack could freeze the target or push them away).
Why?
Cheating
People might try to cheat by telling the server they're doing a lot more damage than possible. The server keeping track of this information is required to prevent this.
Multiple clients doing their own calculations would be messy
Let's say I try to attack you, but I have latency of a few seconds. You moved out of range a while ago, but I still see you next to me, so that attack would be valid from my point of view.
Now I tell the server to subtract some of your health. Now what? Should the server do that and suddenly you take a bunch of damage despite no-one being around you any more? Or should the server realise the attack isn't valid any more and send back to me that you suddenly regain the health I already subtracted? Neither option would be a good user experience (you shouldn't be playing with that much lag, but lag spikes happen, and the problem also exists with lower latency).
The above applies to whether or not you hit, but a similar problem happens with regard to how much damage is done: We're attacking each other and I see you lose all your health while I still have a bunch. So I won that fight, right? But you, on the other hand, see the same (due to the update delay between us, and each of us only know about the damage we're dealing). So you also won? There isn't a good way to resolve that either.
Footnote regarding calculating on both the client and server:
In some cases in these games, some calculations happen on the client as well as the server, to reduce lag (so the client can update without waiting for the server). The states would then be synchronised between the two (which sometimes results in "desync", where you jump backwards to where you were a few seconds ago - you may have seen this in one of many popular games).
For your own movement, this could make sense, as you know where you're currently busy moving and there isn't (much) probabilities involved in how that happens. It would only a big problem when there's a significant delay, which is assumed to be an exception rather than the norm, and the alternative would having a very irritating delay on every single move you make (even if your latency is fairly low).
Damage, on the other hand, needs to consider where the target is, whether they're still alive, whether you actually hit them (if I generate a number, or roll some dice, which says I hit and the server does the same to determine that I miss, there is a problem), or did a "critical hit" , any modifiers that might be affecting how much damage is done and possibly other factors. If you try to do the calculation on both the client and server, health counters would constantly jump up and down when the client guesses some of these things wrong, which would arguably be a much worse experience than just having the damage take a little while to show up on the target.
That's not to say it's completely nonviable to do the calculation on both in some scenarios, it's just quite a bit harder in a lot of cases than doing the same for movement (which is already nontrivial).
$endgroup$
Calculate everything on the server
That is: you tell the server where you want to move and who you want to attack (if abilities are targeted, as many are with MOBAs) or in which direction (if the ability is aimed directionally, like in most first-person shooters on PC). The server will then calculate whether your move is valid (i.e. it's actually possible to move that far) and whether your attack hits, how much damage is done (including critical hits) and whether anything else needs to happen (e.g. an attack could freeze the target or push them away).
Why?
Cheating
People might try to cheat by telling the server they're doing a lot more damage than possible. The server keeping track of this information is required to prevent this.
Multiple clients doing their own calculations would be messy
Let's say I try to attack you, but I have latency of a few seconds. You moved out of range a while ago, but I still see you next to me, so that attack would be valid from my point of view.
Now I tell the server to subtract some of your health. Now what? Should the server do that and suddenly you take a bunch of damage despite no-one being around you any more? Or should the server realise the attack isn't valid any more and send back to me that you suddenly regain the health I already subtracted? Neither option would be a good user experience (you shouldn't be playing with that much lag, but lag spikes happen, and the problem also exists with lower latency).
The above applies to whether or not you hit, but a similar problem happens with regard to how much damage is done: We're attacking each other and I see you lose all your health while I still have a bunch. So I won that fight, right? But you, on the other hand, see the same (due to the update delay between us, and each of us only know about the damage we're dealing). So you also won? There isn't a good way to resolve that either.
Footnote regarding calculating on both the client and server:
In some cases in these games, some calculations happen on the client as well as the server, to reduce lag (so the client can update without waiting for the server). The states would then be synchronised between the two (which sometimes results in "desync", where you jump backwards to where you were a few seconds ago - you may have seen this in one of many popular games).
For your own movement, this could make sense, as you know where you're currently busy moving and there isn't (much) probabilities involved in how that happens. It would only a big problem when there's a significant delay, which is assumed to be an exception rather than the norm, and the alternative would having a very irritating delay on every single move you make (even if your latency is fairly low).
Damage, on the other hand, needs to consider where the target is, whether they're still alive, whether you actually hit them (if I generate a number, or roll some dice, which says I hit and the server does the same to determine that I miss, there is a problem), or did a "critical hit" , any modifiers that might be affecting how much damage is done and possibly other factors. If you try to do the calculation on both the client and server, health counters would constantly jump up and down when the client guesses some of these things wrong, which would arguably be a much worse experience than just having the damage take a little while to show up on the target.
That's not to say it's completely nonviable to do the calculation on both in some scenarios, it's just quite a bit harder in a lot of cases than doing the same for movement (which is already nontrivial).
edited May 8 at 18:20
answered May 7 at 20:42
DukelingDukeling
2364
2364
add a comment |
add a comment |
NameHere is a new contributor. Be nice, and check out our Code of Conduct.
NameHere is a new contributor. Be nice, and check out our Code of Conduct.
NameHere is a new contributor. Be nice, and check out our Code of Conduct.
NameHere is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Game Development Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgamedev.stackexchange.com%2fquestions%2f171706%2fshould-damage-calculation-in-a-competitive-multiplayer-game-be-done-client-sided%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
9
$begingroup$
Imagine you're the server, and I tell you I just dealt 9999999999999 damage to my opponent. Should you believe me? How will you know if I'm telling the truth?
$endgroup$
– DMGregory♦
May 7 at 19:18
2
$begingroup$
I would argue that you do not even tell the server you hit the enemy, you just tell it what attack you do and the server decides if it hits.
$endgroup$
– Theraot
May 7 at 21:01
$begingroup$
See also The state that is synced when a window is broken in a FPS game
$endgroup$
– Theraot
May 7 at 21:19
2
$begingroup$
@DMGregory The answer to that is simple: the opponent will develop a better cheat program that will tell the server that they have 9999999999999+1 armour.
$endgroup$
– Alexandre Vaillancourt♦
May 8 at 1:06
$begingroup$
sidenote - a good example for a serverside game is World of Tanks, if you want to check out an existing game.
$endgroup$
– Baldrickk
May 8 at 11:08