Forums
April 26, 2024, 06:47 PM

Author Topic: MapGEN v0.8.7.2  (Read 55626 times)

0 Members and 2 Guests are viewing this topic.

Offline TheKomodo

Re: MapGEN v0.8.6.2
« Reply #270 on: December 17, 2018, 09:00 PM »
Interesting stuff Plutonic :)

You must be pretty interested in Math?

Offline Plutonic

Re: MapGEN v0.8.6.2
« Reply #271 on: December 17, 2018, 09:07 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.

Offline Xrayez

Re: MapGEN v0.8.6.2
« Reply #272 on: December 17, 2018, 09:13 PM »
Oh I see, so the curves define the actual map. While reading about points, it reminded me about Voronoi diagram in some way.

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.

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...

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. :)
« Last Edit: December 18, 2020, 12:13 PM by Xrayez »

Offline Xrayez

Re: MapGEN v0.8.6.2
« Reply #273 on: December 17, 2018, 09:14 PM »
Interesting stuff Plutonic :)

You must be pretty interested in Math?

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

Offline Xrayez

Re: MapGEN v0.8.6.2
« Reply #274 on: December 26, 2018, 05:29 PM »
Apart from map generation I'm almost done with grass/roots rendering, thanks!  ;D


(the map is hand-drawn, not generated)

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



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

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:

Quote
Perfect 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.  :)

Quote
The 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.
« Last Edit: December 26, 2018, 06:28 PM by Xrayez »

Offline Plutonic

Re: MapGEN v0.8.6.2
« Reply #275 on: December 26, 2018, 06:54 PM »
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!

Offline Xrayez

Re: MapGEN v0.8.6.2
« Reply #276 on: December 27, 2018, 03:59 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!



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!
« Last Edit: December 27, 2018, 04:08 PM by Xrayez »

Offline Xrayez

Re: MapGEN v0.8.6.2
« Reply #277 on: December 28, 2018, 11:29 AM »
Made a theme for MapGEN:

* Magic.zip (123.76 kB - downloaded 69 times.)


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

« Last Edit: December 28, 2018, 11:31 AM by Xrayez »

Offline Sensei

Re: MapGEN v0.8.6.2
« Reply #278 on: December 28, 2018, 02:00 PM »
Cool terrain Xrayez. Can this also be implemented in game like tetris and candy?

Offline Xrayez

Re: MapGEN v0.8.6.2
« Reply #279 on: December 28, 2018, 02:31 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:


Offline Sensei

Re: MapGEN v0.8.6.2
« Reply #280 on: December 28, 2018, 05:50 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 :/

Offline Xrayez

Re: MapGEN v0.8.6.2
« Reply #281 on: December 28, 2018, 05:57 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.

Offline Sensei

Re: MapGEN v0.8.6.2
« Reply #282 on: December 28, 2018, 07:50 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.

Offline Plutonic

Re: MapGEN v0.8.6.2
« Reply #283 on: December 28, 2018, 07:57 PM »
If you use the mapgen wormkit module you can generate from within the editor screen.

Offline TheKomodo

Re: MapGEN v0.8.6.2
« Reply #284 on: December 28, 2018, 09:01 PM »
Also, .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.