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

Increase maximum migration distance #2447

Open
XHawk87 opened this issue Nov 23, 2024 · 5 comments
Open

Increase maximum migration distance #2447

XHawk87 opened this issue Nov 23, 2024 · 5 comments
Labels
enhancement New feature or request server This issue requires changes to the server

Comments

@XHawk87
Copy link
Contributor

XHawk87 commented Nov 23, 2024

Is your feature request related to a problem? Please describe.
Currently, the maximum migration distance for a server is arbitrarily limited by the maximum city working radius. This is currently blocking: longturn/rules-of-chaos#17

Describe the solution you'd like
Increase the maximum migration distance to the highest value it can be set to without causing errors.

Describe alternatives you've considered
https://youtu.be/ubPWaDWcOLU?feature=shared

Additional context

#define GAME_MAX_MGR_DISTANCE (1 + CITY_MAP_MAX_RADIUS)

@XHawk87 XHawk87 added enhancement New feature or request Untriaged This issue or PR needs triaging labels Nov 23, 2024
@lmoureaux
Copy link
Contributor

I don't think there's gonna be any error, but the performance impact should be kept in mind: a large migration distance would mean walking through the whole map for every city (effectively quadratic complexity in the map size).

@lmoureaux lmoureaux added server This issue requires changes to the server and removed Untriaged This issue or PR needs triaging labels Nov 23, 2024
@XHawk87
Copy link
Contributor Author

XHawk87 commented Nov 23, 2024

That's true. However, we don't know exactly what the performance impact would be without testing it. It's also something that could be balanced in other ways, higher citymindist, smaller map etc. I think people should have the freedom to do stupid things if they want to, and our role should be to provide appropriate warnings so they know it's their own fault.

I don't think there's gonna be any error

This is a value that gets squared, so at least make sure it doesn't cause an overflow.

@lmoureaux
Copy link
Contributor

I don't see it getting squared... The loop goes outward and stops once the distance becomes is too large, so it's capped by the map size.

@XHawk87
Copy link
Contributor Author

XHawk87 commented Nov 23, 2024

You're right, I was thinking about the city map max radius. That algorithm looks pretty inefficient in general.

@XHawk87
Copy link
Contributor Author

XHawk87 commented Nov 24, 2024

If we did need to improve the efficiency, this seems like low-hanging frut:

mgr_dist = static_cast<int>(sqrt(static_cast<double> MAX(

There are only a handful of possible values for the squared city radius, so we could get those from a lookup table rather than calculating a costly square root. This is probably premature optimisation though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request server This issue requires changes to the server
Projects
None yet
Development

No branches or pull requests

2 participants