nicholas-ochoa / OpenSC2K

OpenSC2K - An Open Source remake of Sim City 2000 by Maxis
GNU General Public License v3.0
4.97k stars 86 forks source link

Map Generation #9

Closed cursorial closed 4 years ago

cursorial commented 6 years ago

The base foundation of all maps is terrain generation - we need to talk about how we're going to implement this and whether we're going to attempt to replicate the original game's algorithm or if we're going to create one that simply comes close - we could also talk about providing different ways of generating terrain.

The most ideal scenario would be to provide all of these options - although it really depends on how far we want to extend the scope of the original game.

We can use OpenSimplex noise or Perlin Noise to generate a height map - generating water as a river/ocean/lakes could be done as part of the height map by simply setting a water level. I'm open to hearing about other ideas as well. Finally, plants - trees specifically, we'd have to decide on how we'd want to place them.

Once we've generated a map, we need to figure out how to save it somewhere - since we already know how to import maps, we'll need to essentially reverse this process and store it in files - there is also the option, of course, to create our own format, although keeping the files we generate consistent with the original game is probably the preferred option.

dfloer commented 6 years ago

It seems reasonable to go with whatever internal representation makes most sense for the game to save in, say JSON, and later make an exporter for saving compliant SC2k files. I say compliant, because the game will actually accept loading files that it'll never allow being generated (see my Floating Cloud City or Hell at Clubopolis: http://patcoston.com/sc2k/cities.asp). It's also tolerant of compression quirks, as long as it's compliant. I wrote a test case that was the worst possible compression the game could support, and it opened the city fine.