# Adding movement to a text-based rpg battle

Outline

I have the bones of a text-based RPG - the player can progress through a branching storyline and activate some simple events (recieivng/giving/trading items).

As I am designing the battle system (turn-based obviously) I decided it would be nice to have the player be able to "move" during battle - i.e. a heavy armour clad warrior would charge straight up to the foe but the ranger should pick his foes off from a distance and try to move to a better vantage point as the enemy approaches.

Main question

Rather than just giving the fleet of foot character a higher probability to dodge an attack (to compensate their lower defence) I wanted to give them the option to move to different points within the area of battle (jump on top of a rock, climb into that tree, etc) to make it more tactical but have become stumped.

Can anyone suggest a way to approach this (pseudo code would be nice)?

I am using C++ to write the program, if anyone wants to know.

You could define how these would affect the character and add flavor text. If you group them into something like biomes, you can randomly select a few at a time for each battle depending on where the battle takes place.

For example, if you has just two attributes - Offense and Defense:

"Rocky Biome" : {
"Rock : {
"Take cover behind rock" : {
Defense : 10,
Offense : -15,
OnEnter : "%s takes cover behind a rock",
OnLeave : "%s leaves their rocky cover"
}

"Climb on top of rock" : {
Defense : -5,
Offense : 10
}
}
}
"Forest Biome" : {
"Tree" : {
"Climb up tree" : {
Defense : 5,
Offense : -5
}
"Hide behind tree" : {
Defense : 10,
Offense : -10
}
}
}


Then you'd just display these as an extension of a "Move" option.

> Move
Where to move?
1. Take cover behind rock
2. Climb on top of rock
3. Climb up tree
4. Hide behind tree
> 3
So-and-so climbs up a tree


    "Rock : {
Image : "BigRock.png",

"Take cover behind rock" : {
Defense : 10,
Offense : -15,
SetCharacterOffset : {-32,0}
}

"Climb on top of rock" : {
Defense : -5,
Offense : 10,
SetCharacterOffset : {0,64}
}
}

• Thanks! I really like this model, definitely going to implement this style with extensions representing distance between different biomes (e.g. the enemy might take two turns to get from the centre of the clearing to leap over the rock you are hiding behind). I don't suppose you can recommend any resources to help with making a decent battle AI? – Kvothe Mar 4 '15 at 16:30
• I think it would be interesting to expand this answer with a simplistic "distance" stat consisting of 'close' (melee distance), 'medium' (thrown and ranged distance), and 'far' (ranged only distance). A move option would allow one to change their distance stat in relation to a specific enemy, or group of enemies. – nijineko Aug 12 '16 at 15:10