Quote:

But I am guessing what you did was place like a var. Example enemys are 1 and good guys are 2. Then scan if it's one or two. Am I close?





Quote:

well kinda but go ahead and try that and you'll run into a big problem.. I accually had to make all entities scan, and then it detects what my.id skill is. But ya something like that.





The alliance thing works something like this..

At Game start, you define a few teams. For PrenceofDarkness's demo I've defined the teams Player,vCon,Skeleton.

Then you define the initial alliances that members of those teams will have with each other when they are first created. Since we wanted vCons to team up with the Player against the Skeletons the definition was something like that:

PlayerTeam Towards VconTeam-->Ally
PlayerTeam Towards skeletonTeam-->Enemy

VconTeam Towards PlayerTeam-->Ally
VconTeam Towards VconTeam-->Ally //other team members
VconTeam Towards SkeletonTeam-->Enemy

SkeletonTeam Towards PlayerTeam-->Enemy
SkeletonTeam Towards VconTeam-->Enemy
SkeletonTeam Towards SkeletonTeam-->Ally //other team members

Now let's say we create a few models. By defining the .id skill from WED we can define if the model belongs to the Player, Vcon or Skeleton Team. So we make 1 player, 2 vcons and 2 skeletons

When the models are created, the alliance Array which keeps track of all the models in the game, will look something like that:

Code:
 

|Player | vCon A | vCon B | Skeleton A | Skeleton B
---------------------------------------------------------------------------
Player |Undefined Ally Ally Enemy Enemy
vCon A | Ally Ally Ally Enemy Enemy
vCon B | Ally Ally Ally Enemy Enemy
Skeleton A | Enemy Enemy Enemy Ally Ally
Skeleton B | Enemy Enemy Enemy Ally Ally




Now all we need to do is check this array to see if model A is Hostile or not with model B. If Skeleton A spots Vcon B around(scans him or something), he checks the Skeleton A raw and VconB column to find a field saying: 'Enemy'. So he attacks.

The beauty with this system is that alliances can take any form in the future. Since the array keeps track of individuals instead of just noting down their teams, models on the same team may go against each other, individual alliances can be made etc..

for example, the player is initially Allied with all the Guards of a village. But one day he goes loco and kills one of the Guards in plain view of two other really suprised Guards. The Guards turn hostile with the Player and charge on him. Now if the Player manages to kill both of them, although those two indvidual models turned hostile on the Alliance table, the rest of the Guards are still Allies with the player cause they have no idea what happened!

and so on..


That's really old code though.. I'm suprised it came up.. But I guess it still works ok. Prence PMed me to explain some things here about it, so i did... hope someone has fun with it..

Aris


INTENSE AI: Use the Best AI around for your games!
Join our Forums now! | Get Intense Pathfinding 3 Free!