Skip to main content
Added more information.
Source Link
totymedli
  • 1.3k
  • 1
  • 13
  • 27

In electrical engineering class we learned that signal lines are not ideal, so it takes time for the signal to reach the other end of the cable, and if we doesn't take this into account, it can lead to crazy phenomenons like:

enter image description here

Imagine we have a tank game, where tank1 (played from Europe) shots tank2 (controlled from the USA). In tank1's monitor he sees that tank2 is destroyed, but it takes some (very small but not negligible) time for the signal to reach tank2's monitor. So while the signal travels, he can fire his virtual cannon too, destroying tank1. The signal of this act starts his journey to tank1, before the data that tells to tank2 that he is dead, arrives. This causes the weird phenomenon, that tank1 destroyed tank2, but tank2 still can destroy player1 (despite that tank2 doesn't even exists).

They told us, that we cant solve this problem in the hardware way, we have to prevent this in the software side, but they didn't tell us how should we do this, but I am courious, so how do we/they solve this problem?

The problem is not about the time that elapse while the bullet flies in the air, it is about that the first tank should be destroyed, so it shouldn't be able to shot (or be able to do anything), but in our problem it is able, because the information that he destroyed doesn't arrived yet. In this case we should interpret the word shot as: the bullet impacted and it destroyed the tank. So the actual signal that is going to be sent to the other client is that he is destroyed. Not the event that the enemy tank fired its cannon.

In electrical engineering class we learned that signal lines are not ideal, so it takes time for the signal to reach the other end of the cable, and if we doesn't take this into account, it can lead to crazy phenomenons like:

enter image description here

Imagine we have a tank game, where tank1 (played from Europe) shots tank2 (controlled from the USA). In tank1's monitor he sees that tank2 is destroyed, but it takes some (very small but not negligible) time for the signal to reach tank2's monitor. So while the signal travels, he can fire his virtual cannon too, destroying tank1. The signal of this act starts his journey to tank1, before the data that tells to tank2 that he is dead, arrives. This causes the weird phenomenon, that tank1 destroyed tank2, but tank2 still can destroy player1 (despite that tank2 doesn't even exists).

They told us, that we cant solve this problem in the hardware way, we have to prevent this in the software side, but they didn't tell us how should we do this, but I am courious, so how do we/they solve this problem?

In electrical engineering class we learned that signal lines are not ideal, so it takes time for the signal to reach the other end of the cable, and if we doesn't take this into account, it can lead to crazy phenomenons like:

enter image description here

Imagine we have a tank game, where tank1 (played from Europe) shots tank2 (controlled from the USA). In tank1's monitor he sees that tank2 is destroyed, but it takes some (very small but not negligible) time for the signal to reach tank2's monitor. So while the signal travels, he can fire his virtual cannon too, destroying tank1. The signal of this act starts his journey to tank1, before the data that tells to tank2 that he is dead, arrives. This causes the weird phenomenon, that tank1 destroyed tank2, but tank2 still can destroy player1 (despite that tank2 doesn't even exists).

They told us, that we cant solve this problem in the hardware way, we have to prevent this in the software side, but they didn't tell us how should we do this, but I am courious, so how do we/they solve this problem?

The problem is not about the time that elapse while the bullet flies in the air, it is about that the first tank should be destroyed, so it shouldn't be able to shot (or be able to do anything), but in our problem it is able, because the information that he destroyed doesn't arrived yet. In this case we should interpret the word shot as: the bullet impacted and it destroyed the tank. So the actual signal that is going to be sent to the other client is that he is destroyed. Not the event that the enemy tank fired its cannon.

Source Link
totymedli
  • 1.3k
  • 1
  • 13
  • 27

Prevent anomalies caused by signal propagation time

In electrical engineering class we learned that signal lines are not ideal, so it takes time for the signal to reach the other end of the cable, and if we doesn't take this into account, it can lead to crazy phenomenons like:

enter image description here

Imagine we have a tank game, where tank1 (played from Europe) shots tank2 (controlled from the USA). In tank1's monitor he sees that tank2 is destroyed, but it takes some (very small but not negligible) time for the signal to reach tank2's monitor. So while the signal travels, he can fire his virtual cannon too, destroying tank1. The signal of this act starts his journey to tank1, before the data that tells to tank2 that he is dead, arrives. This causes the weird phenomenon, that tank1 destroyed tank2, but tank2 still can destroy player1 (despite that tank2 doesn't even exists).

They told us, that we cant solve this problem in the hardware way, we have to prevent this in the software side, but they didn't tell us how should we do this, but I am courious, so how do we/they solve this problem?