More realistic thruster actions - force and moment

Discuss all things Battleships Forever that aren't Ships and Shipmaker - Missions, Development, etc.!

Moderators: th15, Moderators

AnnihilatorX
Commander
Commander
Posts: 116
Joined: Sat Mar 01, 2008 3:49 am

More realistic thruster actions - force and moment

Post by AnnihilatorX »

In BSF 0.9, we saw the introduction of new thruster fields of angle arc, which determines the range of angle that the thruster will fire relative to ship facing, similar to weapon arc. The further away from the ideal angle, the less the thruster effect appears. This is all cool and nice until you consider the following:

The single valued angle arc setting does not allow you to say, have thruster left side of the ship fires when turning right and vice versa. Nor it does allow us to have thrusters that have stronger output if it's further away from centre during rotation. A thruster facing backwards and angle offset other than the simple 0, 90, 180, 270 cases will sometime result in completely wrong application of thrusters.

I propose a proper utilisation of mathematics to create realistic thruster action. You should read the following only if you understand rotational moments and the difference between translational and rotational accelerations, and vector mechanics; otherwise it'd be a waste of your time :) .

Ideally, a thruster off centre should have stronger effect with greatest turning moment. The turning moment is found by thruster force * the shortest perpendicular distance from the thruster's facing axis and the ship's centre point. The longer this length is, the stronger the thruster's contribution to the rotational action. This should translate to a more pronounced thruster effect (Note that the thruster force is the unknown here and what we want to realistically display). This is due to the fact that if you want the ship to rotate spending the least amount of fuel to get the most rotation done, you put all your energy in firing the thruster that contribute most rotational moment.

For translational movements, the thruster effect scale should be implemented as well for the above reason. This is relatively easy. The cosine of angle between the offset (facing) of the thruster (the offset needs to subtract 180 degrees but this is irrelevant to the point of discussion) and the x component of ship's acceleration vector is the contribution to translational movement in of that thruster in x direction, and it's effect should scale by multiplying this factor. Similarly, the sine of angle of the offset of the thruster and the y component of the ship's acceleration vector is the contribution of movement of the thruster in y direction.
The x y direction are local coordinate system of the ship, i.e. invariant to the ship's facing. Whether you need to convert using trigonometry to a global coordinate system depends on the game's implementation. I am sure the devs'd understand. Of course the devs can add a further scaling field on the thruster to add moddability to allow disabling or multiplication of the scaling factor.

By using this translational thruster power scaling factor, thrusters that face backward 180 degrees will fire at maximum (cos 0 = 1) when the ship try to accelerate purely forward. Similarly, thruster that face 30(minus 180) degrees will have a strength of cos 30 = 0.707 when ship is going purely to the bearing of 0; while haveing a strength of cos 0 = 1 when the ship try to accelerate into a bearing of 30 degrees.


The rotational moment is a bit more tricky. You need vector mechanics to determine the shortest perpendicular distance between the centre of the ship (coordinate 0,0) and the axis made by the offset angle of the thurster. You find the shortest perpendicular distance by performing a dot product of the thruster offset vector and the ship facing vector. This is the problem of finding a shortest distance between a line (imagine the infinite axis depicting the facing of a thurster) and a point (centre of the ship, i.e. core). The procedure is similar to this. After the distance is found, it is normalised against all other distances, and multiplied by the rotational acceleration magnitude of the ship. By using this principle, any thruster in any facing or position will fire realistically toward ship's rotation.
Kaelis
Moderator
Posts: 1590
Joined: Fri Dec 14, 2007 4:46 am

Post by Kaelis »

This is impossible due to the way in which ship movement is handled inside BSF.
User avatar
Arcalane
Pseudofeline Overlord
Posts: 4034
Joined: Thu Sep 13, 2007 10:37 am
Location: UK

Post by Arcalane »

Kaelis wrote:This is impossible due to the way in which ship movement is handled inside BSF.
Even if it wasn't, there's sod-all chance of it happening. We have better things to code. ;)
  /l、
