fluffy-mods / ResearchTree

Graphical research tree and queue system for RimWorld
Other
23 stars 25 forks source link

Games becomes sluggish when panning the search window with mouse. #23

Closed bicobus closed 5 years ago

bicobus commented 5 years ago

I play on linux, so I don't know if other platforms experience this issue.

Whenever I use the mouse to pan around the window, the interface becomes sluggish until panning stops. I suspect it is due to the mod trying to redraw the tree for every pixel moved.

This problems does not occurs when using the direction keys to pan around the research tree.

Do you not generate a static tree, akin to a bunch of images? This feels like the mod tries to compute the position of every single on-screen element at any given time.

FluffierThanThou commented 5 years ago

This feels like the mod tries to compute the position of every single on-screen element at any given time.

That's pretty much what happens ;).

RimWorld uses Unity's immediate mode UI, which doesn't really have a concept of state - the whole UI is rebuild every frame. I do cache the positions of nodes (and the positions of elements within those nodes), but while dragging those get updated every frame.

I probably could be smarter in how I update positions, but frankly, it's a marginal problem under most conditions, and just not really worth the time investment to me right now.

bicobus commented 5 years ago

One solution would be to generate a tree as a solid pane, like legos, and use the research window to drag that pane around. The equivalent of sliding an image around.