9
\$\begingroup\$

I've been experimenting with algorithms to automatically generate road maps for a game I am working on.

I'm using the "Kingdom Rush" games as a reference point as they have some great-looking maps.

Examples of road maps from the game "Kingdom Rush"

I am new to procedural content generation, and was wondering if anyone here has any pointers. I have experimented with generating random road topologies, e.g. a few entrance/source nodes, several inner nodes (fork and merge), and some exit sink nodes, then using graph-layout algorithms to create an actual road map based on this information.

Here's one example using the Fruchterman-Reingold algorithm for road layout:

PCG-generated map 1

The blue graph uses some randomly-generated Bézier control points to make the edges look less straight.

Here's another example generated using the same algorithm but different random numbers:

PCG-generated map 2

The trouble is most of the results end up looking quite similar, and I am not sure what rules I can add to improve the controllability and diversity of the procedurally-generated maps.

Any advice appreciated.

\$\endgroup\$
2
  • \$\begingroup\$ Awesome question. The reference images help a lot as does including the stuff you've tried so far. Can you elaborate a bit more on what you mean by 'controllability'? There's lots of things you could control; some examples would help. \$\endgroup\$
    – Pikalek
    Commented May 8, 2018 at 13:54
  • \$\begingroup\$ Hi! Thanks for the response. By controllability, I mean is it possible to write certain rules (e.g. don't place intersections closer than a certain distance from each other; don't allow angles sharper than x degrees) and have the generation algorithm respect these constraints? In addition, these rules shouldn't hamper the algorithm's ability to generate a diverse range of interesting maps. Your encouragement is heartening though. I was beginning to get frustrated with the details of getting this to work! \$\endgroup\$
    – SixTwoOne
    Commented May 9, 2018 at 5:25

1 Answer 1

2
\$\begingroup\$

Your example roads have curves on the segments between intersections where your generated ones do not. Have you tried adding more "redundant" control points on your roads?

How about having the number of loops be a generation parameter? Also "curviness" (number of redundant control points) Number of exits would be another.

I think you could also end roads when they hit intersections by giving them double control points. That should make the intersections look better.

\$\endgroup\$
1
  • \$\begingroup\$ I think the intermediate control points suggestion is good! The graph-layout algorithm I am using at the moment only produces straight lines, but I could place a "curved bend" node somewhere between two other nodes and use a heuristic to place control points nearby that would make it look pretty. I definitely need to look into this more, as it also ties in with creating better-looking intersections. \$\endgroup\$
    – SixTwoOne
    Commented May 9, 2018 at 5:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .