Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.95.1a is out! (12/10/21); Blog post: The Pilgrim's Path (07/19/22)

Author Topic: Odd AI Behaviors in Sim  (Read 1496 times)

xenoargh

  • Admiral
  • *****
  • Posts: 4931
  • naively breaking things!
    • View Profile
Odd AI Behaviors in Sim
« on: March 09, 2015, 10:07:09 AM »

Basically, when I'm testing my latest AIs in the Sim, the AIs attached to ships generated by the Sim fleet operate just fine, but when I take my tested ship and put it onto AI behavior, I often have to put it onto AI control more than once to get it to behave as expected. 

It also suddenly seems to lose the target and just wanders around at random times.  It's almost like it can sense the other ships that haven't spawned, or something else is interfering with its operation, or the Vanilla AI is running at the same time as my AI, and they are giving contradictory steering orders, resulting in bad behavior.

In battles, the AI is working just fine... I think.  It's certainly killing me very well now, lol.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20578
    • View Profile
Re: Odd AI Behaviors in Sim
« Reply #1 on: March 09, 2015, 10:23:42 AM »

Just took a quick look, and I don't see what could be causing this. The autopilot-related code should use the custom ai (i.e. it's not hardcored to use the standard AI or anything like that), and it doesn't seem to be aware of where it's in a simulation or not.

It's also not really possible for multiple AIs to control the same ship. Rather, it IS possible, but you'd have to really try - i.e. create a ship AI, not assign it to a ship, and keep .advance()ing it yourself. The code that assigns your custom AI to the player's ship is exactly the same code that assigns the vanilla AI to it, the only difference is which AI got picked.

Hmm. Maybe there's something in your AI that's (unintentionally, perhaps) side-specific?
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 4931
  • naively breaking things!
    • View Profile
Re: Odd AI Behaviors in Sim
« Reply #2 on: March 09, 2015, 01:15:41 PM »

I will look at the side-specific issues; I finally wrote a comber utility so that sides other than 0 / 1 are explicitly controlled, so that may well be it.  Thanks for your insight :)
Logged
Please check out my SS projects :)
Xeno's Mod Pack