Random Map Generation

Interesting mapping tools and mapping help.

Moderator: Morax

Random Map Generation

Postby Duck_42 » 16 Mar 2014, 00:48

A while back, I decided to give this a go and see what I could come up with. It's taken a fair bit of work, but using HazardX's SCMAP loader code, I was able to write a program to generate playable SupCom/FA maps.

Some of you may have noticed a few maps in the vault labeled CGM-(some number). Those maps were generated using this program. It currently takes around 20 seconds to generate a 20x20 (1024x1024) map (depending on the map template script and your PC's processing power).

Several people have expressed an interest in this project. I can defintely use all the help I can get, so I'm putting this project out as open source. The repository is on Bitbucket at
https://bitbucket.org/Duck_42/supreme-commander-random-map-generator/overview.

Primarily, I need assistance in building:
-Additional Tilesets
-Map Template Scripts
-Further Algorithm Improvements (prop placement, mass spot placement, water parameters, etc)

Eventually, I'd like to get this project to a point where it can be used as part of Galactic War. While I may be able to do that on my own eventually, It will definitely happen faster if I have help.

I'll do my best to answer questions and comments posted on this thread. However, if you have questions specific to development of the project (i.e. what were you trying to do in xyz source code file), please post them on the Bitbucket site. If you encounter any bugs, find areas for improvement, or see a coding task that needs done, please create an issue on the Bitbucket project site.
User avatar
Duck_42
Avatar-of-War
 
Posts: 237
Joined: 29 May 2012, 03:16
Has liked: 5 times
Been liked: 18 times
FAF User Name: Duck_42

Re: Random Map Generation

Postby nine2 » 16 Mar 2014, 03:10

This is awesome. I like how you've done the preview builder. How did you work out all of the values for the terrain types? ... and what do they do anyway?
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Random Map Generation

Postby Duck_42 » 16 Mar 2014, 03:28

For non-water, I used the most visible texture at that location to decide which terrain type. For water, i used the depth. Take a look at the TerrainTypeBuilder.cs if you want more information.

As far as what the terrain type does, I don't really know. I always assumed it determined the emitter used for unit walking effects (i.e. kicking up dust, debris, etc). It wasn't that hard to assign terrain types based on the texture though, so I went ahead and did it.
User avatar
Duck_42
Avatar-of-War
 
Posts: 237
Joined: 29 May 2012, 03:16
Has liked: 5 times
Been liked: 18 times
FAF User Name: Duck_42

Re: Random Map Generation

Postby nine2 » 07 Jun 2014, 04:50

I'll move my convo over here so as to not pollute your GW thread any further.

We could do that pathfinding thing you know, I'm sure you would be able to nuget a pathfinding library fairly easy ... pathfinding isn't that hard, its just performance which I find difficult but in your case it doesn't matter.

Lets assume that we can actually do it, how would we use it? If you were going to use it to place mass points, would you just randomly generate 5 mexes for player one, then measure the path-found distance between the mexes and the start location, then somehow use pathfinding to find 5 locations the same distance away from player 2? That doesn't sound very good.

I think mex locations should be symmetrical or perhaps symmetrical with a small amount of randomness built in - but having them completely different is uncool.

What you could do is say each starting location gets two mass extractor clumps (one near and one far) and two reclaim clumps (one near and one far). Each players clump would be an identical (pathfound) distance from the starting location. Within that clump, which is a small area, the actual placement of the contents (mexes/reclaim) could be random.

The only problem I really see is:

How can you work out from the heightmap what slopes are too steep to cross?

viewtopic.php?f=53&t=7567
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Random Map Generation

Postby Omnipotent » 16 Aug 2014, 15:43

Is it possible to design an algorithm that dictates strata painted at specific elevations?

For example/ default elevation is 64, say water level is 60, and any elevation less than 62 is sand and higher that 100 is rock, 150+ = snow.

You could create professionally painted maps that way and still have further creative control when opening it in the official editor.

I will follow this project, looks interesting.

Omni.
1 Sulphur Mounds, Sulphur Lake, and Open Combat
2 Coastal Bridge v2
3 Burner, Burner II
4 Fortress Ascent
5 Gap Of Genesis
6 Genesis VI, Genesis IV
7 Coastal Aisles
8 Hypothermia
9 The Requisite
10 New Wonder
11 New Zeta Wonder
User avatar
Omnipotent
Crusader
 
Posts: 48
Joined: 22 Nov 2013, 12:56
Location: All your maps are belong to us.
Has liked: 3 times
Been liked: 9 times
FAF User Name: Omnipotent

Re: Random Map Generation

Postby Duck_42 » 17 Aug 2014, 21:10

@Omni,

Is it possible to design an algorithm that dictates strata painted at specific elevations?

For example/ default elevation is 64, say water level is 60, and any elevation less than 62 is sand and higher that 100 is rock, 150+ = snow.


Yes. The map generator already does this. It's a function of the map template script. The script generates the terrain height map along with the stratum texture maps. Normally, elevations near the water will be covered with sand (stratum 3). Higher altitude elevations will normally be covered with rock and/or snow (depending on the tile set). It's very flexible though, so if one wanted to have some variation for a particular map template, one could do so easily.
User avatar
Duck_42
Avatar-of-War
 
Posts: 237
Joined: 29 May 2012, 03:16
Has liked: 5 times
Been liked: 18 times
FAF User Name: Duck_42

Re: Random Map Generation

Postby Omnipotent » 22 Aug 2014, 11:05

Duck_42 wrote:Yes. The map generator already does this. It's a function of the map template script. The script generates the terrain height map along with the stratum texture maps. Normally, elevations near the water will be covered with sand (stratum 3). Higher altitude elevations will normally be covered with rock and/or snow (depending on the tile set). It's very flexible though, so if one wanted to have some variation for a particular map template, one could do so easily.


Hey thanks for your reply,

Was wondering, have you made any further progress on the editor? Will you be able to merge it with the Official Editor?

Another question I had was, do you know, or are you developing a tool which helps edit v60 .scmaps? It's apparent that the only way you're going to add a dynamic skydome or change the static skybox & background is if you find the hex code associated with it in the scmap. I have no experience with using hex editors and I cannot code. I wouldn't be bothered by such a thing but it's aesthetically displeasing, I never really noticed till I read a thread on it, and I'm OCD.

Many regards,
Omni.
1 Sulphur Mounds, Sulphur Lake, and Open Combat
2 Coastal Bridge v2
3 Burner, Burner II
4 Fortress Ascent
5 Gap Of Genesis
6 Genesis VI, Genesis IV
7 Coastal Aisles
8 Hypothermia
9 The Requisite
10 New Wonder
11 New Zeta Wonder
User avatar
Omnipotent
Crusader
 
Posts: 48
Joined: 22 Nov 2013, 12:56
Location: All your maps are belong to us.
Has liked: 3 times
Been liked: 9 times
FAF User Name: Omnipotent

Re: Random Map Generation

Postby Duck_42 » 23 Aug 2014, 18:52

have you made any further progress on the editor?


Not much. I've been distracted with other stuff lately. I use BitBucket for version control of the project, so one can view the change history at https://bitbucket.org/Duck_42/supreme-commander-random-map-generator/commits/all.

It's probably not accurate to call this an editor. I have no plans to build any sort of GUI for map editing.The map generator merely creates a random map (based on provided input). However, generated maps can be opened in the official map editor.

Another question I had was, do you know, or are you developing a tool which helps edit v60 .scmaps?

No. I have no plans to do this. Any time I have for coding will likely be spent on enhancing the map generator. To answer the other part, AFAIK, none of the available map editors can read v60.
User avatar
Duck_42
Avatar-of-War
 
Posts: 237
Joined: 29 May 2012, 03:16
Has liked: 5 times
Been liked: 18 times
FAF User Name: Duck_42

Re: Random Map Generation

Postby Omnipotent » 25 Aug 2014, 23:22

Duck_42 wrote:
Not much. I've been distracted with other stuff lately. I use BitBucket for version control of the project, so one can view the change history at https://bitbucket.org/Duck_42/supreme-commander-random-map-generator/commits/all.

It's probably not accurate to call this an editor. I have no plans to build any sort of GUI for map editing.The map generator merely creates a random map (based on provided input). However, generated maps can be opened in the official map editor.

No. I have no plans to do this. Any time I have for coding will likely be spent on enhancing the map generator. To answer the other part, AFAIK, none of the available map editors can read v60.


Ah right, that's a shame. I guess that issue will never be resolved. Funnily enough, I tried using the hex editor to manually edit the path to the envcube. Literally copied and pasted an official FA scmap path into a new scenario, to no avail. It was made apparent that weather is defined by parameters. Not by simply selecting a predefined skycube like in Vanilla. So a weather generator would be required.

I did find that, there were .dds files that corresponded to planets and stars. Thus treated as decals in the sky layer. So there were static and moving elements in the sky layer. The background CAN also be changed. There was default, black, UEF, Aeon, Cybran, and Seraphim.

But yeah you're right. Too much time sorting that out. The only person that gave it a real shot for the community was HazardX, he's also quite adamant that he just wants to do his own thing now and isn't interested anymore. I guess we will never know. Better get used to "Default EnvCube" for the rest of my mapping days haha.

Anyways, good luck with your project. I imagine maps will be pumped out rather swiftly using this. A necessary tool for Galactic War I think,

All the best.
1 Sulphur Mounds, Sulphur Lake, and Open Combat
2 Coastal Bridge v2
3 Burner, Burner II
4 Fortress Ascent
5 Gap Of Genesis
6 Genesis VI, Genesis IV
7 Coastal Aisles
8 Hypothermia
9 The Requisite
10 New Wonder
11 New Zeta Wonder
User avatar
Omnipotent
Crusader
 
Posts: 48
Joined: 22 Nov 2013, 12:56
Location: All your maps are belong to us.
Has liked: 3 times
Been liked: 9 times
FAF User Name: Omnipotent

Re: Random Map Generation

Postby nine2 » 26 Aug 2014, 03:16

Omnipotent, you seem to know a bit about it - besides the sky cube, do you know what other changes there were in v60 maps?
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Next

Return to Mapping

Who is online

Users browsing this forum: No registered users and 1 guest