Unofficial map editor (WIP)

Benualdo

Earth TSL enjoyer
Joined
Apr 13, 2005
Messages
82
Location
Europe, FR
Let's be honest, we have no idea when a map editor for Civ VII will be available, and I can't wait to play on custom maps... so I decided to start an unofficial map editor! 🙂
Ping me if you're interested to test or contribute.

Thanks.

1742337807884.png


Civ7Map is available in the downloads section: https://forums.civfanatics.com/resources/civ7map-unofficial-map-editor.32103/
 
Last edited:
Please tell me what I can do to help with this.

Hi Douglas,

As for how you can help, that depends on what you’re able to do:
  • For example, if you’re more into Art, we’ll need icons for different resource types, wonders, etc.
  • If you’re into coding and comfortable with C-ish C++, I have plenty of ideas for map editing tools.
  • If JavaScript is more your thing, you could work on map generation scripts patching.
  • If you’re neither into Art nor code, simply testing if the program works well on your computer would already be a great help!
I’ve set up a GitHub repository for development here, and my next steps are:
  • Continuing to reverse-engineer the Civ 7 format (so far, I only have terrain types and biomes; I still need to figure out how resources are stored).
  • Basic Painting/edition tools
  • TSL import/export
  • Patching the .js file with Civ 7 data to bypass the current Civ 6 → Civ 7 conversion used in the script and instead write tiles directly in the Civ 7 format.
I’ve set up a GitHub repository for development here where your can get the sources and build from code, or download an early release. It does not do much for now, but tell me if you have any issue running it.

Thanks.
 
