Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
techbear

Administrator
Registered:
Posts: 142
Reply with quote  #1 

It was pointed out to me that the ship brain unit, BRAIN_GUARD_STATION, has a single value associated with it, and no one seems to know what it does!  So I looked at the code, and the answer leads only to more questions. :/

The BRAIN_GUARD_STATION is currently only used in deep strike missions, for the enemy ships that are supposed to stay at the bases they protect.

 

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
case BRAIN_GUARD_STATION:
debugString += L"--- BRAIN_GUARD_STATION ";
debugString.AddFloatAsString(value[0],0,0);
debugString += L"^";
{
if (0 == targetID)
{
// find my closest station
float closestStation;
D3DXVECTOR3 pointStation;
targetID = ship->ClosestFriendlyStation(closestStation, pointStation);
}

Station *myStation = gameListStation.list->Find(targetID);
if (myStation)
{
D3DXVECTOR3 diff = ship->pos - myStation->pos;
float myDist = D3DXVec3Length(&diff) * value[0]; // value[0] is the relative dist between ship-station and enemy-station

// compare the distance of each player to my station
Player *ply = gameListPlayer.list->First();
while (ply)
{
diff = ply->pos - myStation->pos;
float dist = D3DXVec3LengthSq(&diff);
// if any of them are too close
if (dist < myDist * myDist)
{
// run to my station to guard it
debugString += L"Moving to station to guard it.^";
ship->curTargetPoint = myStation->pos;
ship->followPath = FALSE;
debugString += L"Pathfinding turned OFF.^";

// if commander, fleet follows
if (ship->myFleetIndex < 0 || ship->myFleetIndex >= 100) // BAD FLEET INDEX!
{
debugString += L"myFleetIndex is invalid (not 0-99)^";
return FALSE;
}
if (ship->recordArray[ship->myFleetIndex].commanderID == ship->myContainerID)
{
ship->recordArray[ship->myFleetIndex].curTargetPoint = ship->curTargetPoint;
}
}
ply = gameListPlayer.list->Next();
}

}
else
targetID = 0;

}
return FALSE;
}




This is it; the brain guard code, which sez, IF a player is close enough to my base, then move to my base.

The mystery value is a coeff for the distance of the player (which triggers the action).

I wrote this a long time ago, and didn't re-visit or revise it since, and that's a mistake.  At the time, I thought it'd be clever to make the ship (or fleet) "protect" it's base when a player ship drew near.  But the player's so fast, and different things are happening, so this behavior is invisible/pointless.

------------------------------------------------------------------------
SO it would be wise to ask, what behavior do we WANT from fleets that defend enemy bases? 

And what sort of brain stack object would generate that behavior?

Please let me know your opinion on this!  Thanks!



ryleyra

Registered:
Posts: 3,007
Reply with quote  #2 
One possibility I can thing of is that if an enemy station has taken shield damage, any ships assigned to that station will either return to station or stay close to it. If the damage is repaired, the ship is free to seek out the player ship(s) or defend other stations.

This would be similar, I think, to a player strategy. Defend the stations that are under attack.

I could have some other ideas, I'll think about it.
Xavier Wise

Registered:
Posts: 1,141
Reply with quote  #3 
I was looked at scripting an enemy fleet to guard several bases by traveling from one to the next, as if they were on a patrol. The issue was, it was a lot of changes to the AI stack at each base. For me, having this kind of function in the Guard_Station would make it much easier to set this up and allow for the creation of some interesting deep strike missions.

If we could specify to an enemy fleet a base to defend and a distance they should remain within, that could create some interesting behaviour. Within that distance, enemies could patrol the area, attacking players when they come close (with the activation of the next brain stack "attack if player is within X distance"), or return to the base they are to defend if that base is attacked. The patrol could be a circular route around the base, or could be changes of direction when it reaches the maximum distance away from the base. With a larger area to patrol, it would allow players to find gaps in the defenses. By restricting the patrol area, it also means you could build a defensive ring of mines around the base that the enemies wouldn't fly in to.

