Not a member yet? Why not Sign up today
Create an account  

  • 3 Vote(s) - 4.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 
Cinematic aircraft AI. 2.0: dogfights galore

#11
Nice job LoSboccacc! I love aerobatic maneuvers with jets and have actually thought about making a similar script just to try with my own planes (now maybe I don't have to! Tongue).

I suggested this a possible addition to Madwands AI and he offered the response that while possible is likely not practical in many battle scenarios. I can see that point as well, but since half of this game is watching your creations at work - if it could be done effectively, it would be something fun to watch. I'll look forward to seeing how your script progresses and matches up against some of the AIs currently out there. Good luck with the continued development!

In the meantime, I will have to give this a spin with some of my jets and see what happens Tongue Cheers!

(P.S. In the video your plane is oscillating it's pitch while chasing the squirrel down. Is this caused by your own flying pattern, the script, or perhaps tpg of the squirrel movements? Was a bit curious on that.)
Reply

#12
Oscillation happens because I've yet to figure out oscillation dampening. For cannons to fire without mantlet I need aggressive attitude holding which means overcorrecting.

Should be fixed after I get around to clamping the integrative term of the controller. Easily said than done sadly. And needs to autotune for different aircraft.

I'd love to work with Madwand but our script got a very different implementation of the director. I work with vectors, he with angles.

His script is way better, handles bigger planes better, handles planes with insufficient authority to roll above a certain angle and fly etc.

Each approach enabled some feature and moving them from one script to another is gonna be hard
Reply

#13
I'm always quite impressed with Madwands script - but since it's built to be used with almost any aircraft, it likely makes it a bit difficult to implement certain features that would work for all the script users.

On the flipside, maybe your scripts focus on those specifics (like the one in this thread being capable of aerobatic maneuvers). Then both the scripts basically have different purposes and hopefully people can enjoy both concurrently.

Lastly, on the subject of oscillation - one thing I've done before (which I'm pretty sure I got the idea from looking at Madwands script) -- is to use the angular velocity to scale your pitch/roll values. So the faster your pitching/rolling, the more thrust you can apply to counteract it.

This code might be of use (just quickly grabbed from an old script):

Code:
function Balance(I)
  local rs = math.min(math.abs(self.roll)/scaleRollSpeed,1)
  local ps = math.min(math.abs(self.pitch)/scalePitchSpeed,1)
  local a = I:GetLocalAngularVelocity()
  if self.roll>maxRollAngle and a.z>-maxRollSpeed then I:RequestControl(2,rRight, rs)
  elseif self.roll<-maxRollAngle and a.z<maxRollSpeed then I:RequestControl(2,rLeft, rs) end
  if self.pitch>maxPitchAngle and a.x<maxPitchSpeed then I:RequestThrustControl(pDown, ps)
  elseif self.pitch<-maxPitchAngle and a.x>-maxPitchSpeed then I:RequestThrustControl(pUp, ps) end
end

--Sorry about the lack of comments in here.  If you have any questions about variables/value/ect. just let me know!
Reply

#14
You can use my simplex algorithm for tuning.
And my PID got windup prevention as well.
Reply

#15
(2015-11-01, 08:20 PM)Arekku Wrote: You can use my simplex algorithm for tuning.
And my PID got windup prevention as well.

gonna try. do I need a simplex factory for each pid? (I have three dof, need to create three pid controller)

edit:

wait, isn't the algorithm doing a downhill search? can't I just plug the control value directly and use the deviation angle as score?
Reply

#16
You need one factory, but it needs to create one optimizer per pid.

And it is a downhill search.
Reply

#17
ok tested it out and doesn't work. I mean, it works unless you get in space or water or you get a lot of direction changes, then the optimizer gets confused by the insurmountable error increase

the problem here is that pid works well to reach stability to a set point, and I'm using it to follow a moving target. pid kind of work, but the optimizer is confused between error created by pid constants and error caused by the target moving and the plane reacting slowly to input


probably gonna just use your pid class with the clamping, which already work a lot better than what I had, and revisit optimization later.
Reply

#18
Maybe you can use tuner while there are no targets to follow?

And if possible I'd like a copy of the failed code so I can see if I can make some improvments.
Reply

#19
Nice work. I'm not sure what extra features you may have added that mine does not, but I'm interested in seeing if my AI can be improved by adding some of the features recent Lua coders have developed. It's not hard to translate between vectors and angles, my code does it in several locations, most notably in the Flocking function. I certainly encourage you to see if we can merge some functionality.
Reply

#20
(2015-11-01, 10:53 PM)Arekku Wrote: Maybe you can use tuner while there are no targets to follow?

And if possible I'd like a copy of the failed code so I can see if I can make some improvments.

hi here is the code with the optimizer enabled

http://pastebin.com/ehTNp9Pq

Madwand Wrote:I'm not sure what extra features you may have added that mine does not

just one: it align the plane to the cannon firing angle so cannons can fire without using mantlets and angling the barrel, which looks ugly

looping split s and other cool features emerge from the plane trying to keep the up side into the turns, even if the turn plane is vertical, but that doesn't count as 'feature' Tongue

v0.9:

- removed dependency on the aerial card which was messing with water level dive attacks

- some check to avoid 'sharking' around a target indefinitely

- terrain avoidance code

- uses the AWESOME PID Controller from Arekku
( see http://www.fromthedepthsgame.com/forum/s...?tid=11767 )

http://pastebin.com/YnjfEKgm
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)