Jump to content
  • Advertisement
Sign in to follow this  
Foxostro

AI controls for Newtonian-physics space flight

This topic is 4805 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to create an AI system to help the player in my latest project pilot a space craft that is forced to obey the laws of Newtonian physics: I have a craft of known mass and moment of inertia drifting in the vaccuum of space. It will have an arbitrary number of thrusters placed at any arbitrary location on the outer surface of the ship. Each thruster has a range of directions in which it can be oriented, but may not be oriented so as to fire into the ship's hull. My problem is control of this vehicle. There may be a dozen thruster assemblies on the surface of the player's ship, and that is far too much to force a person to keep track of. I want to design a system that can rotate the ship to any desired orientation so that the ship's engines may then push the ship to it's destination. Ideally, the player pulls back his joystick and this AI system will command the thrusters in such a manner as to pitch the ship up as best as it can. If each thruster could be oriented in any direction at all, even into the ship itself, I would accomplish this by calculating the torque needed to turn the ship where I want. But instead, I would like the player to face situations where thrusters are viable targets on eachother's ships. I want it to be possible to destroy indivual thrusters and hinder a ship's maneuverability. Making it impossible for an opponent player to pitch up, or stop a roll, for example. I was reading the "Dogfighting AI" thread to get some ideas for how I can do this. But the articles presented in this thread (namely "Creating a Dogfight Agent") are mainly concerned with modern airplanes that have elevators, airelons, and so on, that are not related to this problem. Also, I do not need to determine the proper maneuver to perform, this system is only acting as a semi-auto-pilot for the player. The best solution I could come up with was training a neural network to fire thrusters in order to keep the ship oriented properly. I don't really have any experience with neural nets, can they keep track of a large number of inputs? Such as yaw, pitch, throttle for 12-20ish thruster assemblies at a time? Would a neural network react quickly to the loss of a thruster assembly, or would the ship behave stranglely for a few minutes after a minor system was smeared on the hull by a passing asteroid? I would prefer a nice straight-forward system to netural nets too. I don't like the idea of an AI system that I can't easily debug :( Most importantly, neural networks seem like a very n00b-ish technology to ask about in these forums. I do NOT want to appear foolish, I'm just stumped :/ So I thought I's try polling GameDev for thoughts. You guys seem to have a lot of good ones. Thank you for the your time and patience!

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
You know where you wnat to be (direction), you know where you are (direction), you know where each thruser is(direction), so pick the thrusters that provide the 'best' removal of thrust. Maybe a modification of a*, where your goal state is where you are at the right direstion, and your cost is how far you are away from it.

Czar of #Czar.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You know where you wnat to be (direction), you know where you are (direction), you know where each thruser is(direction), so pick the thrusters that provide the 'best' removal of thrust. Maybe a modification of a*, where your goal state is where you are at the right direstion, and your cost is how far you are away from it.

Czar of #Czar.

Share this post


Link to post
Share on other sites
A* sounds intriguing. I'm going to google this a while. Until now I was looking to Neural Nets and Calculus-style optimization.

So it would be kinda like searching for the best path to the goal, but that each "move" is actually a firing of different combinations of thrusters and the goal is the desired orientation of the ship?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Can the individual thrusters be turned instantly, or does it take some time to orient them in a desired angle?

Share this post


Link to post
Share on other sites
As this moment, my code is a mess of stub functions and scribbled notes on paper. So, I guess for simplicities sake, I'll make thrusters aim themselves instantly.

Share this post


Link to post
Share on other sites
could you use some kinda of neural net, and train it to thrust properly depending on the inputs you give it, and you train it by having another ship or something that rotates on the ships axis etc, without the use of thrusters, just you coding it, so then you have a model to which the nn should copy.

I don't know what kind of nn would be best for this, im still learning all the different types... but if anyone knows..

Because I am going to have this same problem pretty soon, I thought to just put thrusters in basic points and manually decide which ones thrust depending on the input.

Share this post


Link to post
Share on other sites
I advocate the use of multiple nets. Have a net that translates the players input command to an output response. Take that reponse and feed it to other nets attached to separate thrusters. The correct thrusters that fire properly will be given a positive response and the ones that dont a slap in the proverbial face. Discipline the incorrect thruster nets that do fire.

Or instead of a supervised net(s), use a GA that has a fitness function that determines whether the response given by the nets was correct and got the payer to where he wanted to go, or discipline that badly performing nets that don't.

I just picked up the same idea youv'e had for a newtonian space sim. Hope that helps.

Share this post


Link to post
Share on other sites
This sounds to me like something that could be done mathematically. If you could determine where each thruster needed to be and how fast each thruster needed to be going when it got there you could have each of the thrusters aim for its own goal completely diregarding the other thrusters. To avoid having them fire into the ship you could simply turn off the ones that would fire into the ship. This method would probably work better the more thrusters there were so I expect the player would definitly have some trouble controlling if alot of their thrusters were destroyed.

Some form of A* could definitly work, but it might not be very effecient if there were lots of thrusters.

Share this post


Link to post
Share on other sites
If you want to get done anytime this millenia then I suggest you treat the thrusters individually. Each thruster believes itself is the only thruster on the ship. With that as a base it shouldn't be very hard to calculate how it should be oriented.

Why make such a small part of the game such a huge project, eh?
Keep It Simple & Stupid !! :D

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!