I’ve some “my” vision of how it should be implemented, based on that presentation of H3 RMG:
- Split map to zones, according to template. This can be done simply by having several internal templates of placement, based on zones connections. I.e. if there are a zone that connects to more that 3 other directly, we should put it in center area and put others around. If there is no such zones, we can make zones roughly equal by width and height or make long, stretched by x or y, etc. I think there is very limited set of possible ways, and they can be somehow hardcoded, no need to use some complicated algorithm for them.
After deciding a rough template, place dots split using voronoi diagram the space. Or may be some else, but this will be ok for the start, I suppose. - Start filling each zone by placing boundary obstacles (to divide from surrounding zones) and essential objects, like castles, mines and ways to other zones. Way is just a road, if zones are directly connected, or portal if road won’t fit. About that problem with portals, may be I didn’t understood it right, but I don’t see anything wrong in placing portals instead of roads, cause cost to travel it is roughly same (maybe like 2/3 steps shorter, but that’s negligible). I even thought of starting without any roads, only portals cause it can simplify things a little.
- Now place optional object in some prioritized order. I.e. place additional castles/towns, then mines, then dwellings, special objects (well, etc), resources, treasures/artifacts.
- Make roads to connections.
- Finalize by putting guards and obstacles everywhere needed.
- Validate that all is guarded and is accessible properly.
Placement of the objects may be done by algorithm described in presentation, by putting them while some minimal distance is keeped between them, thus having desired distribution around the zone.
The most complex task for me seems the right placements of obstacles and guards, so they won’t block something that was not intended to be blocked. I think that should be done on both steps of placing objects and guarding them, so object won’t be placed on some tile that is not possible to guard properly. Other way may be to delete this “wrong placed” objects on the step of guarding/validation. But this should be done carefully and only with additional objects like treasures/resources, so it won’t hurt balance a lot.
I’ve already made some programming, and have some of this working:
- Zones can be of any polygonal shape, for now map is split to rectangles, but it should work for any shape.
- Town is putted to the center of the zone.
- Mines and resources are distributed over the zone.
- Some resources are guarded, but by very stupid method of simply surrounding them with obstacles and putting a guard on one of the tiles.
That’s what I have for now, and I want to improve it till I’ll get something like I described on top.
I already have plenty of feedback because of coding and testing (i.e. that guards should be incorporated with placement, in the beginning I thought this should be totally different steps). I think that’s a better way of doing the RMG, since many problems will surely arise during process, and extensive planning may fail at some point.
And additional question about random number generator:
If I use it like this: gen.getInteger(0, 10), it always gives the same number again and again. I’ve fixed this at some places where range is limited, by simply using static var for gen.getRangeI, but there are some cases where this is not possible. How can this be solved?