Re: Time in turn-based systems yet again
- From: Da-Breegster <dabreegster@xxxxxxxxx>
- Date: Wed, 21 Dec 2005 19:10:53 GMT
On 2005-12-21, Narf the Mouse <lrgmouse@xxxxxxxxx> wrote:
>
> Da-Breegster wrote:
>
>> Hey. I know this topic has been brought up too many times before, but I just
>> don't get it in the way I'm thinking I should. I've already figured out how I'm
>> going to handle something like poisoning. Getting poisoned schedules a callback
>> to occur in the next turn, which depletes HP and schedules itself for the next
>> turn infinitely. (Thus making it viral.) A callback is scheduled to broadcast
>> an Unpoisoned event in about 6 turns. But what if a potion of healing is quaffed
>> between them? It will broadcast an Unpoisoned event as well. I'll implement a
>> dispatcher and watcher system and whatnot, and it will cancel those events.
>> (Yes, this isn't really time in the usual sense, but it's cool and it explains
>> the callback/event system.)
>>
>
> Without looking at the other posts in this rather large topic, here's
> how I handled it in my proto-roguelike.
>
Well it's a complex subject, see.
> First, you have a turntimer float for each character (PC, NPC,
> monster). Then, you set that to 100 / a number based on whatever you're
> using for your characters speed.
>
> Next, you run through all the turntimers, pick the lowest number, and
> decrease all the turntimers by that number.
>
> Then, all the characters with a zero'd turntimer move and get their
> turntimers reset.
>
> It's not truely turn-based, but it does the job.
>
Kind of cool but weird. Sort of like a priority queue.
It is a priority queue I think. Everybody starts off with some priority
based on their speed and the smallest is popped off. Every actor's
priority is decreased by that number, ending one or more actors up with
0. They act at 0, then go back in the queue with their original speed
value. I really like this idea, as it prevents the priority from
building up.
How's this compare to the other priority queue idea where everybody
starts at 0, the cost of an action is added to priority each turn, and
the smallest acts again? It seems the same, but there could be
subtle differences.
.
- Follow-Ups:
- Re: Time in turn-based systems yet again
- From: Brendan Guild
- Re: Time in turn-based systems yet again
- From: Da-Breegster
- Re: Time in turn-based systems yet again
- References:
- Time in turn-based systems yet again
- From: Da-Breegster
- Re: Time in turn-based systems yet again
- From: Narf the Mouse
- Time in turn-based systems yet again
- Prev by Date: Re: Time in turn-based systems yet again
- Next by Date: Re: I want to learn!
- Previous by thread: Re: Time in turn-based systems yet again
- Next by thread: Re: Time in turn-based systems yet again
- Index(es):
Relevant Pages
|