-
Notifications
You must be signed in to change notification settings - Fork 4
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
Basemodule listObservableTiles performance #3
Comments
are you sure dy shouldn't be dv? |
No, it should be correct. dy is part of the cubic coordinates, the others are x = u and z = v (y=-u-v). I inlined these conversions as you don't use cubic coordinates, see the link. |
Any chance you can compress that by including the dv into the second loop? |
I think you can also do the following way:
I quickly check it in mathematica with the following code (and it seems to work):
|
The method listObservableTiles in basemodule, checks each tile if it is within the viewrange. The performance can be significantly increased simply listing the tiles within a fixed range as follows:
Where N is the view range.
Adapted from http://www.redblobgames.com/grids/hexagons/#range
The text was updated successfully, but these errors were encountered: