[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: suspending scripts execution
- From: Luo Hei <luo_hei@...>
- Date: Mon, 12 Nov 2007 12:10:02 -0500
I have designed the AI scripting for my project in the following way:
for each entity I execute the AI script every X ms. This works fine for
very simple scripts, but for more complex scripts I expect the program
to repeat a lot of basic tasks, like checking if entity is fighting, if
has to heal itself, etc. So, it is much better to suspend execution and
continue on next refresh turn that to spend CPU cycles on something
already done 100 ms ago. I thought in coroutines, but then I noticed
that i have to deal with 200-300 entities, which represents 200-300
different scripts executed one after another.
Is there some way to do this? Or perhaps I should redesign my AI system?
http://dsgp.blogspot.com | Linux, programación, juegos
Have no place I can be since I found Serenity
But you can’t take the sky from me
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.