Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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

If you ever wanted to add graphics, you'd just attach some more information to each definition:

    "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}
        }
    }
share|improve this answer
    
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 at 16:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.