Notifications
Clear all

How Do I Calculate....

Page 2 / 2

fluffyfreak
(@fluffyfreak)
Captain Registered
Joined: 7 years ago
Posts: 1306
 

I think it's just a meta table with 3 elements. You can get each element by it's index "x", "y", or "z" too.

 

If you just want the velocity without the direction then you could just get it's "length" which will give a single value for "speed" I guess.


ReplyQuote
nozmajner
(@nozmajner)
Member
Joined: 7 years ago
Posts: 291
 

Looks very good.

A bit of nitpicking: I think "Main" and "Retro" thrusters might be better terms. At least for me. Forward could imply that the thrusters are looking forward, or that they accelerate you forward.

And a bit more: Maybe you could move them up above the acceleration displays, so the deltaV and Speed displays are right next to each other. Would make it easier to judge, how much juice you have left in your tanks.

 

Anyhow, this feature will sure give the adventurous player an edge over the autopilot regarding transfer times. 🙂

 

 

Also, if you zip it up this way, it can be used as a mod, making it easier to test:

stop.zip

    /lang/ui-core/en.json

    /ui/InfoView.lua

        /InfoView/Shipinfo.lua


ReplyQuote
Bugbear
(@bugbear)
Senior Chief Registered
Joined: 13 years ago
Posts: 78
 

Thanks for the help on IRC.  No success yet but I'll keep bashing away...


ReplyQuote
Bugbear
(@bugbear)
Senior Chief Registered
Joined: 13 years ago
Posts: 78
 

We now have the distance to stop calculation available on the F3 page, and I've uploaded the latest ShipInfo.lua here: https://app.box.com/s/l04gnf0ltgliz3fxvuvo8klskfbivvai

 

I'll now do some work on figuring out how to display these numbers on the cockpit (aka WorldView screen).

 

There is one minor gotcha with the calculations though - the distance to stop is based on the speed relative to the frame of reference (which admittedly is what I requested in the first place).  Now that I've had a chance to play with this, I'm thinking that speed relative to destination would be more useful.  When travelling from Earth to Mars for example, the point at which deceleration needs to begin occurs while the frame of reference is Sol, which means that the speed will be out by something like 25km/s.

 

I'll see what I can do about this looking at the underlying code...


ReplyQuote
Bugbear
(@bugbear)
Senior Chief Registered
Joined: 13 years ago
Posts: 78
 

Another update.  After another couple of months of sporadically trawling through the Pioneer C++ source, I've been able to create a function in WorldView.cpp that calculates the distance to stop, and displays this on screen just below the current nav target relative speed indicator - screenshot here: https://app.box.com/s/2jt86yrl0s3eq3svkxymkzttvsro1f78 (The F means distance to stop using the 'forward' or main thrusters, the R means distance to stop using the 'rear' or retro thrusters.  The rear thrusters are less powerful than the front, therefore they will take more distance to accelerate / decelerate from a given speed).

 

(After using this a few times, I'll probably also add the current available delta-v - that's a very important number when travelling between planets...)

 

This is still a work in progress - my intent is to make this calculation available only to commanders that purchase the Nav Computer Upgrade in-game so as a result I would need to work out how to declare a new piece of purchasable equipment (knowing my luck and my schedule that will take me another couple of months...).

 

I know that some other devs (in particular ecraven) have been doing some excellent work in not only calculating this information, but also presenting it on screen in a much more attractive manner (I've always said that I don't do "pretty" very well), so it may be that my efforts so far will come to naught.

 

What I'd like to to, though, is make available the code I've created so far, and have some of the devs look it over and tell me whether I'm on the right track (I really should work out git works... )

 

WorldView.cpp - https://app.box.com/s/e7zo8hxyk8kj8uvs0isyjrhnpq203tz8

WorldView.h - https://app.box.com/s/m5ynr4w3aw83u5n1hdijyoeotfm4bqa6

 

 


ReplyQuote
impaktor
(@impaktor)
Pioneer Moderator
Joined: 7 years ago
Posts: 166
 

I applaud your efforts, but I think we're on a good path to already include all this in master branch. ecraven's pull request went up last night (#3819). With this, pioneer will no longer draw to the worldview from C++, but from Lua.

It will be significantly easier for modders to add and change the "F1" view.

None of your links above work for me, I just get a blank screen. (Possibly my adblocker acting up?) You can upload your screenshot directly to the forum. That way we can all see it (if logged in), without relying on any third party.

But despair not, your work is not in vain. Without having looked at any code, it might be that you have a more accurate approximation for full stop distance than ecraven, if so, you can collaborate on using your code in his UI.

 


ReplyQuote
Bugbear
(@bugbear)
Senior Chief Registered
Joined: 13 years ago
Posts: 78
 

OK, screenshot and code files attached...

 

The code includes a probably inacurrate attempt at retrieving the current available deltaV...


ReplyQuote
Gernot66
(@gernot66)
Lieutenant Registered
Joined: 7 years ago
Posts: 522
 

na also da bleibt mir doch die spucke weg
i rather will do it with my guts


ReplyQuote
Page 2 / 2