More realistic thruster actions - force and moment
Moderators: th15, Moderators
-
- Commander
- Posts: 116
- Joined: Sat Mar 01, 2008 3:49 am
More realistic thruster actions - force and moment
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.
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.
-
- Commander
- Posts: 116
- Joined: Sat Mar 01, 2008 3:49 am
Since this is a 2D problem, and the maths behind is easier than it sounds in wordings, it's not that hard to program.Arcalane wrote:Even if it wasn't, there's sod-all chance of it happening. We have better things to code.Kaelis wrote:This is impossible due to the way in which ship movement is handled inside BSF.
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
-
- Commander
- Posts: 116
- Joined: Sat Mar 01, 2008 3:49 am
-
- Commodore
- Posts: 535
- Joined: Mon Jul 21, 2008 1:04 pm
- Location: CT, America
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]
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]
Technically th15 coded the game, not Kaelis, although Kaelis had a significant hand in recent updates.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)
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_, )ノ
゙(゚、 。 7
l、゙ ~ヽ
じしf_, )ノ
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]
[tangent] Anyways this place has gotten a stardestroyer.net feel to it now[/tangent]
Dude.......
Cheese Cake
Stardestroyer...
Cheese Cake
Stardestroyer...
Do elaborate...fusion wrote:[tangent] Anyways this place has gotten a stardestroyer.net feel to it now[/tangent]
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]
[url=http://www.wyrdysm.com/phpBB2/viewtopic.php?t=2792]HW2 Hiigaran Navy[/url]
- Anna
- The artist formerly known as SilverWingedSeraph
- Posts: 3447
- Joined: Wed Sep 26, 2007 8:51 pm
- Location: Elsewhere
You can probably blame me for that.fusion wrote:[tangent] Anyways this place has gotten a stardestroyer.net feel to it now[/tangent]
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.
Quality Control Enforcer
Gay cute girl and fucking proud of it.
-
- Commander
- Posts: 116
- Joined: Sat Mar 01, 2008 3:49 am
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.Wicky_42 wrote:Do elaborate...fusion wrote:[tangent] Anyways this place has gotten a stardestroyer.net feel to it now[/tangent]
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.
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.
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]
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]