Opened 12 years ago

Closed 11 years ago

Last modified 5 years ago

#892 closed enhancement (fixed)

Add paths to random maps

Reported by: historic_bruno Owned by: historic_bruno
Priority: Nice to Have Milestone: Alpha 9
Component: UI & Simulation Keywords: rms, rmgen
Cc: Patch:


One thing missing from the rmgen API is the ability to place paths. Paths are conceptually a line connecting two points, with some parametric variation in curviness. They can be used for roads, rivers, and many other things. The current plan for implementation is an area placer called PathPlacer which can be used in place of clumps.

An example of how this might look on the Cantabrian Highlands map:

Attachments (2)

pathplacer.js (5.6 KB ) - added by historic_bruno 11 years ago.
work in progress
pathplacer2.js (5.0 KB ) - added by Jonathan Waller 11 years ago.
Updated script with fixed fill code

Download all attachments as: .zip

Change History (13)

comment:1 by Kieran P, 11 years ago

Milestone: Alpha 7Alpha 8

comment:2 by Kieran P, 11 years ago

Milestone: Alpha 8Backlog

by historic_bruno, 11 years ago

Attachment: pathplacer.js added

work in progress

comment:3 by historic_bruno, 11 years ago

Keywords: review added
Milestone: BacklogAlpha 9

I have no idea what's wrong with that path placer, but I'm tired of having it around with no progress :)

by Jonathan Waller, 11 years ago

Attachment: pathplacer2.js added

Updated script with fixed fill code

comment:4 by O.Davoodi, 11 years ago

Resolution: fixed
Status: newclosed

The new path placer script works perfectly. So we should close this.

In 11152:

Adds the path placer library by historic_brunno to rmgen. Fixes #892.
Also takes all the duplicated parts of random maps including the new player start entities and random biome system into rmgen libraries.
Tweaks nile river and snowflake random maps.

Last edited 11 years ago by O.Davoodi (previous) (diff)

comment:5 by historic_bruno, 11 years ago

Keywords: review removed

comment:6 by elexis, 5 years ago

In 20132:

Remove unnecessary, terribly named random biome getter functions.

Refs #892 / rP11152
Proposed by leper in irc on 2016-06-15
Discussed with FeXoR in irc on 2016-04-10

comment:7 by elexis, 5 years ago

In 20383:

Extend the cubicInterpolation function to consume a tension argument allowing to modulate the smoothness of the interpolation.

Thereby unify the chordal Catmull-Rom spline interpolation of the ClumpPlacer (C++ rP2378, JS rP9096),
the copy of that in the PathPlacer (rP11152, refs #892) and
the centripetal Catmull-Rom spline of the bicubicInterpolation function from rP18925, refs #4218
and don't claim the latter to be a uniform Catmull-Rom spline.

Reviewed in part by fatherbushido, discussed in rP18925.

comment:8 by elexis, 5 years ago

In 20879:

Extract a RandomPathPlacer prototype from Deep Forest (rP11444) and Schwarzwald (rP15327) duplication, refs #4805, #4804.

This allows creation of paths that are not linear nor sine-shaped like the PathPlacer, refs #892.
To mimic the per-tile path elevation randomization on Deep Forest, use a SmoothElevationPainter and it's randomization argument from rP20354.
Use vector algebra and the mapCenter getter, refs #4845, #4854.

comment:9 by elexis, 5 years ago

In 20969:

Fix wrong PathPlacer failfraction computation in rP11152, refs #892.

It unintentionally used the dist variable of the inner loop, not the dist variable reflecting the path length.
It was never noticeable since the few PathPlacers called with Constraints either had failCount 0 or
exceeded the allowed failures by a factor of thousands.
All PathPlacer calls were intended to succeed or fail completely.
Hence set the default failFraction to 0.

comment:10 by elexis, 5 years ago

In 21081:

Rename some variables of the pathplacer and use JSdoc, refs #892, #4831.

comment:11 by elexis, 5 years ago

In 21082:

Implement a ConvexPolygonPlacer that returns all points in the convex hull of some given points.
Implements the Gift-Wrapping algorithm to compute the convex hull.

Replace the latter half of the pathplacer with this new placer, refs #892.
Improves the performance a bit, refs #5011.

Use the new placer on Kerala and Hyrcanian Shores to replace the workaround from rP20933, refs #4855
(the area is not supposed to be parallel to the meandering river).

Note: See TracTickets for help on using tickets.