Posted By: Locoweed
RTS Team Formations with A* - 08/07/05 05:44
I am currently working on a RTS strategy example (possibly tutorial) that will involve massive teams fighting on a medeviel battle field . I may not have much free time to get it done quickly so I will put any major updates up when they happen. This is what I have done so far.
I have it so teams of 4 can be set-up. The player can have up to 62 teams right now and the computer will also be able to have that many teams when I get to the computer ai. Each team is set to a user-defined formation type. The formation type of a team can be changed during game play, although it isn’t shown in this example program. Entities use Astar when needed, although I still have some bugs to work out yet on the Astar, namely the dreaded Warning 1502 - Enless Loop, pops up under certain conditions. I am working on solving this problem. I don't think it should take too long to figure out.
The set-up in WED goes like this.
a) You first add your team members in WED, up to 4 entities per team.
b) You then assign all of these enties action PlayeUnit and the same TEAM_ID (1-62) in WED. Different teams cannot have the same TEAM_ID, it is unique to each team.
c) Then you assign each team member a MEMBER_ID (1-4) in WED. MEMBER_ID = 1 is considered the leader of team. The team’s formation is based off of him. If he dies (not in code yet), then MEMBER_ID 2 becomes 1, and thus the leader, etc.
d) Then you assign each member of the team the team’s FORMATION_TYPE (1-3 in example). Formation types are user-defined in the wdl. Different teams can have same formation types. In the example program there are 3 different user-defined formation types set-up.
e) Goto a) and repeat step for all desired teams.
I am not going to cover the formation set-up much for now, but a formation is basically a 3x3 array. 0’s represent empty positions in the formation. 1-4 represents the team members positions in the formation. The bottom row of the array represents the front of the formation.
So a formaton array like
( 0,1,0,
2,0,3
0,4,0 )
would represent a diamond shaped fomation with the leader (1) in the rear and member #4 in the front of the formation.
If the team moves as a unit, when they reach the goal position, they will try to be in formation and all facing toward the front of the formation.
Movement:
To move a single entity.
L-click on the entity, then L-Click again where you want him to go.
To move the entire team.
While holding down Space_Bar, L_Click on any member of the team (the entire team will be selected), then L-click where you want team to go. ( I am saving R-click for battle stuff when I get to that)
Camera:
Scroll screen by placing mouse pointer at edge of screen.
Zoom with Mouse Wheel.
There is a very simple DLL included with the source in VC++ 6.0 . All it does is basically store and retrieve the Waypoints for now, so more entities can use the Astar algorithm, which is a wdl. The Astar program is a modified version of Phillip Walser’s A* #2. If you want to play around with the SDK, make sure you change Project-Settings (General & Debug) to the correct path of where the game folder is located on your system. I actually have an entire Astar in a DLL, but I don’t have it working yet, so I thought I better get more aquainted with how SDK works before I try to get it running again.
It can be found at My 3DGS in my signature under Pathfinding link. It’s called PathGuru.
Later,
Loco
I have it so teams of 4 can be set-up. The player can have up to 62 teams right now and the computer will also be able to have that many teams when I get to the computer ai. Each team is set to a user-defined formation type. The formation type of a team can be changed during game play, although it isn’t shown in this example program. Entities use Astar when needed, although I still have some bugs to work out yet on the Astar, namely the dreaded Warning 1502 - Enless Loop, pops up under certain conditions. I am working on solving this problem. I don't think it should take too long to figure out.
The set-up in WED goes like this.
a) You first add your team members in WED, up to 4 entities per team.
b) You then assign all of these enties action PlayeUnit and the same TEAM_ID (1-62) in WED. Different teams cannot have the same TEAM_ID, it is unique to each team.
c) Then you assign each team member a MEMBER_ID (1-4) in WED. MEMBER_ID = 1 is considered the leader of team. The team’s formation is based off of him. If he dies (not in code yet), then MEMBER_ID 2 becomes 1, and thus the leader, etc.
d) Then you assign each member of the team the team’s FORMATION_TYPE (1-3 in example). Formation types are user-defined in the wdl. Different teams can have same formation types. In the example program there are 3 different user-defined formation types set-up.
e) Goto a) and repeat step for all desired teams.
I am not going to cover the formation set-up much for now, but a formation is basically a 3x3 array. 0’s represent empty positions in the formation. 1-4 represents the team members positions in the formation. The bottom row of the array represents the front of the formation.
So a formaton array like
( 0,1,0,
2,0,3
0,4,0 )
would represent a diamond shaped fomation with the leader (1) in the rear and member #4 in the front of the formation.
If the team moves as a unit, when they reach the goal position, they will try to be in formation and all facing toward the front of the formation.
Movement:
To move a single entity.
L-click on the entity, then L-Click again where you want him to go.
To move the entire team.
While holding down Space_Bar, L_Click on any member of the team (the entire team will be selected), then L-click where you want team to go. ( I am saving R-click for battle stuff when I get to that)
Camera:
Scroll screen by placing mouse pointer at edge of screen.
Zoom with Mouse Wheel.
There is a very simple DLL included with the source in VC++ 6.0 . All it does is basically store and retrieve the Waypoints for now, so more entities can use the Astar algorithm, which is a wdl. The Astar program is a modified version of Phillip Walser’s A* #2. If you want to play around with the SDK, make sure you change Project-Settings (General & Debug) to the correct path of where the game folder is located on your system. I actually have an entire Astar in a DLL, but I don’t have it working yet, so I thought I better get more aquainted with how SDK works before I try to get it running again.
It can be found at My 3DGS in my signature under Pathfinding link. It’s called PathGuru.
Later,
Loco