3 ms·
Indeed. This problem arises even in a single thread setting. Let's say 2 units aim at each other, and in frame N, they are at range of each other. Here's wha
by loup-vaillant 12y ago
Indeed. This problem arises even in a single thread setting. Let's say 2 units aim at each other, and in frame N, they are at range of each other. Here's what should happen:
- Unit1 kills unit2
- Unit2 kills unit1
If you double buffer your actions properly, both unit will be dead at frame N+1. If however you modify your data in place, this may happen:
1. Unit1 kills unit2 => delete unit 2
2. Unit2 no longer exists. Unit1 lives.
Or, this may happen:
1. Unit2 kills unit1 => delete unit1
2. Unit1 no longer exists. Oops.
Oops.
What definitely does not happen is the double kill. StarcraftII can live with that, but other games, like Frozen Synapse, would be broken.
- agumonkey 12y agoWhat you call double buffer, other call transaction I believe, and it's a system design. You have clear steps where information is gathered and rules are applied. In that case you take all the attacks, computes the damages, apply them and prune the dead.