Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: T-Man on July 03, 2016, 05:40:17 am

Title: Can a ship have multiple AIs?
Post by: T-Man on July 03, 2016, 05:40:17 am
I was thinking of re-doing my Custos-X-AI project so it uses the model from the latest version of BP, but had a sudden thought related to it. You have player ships with working AI turrets without trying to fight the player's control, and I get the impression that turrets are independent of their ship AI (I don't know much about the AI)?

Could a similar system be used to give a ship in effect two AIs, of different types, and establish restrictions on what each of them can do? So for example a Custos-X with a 'cruiser' AI that has normal ship control and then a 'fighter' AI that is locked out of anything other than the primary mounts on the ship (which the cruiser AI doesn't recognise and so doesn't fire)?

I defer to the experts (i.e. people who unlike me actually know about the AI :lol:). Is this feasible? Would it be harder than trying to teach cruisers to use primary mounts (which would be an alternative, assuming that is feasible too)?
Title: Re: Can a ship have multiple AIs?
Post by: General Battuta on July 03, 2016, 09:40:07 am
Turret AI class has no effect anywhere in the game. But that's not quite what you mean...
Title: Re: Can a ship have multiple AIs?
Post by: AdmiralRalwood on July 03, 2016, 03:44:10 pm
I was thinking of re-doing my Custos-X-AI project so it uses the model from the latest version of BP, but had a sudden thought related to it. You have player ships with working AI turrets without trying to fight the player's control, and I get the impression that turrets are independent of their ship AI (I don't know much about the AI)?

Could a similar system be used to give a ship in effect two AIs, of different types, and establish restrictions on what each of them can do? So for example a Custos-X with a 'cruiser' AI that has normal ship control and then a 'fighter' AI that is locked out of anything other than the primary mounts on the ship (which the cruiser AI doesn't recognise and so doesn't fire)?

I defer to the experts (i.e. people who unlike me actually know about the AI :lol:). Is this feasible? Would it be harder than trying to teach cruisers to use primary mounts (which would be an alternative, assuming that is feasible too)?
That's... not really how the AI works. I mean, what you call "cruiser AI" is actually a different function getting called in the AI code (specifically, if the ship class's AI bool set includes STI_AI_ATTEMPT_BROADSIDE, then ai_chase() will defer to ai_cruiser_chase(), which includes no provisions for firing non-turret weapons). On the one hand, they are different types of AI; on the other hand, it's not because of different AIs getting "assigned" to the ship, it's because all ships are running the same code, and that code checks attributes of the ship it's running on (as well as its AI class and various AI profile settings) to determine how it behaves.