Author Topic: Can a ship have multiple AIs?  (Read 1466 times)

0 Members and 1 Guest are viewing this topic.

Offline T-Man

  • 210
  • I came... I saw... I had a cuppa!
Can a ship have multiple AIs?
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)?
Also goes by 'Murasaki-Tatsu' outside of Hard-Light

UEF fanboy. Rabid Imagination.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Can a ship have multiple AIs?
Turret AI class has no effect anywhere in the game. But that's not quite what you mean...

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Can a ship have multiple AIs?
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.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.