SirJodelstein

[1.0.2] Persistent Trails - record, share and replay track data! (May 14, V1.2)

Recommended Posts

Document your epic journeys! Fly in formation! Race your friends! Paint the skies! Here is the Persitent Trails plugin:

KqaA0MY.png

Download on KerbalStuff

This is a partless plugin (made in cooperation with Snjo) that records a track history of your vessel. Like this:

e4RZ1wZ.jpg

More uses

Javascript is disabled. View full album

(Video link for demo of replay-racing, note that this is outdated, replay now has actual vessel geometry instead of spheres)

Formation flying (with track line visualization switched off)

Features:

- Vessel geometry track replay. Optionally with physics colliders (so you can crash into the recorded vessels). Optionally with playback looping for continuous motion. Or with Fast-Forward.

- optional direcitonal markers

- "continue track" function allows to resume a previously recorded track

- add "log entry nodes" to a track to have georeferenced labels on your track

- fully customizable style

- Each track is stored in a separate file for easy sharing

Technical stuff

- Released under MIT license.

- Download on Spaceport

- Source on GitHub

- Install: Put the PersistentTrails folder as a subfolder of GameData (just like any other mod)

- Requires the Toolbar plugin, which is not longer distributed with this plugin.

Version history

- 1.2 Update for 1.0.2.

- 1.1 [Release Details]: Plugin Toolbar integration, FigaroGPS support, fixes for struts, fuel lines and launch clamps for replay

- 1.0 [Release details] Joined forces with Snjo. Vessel geometry saving and replay, Replay looping, smart node placement.

- 0.8 fixed quickload bug, fixed logentry node labels not updating while GUI is hidden(F2). added tooltips and track length display

- 0.7.1 memleak fix and fix for orbital velocity recording

- 0.7 StackOverflow Exception removed, 0.2 seconds recording option, minor GUI enhancements => Beta Status

- 0.6 added playback function, fixed logentry label positions

- 0.5 initial release

Future plans/TODO

- Stock AppLauncher integration

- better track list (title linebreaks etc)

- more info readouts (time, avg. velocity, etc)

- automatic line-width adjustment depending on distance between camera and track points

- Detect node-label mouseovers and display log-description text

- make tracks show up in map mode

- ballistic preciction preview

- (maybe) add "realistic" tire tracks with textures (if something like that does not kill performance too much)

Feedback, code contributions/corrections and help welcome. Thanks a lot for all the helpful voices on the "help a fellow developer" thread, to the creators of TacLib for their great window-gui-framework, and to the creators of KerbCam and Kerbal Alarm Clock for the source code that helped me a lot in learning how to do stuff with the KSP API.

Edited by SirJodelstein
1.0.2

Share this post


Link to post
Share on other sites
So, this will "paint" every place you go with your vehicle?

If activated, it records latitude, longitude and altitude of the current vessel every X seconds. These data points are rendered as a line with adjustable color and thickness.

Share this post


Link to post
Share on other sites

"Coming to a screenshot thread near you soon: Giant pink [RICHARDS] on Duna...

Internet folk are predicable after all"

Lol cant wait to see peoples creations with this

This mod Looks Awesome :o

Edited by sal_vager
Slightly inappropriate language.

Share this post


Link to post
Share on other sites

Ok, so locally on your machine, how do you have your plugin installed? Reason I ask is that there's a lot of dlls in these folders and if they're all in the gamedata folder somewhere, KSP will find and try to execute them. Not saying that's the cause of your problems but definitely something to avoid doing.

Share this post


Link to post
Share on other sites

I was thinking yesterday how great something like this would be. Lo & behold, the KSP community is full of telepaths! Thanks for this, I'm off to draw a face on the Mun :D

Share this post


Link to post
Share on other sites

Ok, about your error, I think you're probably caught in a loop somewhere executing over and over until you run out of resources. I'm not done going through it but this looks bad right here

from trackmanager.cs


public void updateCurrentTrack()
{
trackManager.updateCurrentTrack();
}

Edit: Eh, it's in a different class, never mind.

Edited by Starwaster

Share this post


Link to post
Share on other sites
Ok, so locally on your machine, how do you have your plugin installed? Reason I ask is that there's a lot of dlls in these folders and if they're all in the gamedata folder somewhere, KSP will find and try to execute them. Not saying that's the cause of your problems but definitely something to avoid doing.

Install this just like any other plugin - just extract the zip in your GameData folder. The zip contains just one dll plus icons.

Pretty cool, does this show up on Map View?

No, not (yet). For the moment, you will have to zoom out in the 3D view and make the line width big enough to see it from a big distance.

I have a idea. You (maybe) can implement a replay mode with this. Just have the ship track the line without input

