var
turn = 0
proc
take_turn(mob/m)
turn++
var
ai_distance = world.view * 2
for(var/mob/o in orange(ai_distance, m))
o.ai()
mob
animate_movement = NO_STEPS
proc
ai()
player
text = "@"
Move()
. = ..()
take_turn(src)
enemy
ai()
// do targeting/movement/etc
This works fine but I realized that later on I would want to be able to allow players and enemies to go multiple (or possibly less) times per "turn". I'm not entirely sure how to go about setting such a system up.
So say the standard delay is 1000, the player has speed 250, a bat has speed 500, and a slime has speed 100. Everybody starts at delay 1000. We'll say ties are broken in speed order, but any deterministic mechanism will do. You'll see the following turns:
Bat
Bat
Player
Bat
Bat
Player
Bat
Slime
Bat
Player
So the bat acts really often, the slime barely gets a look in, and the player is in the middle. 'haste' and 'slow' style spells work by changing the speed stat, as do magic items that make you faster.
My 2011 GIAD entry, Mirage Arcana, implements something like that, and the code is available, though hacky, if you'd like to see it in action.