Future Drone AI Discussion
Posted: Wed Feb 04, 2015 3:08 pm
This topic came to mind when looking at the No Captain Mode discussion, but I thought I'd like to throw in my two cents about what the wraith AI should look like -- or rather, the psuedocode I suppose. Figured in my head it would look something like this. (Hope it makes sense and/or is useful.)
Interior Ship Check
... this is far from perfectly described, but more than anything I suppose this meant to primarily be an idea, or a framework for discussion; just so the exact details can be picked over.
Interior Ship Check
- Are there 3 decoy flares total between the drone's inventory and spread out upon the BC?
- If so pick up decoy flares until 3 are in inventory before proceeding.
- If not, create decoy flares until 3 are available and repeat this check.
- Is there an available wraith?
- If not, linger until there is one available
- A wraith is available - is it fully loaded with decoy flares?
- If not, move decoy flares from inventory onto the wraith until it is full.
- Launch the wraith. Proceed to exterior ship checks.
- If another check is running, do nothing.
- Periodically run a health check.
- Whenever an enemy unit comes into vision, run a combat check.
- Whenever a battlecruiser ping occurs, run a hunt check.
- Whenever a miner is being attacked, run a battle check.
- Is there an object in space within a proximity of X?
- If so, perform an object density test. Create a new pathing away from the center of mass.
- If energy is below 20%, create a new pathing to the battlecruiser.
- Otherwise, if above 50% power and within a proximity of X units to the battlecruiser, take a sample of all allied miners on the map beyond a range of X units from the battlecruiser.
- If there are any beyond this range, create a new pathing to a randomly that unit.
- Is life below 70%?
- If not, do nothing.
- If so, create a new pathing to the battlecruiser.
- If the battlecruiser is within docking distance, dock. Then perform an interior ship check.
- Has it been at least 30 seconds since a wraith has performed a miner ping?
- If so, wait one second and then perform a miner.
- Are there any miners with no non-miner pings within a distance of X units from them?
- If so, create a new pathing to that point.
- Is there a ship being attacked within a distance of X units?
- If so, create a new pathing to that ship.
- If that unit dies, are there any other allied ships in a proximity of X units?
- If so, create a new pathing to that ship.
- Otherwise, cancel the current pathing.
- Are there incoming projectiles?
- If so, perform an object density test. Side thrust to the side which yields the lower density.
- Is health below 30%?
- Take a sample of all enemy offensive combat ships in the area. Check if their total health is greater than the wraith's.
- If so, create a new pathing back to the battlecruiser.
- Take a sample of all enemy offensive combat ships in the area. Check if their total health is greater than the wraith's.
- Otherwise, take a sample of enemy units within firing range. Are there any?
- If not, consider the check complete.
- If so, are they across the map wrap?
- If so, create a new pathing across the map wrap.
- If not, face the closest ship and fire as frequently as possible.
- Is the ship beyond a distance of X?
- If so, raise engines.
- Is the wraith's EMP available?
- If so, fire.
- Is the wraith's EMP available?
- If so, raise engines.
- Is the ship within a distance of X?
- If so, lower throttle to a % relative to the distance between the wraith and the target.
- Is the ship beyond a distance of X?
- Wait x seconds and re-perform this check.
- Is there a hostile target in vision range?
- Is health above 30%?
- If so, cancel the current pathing and run a combat check.
- Is the wraith's EMP available?
- If so, fire.
- Is health above 30%?
- Otherwise, is the designated unit or position within a proximity of X units?
- If so, cut throttle and consider the pathing complete.
- If not, up maximize throttle and perform an object density test.
- If the center of mass is within a 20 degree cone of the wraith's heading, run parallel to the center of mass for 1 second, and then check the pathing again.
- Otherwise, continue flight in the intended direction.
- Take a sample of all objects in space within a distance of X of an input ship.
- Return the angle from the ship to the center of mass of these objects.
... this is far from perfectly described, but more than anything I suppose this meant to primarily be an idea, or a framework for discussion; just so the exact details can be picked over.