Cool idea. I had something similar in mind, and the foundation for this already in place. Each track point is saved with a currently unused time tag, so it will be possible to do these replays in real time (or optionally with some speedup factor. Not sure how to get the vessel geometry/mesh, but moving a sphere along that path is definitely doable.

Share this post


Link to post
Share on other sites

Very cool. I was thinking something like this would be good but I wouldn't have made an implementation that neat.

I've not got the time to check your code unfortunately at the moment but I hope you get it sorted. This really expands the potential in challenges, since you can verify claims properly.

Share this post


Link to post
Share on other sites

Just making sure, but did you also see this part of the error? (from output_log.txt)


at (wrapper delegate-invoke) PQS/OnDefaultDelegate:invoke_void__this__ ()

at (wrapper delegate-invoke) PQS/OnDefaultDelegate:invoke_void__this__ ()

at (wrapper delegate-invoke) PQS/OnDefaultDelegate:invoke_void__this__ ()

at (wrapper delegate-invoke) PQS/OnDefaultDelegate:invoke_void__this__ ()

at (wrapper delegate-invoke) PQS/OnDefaultDelegate:invoke_void__this__ ()

at (wrapper delegate-invoke) PQS/OnDefaultDelegate:invoke_void__this__ ()

pages and pages and pages of it

Share this post


Link to post
Share on other sites
No, not (yet). For the moment, you will have to zoom out in the 3D view and make the line width big enough to see it from a big distance.

.

Like this and hope that it can be viewed in map view.

For the line width issue, if you can find a way to get the camera distance, you can multiply that as a coefficient with a constant value for the line width so that when you zoom the camera farther, the line width will increase accordingly and the line will appear with an almost constant width on the screen. Well, at least I've done that in some of my plugins before, though in map view.

Share this post


Link to post
Share on other sites

Any plans to record the vessel's position and vector in 3d space? This would help immensely to visualize my shuttle's reentry path.

Share this post


Link to post
Share on other sites
Just making sure, but did you also see this part of the error? (from output_log.txt)


at (wrapper delegate-invoke) PQS/OnDefaultDelegate:invoke_void__this__ ()

at (wrapper delegate-invoke) PQS/OnDefaultDelegate:invoke_void__this__ ()

at (wrapper delegate-invoke) PQS/OnDefaultDelegate:invoke_void__this__ ()

pages and pages and pages of it

Jup, that's what i am seeing in my logs. the erros start with one line of "StackOverflowException: The requested operation caused a stack overflow.", followed by this this not-really helpful stacktrace. Looks like infinite recursion for me, but thats not my code, and (as far as i can tell) i have not done anything with PQS in my plugin, i don't even know what that does.

automatic line width

added to my TODO list. Good idea. It would be even easier if Unitys linerenderer could just render OpenGL-Lines with a constant pixel width, but i could not find such an option.

Also, i do not know how this map view works or how i can draw stuff in there. I have read something about ScaledSpace, but i am not sure how to continue

Any plans to record the vessel's position and vector in 3d space? This would help immensely to visualize my shuttle's reentry path.

Vessel altitude is tracked as well, so you can already record flights with it. Just keep in mind that the track is recorded relative to a parent body, path tracking in near-geostationary orbits would probably make some really weird trails

Share this post


Link to post
Share on other sites
added to my TODO list. Good idea. It would be even easier if Unitys linerenderer could just render OpenGL-Lines with a constant pixel width, but i could not find such an option.

Also, i do not know how this map view works or how i can draw stuff in there. I have read something about ScaledSpace, but i am not sure how to continue

 line.SetPosition(..., ScaledSpace.LocalToScaledSpace(FlightGlobals.ActiveVessel.orbit.getPositionAtUT(time)));

some code snippet from one of my plugins using ScaledSpace, with the lineRenderer (its useWorldSpace is true BTW).

Share this post


Link to post
Share on other sites

Version 0.6 is out! Added a replay window that moves a sphere along the path, at the same speed that the recording vessel had. Includes a fast-forward function and a slider for direct playback position selection. Still working on that stupid StackOverflow crash...

WVJwBvI.png

Edited by SirJodelstein

Share this post


Link to post
Share on other sites

Wooot, i finally found and fixed the bug that caused the StackOverflowException (Note to self: dont put "AddToProstDrawQueue" calls in OnGUI). Plus, i added a "high speed record" mode with recording interval 0.2s for fast movements like flights. With this fix, this plugin has officially reached Beta status.

P8AhMGC.png

Tower flyby attempt while checking out the new 0.2s recording interval. 1400 track points recorded and rendered without noticable slowdown

Now go out and play with it :) I am sure there are still some bugs in it, but in the current state it is definitely useable. Have fun!

Share this post


Link to post
Share on other sites

Excellent, now aerobatics will turn to ACMI. :D

Plus we can record a rocket's ascent path and then follow it when we want to launch the same rocket again.

Share this post


Link to post
Share on other sites

:( It seems like the record ends when my rocket reach a certain altitude.

So I cannot record the entire ascent path of the rocket. Any clue?

Share this post


Link to post
Share on other sites
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.