Procedural dune generation painter.
Details
- Reviewers
- None
- Group Reviewers
Restricted Owners Package (Owns No Changed Paths)
Used in map Dune: https://code.wildfiregames.com/D1636
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Branch
- /ps/trunk
- Lint
Lint OK - Unit
No Unit Test Coverage - Build Status
Buildable 10160 Build 17228: arc lint + arc unit
Event Timeline
Could you add a screenshot as a showcase, please?
There was the rectangularSmoothToHight function that took an influence map of surrounding tiles that could also be used to create dunes. (looks like it has been removed in a cleanup frenzy though...)
The map on https://wildfiregames.com/forum/index.php?/topic/24638-random-map-dune-desert/ is the showcase
@nani maybe a good occasion to use the new class syntax? VSCode can auto convert it.
Also missing newline at end of file and semicolons :)
Some coding convention notes to keep you waiting for FeXoR.
Comments Start with caps a space and end with dots.
Boolean instead of bool I believe
I guess you could use let for that for loop.
Is it a rmgen convention to have lower case functions?
Seems I forgot add the possibility to customize the base height (was always 0 if ELEVATION_SET)
binaries/data/mods/public/maps/random/rmgen/painter/DunePainter.js | ||
---|---|---|
6 | @ both scaleVertical and baseHeight: In what unit? State that. (e.g. tiles, meters, engine space units, art length units, ...) | |
20 | Nice you added the expected value range but a discription is missing ;) | |
44 | "wider than tall" once more. | |
56 | Those are magic (optimized by fiddling around and testing aiming for the result you find most appealing I guess - that's OK of cause!) numbers anyway so would'nt it be appropriate to use 8.1 instead of 9*0.9 and 5 instead of 50*0.1? If this multiplication really helps wrapping your head around what's going on leave them as they are I guess. | |
61 | Huh? When does the case "not this.type" happen??? |
Mostly good, please try to make the JSdoc phrases and comments more telling and check that last "type" check.
binaries/data/mods/public/maps/random/rmgen/painter/DunePainter.js | ||
---|---|---|
6 | scaleVertical is a multiplier so its value is adimensional | |
56 | 0.9 and 0.1 are weights but yes, I prefer to leave the expression expanded for easy modification. | |
61 | this.type can be ELEVATION_SET = 1 or ELEVATION_MODIFY = 0 |
Well, the map looks good, but I can't say that much about the code (Due to not having that much knowledge about random noise creation and due to not having looked at it that much).
As far as I can see this depends on perlin noise (or fractal noise?), which raises the question to me if perlin noise delivers that much better results that the noise that is already in rmgen ?
The last thing I heard about perlin noise is that there are copyright disputes, which is why OpenSimplex Noise was developed.