Page 2 of 2
RE: How Do I Calculate....
Posted: Sat Jun 25, 2016 12:19 pm
by Bugbear
OK, I'm still a little dense (I'm still fairly new to Lua). How do I access the components of the LuaVector object? (In the menatime I'll keep reading up on Lua basics...)
RE: How Do I Calculate....
Posted: Sun Jun 26, 2016 2:19 am
by Bugbear
Here's a first draft of the 'Distance to Stop' calculations. You can download the various required files via this link: https://app.box.com/s/0ancxt0768dixhqoqssf[/url] I've also included some screenshots in that link so you can see the results of the calculations. Bear in mind that this is an initial draft and the presentation of the data is not quite where I'd want it. Also, at this point I haven't worked out how to get the current ship's velocity so I've just hard coded 1000km/s for now, just so you can see the calculations in action... ** edit ** While I think of it, if I can get access to the distance to the selected destination, I should also be able to determine the turnaround distance and speed - this would also take into consideration the amount of fuel (propellant?) that you have in the tank... Dammit, I can see this mod getting bigger...
RE: How Do I Calculate....
Posted: Sun Jun 26, 2016 7:43 am
by nozmajner
Neat! A quick test gave me the good ballpark estimate of .10AU from the Barnard's starting position.Are you sure you want to put all this data into the Orbit Analysis page? It might be more accessible in the ship info page, so you can check it quickly by pressing F3. (Sans proper customizable flight UI top put into) You can access the propellant flow of the ship: ShipDef.thrusterFuelUse[/url] I saw you are calculating it. Don't know which method is better though.
RE: How Do I Calculate....
Posted: Sun Jun 26, 2016 8:15 am
by Bugbear
Hey Noz...I'll see how I go putting my data on the Ship Info page. Now that I've done it once in the Orbital Analysis page, editing the other .lua files should be straight forward. I'll put my calculations under the 'acceleration' data. I want to make the output much more concise than I've done so far in my first draft. I think the most essential information required is (apologies for the dodgy attempt at an ASCII table): | Forward thrusters | Reverse thrusters |Distance to stop | | |Time to stop | | | If a table looks too out of place on the F3 page, then I'll just list it instead. The unit of measure displayed for both the distance and time would be dependent on the magnitude of the measurement, e.g. if distance is > 0.10 AU, then show distance in AU, otherwise in km. I'd do something similar for time, with an aim to make the leading integral component of the measure as small as possible (easier to explain in code than in English...) I didn't notice the thrusterFuelUse property. I'll use that instead. Cheers
RE: How Do I Calculate....
Posted: Sun Jun 26, 2016 9:15 am
by Bugbear
Some minor modifications - I've moved the calculation output to the Ship Info page - same link as above (https://app.box.com/s/0ancxt0768dixhqoqssf[/url] Download the en.json (https://app.box.com/s/venvrlgguor8h3xayxxy31110dtl8abt[/url] and the ShipInfo.lua ([url]https://app.box.com/s/l04gnf0ltgliz3fxvuvo8klskfbivvai)[/url] to see it in action. Image of the display: https://app.box.com/s/1gv9d48kkb0jsiip9rkfp2xt85vmnflo[/url] Again, I don't yet have the code for getting the current speed so an indicative speed of 1km/s has been hard coded on the ShipInfo.lua file. I also haven't worked out how to grab the thrusterFuelUse property - not sure if this value changes from forward to reverse thruster, so not sure of the syntax for getting this value for a specific engine. All I need is the code to get the current speed....hint, hint

RE: How Do I Calculate....
Posted: Sun Jun 26, 2016 2:40 pm
by fluffyfreak
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.
RE: How Do I Calculate....
Posted: Sun Jun 26, 2016 4:11 pm
by nozmajner
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
RE: How Do I Calculate....
Posted: Mon Jun 27, 2016 9:37 am
by Bugbear
Thanks for the help on IRC. No success yet but I'll keep bashing away...
RE: How Do I Calculate....
Posted: Sat Jul 02, 2016 12:48 pm
by Bugbear
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[/url] 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...
RE: How Do I Calculate....
Posted: Fri Sep 23, 2016 11:52 pm
by Bugbear
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[/url] (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[/url] - https://app.box.com/s/m5ynr4w3aw83u5n1hdijyoeotfm4bqa6[/url]
RE: How Do I Calculate....
Posted: Sat Sep 24, 2016 2:12 am
by impaktor
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.
RE: How Do I Calculate....
Posted: Sat Sep 24, 2016 4:05 am
by Bugbear
OK, screenshot and code files attached... The code includes a probably inacurrate attempt at retrieving the current available deltaV...
RE: How Do I Calculate....
Posted: Wed Apr 12, 2017 1:38 am
by Gernot66
na also da bleibt mir doch die spucke wegi rather will do it with my guts