Re: Time in turn-based systems yet again



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.
.



Relevant Pages

  • Re: [QUIZ] Word Chains (#44)
    ... // Ruby extension implementing a priority queue ... // Except for using a value except of a void* the priority queue c-code is ruby ... unsigned int degree; ...
    (comp.lang.ruby)
  • Dont need to be kid-friendly...
    ... everyone that kid-friendly is not a priority in my movies. ... If you don't mind showing the youngsters violence ... having that character keep trying to get other characters to kill ... Derek's recommendation of "Slayers". ...
    (rec.arts.anime.misc)
  • Re: QoS to limit bandwith to a particular app?
    ... Create a class map such as: ... With CBWFQ you should not reserve more than 75% of the bandwidth. ... Priority 880 ... line speed for priority queue will most likely leave other traffic no chance ...
    (comp.dcom.sys.cisco)
  • [RFC PATCH 4/5] cfq-iosched: enable idling for last queue on priority class
    ... priority queue has idling disabled, lower priority queues may steal ... The patch solves this issue by always performing idle on the last ...
    (Linux-Kernel)
  • Re: Priority Queues in VBScript
    ... i am trying to make a priority queue in VBScript. ... Public Sub addPriQ(nPri, sName) ... For Each aAct In aActs ...
    (microsoft.public.scripting.vbscript)