゙(゚、 。 7
 l、゙ ~ヽ
 じしf_, )ノ
AnnihilatorX
Commander
Commander
Posts: 116
Joined: Sat Mar 01, 2008 3:49 am

Post by AnnihilatorX »

Arcalane wrote:
Kaelis wrote:This is impossible due to the way in which ship movement is handled inside BSF.
Even if it wasn't, there's sod-all chance of it happening. We have better things to code. ;)
Since this is a 2D problem, and the maths behind is easier than it sounds in wordings, it's not that hard to program. :roll:

All you need it the x, y positions and angle offset of all thrusters relative to the ship's core, and the acceleration direction of the ship as a vector. Those are the only parameters you need really for the calculations. I assume such vector is known because of the way how angle arc works at the moment :?:
Kaelis
Moderator
Posts: 1590
Joined: Fri Dec 14, 2007 4:46 am

Post by Kaelis »

AnnihilatorX wrote:Those are the only parameters you need really for the calculations. I assume such vector is known because of the way how angle arc works at the moment
No, it is not known, its not handled that way / its not that simple. Stop talking about something you have no idea about.
AnnihilatorX
Commander
Commander
Posts: 116
Joined: Sat Mar 01, 2008 3:49 am

Post by AnnihilatorX »

If it's unknown then another way is to use the green arrow you see when user clicks on a coordinate for the ship to move to. The parameter you used to draw the green arrow is exactly the vector required.
Slayer0019
Commodore
Commodore
Posts: 535
Joined: Mon Jul 21, 2008 1:04 pm
Location: CT, America

Post by Slayer0019 »

