Avorion

Avorion

Braking Distance Display
41 Comments
Enlonwhite 24 Aug, 2023 @ 2:50am 
You know this idea of braking distance is actually really good, I like it!
thelich 29 Jul, 2022 @ 5:50am 
@Sineme Looks like brake thrust is greater when ship velocity exceeds it's maxVelocity (i.e. when boost is active). Aprox. by 1.7 (may depend on ship mass).
Kirona 28 Nov, 2021 @ 5:26pm 
Just to be absolutely sure I ran a few tests with only your mod active on a new save - I used Creative to build but installed no subsystems or anything.

At 170% engineer workforce, a deceleration rate of 48.4m/s2, and a boosted speed of 3934m/s I got an estimated 159.92km stopping distance but stopped in about 34km.

I also tested the workforce by taking the same ship and cutting down to 100% workforce. Deceleration still 48.4m/s2, boosted speed was 2316m/s, mod said I'd need 55.43km to stop and I stopped in a bit under 13km.

I do think the low brake force is contributing though - I slapped on a huge inertial dampener and tested again and got a much better result. At a speed of 2315m/s and a deceleration rate of 254.4m/s2, the mod said I'd need 10.54km to stop and I stopped in about 9km. Still not *exact* but close enough that I'd never notice outside of specifically testing things.
Sineme  [author] 28 Nov, 2021 @ 2:02am 
I tested velocity bypass system and increased workforce at 8k m/s, 4k m/s and 1k m/s with a brake thrust of 450 m/s² in all cases the braking distance was as (in)accurate as I expected it to be (i.e. off by a few km) but not 140km like in your case. Maybe it is inaccurate due to the low decceleration, I will have to test that later. Also the engineers didn't make a difference in decceleration but I wasn't sure when I replied to you.
Kirona 27 Nov, 2021 @ 4:34pm 
Since I can't edit my comment I wanted to add on, does a higher engineer workforce also impact acceleration/deceleration or just max speed?
Kirona 27 Nov, 2021 @ 4:33pm 
I use a number of mods but nothing that touches velocity/acceleration/deceleration. I'm also not using any speed-adjusting systems, including the Velocity Security Control Bypass.

My ship has been edited a bit since last night but I did another test. I have engineers at 194% workforce, and with a velocity of 4216m/s (boosted to max) and a deceleration of 50.4m/s2 listed in the build menu, this mod claim a braking distance of 176.36km. Actual braking distance was closer to 38km.

Without boosting I had a velocity of 1053m/s (which fits the build menu's max velocity of 542m/s and my engineers at 194%), deceleration still 50.4m/s2, and the mod showed a braking distance of 11km when I braked in about 8km. So it looks like it gets dramatically worse while boosting or traveling at higher speeds.
Sineme  [author] 27 Nov, 2021 @ 5:01am 
@Kirona, wow, I totally missed adding the description.
150km sounds like a lot. I haven't tested the mod with Velocity Security Control Bypass Systems. What was your velocity and what is your decceleration? Are you using mods that increase velocity/accelleration/decceleration or add systems that do? Or were you using vanilla Systems that alter these values? Do you have more Engineers, i.e. >100% efficiency?
Kirona 26 Nov, 2021 @ 10:37pm 
I'm getting some seriously inaccurate distance values. A test I did just now displayed a braking distance of over 150km, but I actually came to a stop in about 35km. The visual warnings also don't have a working text description, it's just BrakingDistanceDisplay3 or BrakingDistanceDisplay5.
Aranos 5 Oct, 2021 @ 1:52pm 
The issue does not occur for me anymore. So my find was correct and my modconfig was the problem.
Aranos 5 Oct, 2021 @ 10:16am 
I will test it later but I think the issue was more with how I configured the modconfig.lua and how it was used. As you can see in the path I posted it was using \ and / and combining both is not a good idea. I think this might be a bug in Avorions path validation code as I didn't put the paths manually but it combined the two formats by itself.
Now the mod is loaded from //G//Steam//steamapps//workshop//content//445220//2615158540 (I guess the // are for escaping purposes) so only / is used.
Sineme  [author] 5 Oct, 2021 @ 1:17am 
@Aranos that could be it. Avorion doesn't allow access to files outside the Avorion folder for mods for security reasons. The reason why it works on startup is because I don't access or modify save files myself but the game secures player data every so often for example when the player is unloaded, when objects are copied or when the game is saved and at other points to refresh saved data. And my script is one of the things getting saved there, so maybe it kicks my script out at that point as it looks like my script tries to access something outside the allowed scope.
To test this, you could try /save or /run Player():secure() and see if my mod stays
Aranos 4 Oct, 2021 @ 2:22pm 
I wonder how it got loaded at least on startup then though.
Aranos 4 Oct, 2021 @ 2:20pm 
I think I might have found the issue in my server log.
2021-10-03 18-53-34| Error while securing script values of "C:\Users\****\AppData\Roaming\Avorion\galaxies\****\workshop\content\445220\2615158540\data/scripts/player/client/braking_distance_display.lua": boost::filesystem::weakly_canonical: Die Anforderung wird nicht unterstützt; Skipping.

This might be linked to me moving the galaxies folder via softlink (it is really on my G: drive). Not sure why it would cause this issue though.

I hopefully solved it by starting a new game (with the mod) and copying the modconfig.lua from that one...I did that manually before which referenced the script files in a different way (putting them into the galaxy itself instead of loading them from the steam workshop folder).
Aranos 4 Oct, 2021 @ 12:26pm 
For Xsotan it was only the first alert and when they jump into the sector. "Signals growing stronger" didn't trigger it.
Aranos 4 Oct, 2021 @ 12:25pm 
Now a popup from Mission Exodus broke it (so seems to be for mission popups in general)...hope that is reproducable.
Aranos 4 Oct, 2021 @ 12:13pm 
Re-validated the Avorion installation, manually removed the workshop files from my galaxy save file, re-subscribed the mod (and Azimuth) -> mission alert "Search and Rescue" -> brake distance gone (this mission popped up directly after a sector switch)
Aranos 4 Oct, 2021 @ 11:56am 
I checked the files manually and they are fine. I even saw all the changes ;)