Another idea is that you could specify multiple bases to defend, and the enemy ships would fly from one to the next, making a beeline for the base that is being attacked at that moment. This could create interesting situations for multi-ship missions, where one ship attacks a base to draw off the patrolling defenders, and then a second ship strikes at the base the defenders have just left. It would also allow the possibility of setting up "covert" missions, where you have to slip in through the enemy patrols, with the bases providing waypoints that the enemies would move to.

__________________
Fleet Captain Xavier Wise - TSN Sabre
Link to TSN RP Community website
ogremasch

Avatar / Picture

Registered:
Posts: 229
Reply with quote  #4 
Enemies that are intending to defend bases should be given a list of all remaining enemy bases so that if a base was destroyed prior to the enemy vessel being destroyed the ship can then head for the next base on their list that is still operational.

Defend base in the Brain stack could default to a list of bases with attack player being an option in terms of if no enemy bases exist then the ship goes after the player ship.

I am unsure how or if this is possible but I imagine that setting an option to automatically assign bases in a random order or set the order manually would be needed, maybe not.

The additional action to attack player or do something else when no enemy stations exist makes sense to me from a logic standpoint but I dont know if it makes sense from a programming standpoint or if it can just be included in the brain stack in such a way that if no enemy stations exist it triggers the enemies that were previously assigned to guard duty to attack the player. It could also be an option to trigger the switch to attack player if the one station that the enemy was defending is destroyed even if there are other stations available to defend.
Darrin

Registered:
Posts: 165
Reply with quote  #5 
The simplest option would be just a distance value: "If a base on my side is within X meters of my current position, go guard that base." If there are multiple bases within X, pathfind to the nearest base.

This would allow a script to load enemies around a particular base, and they would presumably stay there guarding it, unless another CHASE_PLAYER or CHASE_ANGER takes precedence. If there is no CHASE or other AI command in the stack, then presumably the guarding ship would attack any enemies that come within X, but the guard would break off the attack if following the enemy would take it further than X away from the base. 

However, this might allow a crafty player to draw an enemy up to X away from a base, causing the guard to stop attacking, while the player pummels it to bits from just outside X. On the gripping hand, I'm not entirely sure players would be patient enough to exploit this. Also, the enemy ships are so slow, I'm not sure the players would even notice if an enemy tried to turn back towards a base to defend it. 





Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 2,404
Reply with quote  #6 

IMO the AI ships guarding bases should be given the equivalent of a "Go Defend" command sent by a player. The target of that command should be the base where they spawned. Once the base is destroyed they should just go into normal player-hunting mode.

Here is my logic: The Kralien, Torgoth, Arvonian, and Skaraan ships spawn near bases of their own race. If I am a Kralien ship who lost my Kralien base instead of running off to defend a Torgoth base I should go hunting for revenge against the player.

It would be nice to see this in Deep Strike and Border War missions both.


__________________
"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight."
- Winston Churchill
ryleyra

Registered:
Posts: 3,007
Reply with quote  #7 
Yeah, I agree that a ship's home base should be a higher priority than other bases. Otherwise, the players could just lure all the enemies to a single base and then go wipe out the others while they are milling about.

I'm actually not sure how Thom determines which base is an enemy ship's "home", but I'm assuming such is determined at initial layout.

clavestone

Avatar / Picture

Registered:
Posts: 359
Reply with quote  #8 
OK, My 2 cents, which may not be much.

If an enemy base is under attack, maybe any/some of the elite ships that are not assigned to base defense (the ones that cross the border towards the TSN bases) turn back for defense. The catch is player ship is fast, so my only thought would be any remaining, fast moving (jump capable) Skaaran ships come back for defense.

Weapons "Kralian base down,  Captain! Scratch one...."

Science "CAPTAIN, INBOUND 3 Skaaran Executers coming in hot!"

Comms "Captain, Skaaran commander S56 has issued a proclamation that Revenge is a Dish Best Served Steaming HOT!"

My coding days are long ago, so I don't know the viability of the scenario.

__________________
PirateLord Eric Wethington:
Commander of the 1st CAP Light Recon Fleet stationed at ShoShuShen station, Eastern Front Sector
Captain of the Privateer Longbow "Jimi-Saru"
Captain of the Privateer Brigantine "Fulminate" and 59th Pirate Fighter wing "The Reapers"

Charter Member of the Eastern Front online group (PirateLord)



Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.