Implements random map system, fixes #6.
Includes default library "rmgen" w/ API based on rmgen tool.
Modifies rmgen scripts Cantabrian Highlands, Neareastern Badlands, and Latium.
Old map support dropped from MapReader.
Fixes a few bugs in existing game setup and initialization scripts.
Description
Description
Event Timeline
/ps/trunk/binaries/data/mods/public/maps/random/rmgen/placer.js | ||
---|---|---|
156 | unused |
Comment Actions
This was a very important patch in 0 A.D. history as it allowed modifying the random map gen library without having to mess with C++ code.
/ps/trunk/binaries/data/mods/public/maps/random/rmgen/painter.js | ||
---|---|---|
1 | Order of painters is awkward (ElevationPainter, LayeredPainter, SmoothElevationPainter, TerrainPainter) should be (TerrainPainter, LayeredPainter, ElevationPainter, SmoothElevationPainter) so that painters are grouped by what they do (texture or elevation) and in the order of increasing complexity (simple, complex). | |
50 | The Breadth-First-Search algorithm copy & pasted by LayeredPainter and SmoothElevationPainter, rendering both functions unintelligible, so neither improvable nor maintainable. | |
195 | comments redundant with code | |
283 | semi-redundant if statements with redundant partial consequents | |
/ps/trunk/binaries/data/mods/public/maps/random/rmgen/placer.js | ||
72 | The cubic interpolation could have been moved to a function, | |
/ps/trunk/binaries/data/mods/public/maps/random/rmgen/random.js | ||
1 | There were thousands of lines of code that were replaced in alpha 22 with patches by bb to get rid of these functions again. | |
/ps/trunk/binaries/data/mods/public/maps/random/rmgen/terrain.js | ||
42 | Not a fan of these code separators. Let the code speak for itself. |
Comment Actions
This commit transcribed what was identically present in C++ before.
The original C++ rmgen system was introduced in rP2293 (What was that ASCII generator though?).
The SmoothElevationPainter was introduced in rP2519.
The first two random maps were Cantabrian Highlands rP2683 and Neareastern Badlands rP2733.
The C++ rmgen code was removed after this commit in rP9219.
/ps/trunk/binaries/data/mods/public/maps/random/rmgen/painter.js | ||
---|---|---|
182 | heightmapSize would have been more clear (refs #4825). |
/ps/trunk/binaries/data/mods/public/maps/random/rmgen/placer.js | ||
---|---|---|
156 | Deleted in rP20357. | |
197 | Just use && to test all conditions at once instead of of nesting in the else part. Fixed in rP20357. | |
220 | always met | |
/ps/trunk/binaries/data/mods/public/maps/random/rmgen/vector.js | ||
8 | Why does this use y and not z and introduce a Point? |
Comment Actions
There were 5 months of rewriting the random map script and random map generation library put into this, which addresses all duplication concerns, the requested sorting, adds documentation and switches almost all operations to vector algebra.
It is an ingenious library!
/ps/trunk/binaries/data/mods/public/maps/random/rmgen/placer.js | ||
---|---|---|
18 | This prevents getting a large circular area if the center is out of bounds or fails the constraint, even when the fail fraction is infinity. |