Possession 2: Speed Systems in Roguelikes


Fun(?) fact: Speed was the first R-rated movie I ever watched. And I haven't seen it since then.

Fun(?) fact: Speed was the first R-rated movie I ever watched. And I haven’t seen it since then.

Speed is a problem in turn-based games. It’s much easier to just have everyone move once per turn. Anything else just gets complicated, both from a programming and a gameplay standpoint. But given that the differences between bodies are such a big deal in Possession, I really want there to be some creatures that are weak but fast, and some that are strong and slow. Not to mention the possibilities of spells or obstacles that speed/up slow down creatures, and let the player (or their enemies!) run away or escape more quickly.

(I’m going to warn you right now, this post is a bit more in-depth in the development process than other posts have been. If you’re not really interested in game dev it might not be that interesting, but I’m putting it up so hopefully someone facing the same problems might be helped by it).

At first I tried a simple system where certain creatures either got an extra turn or lost a turn every X number of turns, but implementing it got kind of ugly and annoying. I decided to look into what other people had already done. I found this post, detailing a wide variety of time systems used in roguelikes, and decided to go with an energy-based system, which is apparently what Angband uses, which is somewhat appropriate I guess because even though I don’t really like it much now, it was the first roguelike I ever played.

Anyway, the basic way it works is, every creature has a “speed” rating that is added to their “energy” stat every turn. If their energy stat is above 100, they can move, and 100 is subtracted from it. If it’s above 200 they can move twice, above 300 three times, etc. Most creatures just have speed 100, meaning they move once a turn.

For example:

Creature Speed Energy, Turn 1 Energy, Turn 2 Energy, Turn 3
Bat 150 150 (moves once, reduces to 50) 200 (moves twice, reduces to 0) 150 (moves once, reduces to 50)
Zombie 50 50 (doesn’t move) 100 (moves once, reduces to 0) 50 (doesn’t move)
Caretaker 100 100 (moves once, reduces to 0) 100 (moves once, reduces to 0) 100 (moves once, reduces to 0)
The ghost moves faster than most creatures, so the player has a chance to run away. Click to enlarge.

The ghost moves faster than most creatures, so the player has a chance to run away. Click to enlarge.

Same goes for the player, of course. If they have above 100 energy, they can move, if not, a turn happens without them. If they have above 200 energy, their move is an “extra” move. They still move, as does any creature with more than 100 energy, but nobody’s energy increases that turn.

Double-jumping bats. Animated, click to view.

Player takes extra turns, then bat takes extra turns. Click to enlarge.

This system worked pretty well as-is, but it does run into a weird problem. I had bats and ghosts both faster than normal, but the ghost was slightly faster than the bat. It got an extra turn every two turns, and the bat got an extra turn every three. This resulted in, one turn, the ghost would move twice and the bat wouldn’t move, the next turn the bat would move twice and the ghost wouldn’t move. It didn’t make much sense.

Bat now takes extra move when player takes extra move. Animated, click to view.

Bat now takes extra move when player takes extra move.
Click to enlarge.

So, the get around that, I made it so that if the player is faster than a creature, the creature saves up enough energy to take an extra turn, it doesn’t actually take its extra turn until the player takes their extra turn. That seems to work pretty well so far. Might take some more tweaking as things continue, but we’ll see.

The other problem with this system is that all actions take the same amount of time. It’s not currently possible to have, for example, a creature who moves slowly but attacks at the same speed. Or a creature that can move 5 spaces per turn but only attack once. I’ll have to see if that’s something I want to invest the time into making possible.
Advertisements

Tags: , , , , , , ,

2 responses to “Possession 2: Speed Systems in Roguelikes”

  1. NE1 says :

    Take this with a grain of salt since I haven’t played your system but it occurs to me that you might want to make the players speed translate to the refresh rate. This way, if the player’s speed is 90 everything at 180 and above goes twice

    This change has three virtues. First, the player never skips a turn (if slowed for instance) while other things move, they just move more quicly around the player. Second, the monsters don’t have to save up because the player never takes two actions at once. Third, (and this one is more ephemeral) the world is being defined by the player so all balancing more naturally is done in regards to player’s point of view.

    Just a thought. Sounds like good work either way though. 🙂

  2. Taylor says :

    You know, I thought about doing it that way at first, and I can’t really remember why I decided against it. I think it was because of worries about how that would affect cooldowns. If an ability cools down in 10 turns, what does it mean when the turns are longer or shorter?
    But I dunno, thinking about it now, that doesn’t really seem like a big deal.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: