-
Notifications
You must be signed in to change notification settings - Fork 291
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
add client setting for Max Range to Draw Sensor / Visual Rings #4470
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling fix. Also, discussion point: do we really need the extra setting? Why not just cap the draw range to the bigger of board width/height and call it a day? I don't think I've ever seen a board bigger than 200x200.
would just capping still lag people with slow computers on large maps? the setting allows it be be dialed back to what your computer can handle. |
Why is it slow with sensor range 1000? Wouldn't this mean it shouldn't draw anything? Or rather, only draw sprites at the board edges (one could think about removing even this if the board edge is not actually the edge of the range) |
it calculates out to max range, then removes them any not on the board, before it tries to draw anything. it grows larger the further out you are, since it adds a other circle of points each step. I have added logic to only calculate out to max range from your position on the board, that should help. |
I'd like to second @NickAragua suggestion to not give this a client setting if it can be avoided. The algorithm for determining the hexes to paint can be improved a lot here I think. If I'm not mistaken, the thing to draw here is a ring of hexes at the respective range, right? So the only hexes that can possibly have a sprite are those at exactly the range and those on the board edge. Those on the board edge could be omitted because that doesn't add any relevant information (obviously, any range ends at the board edge). First, check if X > board diagonal. If so, draw nothing. Otherwise, add those at range X, not all those from range 0 to X. Then remove any not on the board. Then to determine the edges to draw just compare the surrounding hexes if they're more distant than X. Unless range X = 0, only a maximum of 3 edges can ever be there. This should speed up things and I'm sure there is more potential improvement. I hope I made not too many errors in this. |
with sensors currently, the start is drawn on the near side of the hex, and the end is on the far edge. this helps showing they are one range. not sure your algorithm would handle that. also drawing the ones along the board edge help show that the two ranges are connected and the sensors are active between the two. drawing along the board edge shows that you can see up to that edge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a major improvement over what was there before anyway. If the person reporting the issue is still experiencing slowness afterwards, then we can work on further improvements in the spirit of those outlined by @SJuliez, in terms of not looping through every hex on the map.
also if you turn it off, nothing will calculate now. |
fixes #4467