AI controls for Newtonian-physics space flight
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!
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?
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?
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.
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.
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.
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.
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.
-------------------------------------------"Oh no! It's a Parabola of Mystery!!" - RvB | Blog
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.
Some form of A* could definitly work, but it might not be very effecient if there were lots of thrusters.
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
Why make such a small part of the game such a huge project, eh?
Keep It Simple & Stupid !! :D
----------------------~NQ - semi-pro graphical artist and hobbyist programmer
It seems to me that if you managed to pull this AI off with a reasonable amount of accuracy, you may be able to apply the code to other applications. for example: if you created a model and set the thrusters to a fixed position, you would be able to emulate the old apollo capsules. You could also adapt it to be used on smart bombs. Just a thought...
Chances are, if you are using a 'buzzword' process for this, you are doing overkill.
So, you give input to your computer, the computer looks at what forces it requires to complete the input you give, and then compares that to all your thrusters and where they are. If you have some that can provide the required thrust as asked, but are not already in the needed position, then you look at where they are now, and what you will have to do to get them in position.
Keep the systems SIMPLE! don't try for overkill on anything. Anything that you do, and it makes you think "Hey, this is really rather hard and complex" then you should likely start looking at it from another angle, as chances are, you're doing it wrong.
So, you give input to your computer, the computer looks at what forces it requires to complete the input you give, and then compares that to all your thrusters and where they are. If you have some that can provide the required thrust as asked, but are not already in the needed position, then you look at where they are now, and what you will have to do to get them in position.
Keep the systems SIMPLE! don't try for overkill on anything. Anything that you do, and it makes you think "Hey, this is really rather hard and complex" then you should likely start looking at it from another angle, as chances are, you're doing it wrong.
Old Username: Talroth
If your signature on a web forum takes up more space than your average post, then you are doing things wrong.
If your signature on a web forum takes up more space than your average post, then you are doing things wrong.
In my space-flight game I was also going to use newtonian flight, but I wasn't planning on using AI to control the thrusters, just simple math.
You'll need 14 stationary (non-rotatable) thrusters in all:
5 in the nose: foreward (brake)(1), left(2), right(3), up(4), down(5)
5 in the stern: main thruster(6), left(7), right(8), up(9), down(10)
2 on the left wing: up(11), down(12)
2 on the right wing: up(13), down(14)
The thrust from each thruster is "normalized", that is a thruster that is 2 m from the center of rotation must be twice as powerful as a thruster that is 4 m from the center.
To pitch down you fire the 4 and 10 thrusters, pitch up is 5 and 9.
To yaw left you fire 3 and 7, right is 2 and 8.
To roll cw you fire 12 and 13, ccw is 11 and 14.
If you need more thrusters you can place 2 more on each wing pointing forward and backward. These can be used for yaw in addition or instead of the nose and stern ones.
If you want to stop the motion once the player release the stick you must cancel out the rotation you've got. Example, if the player yawed up for 5 seconds at 20% power you must yaw down for 5 seconds at the same power or 1 second at 100% power.
Another option that would be easier for the player is to fire the thrusters at X power for 1 second when he moves the stick, then shut it off and cancel the rotation when he centers the stick. This would cause a rotation at a steady rate.
If say the nose thrusters are destroyed, the player could still yaw, pitch and roll, but yaw and pitch would also cause the ship to slide sideways.
You'll need 14 stationary (non-rotatable) thrusters in all:
5 in the nose: foreward (brake)(1), left(2), right(3), up(4), down(5)
5 in the stern: main thruster(6), left(7), right(8), up(9), down(10)
2 on the left wing: up(11), down(12)
2 on the right wing: up(13), down(14)
The thrust from each thruster is "normalized", that is a thruster that is 2 m from the center of rotation must be twice as powerful as a thruster that is 4 m from the center.
To pitch down you fire the 4 and 10 thrusters, pitch up is 5 and 9.
To yaw left you fire 3 and 7, right is 2 and 8.
To roll cw you fire 12 and 13, ccw is 11 and 14.
If you need more thrusters you can place 2 more on each wing pointing forward and backward. These can be used for yaw in addition or instead of the nose and stern ones.
If you want to stop the motion once the player release the stick you must cancel out the rotation you've got. Example, if the player yawed up for 5 seconds at 20% power you must yaw down for 5 seconds at the same power or 1 second at 100% power.
Another option that would be easier for the player is to fire the thrusters at X power for 1 second when he moves the stick, then shut it off and cancel the rotation when he centers the stick. This would cause a rotation at a steady rate.
If say the nose thrusters are destroyed, the player could still yaw, pitch and roll, but yaw and pitch would also cause the ship to slide sideways.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement