1
Programming / Re: Slow Attack/Movement Speed
« on: June 29, 2011, 02:57:43 AM »Quote
Can you provide a few more examples with probabilistic tick-scheduling?
I will say that there is a limitation in that your tick has to be the shortest possible action. With that in mind, let's set our system as 10 ticks per turn, with "normal" player actions taking 10 ticks each. Let's also define a speed 0.7 "Troll" and a speed 1.8 "Kobold". Time for a race!
Player: steps take 10.00 ticks. Schedule first step at tick 10/0
Kobold: steps take 5.56 ticks. Schedule first step at tick 5/56
Troll: steps take 14.29 ticks. Schedule first step at tick 14/29
The remainder indicates the percentage likelihood each action that the action is delayed one round.
tick 5: RNG 62 - Kobold steps and schedules for tick 10/56
tick 10: RNG 39 - Kobold reschedules to 11/0. Player steps and schedules for 20/0. Note that the Kobold had a 44% chance of going (again) before the player here.
tick 11: Kobold steps and schedules for 16/56
tick 14: RNG 67 - Troll steps and schedules to 28/29
tick 16: RNG 29 - Kobold reschedules for 17/0
tick 17: Kobold steps and schedules for 22/56
tick 20: Player steps and schedules for 30/0
tick 22: RNG 45 - Kobold reschedules to 23/0
tick 23: Kobold steps and schedules for 28/56
tick 28: RNG 28 - Kobold reschedules to 29/0. Troll steps and reschedules for 42/29
So, what we'll seen so far is: KPKTKPKTKP, which is pretty reasonable for the large disparity in movement rates we have.
Where this system really gets interesting is when creatures have similar speeds but one is slightly faster or slower.
I like it because it doesn't seem to have any strange artifacts like slower creatures occasionally going twice before a faster creature and because it isn't completely deterministic thanks to the RNG each tick, so you can't rely on or exploit, say, getting an extra move on every sixth attack.