5
\$\begingroup\$

the result i’m Looking for

I’ve been fascinated by procedural generation for over two years now. I have played around with many types of noise generation and even wrote some myself. I’ve been looking into water erosion and procedurally generated biomes and during this time I’ve managed to build some nifty little map generators. Something that has always escaped me, however was generating a procedural map that is not “tile based”. So far, all the procedural map generators I have built relied on one axiom - the map is represented as a 2d matrix containing some sort of information about the terrain that is to be found there. This means that I, by definition, can’t build anything that is not tile based.

And this is why I come here asking for your help. I am curious about how one could render a procedurally generated map in a non tile-based fashion. My end result is the image I posted.

The solution that immediately jumped to my mind is drawing each end every pixel individually, thus making the map look essentially non tile based. This, however would require enormous memory and is unfeasible.

So I am turning to the masters - how can I procedurally generate (and more importantly render) such a map? How would I go about representing the sprites to be drawn? Where do I even get started? This feat is so much out of my grasp that I do not even understand where I should be looking

Note - I know about marching squares and wang tiles. These approaches are however not something I’m fond of because of the huge workload that would go into drawing the resources. I am looking for something more in the realm of algorithms

Thank you!

\$\endgroup\$
  • 2
    \$\begingroup\$ Welcome to GDSE. Taken as a whole, this question strikes me as too broad / too much of a how do I get started question. I can think of a few of different ways just to do the procedural rivers alone. Please consider editing down to one or more on-topic questions. \$\endgroup\$ – Pikalek Apr 27 at 21:36
  • \$\begingroup\$ For example every vector graphics is non tile/pixel based. \$\endgroup\$ – Trilarion May 9 at 11:17
  • \$\begingroup\$ If you're not using tiles then you have to render the texture yourself, then use that texture in your displays just like you noticed. That is why tiles were invented, to compress the space required. Note: "algorithms" are not magical, everything you've created so far has been the result of algorithms... \$\endgroup\$ – Patrick Hughes May 9 at 23:54
  • 1
    \$\begingroup\$ Have you looked at how existing fantasy map generators of this ilk work under the hood? \$\endgroup\$ – DMGregory May 10 at 11:35
  • \$\begingroup\$ @DMGregory wow, this is great! Thank you! \$\endgroup\$ – Mihai Fumarel May 10 at 12:50
2
\$\begingroup\$

I'm not a master, nor do I do much with procedural content, but this is how I would create such an image:

If you're not using tiles, I would think the next most basic element is line (which you can define as an array of points). Take the river in your reference image for example. That's simply two parallel lines, with random points along each line randomly offset to the left or right via your favorite noise algorithm.

If you want a specific river shape, just start with a single, low-resolution center line, maybe with just a few randomly shifted points to set the initial flow. From the center line you can basically extrude your left and right edges, and just add more randomly shifted points along each edge line for more detail. Once you've got your lines represented in memory, just use a flood fill algorithm to texture the overall river shape.

You could just as easily work with shapes instead of lines. If you were to generate a smooth noise image, you could use an algorithm to group values/colors into shapes. Once you know the bounds of a certain shape, pick a random point within that shape to place your sprite. If your sprite doesn't fit within the bounds of the shape, pick another point inside the shape until you find one that works (but only do that a few times; If you can't find a valid point in a reasonable amount of time, skip it and move on).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.