AnnihilatorX, Kaelis is not only more experienced than you at this, he coded the game. If anyone would know the workings of the code, it would be him. It's like arguing with Einstein over relativity (to use an extreme example)
Got Steam?
Join the official BSF Steam group today!
Sign up [url=http://steamcommunity.com/groups/wyrdysm]here![/url]

[img]http://i192.photobucket.com/albums/z148/JohnDG/sig-1.png[/img]
User avatar
Arcalane
Pseudofeline Overlord
Posts: 4034
Joined: Thu Sep 13, 2007 10:37 am
Location: UK

Post by Arcalane »

Slayer0019 wrote:AnnihilatorX, Kaelis is not only more experienced than you at this, he coded the game. If anyone would know the workings of the code, it would be him. It's like arguing with Einstein over relativity (to use an extreme example)
Technically th15 coded the game, not Kaelis, although Kaelis had a significant hand in recent updates.

The moral of this story? AnnihilatorX does not understand how ship movement in BSF is coded and should shut up, because it's really not that simple.
  /l、
゙(゚、 。 7
 l、゙ ~ヽ
 じしf_, )ノ
fusion
Lieutenant, Junior Grade
Lieutenant, Junior Grade
Posts: 16
Joined: Fri Oct 19, 2007 8:12 am

Post by fusion »

Question, could you do it though if it was determined by how far the thruster is away from the core? I mean the physics equation is easy enough... The speed gained by the thruster over the radius of the circle drawn by the distance from the core to the thruster= the angular velocity gained by the ship. Of course the problem is the amount of other thrusters placed on the ship...

[tangent] Anyways this place has gotten a stardestroyer.net feel to it now[/tangent]
Dude.......
Cheese Cake
Stardestroyer...
Aaganrmu
Lieutenant Commander
Lieutenant Commander
Posts: 80
Joined: Tue Dec 23, 2008 12:36 am
Location: Holland

Post by Aaganrmu »

My precognition allows me to foresee the answer:
Someone from teh FUTUR!!! wrote:No, it can't be done. The way BSF is coded doesn't allow it. Like said before, a billion of times.
Wicky_42
Captain
Captain
Posts: 352
Joined: Wed Aug 01, 2007 11:41 pm

Post by Wicky_42 »

fusion wrote:[tangent] Anyways this place has gotten a stardestroyer.net feel to it now[/tangent]
Do elaborate...

OT, thrust vectoring and real motion physics would be cool and all, but not only is it evidently impossible considering how the game's been made, but it would also create a very different game to what we have come to know of as BSF.

Perhaps in a future project, whether by th15 or someone else or whatever. At present, just be happy that you can almost simulate it now that you have the exthrusters.
[url=http://www.wyrdysm.com/phpBB2/viewtopic.php?t=4014]Terran Republic[/url]

[url=http://www.wyrdysm.com/phpBB2/viewtopic.php?t=2792]HW2 Hiigaran Navy[/url]
User avatar
Anna
The artist formerly known as SilverWingedSeraph
Posts: 3447
Joined: Wed Sep 26, 2007 8:51 pm
Location: Elsewhere

Post by Anna »

fusion wrote:[tangent] Anyways this place has gotten a stardestroyer.net feel to it now[/tangent]
You can probably blame me for that. :lol:

AnnihilatorX: Stop assuming shit. Stop trying to lecture people who know the game's code better than you. I'm fairly sure that Kaelis has said several times in the past that people shouldn't make suggestions on the code when they have no idea HOW it's coded.
Founder and Event Coordinator for the BSF Beauty Pageant. Founder of the Pseudo-Chainship Project. Admin. Games Master.
Quality Control Enforcer
Gay cute girl and fucking proud of it.
AnnihilatorX
Commander
Commander
Posts: 116
Joined: Sat Mar 01, 2008 3:49 am

Post by AnnihilatorX »

Wicky_42 wrote:
fusion wrote:[tangent] Anyways this place has gotten a stardestroyer.net feel to it now[/tangent]
Do elaborate...

OT, thrust vectoring and real motion physics would be cool and all, but not only is it evidently impossible considering how the game's been made, but it would also create a very different game to what we have come to know of as BSF.

Perhaps in a future project, whether by th15 or someone else or whatever. At present, just be happy that you can almost simulate it now that you have the exthrusters.
No I am not advocating real physics. Vector stuff may be hard to understand, some of you may not even know what vector maths is. But it's something that a 7 years old can do on a calculator given simple instructions. I have some feelings you guys have all misunderstood my intention and thinking I am trying to put forward rocket science and therefore impossible.

I am not trying to change the ship movement. I am only trying to make the thruster display the effects realistically, changing the effect intensity and firing by determining mathematically the magnitude of fire.

Not a single time I was not questioning or denying Kaelis's ability, some of you seem to think I am doing that for whatever reason. It's just that I may know nothing about GM programming but I know enough general programming to know this is just few lines of code. If you are in my position you would be intrigued, no negative feeling, just intrigued.

The general impression I get from you guys is GM programming is rocket science saying that is impossible and that is impossible, and nothing seems programmable in GM. If that's the case then GM is totally useless and should be avoided in BSF2.

If you are interested I can write you some code in pseudo language in detail and show you how simple it is and if there's technical difficulty barring the implementation then that's fine.That's all I want to say.
Kaelis
Moderator
Posts: 1590
Joined: Fri Dec 14, 2007 4:46 am

Post by Kaelis »

AnnihilatorX, i know its simple, and i didnt imply its rocket science. But the fact is that i already told you that its impossible due to the way ship movement is coded (i would have to recode it to introduce vectors), yet you keep insisting.
User avatar
Normandy
Vice Admiral
Vice Admiral
Posts: 1214
Joined: Thu Sep 27, 2007 2:34 am

Post by Normandy »

I would suggest trying to write your own velocity system based on vectors in code. It requires a lot more than you think it does. Calculations are one thing, actually making those calculations do something is another.
[url=http://www.fallingsandgame.com/][img]http://www.gaussianstudios.co.cc/hosting/fsgbanneram3.png[/img][/url]

tl;dr-ers will be shot on sight.
[size=75][url=http://bsf.wikidot.com/]BSF Wiki[/url]
"I have measured your 'fun', and science has quantitatively rated it a three." ~Lord Tim (Data Realms Fan Forums)[/size]
Post Reply