Jump to content

Random map : Alpine Mountains


 Share

Recommended Posts

Hey guys, here is my try at making mountains in 0 A.D. with the new random map "Alpine Mountains", inspired by the skirmish map of the same name :

screenshot0049.thumb.png.c8672593e9ea9670d357cbc38dc2b3f9.png

screenshot0052.thumb.png.879f308a09e270d09b14a3f20e8a4d2a.png

screenshot0051.thumb.png.bf6acfd906b1f249125605e66c5ebc9e.png

However, sometimes the generation can make a player separated from the rest due to forest blocking the path, this should be fixed sometimes later.
The recommanded map sizes to put in the settings is one size larger than what you would typically do for mainland type maps. It would be something like Medium for 2-3 players, Normal for 4-5 players, Large for 6-8 players .
Hope you will enjoy it.

Download here :
feldmap.zip

Edited by Feldfeld
  • Like 9
Link to comment
Share on other sites

46 minutes ago, niektb said:

Only Vosges Mountains don't have any snow and are much more forested IIRC (been on holidays there for a couple of times but looooong ago)

Yeah, also they are not very tall. I think my map ressembles more the feel of the alps except the shape of the mountains isn't quite there yet, too round/regular overall.

43 minutes ago, badosu said:

You can make passages to ensure at least some pathway is free: https://github.com/0ad/0ad/blob/master/binaries/data/mods/public/maps/random/rmgen-common/gaia_terrain.js#L537

E.g. you make all players have a passage to the center or to other players. I'll check this map out!!

I know, but the result would probably look ugly in my case I think.
My dream would have been to somehow be able to use the pathfinder to :
- reject non valid generations
- enlarge existing but small path (for better gameplay)
- possibly paint some roads

Link to comment
Share on other sites

Instead of making an obvious passage you can use the smooth painter for elevation, so the path is at least trespassable. You can also make hills avoid other hills, or use a special class for other non-trespassable obstacles

Edited by badosu
Link to comment
Share on other sites

53 minutes ago, Feldfeld said:

My dream would have been to somehow be able to use the pathfinder to :
- reject non valid generations
- enlarge existing but small path (for better gameplay)
- possibly paint some roads

You don't really need the pathfinder to do that. You just need to flood fill for non mountain tileclasses and see if your two points are connected. But you have to use the underlying storage of tileclasses for optimal performance. But this should not be that slow since the N in O(N^2) would remain in acceptable values.

For nicer mountains, I suggest using fractal generation. More specifically, subdivision generation. The concept is rather simple. Split into half, add height, repeat. The only issue might be that there just aren't enough vertices in 0ad terrain.

Animated_fractal_mountain.gif

 

I might have some code to throw your way which I used to generate some screenshot worthy maps with regards to more natural looking forests.Will post if I managed to find it.

  • Like 3
  • Confused 1
Link to comment
Share on other sites

27 minutes ago, badosu said:

Instead of making an obvious passage you can use the smooth painter for elevation, so the path is at least trespassable.

Yeah, but wouldn't it be weird being able to climb in some mountains but not others (or even being able to climb mountains at all, in this case) ? Also it would make the shape of the mountains less random (I think)

27 minutes ago, badosu said:

You can also make hills avoid other hills,

At first glance it looks incompatible with the way I generate mountains, however there could indeed be a way to do that by sophisticating a bit my algorithm. With the way I imagine now it would still make the mountains look a bit less natural however (and would still not guarrantee a valid map). 

I can always bruteforce a way to make this map reliable for multiplayer, but whether i want to do that is another question xd

Link to comment
Share on other sites

2 minutes ago, smiley said:

You don't really need the pathfinder to do that. You just need to flood fill for non mountain tileclasses and see if your two points are connected. But you have to use the underlying storage of tileclasses for optimal performance. But this should not be that slow since the N in O(N^2) would remain in acceptable values.

Oh yeah, that's true, it's a good solution. (still the 2 other benefits the pathfinder can bring could be nice but far from crucial)

5 minutes ago, smiley said:

For nicer mountains, I suggest using fractal generation. More specifically, subdivision generation. The concept is rather simple. Split into half, add height, repeat. The only issue might be that there just aren't enough vertices in 0ad terrain.

That looks interesting, I'll search that when i have some time.

Link to comment
Share on other sites

You could also just place path tiles (no changes to the map, just add an area) and then avoid those tiles while generating mountains.

As @smiley proposed the mountains could be more beautiful using different methods. An alternative would e.g. a diamond square method (setBaseTerrainDiamondSquare in heihgtmap.js) like used in Caledonian Meadown. There is no painter for that yet though.

  • Like 1
