English
Search
Main Menu
Forums

MapGEN v0.9.1.1

Started by Plutonic, July 25, 2015, 09:28 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.


Plutonic

Quote from: TheKomodo on December 17, 2018, 09:00 PM
Interesting stuff Plutonic :)

You must be pretty interested in Math?

Mmm, no, not realy :D I like making games! Though I do quite like map generation, which usually involves some mathsy bits.

Xrayez

#272
Oh I see, so the curves define the actual map. While reading about points, it reminded me about Voronoi diagram in some way.

Quote from: Plutonic on December 17, 2018, 08:36 PM
This actually wasn't too tricky. The WA graphics provide an image of a small section of grass that tiles horizontally. In order to map it on to the generated map I split it up into as many images as the graphic is wide and then store them in an array. Then, for every pixel that is a "top edge of the map", we just place one of these 1px images on it (centered), where the modulus of the x co-ordinate is used to look up the correct image.

Oh yeah indeed, it would be quite simple when I get to implement it! I can draw grass only once so that it shouldn't affect runtime performance, we'll see.

Quote from: Plutonic on December 17, 2018, 08:36 PM
Urrrr, I probably *should* use normals. But it currently doesn't. And object placement is realy not all that great in MapGen to be honest!
The idea is basically:
1) Scan along the bottom of the object image and work out how wide the "base" of the object is, and where the middle of this base is.
2) Scan through all the edges of the map, look for areas in which the objects "base" would be entirely in the floor, and potentially there aren't other collisions with exisiting map/objects.

Ok so this is quite simple as well then, I can actually check collision against polygons, check the intersection for overlap. If the intersection area is small it means I can somewhat safely place the object...

Quote from: Plutonic on December 17, 2018, 08:36 PM
The current version is not a maze generation algorithm as such, and while I sort of remember the technique, not enough to explain it to someone else. I have managed to find the site that explained it well enough for me to work from at least: https://orden-y-concierto.blogspot.com/2014/12/unicursal-mazes-and-cavern-mazes.html

I'm not a stranger to reading papers!

I'll definitely check out maze algorithm to start things off, I think it's essential if I want roping to be one of the main game modes.

Good write up, thanks! If I can figure out more questions I'll post here. :)

Xrayez

Quote from: TheKomodo on December 17, 2018, 09:00 PM
Interesting stuff Plutonic :)

You must be pretty interested in Math?

Game developers hate math but they have to use it!   ;D

Xrayez

#274
Apart from map generation I'm almost done with grass/roots rendering, thanks!  ;D

map.png
(the map is hand-drawn, not generated)

The only problem I'm facing is grass/roots overlapping:

map_grass_problem.png

I think this is what you meant by "centered":

Quote from: Plutonic on December 17, 2018, 08:36 PM
Then, for every pixel that is a "top edge of the map", we just place one of these 1px images on it (centered), where the modulus of the x co-ordinate is used to look up the correct image.

Seems like I need to figure out whether the grass/roots exceed the vertical slice's center of the map to find out whether it can draw them further...




I've read about unicursal mazes in the link you provided and I think this is the gist:

QuotePerfect maze (left) and unicursal loop resulting from it (right). The loop can be broken at any edge next to one of the exterior walls and parallel to it (marked in red), to give a unicursal maze that starts and ends at a border.

I suspect that you somehow generate a bunch of those loops and break them at strategically random edges that actually seamlessly connect them afterwards... Still far from implementing it though.  :)

QuoteThe maze dimensions should both be 4 or more, or 3×(odd number ≥ 3), to exclude some special cases that are hard to handle, as some have a solution and some don't.

This actually explains why you generator is limited 4x4 rooms in RR maps!

Also, Merry Christmas and Happy New Year! Feel free to reply any time.

Plutonic

Good job so far! Looks about right to me! The overlapping issue is definitely something I had to cope with, I think I checked for the amount of free space both above and below the map edge. (You can get the opposite issue in thin areas of sky). Think I then just scaled it to fit when it didn't, I don't have the code on me right now.

There are two methods in that article, the first quote is from the first one, which mapgen used to use, but no longer does. The second quote relates to the method I use for it now. And yes, hence the limits set!

Xrayez

