Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orbital icon customization loop performance issues #310

Merged
merged 3 commits into from
Sep 21, 2018

Conversation

marr75
Copy link
Contributor

@marr75 marr75 commented Sep 6, 2018

See #309
By looping through just FlightGlobals.Bodies instead of all resources, this loop is quite a bit faster (doubled my framerate with GPP + GEP + OPM). I don't know if important bodies are excluded or if this can be optimized more aggressively without better test data (a config with customized icons, preferably a planet pack). Off the top of my head, a more aggressive optimization would be to identify a smaller set of customized bodies once and then loop through only those bodies OR determine if the icons can be set less frequently (only once, for example).

Very open to ideas and discussion. I'm not much of an artist/designer (or great with working with those assets) so I question how realistic an orbital icon test case I can put together without some outside guidance.

@marr75
Copy link
Contributor Author

marr75 commented Sep 11, 2018

WIP update: appears to me this could be called once per body. Caveat: the method UpdateType is called every LateUpdate tick and this method might reset the icon back to an icon dependent upon the node's type if it detects a change in the icon type. Coincidentally, SetIcon calls UpdateType but does so before the icon is set to the sprite icon. I believe this would actually initialize the MapNode such that it UpdateType would effectively become a no-op.

@marr75
Copy link
Contributor Author

marr75 commented Sep 11, 2018

Okay, I'm actually pretty happy with where this is. I tested replacing some random icons with 'Squad/Props/IVANavBall/navBall_DV_IVA.dds' in Galileo's Planet Pack as my test case. I encountered an issue where entering the map view in flight mode has different behavior than the tracking station. Both call "MapEntered" but the tracking station doesn't seem to have uiNodes populated for the celestial bodies until all the events I know of have already fired. I tried all the scene loaded, scene switched, map entered, and target/camera switched events I could find but the behavior was consistent, there were no uiNodes populated to call setIcon on until after the events were over when the map view was the tracking station - subsequent camera change / planetarium target change events worked, but not the initial event.

So, my compromise was to set a boolean "dirty" state when entering maps and take clear it once LateUpdate found populated uiNodes. I think this could probably be good performance optimization for some of the other map view customizations but I'm not positive. Lower impact to start here.

@marr75 marr75 changed the title WIP: Orbital icon customization loop performance issues Orbital icon customization loop performance issues Sep 11, 2018
@StollD
Copy link
Member

StollD commented Sep 21, 2018

Looks good! Thanks for this, and sorry for me not looking at it for so long.

Sorry, something went wrong.

@StollD StollD merged commit 0bb7164 into Kopernicus:master Sep 21, 2018
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.

None yet

2 participants