Improved Procedural Lavaland Generation

Mapping Ideas and Sprite Galleries

Moderators: MisterPerson, Code Maintainers

User avatar
Dagdammit
 
Joined: Fri Sep 09, 2016 12:42 am
Byond Username: Dagdammit

Improved Procedural Lavaland Generation

Postby Dagdammit » Sat May 18, 2019 12:05 am #494360

This would be a more regulated procedural design method that lavaland could use, basically creating a macro-scale blueprint before that part where it lays down all the tunnels and lava. It would integrate the lavaland ruins into a more natural procedural environment, and create an interesting maze of lava rivers while ensuring you can always reach the far end of the map without crossing magma.

Image
Start by chopping lavaland up (conceptually) into a 4x4 grid of 16 sectors, each approx. 64x64 tiles in size. Bottom left sector is still mining outpost, but necropolis/final boss zone is now the top right sector rather than taking up entire top edge of map. West and south edges of the base lavaland map remain a lava coastline of sorts.

STEP 1: Use a find-union process to link random sectors to random neighbors until the SW and NE corners are connected.
Spoiler:
Exact steps:
​-Pick random tile. (equal weight to all)
-Check random adjacent tile (out of however many exist), do find-union.
--If new union, mark that border as linked. (each sector tracks whether it's linked to the neighbors on its N and E borders)
-Check if SW and NE sector are in the same set (which will mean that a path exists. If not, repeat.)

Image


STEP 2: ​Choose one random possible path between SW and NE. All the links in chosen path are protected; the borders they cross will never have lava rivers placed along them. (This is to ensure there's always a route from the outpost to the necropolis that doesn't require crossing lava.)
Spoiler:
-Start at the SW tile.
-Use random pathfinding to adjacent linked tiles, backtracking at dead ends, until NE tile is reached.
--Do not use A* pathfinding because we don't care if it's the shortest possible path.
--Hell, consider using INVERSE A* where it AVOIDS the options that are likely to be shortest.

Image


STEP 3: Any unlinked borders are designated as lava (for now)
Image


STEP 4: Populate each sector (except for the SW and NE ones) with a randomly chosen core. Cores are medium and large-sized lavaland ruins, possibly including new 'ruins' that are just interesting prebuilt cave formations. Allow each core to update the state of sector borders ("lava" to "linked" or vice versa) based on the core's preferences.
Spoiler:
-Each core is randomly placed within its sector, excluding a 4-tile border along each edge.
--This will limit lavaland ruins to a maximum size of 56x56 tiles, which is enough for virtually every ruin besides the infamously oversized wish granter vault. Even the syndie base is only 38x38.

-Cores can flag some or all of their 4 sides as being "lava" or "open." (for example, the syndie base ruin flags all 4 directions as being lava)
--The "open" flag will change the border in that direction to "linked" if it was initially designated as "lava" in step 3. (Useful if you'd prefer the ruin to be accessed from a specific direction)
--The "lava" flag trumps the "open" flag and will make the border in that direction lava, UNLESS it's part of the protected path. If that's the case, the sector rejects that core and picks a new one.

-Each sector will first attempt to use the previous sector's last rejected core (if any). The order in which the 14 sectors are populated is random.

Image

STEP 5: Now that final lava borders are determined, generate lava rivers along each one. To create a more natural-looking environment, start & end these lava rivers at intersect points that randomly deviate from the actual intersections of the sector grid.
Spoiler:
-Intersect points will never deviate far enough that traveling in any of the cardinal directions would cause you to hit a neighboring sector's core. This is to ensure that lava rivers and cores never overlap.


STEP 6: For each side of a core that's flagged as "lava" AND has a matching lava border on that side of the sector, generate two more lava rivers from the corners of the sector to the relevant intersect point. Then take the resulting ring of lava rivers and fill the interior with lava as well, creating magma lakes.
Image

STEP 7: Generate tunnels between the cores of any sector with a "linked" border.

STEP 8: Place the contents of the cores. Generate minerals, flora, mobs & some small lavaland ruins using the same procedural mechanisms currently in use.



User avatar
knacker48
 
Joined: Fri Mar 29, 2019 11:49 pm
Byond Username: Knacker48

Re: Improved Procedural Lavaland Generation

Postby knacker48 » Sat May 18, 2019 12:10 pm #494419

Seems kind of reminiscent of how spelunky generates its levels with the whole grid system

https://www.youtube.com/watch?v=Uqk5Zf0tw3o

User avatar
Dagdammit
 
Joined: Fri Sep 09, 2016 12:42 am
Byond Username: Dagdammit

Re: Improved Procedural Lavaland Generation

Postby Dagdammit » Sat May 18, 2019 5:08 pm #494437

Yeah, I studied spelunky’s procedural generation methods back in the day (which isn’t hard, they’re amazingly simple). There’s a measure of direct influence.

To be clear, I don’t currently have the coder chops to implement this myself, but I’d be happy to work with anyone who wanted to try. Should at least be able to provide pseudocode for the precise steps.

User avatar
lmwevil
 
Joined: Sun Mar 01, 2015 3:09 pm
Byond Username: Lmwevil

Re: Improved Procedural Lavaland Generation

Postby lmwevil » Sat May 18, 2019 11:43 pm #494486

or we remove lavaland and bring back the asteroid

User avatar
Farquaar
 
Joined: Sat Apr 07, 2018 7:20 am
Location: Somewhere north of Hogtown
Byond Username: Farquaar

Re: Improved Procedural Lavaland Generation

Postby Farquaar » Sun May 19, 2019 12:55 am #494503

lmwevil wrote:or we remove lavaland and bring back the asteroid

Why not have both?

User avatar
Shadowflame909
 
Joined: Mon Jun 05, 2017 10:18 pm
Location: Think about something witty and pretend I put it here
Byond Username: Shadowflame909

Re: Improved Procedural Lavaland Generation

Postby Shadowflame909 » Sun May 19, 2019 1:28 am #494506

isn't the asteroid technically still there.

Get it since it's just a bunch of space rocks

Spoiler:
Image

ThanatosRa wrote:My biggest problem is that I can't fix any of this.


Boris wrote:shadowflame either has a brain the size of a pea or one the size of the moon and he's playing 58D chess.


BeeSting12 wrote:please write an apology to this forums, this community, the host, and the internet as a whole for the data storage space you wasted with this complaint.


BebeYoshi wrote:Saltyflame909


Cobby wrote:The trash bin... have you lost your way home anon?

cacogen
 
Joined: Sat Jun 02, 2018 10:27 am
Byond Username: Cacogen

Re: Improved Procedural Lavaland Generation

Postby cacogen » Tue Aug 06, 2019 9:05 am #506407

I know this is three months old but I really like this idea and someone should implement it
technokek wrote:Cannot prove this so just belive me if when say this


Return to Spriting and Mapping

Who is online

Users browsing this forum: bobbahbrown