Link to comment
Share on other sites

I updated the map using flood fill. I saw @FeXoR put a todo for that. My implementation could probably be generalized. The forests can still block the passage, though, so i'll have to modify the map later to fix that. There's also the nomad case.
I also modified the map a bit. It now can generate 4v4 Tiny maps with a few internal retries :

screenshot0053.thumb.png.83eeba92dda8c5b6f8e4d1df9acd0c78.png

screenshot0054.thumb.png.c19a277bb13b1440e914a6ca70084258.png

Overall, the map is much more reliable now.

 

Quote

You could also just place path tiles (no changes to the map, just add an area) and then avoid those tiles while generating mountains.

As @smiley proposed the mountains could be more beautiful using different methods. An alternative would e.g. a diamond square method (setBaseTerrainDiamondSquare in heihgtmap.js) like used in Caledonian Meadown. There is no painter for that yet though.

Thanks for the suggestions. I'll look into that diamond square method sometimes later.

Edited by Feldfeld
  • Like 3
  • Thanks 1
Link to comment
Share on other sites

General comment on the flood fill algorithm.

When testing reachability, there is no reason to not stop once a connection has been established.

Edit: disregard the comments below. You are already using a stack it seems.

~~Keeping that in mind, for most cases, using a stack (the data structure) might lead to a connection being found faster than if you were using a queue.

If you visualise your algorithm, you would see the fill expanding like a diamond (actually a square oriented diagonally). If you were using a stack, the fill would be expanding line by line. Vertical lines going across the whole area. The probability of hitting the target is much higher. Especially if the target is an area rather than a point.

Basically, last in first out instead of first in fast out. But implementing a stack is more complex than a queue.~~

Edited by smiley
  • Like 1
Link to comment
Share on other sites

7 hours ago, smiley said:

General comment on the flood fill algorithm.

When testing reachability, there is no reason to not stop once a connection has been established.

Edit: disregard the comments below. You are already using a stack it seems.

~~Keeping that in mind, for most cases, using a stack (the data structure) might lead to a connection being found faster than if you were using a queue.

If you visualise your algorithm, you would see the fill expanding like a diamond (actually a square oriented diagonally). If you were using a stack, the fill would be expanding line by line. Vertical lines going across the whole area. The probability of hitting the target is much higher. Especially if the target is an area rather than a point.

Basically, last in first out instead of first in fast out. But implementing a stack is more complex than a queue.~~

Thanks for the comment. Yeah, I didn't do the early stop as it would imply some more checks during the algorithm but guess it's faster after all. Will change for next version.

Link to comment
Share on other sites

4 hours ago, Feldfeld said:

Yeah, I didn't do the early stop as it would imply some more checks during the algorithm but guess it's faster after all. Will change for next version.

Can you abstract it a bit and make it part of rmgen/math.js?

And submit a patch of course. (code.wildfiregames.com is fine by me). It can be reviewed more easily and committed (at least to the one I commit to).

Link to comment
Share on other sites

Alright, so upon testing with other players we discovered that there is a problem with post processing. If you see something like this :

screenshot0056.thumb.png.d076b1f61b9ff6ee3e909f37eb57a550.png

You need to disable post processing in options.
I'm don't know about graphisms so I don't know why this bug happens.

2 hours ago, smiley said:

Can you abstract it a bit and make it part of rmgen/math.js?

And submit a patch of course. (code.wildfiregames.com is fine by me). It can be reviewed more easily and committed (at least to the one I commit to).

Yeah, I'll submit a patch for flood fill, along with the map in my next update, except if the graphic issues turn out to be too much of a problem.

  • Like 1
Link to comment
Share on other sites

34 minutes ago, Feldfeld said:

Alright, so upon testing with other players we discovered that there is a problem with post processing. If you see something like this :

screenshot0056.thumb.png.d076b1f61b9ff6ee3e909f37eb57a550.png

You need to disable post processing in options.
I'm don't know about graphisms so I don't know why this bug happens.

Yeah, I'll submit a patch for flood fill, along with the map in my next update, except if the graphic issues turn out to be too much of a problem.

You have probably changed the contrast or the hdi strength with in the code, usually those are at the end of the map script code, check that.

  • Thanks 1
Link to comment
Share on other sites

I tested it, the mountains and ranges look pretty good!

I found two issues:

- Players can spawn side by side or too close often, you might want to make them avoid with a bigger radius. For this reason, and mountains occupying a big amount of territory i think normal might be the best format atm
- In one occasion the chickens could not be placed for a players, maybe it's an issue with elevation, or additional straggler wood. But I couldn't pinpoint the issue.

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...