Langerz82

2D Overhead - Randomly Generated Maps

Recommended Posts

Hello,

I created a Randomly Generated Map with a new system I created and wanted to share with you all the results. It still has some minor bugs but overall its looking pretty good. Dungeons are gonna be hard to auto-generate.

This will be part of my upcoming game Retro RPG Online 2. The tiled resources are courtesy of BrowserQuest.

 

Clipboard02.jpg

Share this post


Link to post
Share on other sites

Hello,

The methods I used are here:

https://gist.github.com/Langerz82/d4d4291d7aa9d846ed64ab1bb27a9142

Apologies on the lack of documentation as I am still coding it. Basically each map object needs a array of the tiles it going to use. Then apply the right function to it. The first function supports erosion which removes the underlying tiles for optimization purposes. After the map is generated I simply loaded it in Phaser and bam new map.

I'm going to use this code to support Retro RPG Online so it will have a massive amounts of maps. You still may need to tweak the map generator to get your desired results especially the avoiding placements of Objects with other layers. If anybody creates a working dungeon generator please share it, as that is the next thing I will be working on after I get some more resources put into the maps so they are more dynamic.

 

 

Share this post


Link to post
Share on other sites

A method of generating dungeons can be seen here: https://grelf.net/forestdesign.html#N657813 except that I call them mines. A very small portion of the map generated by that can be seen below, in which the red squares are mineshafts coming down from the ground above (positions generated as part of a more complicated map, described elsewhere in the document linked above).
You will note that the code shows that the map will be symmetrical about the line x = y but a slightly more complicated formula could change that. I use digits of PI shifted up to get more randomness.
I only have one level of mines but obviously a third coordinate, z, could be included in the formula to get more levels.
I first used this kind of method in the early 1980s and I have put copies of magazine articles about it on my history page: https://grelf.net/foresthistory.html#N656637
To see my code in action go to https://www.myforest.uk?x=15475.55&y=6085.52&b=100 , go to the scene (key s) and move forward (up arrow).

_IslandMineMap.PNG

Share this post


Link to post
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.
Note: Your post will require moderator approval before it will be visible.

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.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.