Rogue-like Timing

10 09 2009

Normally I’d be asleep by 11:30, but I just had an idea for a timing system in rogue-likes, although it would work pretty well in any turn-based game.

Each mob (and the character) has action points.  Taking an action uses up action points (AP from now on), which regenerate automatically at a rate that determines the creatures speed.  Each loop the creature with the highest AP acts first, and only then if they have at least a certain number of AP, and can act as many times as nessecary to bring them beneath that number.
For example, let’s say the player has 100 AP, and regenerates 100 AP per turn, and there is a monster that is exactly the same.  We’ll assume movement and attacks require 100 AP, but simpler actions like droping an item take only 50.  In this case the required AP to act would be 100.  An example list of actions might be…
PC(100) – Moves (0)
NPC(100) – Moves (0)
– NEXT ROUND – (+100AP EACH)
PC(100) – Drops something (50)
NPC(100) – Attacks (0)
– Next ROUND –
PC(150) – Attacks (50)
NPC(100) – Moves (0)
– NEXT ROUND –
PC(150) – Picks Something Up (100)
PC(100) – Attacks (0)
NPC(100) – DIES
A more interesting example with a slower monster with say, 75 regen.
PC(100) – Moves (0)
NPC(75) – Skipped
– NEXT ROUND – (+100AP for PC, +75AP for NPC)
PC(100) – Attacks (0)
NPC(150) – Attacks (50)
– NEXT ROUND –
PC(100) – Attacks (0)
NPC(125) – Attacks (25)
– NEXT ROUND –
PC(100) – Moves(0)
NPC(100) – Moves(0)
– NEXT ROUND –
PC(100) – Attacks(0)
NPC(75) – Skipped
This results in the player getting an extra action against the creature every 4th round.
Actions requiring more than the required AP would be handled by allow the AP to go negative, and not letting them act until they have enough AP.  The above example with a spell that takes 150AP from the player.
PC(100) – CASTS SPELL (-50)
NPC(75) – Skipped
– NEXT ROUND –
PC(50) – Skipped
NPC(150) – Attacks (50)
And so on and so forth.

Each creature/unit has action points… Taking an action uses up action points (AP from now on), which regenerate automatically at a rate that determines the creatures speed.  Each loop the creature with the highest AP acts first, and only then if they have at least a certain number of AP, and can act as many times as nessecary to bring them beneath that number.

For example, let’s say the player has 100 AP, and regenerates 100 AP per turn, and there is a monster that is exactly the same.  We’ll assume movement and attacks require 100 AP, but simpler actions like droping an item take only 50.  In this case the required AP to act would be 100.  An example encounter might be…

PC(100) – Moves (0)

NPC(100) – Moves (0)

– NEXT ROUND – (+100AP EACH)

PC(100) – Drops something (50)

NPC(100) – Attacks (0)

– Next ROUND –

PC(150) – Attacks (50)

NPC(100) – Moves (0)

– NEXT ROUND –

PC(150) – Picks Something Up (100)

PC(100) – Attacks (0)

NPC(100) – DIES

A more interesting example with a slower monster with say, 75 regen.

PC(100) – Moves (0)

NPC(75) – Skipped

– NEXT ROUND – (+100AP for PC, +75AP for NPC)

NPC(150) – Attacks (50)

PC(100) – Attacks (0)

– NEXT ROUND –

NPC(125) – Attacks (25)

PC(100) – Attacks (0)

– NEXT ROUND –

PC(100) – Moves(0)

NPC(100) – Moves(0)

– NEXT ROUND –

PC(100) – Attacks(0)

NPC(75) – Skipped

This results in the player getting an extra action against the creature every 4th round.

Actions requiring more than the required AP would be handled by allow the AP to go negative, and not letting them act until they have enough AP.  The above example with a spell that takes 150AP from the player.

PC(100) – CASTS SPELL (-50)

NPC(75) – Skipped

– NEXT ROUND –

NPC(150) – Attacks (50)

PC(50) – Skipped

And so on and so forth.

Advertisements

Actions

Information

4 responses

12 09 2009
Mark McKinley

This is a very solid idea. To get a bit more indepth, you could take entity_speed into account. For example, an entity_speed of 1 could result in moving 1 tile per 100 action points (basicly 1 turn for 1 tile), where as an entity_speed of 4 would cost 25 AP to move one tile, letting it move 4 times as fast as an entity_speed of 1. This would allow you to have creatures that run faster, or slower than the player. You could do this with just about any action you could take, and keep AP at a solid 100 across the board to keep things clean. Of course, you could have it so each entity could have more than 100 AP (like you stated) and have a very dynamic timing system (150 AP with entity_speed of 4 would allow movement of 6 tiles per turn!).

Its a very good system that works well, most older turn based tactical games (Fallout and Fallout 2, Jagged Alliance, ect..) use this system.

12 09 2009
Timothy S.

Very good points! I may expand on this a bit, one of the ideas I’ve been tossing around in my head for a future project is a strategy/tactics game of sorts, and this could be useful, thanks!

12 09 2009
Mark McKinley

I plan on using a similar setup for my game, the exception is my game will be real time, so actions will have to take a certain amount of time to complete. I will end up going more indepth into the idea on my blog (click on this post name to go to it) after I finish up my current task in development. It might give you some ideas on how to implement time into your game as well.

12 09 2009
Timothy S.

Awesome, I’ll be watching for it then!

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: