Creating a desert map...With no water.

Rayki

Chieftain
Joined
Nov 19, 2014
Messages
78
Location
Australia
Hey everyone, can anyone help me out here and steer me in the right direction, or even help me out with some code to accomplish this: A desert map with NO water?

I know how to achieve the end result I want from a graphical point of view, change the tilesets to a desert tileset, so you can build a normal city in a desert environ with different tile types, but I don't know where to start to create a template for world generation, can anyone help me with this?

I also need to know if it's is actually possible to removed all bodies of water except for possibly two craters to create the odd Oasis?

Edit: I still need the game to generate an actual desert map to provide enough unlivable space to accomplish flavour elements.
 
Anyone got any tips at all? Like where to go to learn what I need?

I've already looked at the files involved in map generation but have no idea how to go about getting the result I desire from the lines of coding and sometimes strangely alien comments of the employee's from Firaxis. Just need to learn LUA and SQL a bit better, I think I've got the hang of XML at least enough to get by but those other elements elude me.
 
It's the lua scripts in the "Assets/Maps" folder that dictate how much ocean, desert, etc. get generated in a particular type of map (e.g. Archipelago.lua, Atlantean.lua, Protean.lua).

New map scripts can be added in a mod, so you should be able to make a script of your own that generates a desert planet with no ocean. I'm not sure exactly what functions/variables you'd need to change though, since it's not something I've ever experimented with myself.

The Vulcan map in the DLC has no ocean, so that might be a good place to start looking.
 
First you'll need to define a GeneratePlotTypes function globally:
Code:
function GeneratePlotTypes()

You'll need to figure out if and how you'll determine what should be flat/hills/mountains/canyon. Then based on that cycle through all the plots in your map and assign them. This can be handled in a number of different ways.

To change map dimensions and whether or not your map wraps along the x (or y) axis you'll need to define a global GetMapInitData(worldSize) function. Chances are, you'll want a map much smaller than normal (as no ocean = tons of land per civ) and you may or may not want to wrap.

Learning the map scripting process is going to take some time as there are a number of functions you'll need to replace and there are a number of methods available for you to use to achieve what you want.

These are some of the functions, you'll likely need to incorporate a custom version of, into your script, to achieve what you want:
Code:
GenerateTerrain()
AddRivers()
AddFeatures()
some custom wildness determination most likely and probably a miasma generator
and possibly StartPlotSystem()
 
Thanks for the help guys, has really given me the ability to see where I want to go and what I'd most likely need to do. Also Bobert you have really clarified what I need to do from a code point of view, once I've got a git more LUA technique down at least now I know what to start with, although crazily enough I do want large maps, just going to change it so a colony can't be found on actual Desert tiles, just replacements for Grassland, Plains etc. and increase the percentage of desert tiles generated, it'll be hard to balance but I want there to be wastelands where "There be monsters here!!". ;)

Now I need some clarification if anyone can help please, I want virtually what is in the Vulcan map but with FractalLayer support (if I understand that right it involves creating mountain and canyon systems.

1: So in order to accomplish this I need to add in all FractalLayer code entries (methods a,b,c,d etc.) and I should be able to copy/paste the entries and change the tags, values and such to match my mod requirements?

2: Also to remove a thing from the map, ie: Rivers, it seems as easy as not defining said thing in the include or not defining it's attributes in the table data, Would that be a fair assumption?

Bear in mind I am learning LUA as I go and I'm not entirely sure I understand it as yet so keep it simple for the newbie. ;)



Edit: Is there a way to find what is absolutely essential to define for a working map script or is it just trial and error?
 
You'll need to include all the modules Vulcan.lua includes (at the top). You'll also need to write a custom version of function MultilayeredFractal:GeneratePlotsByRegion(). MethodB() for canyon determination is actually never called nor defined in any of the maps that have been released by Firaxis. Whether or not it's necessary for you to implement custom versions of MethodA,C,D for your script is up to you.

To completely get rid of rivers, the easiest thing to do would be to define an AddRivers() function in your script, but not have it do... well, anything. :lol: (Except that AddRivers is also where Firaxis moved some of the Canyon determination code, and AddLakes() and DetermineWildness() and AddMiasma() so you'll need to call those. Though so long as you call them the same way Firaxis does, they should fire the default versions as they're Globals and you wouldn't have to define your own custom versions of them).

I'd start with just making a working version of GeneratePlotTypes() as that will actually allow you to spawn a map in-game and go from there. Should you crash a map spawn and end up with a blank map with no options, use the trick I mention here.

Edit: Also, if you aren't already using something capable of searching multiple files for a given input, then I'd highly recommend you grab notepad++. For instance, if you wanted to know what RiverGenerator.Create() actually does, you'd need to go find it (in god-knows what file [except that I already know it's from RiverGenerator.lua; but that's beside the point]). This is where NP++ comes in. You do a "Find in Files" for RiverGenerator.Create with an *.lua filter and restrict it to Civ:BE's /assets/ directory, and within a couple of seconds you can know exactly which file and line to go to and find RiverGenerator.Create.
 
I'm pretty confident the only absolutely essential thing is a working GeneratePlotTypes(). From there, the game will call the default code for the methods you don't define but GeneratePlotTypes() is where all the action begins. Use the output from the Firetuner console if you're getting crashes to try and figure them out.

If you script isn't appearing in the options in-game (even though you have it in your \maps\ directory [that's right, no need to actually build and update and mess with the "mod" as you go]) then you most likely have a syntax error such as missing an "end" or you've used an assignment operator "=" where you meant to use a relative operator "==" (which compares the two values).
 
Bobert13: You sir, are a champion. :)

Thanks for all the info, it's certainly gonna take a bit of work but I've got a start on it now and at least have an idea of what components I need and how I want to customize them, now I gotta work out the actual syntax and stuff. I do love learning new things, shows that no matter what there's always something else in the world to do. :)

Thanks mate it's much appreciated. :)
 
I try...

Also, I found (or rediscovered I should say) function GenerateMap() in MapGenerator.lua. It is actually the master function and everything that happens during map generation technically occurs within it. It has no code of it's own, only function calls; so it's the definitive "what's in a mapscript" list.
 
Back
Top Bottom