#276
Quote from: Plutonic on December 26, 2018, 06:54 PM
I think I checked for the amount of free space both above and below the map edge. (You can get the opposite issue in thin areas of sky). Think I then just scaled it to fit when it didn't, I don't have the code on me right now.

No need, I managed to handle the overlap!

map_render_grass_over_roots.png

Basically I just look up twice the grass image height ahead before actually drawing the grass:

Code (C++) Select
               
int lookup_limit = grass_height;
if(p_limit_centered) {
    lookup_limit *= 2;
}

// ... checking for map pixels to draw on here to determined by `lookup_limit` ... then:

int render_slices = render_to - render_from;
if(p_limit_centered) {
    // Render only the top half of the map's vertical slice
    render_slices /= 2;
}

// ... draw the grass


Conveniently I don't necessarily have to do the same thing for the roots because if I draw the grass over roots it already masks away roots pixels!

Xrayez

#277
Made a theme for MapGEN:

Magic.zip

Based on Dungeon theme. Seems to work fine even with different grass/roots texture sizes!

MapGEN_Magic_Island.png

Sensei

Cool terrain Xrayez. Can this also be implemented in game like tetris and candy?

Xrayez

Quote from: Sensei on December 28, 2018, 02:00 PM
Cool terrain Xrayez. Can this also be implemented in game like tetris and candy?

Thanks! You mean like using the same objects from tetris/candy themes with this type of terrain? You'd just have to replace relevant /objects from those themes for that:

MapGEN_Magic_Candy_island.png

Sensei

Quote from: Xrayez on December 28, 2018, 02:31 PM
Quote from: Sensei on December 28, 2018, 02:00 PM
Cool terrain Xrayez. Can this also be implemented in game like tetris and candy?

Thanks! You mean like using the same objects from tetris/candy themes with this type of terrain? You'd just have to replace relevant /objects from those themes for that:

[attachment=1]

I mean - using this terrain in game as old ones - cheese, snow, old forest..!? (To be able to generate this terrain's maps in game's map editor)

I'm guessing it won't be possible due to higher numbers of colors.. or whatever. Seems like i asked this question already for some other terrain :/

Xrayez

Quote from: Sensei on December 28, 2018, 05:50 PM
Quote from: Xrayez on December 28, 2018, 02:31 PM
Quote from: Sensei on December 28, 2018, 02:00 PM
Cool terrain Xrayez. Can this also be implemented in game like tetris and candy?

Thanks! You mean like using the same objects from tetris/candy themes with this type of terrain? You'd just have to replace relevant /objects from those themes for that:

[attachment=1]

I mean - using this terrain in game as old ones - cheese, snow, old forest..!? (To be able to generate this terrain's maps in game's map editor)

I'm guessing it won't be possible due to higher numbers of colors.. or whatever. Seems like i asked this question already for some other terrain :/

I don't think that's possible... One could replace the theme data with this one in W:A, but that would lead to desync issues, because the other player must have the identical theme installed on his PC, so it's not trivial. That's why MapGEN exists, because the image maps are synced.

Sensei

Quote from: Xrayez on December 28, 2018, 05:57 PM
One could replace the theme data with this one in W:A, but that would lead to desync issues, because the other player must have the identical theme installed on his PC, so it's not trivial.

Easily avoidable. Instead of .bit, make terrain into .png (can be done in wa map editor with few clicks. no desyncs if someone in the lobby don't have that terrain in wa folder)

Also, .png is what i use all the time, cause it removes background soil from damaged terrain. Having those invisible pixels around the map is a fun killer, especially in fast paced schemes like aerial, where you need to quickly fly through map ruins.

Plutonic

If you use the mapgen wormkit module you can generate from within the editor screen.

TheKomodo

Quote from: Sensei on December 28, 2018, 07:50 PMAlso, .png is what i use all the time, cause it removes background soil from damaged terrain.

This is what actually put me off from using PNG BnG maps, I may be the only one to experience it but I spent so long getting used to banking and planning transfers with bit maps, I made too many mistakes on PNG maps.

It doesn't really matter now though as I don't really play BnG anymore. I also always thought PNG backgrounds have horrible colours and look awful, it hasn't been optimized very well in that way, I don't like that bright purple sorta colour.

I can definitely see how this is useful for what you mentioned though.