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
Configurable number of islands for water & mixed maps #1369
Configurable number of islands for water & mixed maps #1369
Conversation
b0edbfc
to
43dc83a
Compare
Compilation fails because of missing output operators (I.e.
or |
@@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE(GenerateRandomMap_returns_valid_water_map) | |||
loadGameData(worldDesc); | |||
MapSettings settings; | |||
|
|||
settings.size = getRandomMapSize(83, 100); // Need enough space for player islands | |||
settings.size = getRandomMapSize(84, 100); // Need enough space for player islands |
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.
Seems this is still not enough. Have you tried it locally with the minimum size and MAX_PLAYERS? Maybe the change here makes the player islands to small? Because previously this test worked with those sizes, didn't it?
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.
I think that fixed minimum island size of 200 might be too small. I'll try playing around locally.
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.
Or 200 is too large which would lead to a similar result (e.g. 6 players get a large island and there's not enough space for the remaining player).
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.
Looks good so far. A few minor notes to polish it up. Last ones here, I promise ;)
const auto islandRadius = GetIslandRadius(map_.size); | ||
const auto islandAmount = static_cast<double>(settings_.islands) / 100; | ||
auto islandNodes = static_cast<unsigned>(islandAmount * waterNodes); | ||
auto islandSize = rnd_.RandomValue(200u, GetIslandSize(map_.size)); |
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.
I think it makes sense to make the 200 a named constant. I was wondering if this part is correct and GetIslandSize always returns a value >= 200. It does, so its not a bug, but it isn't obvious and I'm not sure what happens if that ever was changed and you call e.g. RandomValue(200, 100)
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 might also make sense to allow smaller islands than 200 nodes. At least for the last or only island. E.g. use a min size of something like min(200u, islandNodes)
. Could at least be decorative ;)
First, I fixed the size of players' home islands to a value depending on the map size (200-1200 nodes). Also, I added configurable "extra" islands (few/medium/many) of random size (range between 200 & 1200 nodes). This makes water & mixed maps slightly more interesting to play I think.
Increase island size range for testing water maps Fixed smoothing iterations for 512x512 map size island-test-map-size++ :-/ Fixed warning
* avoid duplication of enum in iwMapGenerator * convert combined sizes into product of width & height * added kind of stupid integration test for islands amount settings
d42bfb0
to
542953e
Compare
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.
Thanks!
First, I fixed the size of players' home islands to a value depending on the map size (200-1200 nodes). Also, I added configurable "extra" islands (few/medium/many) of random size (range between 200 & 1200 nodes). This makes water & mixed maps slightly more interesting to play I think.
At the moment, I did not bind the central island to a specific size. I liked the idea of having a big island where multiple players can meet eventually. But up to discussion, could also make it optional/configurable as well.
Also, I have to increase the test coverage, I'll look at that this weekend.