I can re-validate my Avorion installation though.

This time the Xsotan entering the sector made it disappear...the second warning didn't though.
Sineme  [author] 4 Oct, 2021 @ 11:51am 
@Aranos my last 2 ideas for today would be
* check your avorion installation/reinstall
* unsubscribe my mod, delete the files if they havn't and resubscribe
my mod should be in \Steam\steamapps\workshop\content\445220\2615158540
where 445220 is the id of avorion and 2615158540 is the id of this mod in case you need to delete it manually
Aranos 4 Oct, 2021 @ 11:50am 
No...it was still visible after the last jump but disappeared when the alert came.
After re-attaching it via the ~dev console it also disappeared after another alert - this time it was my trader being done with his job.
Entering a sector with pirates attacking somehow didn't remove it though. I would have thought it would have the same effect but didn't.

btw. the 2 pixels are much appreciated :)
Sineme  [author] 4 Oct, 2021 @ 11:46am 
@Aranos I've removed my local installation of my mod and subscribed to the workshop version. I triggered the xsotan subspace signal event but my script stays attached. Does it disappear immediatly when you get the signal message or do you have to switch sectors/do something else on top?
Sineme  [author] 4 Oct, 2021 @ 11:39am 
@Aranos I adjusted the text by 2 pixels
Aranos 4 Oct, 2021 @ 11:20am 
When I add it manually there it occurs again.
Aranos 4 Oct, 2021 @ 11:19am 
The mod disables achievements already so no problem for me ;)