v0.02 now supports separate file for map data (as in the latest version of YnAMP's greatest-earth-map), some picking fixes, a tooltip and importing resources (I really need some icons at this point :D)

1740242266056.png
 
There is code in the debug script to edit the map in-game. Is that what you are looking for?

JavaScript:
//Discovery:
MapConstructibles.addDiscoveryType(Database.makeHash(*), loc.x, loc.y); //loc is the plot location. Just an element containing x,y coords. ex. {"x":29,"y":15} However if you hook into the ChoosePlotInterfaceMode you can just use the overwrite function selectPlot(plot, previousPlot){ ... }
//Biome:
WorldBuilder.MapPlots.setBiome(*, loc);
//Feature:
WorldBuilder.MapPlots.setFeature(*, loc);
//Terrain:
WorldBuilder.MapPlots.setTerrain(*, loc);
//Resource:
WorldBuilder.MapPlots.setResource(*, loc, RESOURCE_AMOUNT); //RESOURCE_AMOUNT is just an int i.e. 4
//Fertility:
WorldBuilder.MapPlots.setFertility(*, loc);

let offset: float3 = { x: 0, y: 0, z: 0 };

let params: WorldUI.VFXParams = { placement: PlacementMode.TERRAIN };

previewGroup.addVFXAtPlot("VFX_ADDED_TO_MAP_" + plotEffect.PlotEffectType, loc, offset, params);

*The different types can be found under their corresponding name and by doing a string search in the modules folder. For example if I want to find a terrain type I would do a recursive string search from modules/* . They should all come up like, TERRAIN_NAVIGABLE_RIVER. That's a terrain type. Same for the discoveries they just need to be wrapped in a makeHash function to get a unique reference because they are unique elements where as the rest are not.

If you simply create an extened class from interface-mode-choose-plot you can easily make a mod that would allow a map editor. Idk about saving and reusing the maps though. I haven't really looked that much into the map specific data.


JavaScript:
import ChoosePlotInterfaceMode from '/base-standard/ui/interface-modes/interface-mode-choose-plot.js';

import { InterfaceMode } from '/core/ui/interface-modes/interface-modes.js';

import PlotCursor from '/core/ui/input/plot-cursor.js';

class YOUR_CLASS extends ChoosePlotInterfaceMode { ... }

That's all you need to get started. (At least that I can think of off the top of my head.) Cheers!
 
Last edited:
Just to add on a bit on resources. There are map resources, player resources and city resources (well and the resource db). As far as I'm aware, other than placing resources on the map with the debug functions I gave there is no other way to add resources to anything specific (like players or cities.)
JavaScript:
Map:

const resource = GameplayMap.getResourceType(plotCoord.x, plotCoord.y);

const resourceDefinition = GameInfo.Resources.lookup(resource);

//Player:

const playerResources = localPlayer.Resources; // localPlayer ID is always 0 so you could also do Player.get(0).Resources;

//City:

const cityResources = city.Resources; // You need a reference to a valid city. Cities.get(CITY_ID);

//(Db resources and Game resources [Game resources are more technical functional stuff to do with resources, sadly these are both undocumented private functions.])

Game.Resources

 GameInfo.Resources.forEach(item => {

        console.log(JSON.stringify(item));

});
**The forEach function will give you an array containing all the resources.**
 
Last edited:
Thanks for these informations. I found how to inspect terrain tiles in Tuner but not yet how to edit terrain in-game.

1740311480133.png


Anyway these lines could be useful when it comes to generate map in the Civ VII format, thanks.
 
Added resources (converted from Civ VII format)

1740318215805.png


For conversion I used the following table, but feel free to comment if you think it could be done differently for resources that do not exist in Civ VII

1740318405935.png

1740318850397.png
 
Last edited:
Keep up the great work! Following this with interest!
 
Great work! If I may make a suggestion, one of the limitations of the Civ VI map editor was the fact that you couldn't get a total resource count for each resource. This was done manually, but a report would help with establishing balance (or scarcity and abundance).
 
I 100% agree this is very useful when creating/balancing maps.

In the HK version I had counters for resources like this:

1741707699150.png


I will definitely do something similar for the Civ VII version.

Note that currently, landmasses and biomes are correctly exported (and TSL soon...) you can also place resources in editor but there are still issues to solve so as to load them ingame.
 
It's amazing, thanks a lot.

Does the import map feature works ? And if it does, how it works please ?

For example, I want to create a map from a basic Continents seed then edit it with your map editor, how can I do it ?
 
Last edited:
It's amazing, thanks a lot.

Does the import map feature works ? And if it does, how it works please ?

Yes, the program can import a YnAMP map mod using the Civ6 format for data table (that's what is currently used in YnAMP's Greatest Earth Map and Giant Earth map) or a YnAMP map using the Civ7 format for data table.
When imported map uses the Civ6 format, it's converted to the Civ7 format that is used for edition and export.

It means if you import an existing map like "Greatest Earth Map", make some changes and export it then it will be exported and loaded by YnAMP using the Civ7 format.

Basically, the program supports two workflows:
- When you import a -map.js map from an exiting mod, it will only export the map data and TSL.
- When you import a map you created using the "Create new map mod" option it will not only save map data and TSL but also the other mod files.

Tell me if you want more details :)
 
For example, could you make a short tutorial for importing a Continents++ map from YnAMP mod please ?

I also have a problem with your program. The first time I download "Civ7map_v0.2.zip", I open and it works. But if I close it and reopen it, I have this error:

1742147362783.png
 
Sorry I should have made it clearer in my previous message: "Continents++" is not a map using the YnAMP map format but a map script used to generate random maps.

You can only import maps that are explicitely defining the map contents, they usually use a *-map.js file and a *.-data.js file like this:
e.g.
1742148549058.png

or
1742148755248.png


About the error message when opening the program, check if you have OpenGL drivers installed.
For example on my desktop PC I had nothing to install, but on my surface laptop I had to install the OpenGL compatibility pack in order to have OpenGL shaders to compile.

Also make sure you unzipped to a folder and are not running the program from the .zip archive directly ;)

Hope that help :)
 
Last edited:
Thanks for OpenGl, it works fine now.

For YnAMP, is it possible to generate a random maps with YnAMP and its scripts ? Unfortunately, the YnAMP readme is empty.
 
Thanks for OpenGl, it works fine now.

For YnAMP, is it possible to generate a random maps with YnAMP and its scripts ? Unfortunately, the YnAMP readme is empty.
Thanks, I will add it to the README.

YnAMP currently adds 3 new map types:
  1. Greateast Earth Map (Continent shapes, biomes & TSL are realistic, but resource placement is random)
  2. Giant Earth Map (bigger than the previous, playable but has graphics glitches at X >= 128)
  3. The Continent+ script to generate random maps.
1 and 2 can be edited using Civ7Map, 3 cannot but you can use it in-game to generate (better) random continent maps.
 
Back
Top Bottom