Repository navigation
Conversation
|
Can you describe what exactly is/should be changed/added by this PR? |
|
Improve random map generation with additional terrain features This PR enriches randomly generated maps by filling large, otherwise empty land areas with a variety of terrain features and special scenes. Terrain generation
New generator settings Three sliders control how much of the available land is occupied by mountains, deserts and swamps. Their combined values determine how much open land is filled. A separate checkbox enables or disables the generation of special scenes. The default settings preserve sufficient free space for headquarters placement, while allowing players to adjust the amount and variety of terrain features to their liking. Generation improvements
Tests Add and adjust random map generation tests to cover terrain generation, available building space, special scenes and harbor placement. |
Flamefire
left a comment
There was a problem hiding this comment.
I trust your AI and your judgement of its output and just scrolled over the code.
A bit verbose docstrings and * @param rnd random number generator doesn't really add much additional context but nothing really stuck out.
We should really enforce our naming scheme more as documented at https://github.com/Return-To-The-Roots/s25client/wiki/Coding-conventions
Parameters, local variables, member functions: lowerCamelCase
we violate that already (historically) but such large AI-PRs make it worse.
So either we change our style (guide) or enforce it for new code at least.
I'd say a (larger) PR just renaming where we currently violate that would be best and with AI likely automat-able.
AI will then pick up the existing style for new code automatically.
Or we decide for UpperCamel member methods and update the code for that.
I'd really like to keep that for classes though which allows FooBarGen fooBarGen; to be unambiguous.
I can see an advantage of having UpperCamel member methods but lowerCamel free functions.
But foremost I'd like to have consistency to avoid confusion. @Flow86 your opinion on the direction for this?
|
we should probably at least try to enforce it for new code. lowerCamel free functions + methods make it more readable, |
|
Yeah fair enough, would actually be good to have that as part of the repo, so AI automatically picks up the correct coding style. Also not quite sure how to deal with large AI PRs either, I spent most time testing and trying to understand what it had done, rather than changing the output code. The comments are mostly AI slope, will rework that (or let it rework it) |
Especially on large maps, random maps contain big empty areas. Repeatedly start a new mountain at the node furthest away from water and mountains until no node exceeds the free land to keep. Mountains shrink with each iteration and keep a margin to obstacles, so passages stay open. The free land to keep is based on the mountain distance setting, so it remains possible to place headquarters at the desired distance. Mountains are raised relative to the surrounding land and textured directly to avoid cliffs. Textured nodes are treated as obstacles which leaves islands (and player start positions on water maps) untouched. See Return-To-The-Roots#1530 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The new slider controls the minimum free land to keep. The default of 50% keeps the desired HQ distance to mountains available, 0% disables additional mountains and higher values reduce the free land down to the space required by headquarters. See Return-To-The-Roots#1530 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Free land of random maps is no longer filled with mountains only. Each area found by the mountain search becomes a mountain, a desert hill or a swamp. The new "Desert" and "Swamp" sliders set the proportions together with "Mountains", and the sum of the three controls how much free land is filled. Types are assigned by a running budget so the proportions hold even for a handful of areas, and the first area is always a mountain to keep mines available. - Desert hills are low, smooth hills of desert (wasteland or ice in the other landscapes) with bones around the center. - Swamps (stony lava or ice floes) are flat and half the size of a mountain. Land above a swamp descends to it by one level per node at most, without lowering the banks of rivers or other landscapes. - Deserts are always separated from lush land by steppe and savannah. This is applied after all other texturing as coast transitions may replace textures set before. - Trees, stone piles, animals, fish and harbors keep away from deserts and swamps. The new "Special Objects" checkbox places a few scenes on buildable land, depending on the map size. A scene combines a theme (castle ruin, tower ruin, graveyard, camp, stone circle) with a random layout (overgrown patch, avenue, crag with pond, trail). The ground of a scene blends into the land with one ring per transition texture, hills are smooth and the scene stays free from random trees and stone piles. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The random distributions of the standard library differ between platforms, so maps generated from a fixed seed differ as well. Three tests only passed for the maps generated on macOS. Special scenes required buildable land eight nodes around their center which many maps don't provide: maps often ended up without any scene. Now only the middle of a scene has to be free. Water, mountains, other landscapes and objects in the outer part are left untouched and simply cut the scene. - Test the limit of free land with mountains only as the foot of desert hills is buildable and counts as free land. - Check that flowers don't touch the surrounding meadow instead of relying on the size of the patch. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Restore the single-line test context which a newer clang-format had wrapped. The CI checks formatting with clang-format 10. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The random map test only checked harbors if the generated map contained any, which left the check uncovered. Test the search for coastlines directly with a lake and a swamp made of water instead. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Avoids copying the nodes into a second vector just for sorting, which clang-tidy reported as inefficient vector operation. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
84c8ace to
e9e8b38
Compare
- Use lowerCamelCase for all new functions and methods (free functions, RandomMap members, SceneBuilder methods) and the matching test names - Use maxEnumValue/EnumArray for LandFill instead of numLandFills and a std::array indexed by casts - Shorten docstrings and drop @PARAM lines that add no information Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J1xFd2ZsbRhtWeVV21cLbw
|
Updated the pr last night. Also asked it to apply convections to the entire mapGenerator module to keep it consistent |
|
#2018 was just merged which includes the contribution guide in the repo and updated the names of member methods. |
Resolve conflicts with the lowerCamelCase refactoring (Return-To-The-Roots#2018, Return-To-The-Roots#2019): keep the swamp/desert/special-object changes of this branch and use the renamed upstream API everywhere, including the new files that merged without textual conflicts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J1xFd2ZsbRhtWeVV21cLbw
|
All good, rebase was straight forward |
|
Let me know if I need to do anything else. Otherwise, I'll just consider it done and wait for the merge :D |
A few visual improvements for the random map generator to fill out massive open land masses.
If not obvious, got a "little" help (Fable).
Related to #1530