This changes a couple of things with the mapgen libraries:
- The XClasses constraints factory functions have been moved from library into Constraint, which is probably a more appropriate place for them.
- I added a nearClasses function for generating that particular type of constraint, which did not previously have a factory.
- I added a mountain range generator library file, which is an improved fork of the mountain range generator from the Alpine Valley script. Depending on how it's configured it can potentially produce highly diverse results, from giant mountains to rolling sand dunes.
- I changed some of the core object creation convenience functions to use the new object placing behavior instead of the deprecated behavior.
Basically the difference is that, say you try to create 10 metal mines, with the deprecated behavior if you set the retry factor to 70 you might get 700 mines, or you might get none at all. With the new (and actually correct) behavior you can set the retry factor to 1000 and if you asked for 10 mines you'll only get 10 mines, assuming that there are sufficient locations that meet the specified constraints. This is extremely important for getting reliable object placement behavior, both for resources like stone, metal and food and also for placing props. With the new behavior it's much, much easier to ensure that generated maps are well balanced and consistent, and that any randomness is intentional rather than an undesired side-effect of badly designed library functions. The new functions use much higher retry factors; 1000, 500, and 250 for mines, food and decorations, respectively, as opposed to 70, 50, and 20 for the old functions.
I also added an optional "areas" parameter to all of the object creation functions, since placing objects by area is generally much more reliable for things like, for example, placing fish into lakes or placing units in very specific defined areas. Technically the functions with the new behavior could probably do it reliably by brute force, but by-areas requires far fewer retries to get a successful placement, and so should reduce map generation time where applicable.
The optional areas parameter has no effect on existing maps (it's the last argument and optional), but any maps using the existing create mines/food/decorations functions will need to be re-tuned to the newer behavior. As the problematic old deprecated behavior is a major blocker to creating good mapgen scripts, it should be phased out entirely well before a24 to allow for new content to be developed. Preferably all the old deprecated code should be removed before a24 including the dead libraries in rmgen2, and anything useful consolidated into a more centralized library. This is merely the first step towards that goal.