Skip to content

Only run the routing algorithm when RA updates#70

Open
periodically-makes-puns wants to merge 5 commits intomockingbirdnest:masterfrom
periodically-makes-puns:route_on_ra
Open

Only run the routing algorithm when RA updates#70
periodically-makes-puns wants to merge 5 commits intomockingbirdnest:masterfrom
periodically-makes-puns:route_on_ra

Conversation

@periodically-makes-puns
Copy link
Contributor

If RA has not updated since the last time we ran the routing algorithm, there is no point in re-running it - we will obtain the same result.

Currently, this makes the game run at slideshow pace on rails warp, since this effectively makes RA runs block the current FixedUpdate for 20ms or so while Skopos routes its connections. However, this makes standard gameplay much more bearable, since we only run the routing algorithm 4-5 times per second instead of every physics tick.

Once we combine this with a suitable routing algorithm optimisation, Skopos routing-related lag should essentially become unnoticeable.

private KSP.UI.Screens.ApplicationLauncherButton toolbar_button_;

internal RuntimeMetrics runtimeMetrics_ = new RuntimeMetrics();
internal bool do_refresh = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing underscore in member variable names (2x).

refresh_watch_.Stop();
metrics.num_fixed_update_iterations_++;
metrics.fixed_update_runtime_ = refresh_watch_.Elapsed.TotalMilliseconds;
metrics.num_iterations_++;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that Skopos generally uses pre-increment as it is potentially a bit faster (no need to retain the previous value).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants