Improved WorldBuilder

Caliom

Warlord
Joined
Dec 17, 2007
Messages
164
Inspired by Sedna17s new Colony Screen i played around with the WorldBuilder.
I thought it would be cool if we could edit the Settler-, War- and City Maps in the WorldBuilder. So that we dont have to restart the game everytime we want to switch the player. It would be even cooler if Provinces could be edited too.

Im not that far yet, but one can already view the Settler- and War Maps while easily switching between players. Maybe this already helps someone ;)
I borrowed the mechanic that is used for the Fog of War. When you click on Reveal Tile Mode, you can chose between players and the different maps. See screenshot.


I could need help with the python code.
I read the values directly from the arrays in RFCEMaps.py. Im not yet able to edit the values because somehow i cant write in those arrays. Those changes wouldn't be permanent but it would be a first step. It seems that i can use the gc.setWarsMap method to propagate the changes to c, but then i'm not able to visualize the changes, because i don't know how to read the values from c. Even then this wouldn't be permanent.
I will look into Array2WBPython etc. in the modding tools how it is done there, maybe i can write the RFCEMaps file as a whole.
 
I am not sure what you are trying to achieve here. We are already editing the War, Settler, City Name and Province maps with the World Builder. All that you need to do is add labels to the appropriate spots, save the file and then there are couple of handy Python scripts that convert the labels to a usable arrays. Once you have the arrays, you just copy/paste them into the RFCEMaps.py file.

I don't know if Civilization has the capabilities to directly write over a file form within Python. It should be doable with C++.

If you want to visualize the maps, then WB can be useful. However, if you wish to visualize the Province maps (stable/unstable) it is hard since provinces constantly change. Province visualization is currently in C++, although it should be doable in Python.
 
This would sound really nice, but I also have some worries about the WorldBuilder capatibilities.
It has issues even when saving the map changes, not alone if you directly want to overwrite the python arrays...

Also, changing war and settler maps is fairly quick and easy.
I'm just waiting for final city name maps before updating those
 
I do not share your worries. :)

currently you can only visualize the maps, but i am confident that i will find a way to make the changes permanent. Similary to the python scripts you currently use.

The benefit is that you can easily change the map you want to edit. Both the type of the map and the player. And you have all the other tools at hand that you need to edit the map. I think this will especially be usefull for modmodders and people who want to play around with the map.


I updated the attachment in the first post, for anyone who is interested in the progress.
Currently you can visualize the War- and SettlerMaps. I included different colors for different values. The colors that are currently in use are from highest to lowest: Yellow, Red, Blue, Black, Grey.
I am not sure what other colors are available. I have to stick to the String constants (""COLOR_BLUE", "COLOR_RED", etc.) If someone has an overview of all available colors this would be helpful. I put everything that handles the maps in a new file RFCEMapUtil.py. Colors and values are defined there.

You can also edit the maps. It is however not permanent yet. Right click will increase a value, left cklick decrease. The steps/treshholds are defined in RFCEMapUtil.py too. In order to make this work the round brackets () in RFCEMaps.py have to be replaced by square brackets [], otherwise the values in the arrays cannot be overriden. An already altered RFCEMaps.py is included, but you can use your own too.
 
Colors are defined in .../Civilization 4/Beyond the Sword/Assets/XML/Interface/CIV4ColorVals. Though the values are usually between 0 and 255, for some reason in civ the scale is from 0.000 to 1.000. I guess the values are rounded to the closest by value on the normal scale. Also, I don't know exactly what the fAlpha tag means but I guess that defines transparency.
 
Colors are defined in .../Civilization 4/Beyond the Sword/Assets/XML/Interface/CIV4ColorVals. Though the values are usually between 0 and 255, for some reason in civ the scale is from 0.000 to 1.000. I guess the values are rounded to the closest by value on the normal scale. Also, I don't know exactly what the fAlpha tag means but I guess that defines transparency.

Standard RGB. Alpha is the transparency.

http://en.wikipedia.org/wiki/RGB_color_model
 
it'd be usefull for the reason that the current viewable war/settler maps is outdated
 
The RFCEMaps can be saved from within the Worldbuilder now :)

I'm not yet sure how to trigger the save. At the moment everytime you save a Worldbuilderfile a second file is created within the same directory that contains all the map arrays. The file is almost identical to the RFCEMaps.py and can be used to replace it. No further editing is needed. All arrays are commented with the civilization name, so that you can identify them.
The cityname maps and provincemap are preserved. But they cannot be editet yet. This will be the next steps.

For updated download see first post.
 
Is this world builder compatible with normal rfc

No way.

In normal RFC many of the maps are hard-coded directly in C++ and can only be edited with recompiling the .dll file. There is no way to do anything like that in regular RFC. You can do it for war maps and city name maps only.
 
I added support for city names :)

The code is ugly and slow but it works. City maps can be viewed and edited in the landmark mode.

Make sure to leave the landmark mode before you save the worldbuilder file, because the current city map gets only updated when you leave the mode or switch the player.

Notice that with this version of the worldbuilder you cannot edit normal landmarks anymore, because the landmarks are constantly overwritten and deleted.

I will address the issues above when i better understand the event mechanics and UI widgets.
 
I updated the RFCEMaps.py file since, it's in the svn
Probably it's a good idea if you update your file as well (in the download) to avoid any confusion
 
Hey Caliom, what's the exact status on this?
Updating war and settler maps directly into the python file works perfectly fine?
 
War and settler maps work fine. The only thing you have to do is to replace the curly brackets in your RFCEMaps.py file with square brackets () --> []. You can simply use search&replace, there is nothing that could get messed up.


You can also edit the city names and provinces, but i'm not 100% sure if this allways works correctly. At least my PC has problems to display all the landmarks. Everytime you switch the player the landmarks of all tiles get updated. Sometimes not all new city names are displayed. I think its only a display problem, that means all underlying arrays are intact. But i'm not 100% sure. At least i never experienced that i messed up something.

I have a working copy where the provinces are edited in the same fashion as the war and settler maps avoiding the problems with the landmarks. But i'm not sure if this version is stable. Didn't have time to work on that recently.
Next wednesday i have more time, then i could upload a stable version of the recent progress. It has some nice other improvements too.
 
War and settler maps work fine. The only thing you have to do is to replace the curly brackets in your RFCEMaps.py file with square brackets () --> []. You can simply use search&replace, there is nothing that could get messed up.

() and [] mean different things (array vs list). The RFCEmaps should use () arrays only. Lists should be used for things of variable size only.
 
Next wednesday i have more time, then i could upload a stable version of the recent progress. It has some nice other improvements too.

Sounds nice, till then I will continue to play with the settler and war maps
 
() and [] mean different things (array vs list). The RFCEmaps should use () arrays only. Lists should be used for things of variable size only.

The problem is that arrays are immutable in python. So i have to use lists when i want to make them editable in the worldbuilder. It shouldn't be a problem because i never change their size.
Or do you know any other way how i could do that?
 
The problem is that arrays are immutable in python. So i have to use lists when i want to make them editable in the worldbuilder. It shouldn't be a problem because i never change their size.
Or do you know any other way how i could do that?

Don't mind this at all
As you said, you never change the arrays/lists size
And it's very easy to edit the python file afterwards
 
The problem is that arrays are immutable in python. So i have to use lists when i want to make them editable in the worldbuilder. It shouldn't be a problem because i never change their size.
Or do you know any other way how i could do that?

Then the proper way to do it is to read in the array, convert it to list, edit the list, then save it back as an array. When you save it, you need to save it in the RFCEMaps.py.

On the other hand, if you want the changes to become active immediately, almost all the maps are almost exclusively referenced in C++. Only the city names is an exception. You can simply overwrite the C++ values the same way things are set in RFCEBalance.py, look at the code marked "don't touch".
 
Top Bottom