- #1

- 5

- 0

Hello, everyone!

After searching a lot(!) about this topic on google and wikipedia, I started to actively look for a forum to ask my question, since I don't even know the correct description of the values I'm searching. I hope that you can help me out :) I'm aware that this is not a programmer's forum, but I might need to use some terms from that domain.

Creating a 2d computer simulation of spaceships, controlled by a genetic algorithm.

Here is a link to Smart Rockets, which uses a couple of concepts I plan to implement myself.

Creating a 2d spaceship with thrusters, controlling movement and rotation by (de)activating these thrusters.

A spaceship with thrusters attached to it. These thrusters are attached to the spaceship at various locations, and are rotated by certain angles. When turned on, they determine the acceleration (vector) of my spaceship. To get the total acceleration at a certain point in time, I add each vector of all active thrusters together.

Rotation. I have absolutely no idea, how I can apply rotation to my ship in a realistic way.

I even did a couple of drawings trying to visualize all that for myself, but got nothing useful out of it.

Assuming that my active thruster is in the center of the backside of my (symmetrical) ship, the ship will accelerate to where it's nose is pointing. No rotation is applied here (Please correct me, if I'm wrong).

In case there are two thrusters attached symmetrically at the back of my ship, both of them slightly offset from the center, the ship should start to turn, in case only one thruster is active. Left thruster engaged -> Ship turns clockwise. Right thruster engaged -> Ship turns counter-clockwise. Both thrusters are engaged -> No rotation. Apart from the rotation, the ship moves forward at the same time. Again, I might be wrong here, but engaging both thrusters should yield roughly double the forward speed of a single thruster engaged.

I also want to go further than this... If a thruster is rotated, the force is applied differently (obviously). As I imagine it, the further away the thruster is from the center, the more impact on rotation it would have. In case the thruster is in the center, the ship would simply move in the direction it points, without applying any rotation.

As it seems, I'm looking for a formula, which takes into account not only the rotation, but also the position of the engines, in respect to the center of the ship.

As I said above, please help me to fix any mistakes I made until now...

-] What is the "center" of the ship? Is it correct to assume the center of the ship's mass?

-] How do I calculate the rotation of the ship correctly, depending on the thrusters' power? If possible, I'd need a formula, or at least a name, so I can search for that formula...

-] Does rotating the ship as a sideeffect of engaging a thruster decrease the ship's acceleration in terms of forward movement, if yes, how big is the effect, or how to calculate it?

I want to thank you all in advance for your help, should you need any additional information, just ask :)

After searching a lot(!) about this topic on google and wikipedia, I started to actively look for a forum to ask my question, since I don't even know the correct description of the values I'm searching. I hope that you can help me out :) I'm aware that this is not a programmer's forum, but I might need to use some terms from that domain.

__My ultimate goal:__Creating a 2d computer simulation of spaceships, controlled by a genetic algorithm.

Here is a link to Smart Rockets, which uses a couple of concepts I plan to implement myself.

__My midterm goal:__Creating a 2d spaceship with thrusters, controlling movement and rotation by (de)activating these thrusters.

__What I got so far:__A spaceship with thrusters attached to it. These thrusters are attached to the spaceship at various locations, and are rotated by certain angles. When turned on, they determine the acceleration (vector) of my spaceship. To get the total acceleration at a certain point in time, I add each vector of all active thrusters together.

__What I still need:__Rotation. I have absolutely no idea, how I can apply rotation to my ship in a realistic way.

I even did a couple of drawings trying to visualize all that for myself, but got nothing useful out of it.

Assuming that my active thruster is in the center of the backside of my (symmetrical) ship, the ship will accelerate to where it's nose is pointing. No rotation is applied here (Please correct me, if I'm wrong).

In case there are two thrusters attached symmetrically at the back of my ship, both of them slightly offset from the center, the ship should start to turn, in case only one thruster is active. Left thruster engaged -> Ship turns clockwise. Right thruster engaged -> Ship turns counter-clockwise. Both thrusters are engaged -> No rotation. Apart from the rotation, the ship moves forward at the same time. Again, I might be wrong here, but engaging both thrusters should yield roughly double the forward speed of a single thruster engaged.

I also want to go further than this... If a thruster is rotated, the force is applied differently (obviously). As I imagine it, the further away the thruster is from the center, the more impact on rotation it would have. In case the thruster is in the center, the ship would simply move in the direction it points, without applying any rotation.

As it seems, I'm looking for a formula, which takes into account not only the rotation, but also the position of the engines, in respect to the center of the ship.

As I said above, please help me to fix any mistakes I made until now...

**Here are my actual questions:**-] What is the "center" of the ship? Is it correct to assume the center of the ship's mass?

-] How do I calculate the rotation of the ship correctly, depending on the thrusters' power? If possible, I'd need a formula, or at least a name, so I can search for that formula...

-] Does rotating the ship as a sideeffect of engaging a thruster decrease the ship's acceleration in terms of forward movement, if yes, how big is the effect, or how to calculate it?

I want to thank you all in advance for your help, should you need any additional information, just ask :)

Last edited: