Jump to content

(Question) Increase update frequency of the update functions in ai?


tangowrangler

Recommended Posts

Current questions:

1. Can I increase the update frequency of update functions in the ai scripts?

 

 

 

I was hoping someone who has experience or insight into the ShipAI object can help me out. I want to be able to give the ship i am currently on orders. So I modified the check in craftorders.lua which prevents the option of ordering my ship while i am in it. Sadly my ship still does not do the AI tasks while i am on it. I tested using the patrol sector by putting some print commands to check if my script is being run and it is.

 

When I leave the ship, it starts with the task (ie the patrol). Interestingly, when i get back on, it does not come to a stop, instead it keeps the THE VELOCITY as long as i dont give it any other control inputs. Note that it does not do the Patrol, it only keeps the last commands that the script gave them. This leads me to believe, it must be possible to give my ship velocity commands while I am onboard. I also found that the Entity object has the properties desiredVelocitycontrolActions and aimedPosition which maybe the things i need to modify.

 

Findings 9th April: The desiredVelocity and controlActions are sufficient to give the boarded craft all the motion commands. One must be in the keyboard control for them to occur though. the first parameter is self-explanatory; the second one represents the angular and the translational thruster commands. I tried manipulating a number of other variables but they didnt seem to influence the velocity. This effectively answers question 2.

I was able to introduce changes to the velocity (and potentially angular velocity) by making a Velocity() object. This is not what i want, because i think that object is there to simulate external forces causing changes to the craft states.

My current goal is to find some kind of looping to make my craft face and head towards sth, sth i am targeting. I plan to achieve this by using if statements in an update function.

 

Update 9th April: RIght now i am trying to get my craft to face a target using the primitive control actions. I managed to extract the required yaw and pitch to face a target (took a whole day of work and gave me new found respect for the devs). However, since the function only allows me to set the pitch values once every second, it cannot control it. i.e. it keeps overshooting if u have relatively fast pitching. So now i am looking for a way to control the update rate of the update  functions in ai. Any help will be appreciated.

 

Edit: DIscussion moved to mod thread http://www.avorion.net/forum/index.php/topic,3319.0.html

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...