[WIP] Captain AI overhaul. Updated 09.12.2014
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
[WIP] Captain AI overhaul. Updated 09.12.2014
Captain AI overhaul
============
Installation:
Extract in extensions dir as pr. usual. If alpha is installed, delete that dir (mod was renamed).
Download link:
2.5x version: https://dl.dropboxusercontent.com/u/652 ... _beta2.zip
3.0 version: https://dl.dropboxusercontent.com/u/652 ... eta3.1.zip
What it has:
General movement:
- Move closer at a rough intercept vector
- Ships will behave differently if they have capital wingmen (not rotate so much and stir up formation).
- In zone boosting. Boost if target or position is further than 20KM away. If target is enemy, stop about 12KM away and engage.
- In zone boosting for wingmen. Will boost to catch up if leader is 15KM away. Need to either reassign ships, or move fleet to a different zone to refresh the escort script loop.
-> IZ boost is only enabled for player combat ships for now and is a work in progress.
Shiptypes:
- Balor and Sucellus will hold position and orient weapon toward target (also when target is moving) and break off/gain distance if target get too close.
- All warships (destroyers and "battleships") have custom code to move to and broadside enemy, and standoff/move ranges by type.
- Carriers will try to keep their distance, and rotate to be ready to break off if enemy cap gets too close.
- Tradeships run vanilla code in close combat for now.
General AI:
- Explosion avoidance, will start to move away when target hull gets below 50% and lock the movement for 60s when below 10% to avoid them stopping when target dead to wait for the explosion.
- Panic checks when shield and hull gets damaged. Based on morale + random bonus and amount of damage taken. Will run away if failed.
- "Suicide run" if ship is close to destroyed and target have a lot of hull left. Requires high morale.
-> Xenons will never panic and always do suicide run.
- Path calculations end checks are done in a much faster interval than vanilla (5-10 sec) when enemy is near.
- Cap formation code added to lessen the chaos and allow ships as sucellus to orient ot target. Still some work to do in the escort scripts.
Other:
- Added fix for stuck boosters bug (if this is still an issue in vanilla).
The current version have some output to debug log active to show what the captains are doing, mostly limited to player ships and boosting.
How it works:
Probably have to do a writeup on this sometime..
Mostly using the engine positioning/vectorcode + holding position/rotating ship etc. based on situation, target type and ranges.
The code is sectionized in ship definitions/parameters, AI decisions and shiptype behavior.
Current ship definitions/modes:
- Ranged: Balor, Sucellus
- "Battleship": Arawn, Fulmekron, I
- Destroyer: Taranis, Olmekron, K, Gangrene Chaser
- Carrier: Heavy and Light Sul
Savegame safe?
Treat it as beta code for now.
Compability with other mods:
The mod replaces or changes nodes in the move.attack.object.capital,move.escort.capital, command.move.wait and command.fight.attack scripts.
Mods that don't change anything with the Captain, i.e. don't touch those scripts will work fine.
Don't use the AJD mod whis this one - it's an excellent mod, but causes a lot of weirdness in my scripts.
Todo:
- Code optimizing and cleanup, and I suspect some bugfixing.
- Put it on Steam WS when verified in release state.
- Add some mod compatibility stuff if it's wanted.
- Do some distance tuning for the decision code.
- Do more with skills (threat response, and formation tightness/ chaos based on leadership skill).
- Do a lot more testing/ polishing, especially when it comes to formations...
- Add relevant methods from ego's new AI code when it's released to beta.
Any feedback, tips and ideas would be most appreciated.
This mod will be released with WTFPL when it's done, so if some stuff should be added to complement other mods, just give me a hint and I'll se what can be
============
Installation:
Extract in extensions dir as pr. usual. If alpha is installed, delete that dir (mod was renamed).
Download link:
2.5x version: https://dl.dropboxusercontent.com/u/652 ... _beta2.zip
3.0 version: https://dl.dropboxusercontent.com/u/652 ... eta3.1.zip
What it has:
General movement:
- Move closer at a rough intercept vector
- Ships will behave differently if they have capital wingmen (not rotate so much and stir up formation).
- In zone boosting. Boost if target or position is further than 20KM away. If target is enemy, stop about 12KM away and engage.
- In zone boosting for wingmen. Will boost to catch up if leader is 15KM away. Need to either reassign ships, or move fleet to a different zone to refresh the escort script loop.
-> IZ boost is only enabled for player combat ships for now and is a work in progress.
Shiptypes:
- Balor and Sucellus will hold position and orient weapon toward target (also when target is moving) and break off/gain distance if target get too close.
- All warships (destroyers and "battleships") have custom code to move to and broadside enemy, and standoff/move ranges by type.
- Carriers will try to keep their distance, and rotate to be ready to break off if enemy cap gets too close.
- Tradeships run vanilla code in close combat for now.
General AI:
- Explosion avoidance, will start to move away when target hull gets below 50% and lock the movement for 60s when below 10% to avoid them stopping when target dead to wait for the explosion.
- Panic checks when shield and hull gets damaged. Based on morale + random bonus and amount of damage taken. Will run away if failed.
- "Suicide run" if ship is close to destroyed and target have a lot of hull left. Requires high morale.
-> Xenons will never panic and always do suicide run.
- Path calculations end checks are done in a much faster interval than vanilla (5-10 sec) when enemy is near.
- Cap formation code added to lessen the chaos and allow ships as sucellus to orient ot target. Still some work to do in the escort scripts.
Other:
- Added fix for stuck boosters bug (if this is still an issue in vanilla).
The current version have some output to debug log active to show what the captains are doing, mostly limited to player ships and boosting.
How it works:
Probably have to do a writeup on this sometime..
Mostly using the engine positioning/vectorcode + holding position/rotating ship etc. based on situation, target type and ranges.
The code is sectionized in ship definitions/parameters, AI decisions and shiptype behavior.
Current ship definitions/modes:
- Ranged: Balor, Sucellus
- "Battleship": Arawn, Fulmekron, I
- Destroyer: Taranis, Olmekron, K, Gangrene Chaser
- Carrier: Heavy and Light Sul
Savegame safe?
Treat it as beta code for now.
Compability with other mods:
The mod replaces or changes nodes in the move.attack.object.capital,move.escort.capital, command.move.wait and command.fight.attack scripts.
Mods that don't change anything with the Captain, i.e. don't touch those scripts will work fine.
Don't use the AJD mod whis this one - it's an excellent mod, but causes a lot of weirdness in my scripts.
Todo:
- Code optimizing and cleanup, and I suspect some bugfixing.
- Put it on Steam WS when verified in release state.
- Add some mod compatibility stuff if it's wanted.
- Do some distance tuning for the decision code.
- Do more with skills (threat response, and formation tightness/ chaos based on leadership skill).
- Do a lot more testing/ polishing, especially when it comes to formations...
- Add relevant methods from ego's new AI code when it's released to beta.
Any feedback, tips and ideas would be most appreciated.
This mod will be released with WTFPL when it's done, so if some stuff should be added to complement other mods, just give me a hint and I'll se what can be
Last edited by cicero111 on Fri, 12. Dec 14, 21:48, edited 21 times in total.
- Sandalpocalypse
- Posts: 4447
- Joined: Tue, 2. Dec 03, 22:28
-
- Moderator (English)
- Posts: 8074
- Joined: Tue, 30. Mar 04, 12:28
You star
I currently use a Sucellus for their beauty and the promise of the ICH working despite it being less effective in vanila than a Taranis so I look forward to trying this after i finish beta testing 3.00. Hoping it makes my choice of ship more rational
My only though at the moment is to wonder whether the Taranis could do with a little shaved off its speed but that'snot directly related to this mod (apart from the chase aspect).
I currently use a Sucellus for their beauty and the promise of the ICH working despite it being less effective in vanila than a Taranis so I look forward to trying this after i finish beta testing 3.00. Hoping it makes my choice of ship more rational
My only though at the moment is to wonder whether the Taranis could do with a little shaved off its speed but that'snot directly related to this mod (apart from the chase aspect).
-
- EGOSOFT
- Posts: 3363
- Joined: Mon, 26. Mar 12, 14:57
@Sandalpocalypse
It selects Balor and Sucellus specifically and sets some parameters for each. The movement code is generic. This so each one can be tuned a bit for ranges and behavior without too much code duplication.
@Sparky
Have been thinking about different strategy for each ship type. B/S as artillery ofc, taranis as hit&run destroyers maybe, carriers should keep their distance etc. Maybe do some suicide run thing when hull is below x% for captains with high morale too maybe. Been tossing around some ideas - what could be fun are some unpredictability/surprises to what the captain does.
Typical tradeships should look at the opposition and mostly flee I guess.
@linolafett
Really glad to hear this, and I'm also looking forward to take a peek at what's been done - might learn some new tricks with the engine
I'm just doing this for fun - to directly see the result of those code snippets in 3D space is fascinating.
It selects Balor and Sucellus specifically and sets some parameters for each. The movement code is generic. This so each one can be tuned a bit for ranges and behavior without too much code duplication.
@Sparky
Have been thinking about different strategy for each ship type. B/S as artillery ofc, taranis as hit&run destroyers maybe, carriers should keep their distance etc. Maybe do some suicide run thing when hull is below x% for captains with high morale too maybe. Been tossing around some ideas - what could be fun are some unpredictability/surprises to what the captain does.
Typical tradeships should look at the opposition and mostly flee I guess.
@linolafett
Really glad to hear this, and I'm also looking forward to take a peek at what's been done - might learn some new tricks with the engine
I'm just doing this for fun - to directly see the result of those code snippets in 3D space is fascinating.
-
- EGOSOFT
- Posts: 3363
- Joined: Mon, 26. Mar 12, 14:57
Asked our AI guy again, the change is currently not live ingame, but on his machine. So not jet to test in the beta.
This change will take weaponrange into account, so all ships with huge weaponranges will not fly close to stations and enemyships, at least they try to avoid them. For a arawn the change might not be visible, but the balor for sure. I dont know about flight pattern changes though, so your mod may be still a nice addition
This change will take weaponrange into account, so all ships with huge weaponranges will not fly close to stations and enemyships, at least they try to avoid them. For a arawn the change might not be visible, but the balor for sure. I dont know about flight pattern changes though, so your mod may be still a nice addition
-
- Moderator (English)
- Posts: 8074
- Joined: Tue, 30. Mar 04, 12:28
-
- EGOSOFT
- Posts: 3363
- Joined: Mon, 26. Mar 12, 14:57
-
- Moderator (English)
- Posts: 8074
- Joined: Tue, 30. Mar 04, 12:28
- werewolves?
- Posts: 1166
- Joined: Tue, 31. Jan 12, 00:58
@werewolves?
Have a rough prototype in the works which does such evasion - starts to move away a bit earlier when enemy hull gets below a certain %.
Also have somewhat the opposite where a captain may decide to start a suicide run and try to get as close as possible to the enemy before they explode. This requires high morale or are machine (i.e. xenon), and check happens when their hull gets below x%.
Also have a panic mode implemented where the captain may decide to bravely run away if low morale (xenon will never do this). + are thinking about how to put some additional random madness in there
The goal is if the battle is replayed (and observed from a distance) it will not end up the same way twice.
And are working on a framework for different strategy selection based on skill, ship type and opposition among other things - lots of ideas, only some are implemented yet.
Have a rough prototype in the works which does such evasion - starts to move away a bit earlier when enemy hull gets below a certain %.
Also have somewhat the opposite where a captain may decide to start a suicide run and try to get as close as possible to the enemy before they explode. This requires high morale or are machine (i.e. xenon), and check happens when their hull gets below x%.
Also have a panic mode implemented where the captain may decide to bravely run away if low morale (xenon will never do this). + are thinking about how to put some additional random madness in there
The goal is if the battle is replayed (and observed from a distance) it will not end up the same way twice.
And are working on a framework for different strategy selection based on skill, ship type and opposition among other things - lots of ideas, only some are implemented yet.
- YorrickVander
- Posts: 2702
- Joined: Tue, 29. Oct 13, 21:59
The major issue I see with current ai is that the movement 'to' position is calculated at far too long an interval. Ships will try to park in their target as the target moves but the move to point is not updated; conversely the attacker can fly past the target by some km and back out of weapon range again....
The second issue is relative speed. watching 2 olmekrons fail to catch a k while it flies to a target in the opposite direction to the defending caps is tragic to watch. EDIT especially since the escort ai is too primitive to take off and maybe knock out some engines to prevent it's escape.
Looking forward to comparing your results with clj's and eventually ES's
The second issue is relative speed. watching 2 olmekrons fail to catch a k while it flies to a target in the opposite direction to the defending caps is tragic to watch. EDIT especially since the escort ai is too primitive to take off and maybe knock out some engines to prevent it's escape.
Looking forward to comparing your results with clj's and eventually ES's
X Rebirth - A Sirius Cybernetics Corporation Product
Split irritate visiting pilot with strange vocal patterns.
Split irritate visiting pilot with strange vocal patterns.
-
- Moderator (English)
- Posts: 8074
- Joined: Tue, 30. Mar 04, 12:28
Sir Robin approves of thiscicero111 wrote: Also have a panic mode implemented where the captain may decide to bravely run away if low morale (xenon will never do this). + are thinking about how to put some additional random madness in there
The goal is if the battle is replayed (and observed from a distance) it will not end up the same way twice.
http://2.bp.blogspot.com/-893YnvA1d8o/T ... _small.jpg
Sucellus VS Xenon K
Sucellus runs at full speed while trying to turn towards its target, this is the fail.
An artillery needs to stay put and turn towards its target. If not in range by then, move closer, if in range, let em have it and reverse if target still coming towards you. Once too close, full throttle and do a fly-by to gain x-distance. Then again, turn in place and use the range.
Sucellus runs at full speed while trying to turn towards its target, this is the fail.
An artillery needs to stay put and turn towards its target. If not in range by then, move closer, if in range, let em have it and reverse if target still coming towards you. Once too close, full throttle and do a fly-by to gain x-distance. Then again, turn in place and use the range.
-
- Moderator (English)
- Posts: 8074
- Joined: Tue, 30. Mar 04, 12:28
@YorrickVander
Yup, that long update interval does not work good in "close combat" situations. Are experimenting with different strategies, update intervals and interrupts based on ranges, ship type and hull/shield states on both sides.
On close range evade strategy (enemy hull below 15%) I've removed the target destroyed interrupt to avoid them stopping to take a close look at the explosion if no new targets, and using a fixed "runaway" timer instead.
@swatti
The mod should do this + are coming in ego's new AI package too.
Ranges for Sucellus in current alpha is:
Maxdistance: 7500
Holddistance: 3500
Minimum distance: 1000.
For station targets the ranges are increased with 2KM.
It will prefer to be between max and hold distance ranges (hold position/rotate to target), start reversing when between hold and minimum, and break off and try to gain distance when below minimum. Have changed minimum range to 2KM in the version I'm working on now.
Yup, that long update interval does not work good in "close combat" situations. Are experimenting with different strategies, update intervals and interrupts based on ranges, ship type and hull/shield states on both sides.
On close range evade strategy (enemy hull below 15%) I've removed the target destroyed interrupt to avoid them stopping to take a close look at the explosion if no new targets, and using a fixed "runaway" timer instead.
@swatti
The mod should do this + are coming in ego's new AI package too.
Ranges for Sucellus in current alpha is:
Maxdistance: 7500
Holddistance: 3500
Minimum distance: 1000.
For station targets the ranges are increased with 2KM.
It will prefer to be between max and hold distance ranges (hold position/rotate to target), start reversing when between hold and minimum, and break off and try to gain distance when below minimum. Have changed minimum range to 2KM in the version I'm working on now.