Turn Based Battle - Positioning the team

Get answers to all your basic programming questions. No Ogre questions, please!
Post Reply
User avatar
almondega
Halfling
Posts: 67
Joined: Mon Jun 23, 2008 7:34 pm
Location: Brazil

Turn Based Battle - Positioning the team

Post by almondega »

Hi everyone, I'm developing a turn based rpg game (for hobby), and I'm facing the problem of how to set the team member's positioning (coordinates) in the battle, according to the count of members on that team.

Examples:
If the team has one member, then it will be put on position "B".
If the team has two members, the first go to the position "A" and the second goes to "C".
and so on, up to six members.

These are the position configurations, according to the amount of team members:

1 member
Image

2 members
Image

3 members
Image

4 members
Image

5 members
Image

6 members
Image

For now, I'm saving all six possibilites in arrays, and reading it according to the team count.
This is quite ugly, since it is very hardcoded and might not be well applied to all maps of the game.

Also I thought on another solution, marking the game map with all those position configurations.
But there is another problem, this way all game maps need to be marked and this job can be quite annoying.

Does anybody know a prettier solution for this problem?

Waiting for suggestions :wink:
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56
Contact:

Re: Turn Based Battle - Positioning the team

Post by Klaim »

There are placement algorithms that you can use, with automatic adjustments depending on the context.

Basically, just use algorithm that draw shapes on your grid (like cross, circles, etc).

Then, make the player chose which "shape" should take the team.


Look at Baldur's Gate way of handling it.
Post Reply