The musiccoordinator is in there but your script isn't.
Sineme  [author] 4 Oct, 2021 @ 11:15am 
could you do me a favor and open the console and type in
/run Entity():addScript("lib/entitydbg.lua")
when it happens again. This probably disables achievements, dunno if my/any mod disables them too.
select your craft
interact with it
select ~dev
select the second tab (Player commands) and open player scripts
look for data/scripts/player/client/musiccoordinator.lua
and for data/scripts/player/client/braking_distance_display.lua
I am curious if is just my script not being added
Aranos 4 Oct, 2021 @ 11:08am 
Something entirely else: Would it be possible to customize the position of the text via the options panel (or move the text up by like 2 pixel so it is better aligned in between the speed and hyperspace cooldown numbers? Might be just me but I have it rather aligned between the text lines instead of in between the speed/cooldown bars.
Aranos 4 Oct, 2021 @ 11:05am 
I think I figured out when it happens. It vanished in exactly the moment I got a warning ("Your sensors picked up short bursts of subspace signals"...so Xsotan). And yes, the option panel is gone as well.

Everything else (sector switch, ship switch, build mode, pause/unpause game) didn't trigger it.
Sineme  [author] 4 Oct, 2021 @ 10:55am 
@Aranos the community is small, just because no one else has posted it, doesn't mean it's a rare bug. Do I understand you correctly that the added tab for the options disappears as well? If so it would definitely be a problem with the script not being added to the player properly
Sineme  [author] 4 Oct, 2021 @ 10:52am 
@Kirbcake Sorry, I am new to the steam workshop. This mod requires AzimuthLib now to store the options easily. I added it to the required items
kirb 4 Oct, 2021 @ 10:49am 
The mod says it requires... something to work. Some mod with an ID of 1722652757?
Aranos 4 Oct, 2021 @ 10:48am 
The new features are nice and working well. Sadly it still disappears for me after like 3 jumps (including option panel and sound). Again I sadly didn't notice it vanishing but only when I flew close to something and it didn't show up. Will reload my game to see if I can figure out when exactly it happens.

I am pretty sure I am not doing anything weird...so I am unsure as for why I seem to be the only one mentioning the disappearance problem. Setup is the same as before: vanilla 2.0.7 (except for this mod), galaxy started with 2.0.6, difficulty veteran and (because it could be related) my game pauses when I TAB out of it.

Btw. it may be useful to link the now required Azimuth mod in the description - it didn't download it for me by itself so I had to figure out which one it is based on the mod id.
Sineme  [author] 4 Oct, 2021 @ 8:13am 
@Rizzy yes, I will add options
Maxene 4 Oct, 2021 @ 8:08am 
Can you please make this new thing an optional?

I love the mod but being yelled at by the game that I'm gonna collide with an object is annoying af every 5 seconds with a little noise.
Sineme  [author] 4 Oct, 2021 @ 6:01am 
@Aranos I've rewritten when to display the braking distance I hope it doesn't disappear now
Sineme  [author] 3 Oct, 2021 @ 3:15pm 
@Aranos I add the script when a Player is initialised, so that should not be the issue see my init.lua in scripts/player
Aranos 3 Oct, 2021 @ 3:02pm 
I checked the registerCallback method for Player (Client) in the Avorion documentation. It seems like the callbacks get removed on sector change. Pretty sure that removed the draw then.

Quote:
Register a callback in the player. The callback will be removed when the sector is changed or the receiver, if it's an entity, is destroyed. [...]
Aranos 3 Oct, 2021 @ 2:46pm 
And regarding 2. as well: I agree that the formula may be good enough. As long as it underestimates the braking everything is fine^^
Aranos 3 Oct, 2021 @ 2:33pm 
1. I think it mostly happened when I did something outside of the ship - like build mode or entering a different ship etc. Not sure it is that though. I am on version 2.0.7 without other mods. A reload of the galaxy fixes it (until it breaks a again after some time). Is it possible the "player" object somehow changes and therefore the callback isn't active anymore or something like that? Just guessing.
2. I also saw that. But maybe the BrakeThrust is not the correct value to use (especially when boosting). I saw that there is also a value called driftDecrease available in Physics/ReadOnlyPhysics - not sure it is the correct value either though. As I said the documentation is not that great regarding what value is what.
3. Please no sound (or optional only) - a color indicator is probably visible enough ;)
Sineme  [author] 3 Oct, 2021 @ 1:00pm 
@Aranos
1. I didn't have the time to thoroughly test the mod unforunately. I'll try to see if I can observe the same behaviour/replicate it. Have you noticed when it happens? Does a restart fix it? What mods are you using?
2. I am using the physically correct formula to calculate the braking distance however it is a game with discrete time, so I would have to calculate the braking distance differently. As I don't know how velocity/acceleration is handled, I don't think an accurate formula is possible, but I think the formula used is sufficiently accurate to be useful.
3. Yeah, during testing I noticed it isn't as useful as I had hoped. Having to look up and forward is bad. I've already thought about multiple things throughout last week to improve it like adding sound similar to the parking assistant of cars or adding one of the pop ups you get for low morale/energy/hyperdrive recharging/etc.
Aranos 3 Oct, 2021 @ 9:34am 
The idea is great and it kind of works but there are quite some issues with it at the moment.
1. it randomly stops working for me (display gone completely and doesn't pop up again later either)
2. I tested it by just drifting towards a station when the brake distance was close to the distance (which was ~20km) - I was boosting full speed before which was ~2000 something: my ship stopped 3km in front of it. So somehow the braking speed is wrong it seems.
3. It would be really great if you could add an indicator for if the ship will stop before reaching the selected entity (brakeDistance vs distance between ship and entity, like color the background of the brake distance green = ok, yellow = <2km, red < 500m) - I tired myself but I couldn't really figure out the correct entities...the documentation about this isn't as good as I had hoped
XxKheldorxX 1 Oct, 2021 @ 8:51pm 
Great QoL mod A++
Lance Patchwork 1 Oct, 2021 @ 10:50am 
Jesus this should be vanilla! Simple and REALLY usefull, instead of guestimating and smacking your face in the station. Really nice QoL. Didnt know i needed it untill i saw t.