• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Inferis

TBL File Hacker
21 Badges
Jul 2, 2001
1.574
0
www.inferis.org
  • Stellaris
  • Crusader Kings III: Royal Edition
  • Crusader Kings III
  • Prison Architect
  • Cities: Skylines Industries
  • Cities: Skylines - Parklife
  • Cities: Skylines - Parklife Pre-Order
  • Stellaris: Apocalypse
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Mass Transit
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II
  • Cities: Skylines - Snowfall
  • Cities: Skylines - After Dark
  • Europa Universalis III: Collection
  • Cities: Skylines
  • 500k Club
  • Victoria 2
  • Europa Universalis III Complete
  • Europa Universalis IV
  • Europa Universalis III
Ladies and Gents,

I'm here to announce the first (public) beta of the Magellan tools. (This is a "repost" of my post in the "Hacking..." thread, but you can use this thread to further discuss this beta).

You'll find the magellan page updated with a working download link. Actually two (a 1615 version and a 2020 version). The documentation on the site is slightly out of date, but each command has a /? parameter you can use to get the same info (up to date).

IF you encounter a bug, make sure it is a bug: it might as well be an error you made yourself. After all, the map images should be handled carefully. The tools create a log file when they crash: send this to me (magellan(@)inferis.org).
If there is another problem, like EU2 crashing, send an as detailed possible "what you did" to the same address. Keep any files that cause crashed, as I might ask for them to bugfix them.

I repeat: THIS IS A COMPLEX ISSUE. Editing the map is NOT A SIMPLE FEAT.
So please, give it some time to build some skill before bombarding me with questions. It will not yield the expected/correct results the first time.
Remember to take a backup of your EU2 files (everything in the Map directory and province.csv in the DB directory).

Besides, you can always ask the forum for help. The alpha testers got a good hang of it (which took some time to get, I'm sure), they'll probably be able to help you too.

Lastly, I'll be "offline" until sunday evening, so don't expect an answer soon.

;)

Oh, one more thing: THIS IS A COMPLEX ISSUE. IT WILL TAKE SOME TIME TO LEARN AND GET USED TO IT. THINGS WILL GO WRONG.
 
Inferis, I can't find how to make your files work, it just open and closes after telling no dir and such things, can you make a little intorduction tutorial?? :p
 
Okay, a short one. Xie can make a longer one (he was going to do that anyway).

Here's the path you usually take

1. extract game data to eu2map file (mextract)
2. export image from eu2map file (mimage /E)
3. edit resulting PSD in photoshop or similar
4. check modified image for correctness (mimage /C, mimage /SI)
5. if okay, import image into eu2map file (mimage /I)
6. repeat steps 2-5 as much as needed
7. inject changes into EU2 (minject)

A bit longer:

1) You need to extract the current eu2 map data first:

Code:
mextract <file> /1

This will create a "file.eu2map" containing the needed data, and the image of lightmap1, but not of the 2 others. Leaving away the /1 will include both lightmap2 and lightmap3, but that's not necessary.

However, this assumes you have EU2 installed on that machine. Since this might not be the case, or mextract fails to find the location, there also is a /D option for specifying the root directory.

Code:
mextract <file> /1 /D:<dir>

The specified directory must contain a Map and DB directory, like the normal EU2 installation would have.

2) Extract a part of the map

Now that you have an extract, you can start editing. Might be wise to create a backup of the eu2map file first, and also of the original game files.

To do this, you use the mimage tool.

Code:
mimage [/E] <map.eu2map> /R:<region> <targetfile>

This extracts a psd file (targetfile.psd) from the specified map. You need to specify a region to extract, of course. This is a 4 valued list, separated by commas. The values are (in correct order): left,top,width,height

Code:
/R:100,100,200,300

For example, this will extract a 200x300 rectangle at location (100,100).
The coordinates will be rounded off to the next 32 pixel boundary, so you will see other values reported.

3) Edit the resulting PSD in an editor
There will be 4 layers: Borders, IDs, Shading, MAPINFO.
* The MAPINFO layer: YOU DON'T TOUCH IT. Screwing this up will render the file useless.
* Border layer contains border info (in red)
* The ID layer contains colored areas. It is an "overlay" layer initially, and you can see the shading layer below.
* The shading layer contains the actual image.

The ID layer contains ID info of the map: if you add provinces, you need to find the correct color (using mcolor) for the ID you want and fill the specified area with that color on this layer.
TURN THE LAYER MODE TO NORMAL BEFORE SAMPLING OR EDITING THIS LAYER!

Mismatching "ID colors" will cause the image not to be imported, so be careful.

4) Test the modified image

You do this by running mimage in the /C and /SI modes first.

Code:
mimage /C <file.psd>

This checks if the ID layer is valid. It will report ALL errors found (bad IDs). Correct these first before proceeding.

Code:
mimage /SI <file.psd> <map.eu2map>

This will simulate the import of file.psd to map.eu2map. It won't modify any files, so in case something goes wrong (ie in compressing a block) you won't have lost your work. If this says it's okay to import, you can proceed to the next step.

5) Import the modified image

Now you import your changes into the map file.

Code:
mimage /I <file.psd> <map.eu2map>

This should work without a problem if you did the steps above correctly.
After this step, the map.eu2map file contains your modifications.

You can repeat the steps above a number of times before going back to EU2.

6) inject your changes into EU2

Code:
minject <map.eu2map> /L
minject <map.eu2map> /L /D:<dir>

This will inject your changed map into the game. The /L option specifies that the tool has to generate lightmap2 and lightmap3 from lightmap1. If you did not specify the /1 option with mextract, this is not necessary, but the zoomed out views won't have your changes. Also, if you did not specify the /1 option (and lightmap2 and 3 are present in the eu2map file) the tool complains that it is not necessary to regenerate. You can override this and force regeneration by specifing the :O modifier to the /L option:

Code:
minject <map.eu2map> /L:O

As said, this forces regeneration of both lightmap2 and lightmap3.
This tool will also calculate the TI etc...

Again, as with mextract, you may have to specifiy the /D option if there's no EU2 to be found.


You can now try to run the game and hopefully see your changes.
Try simple things first.


There's a lot more info to share, but this is a good starter. ;)

On filenames
if I specify a file or directory below using <file> or <dir> or something, and there are spaces in that file- or directoryname, you need to quote the filename:

Code:
mextract /D:"d:\Installed Games\EU2 Copy\"

Capice?
 
Last edited:
well now I only need to learn how to modify the psd file and get it looking correctly, but I have found a teacher already :p
 
The Editor is great, only a complain, TI looks weird and same with a pair of terrains more :p
 
Thanks for your effort ;)
 
I crated new province you can see it here:
borderproblem.png

but i don't know how to make shadow border between Kujawia and Wielkopolska. Please help and talk how to do it. One more question: how to make shadow for new province without arduous editing shadow layer? Thanks.
 
magellan.0.99.8.beta1-2020.zip - Supporting earlier than feb2 beta (2020 provinces)
magellan.0.99.8.beta1-1615.zip - Supporting feb2 beta and later (1615 provinces)
This is from your page, Inerfis, somehow that does not seem right.
 
great work:)
but i wanted to point out some odd things:
why include the #ziplib in every exe instead of a separate dll?
and writing/generating tons of code for "enums" you are only accessing through a hashtable - EU2.Enums.Goods and EU2.Enums.Culture?
 
Coder said:
great work:)
but i wanted to point out some odd things:
why include the #ziplib in every exe instead of a separate dll?
and writing/generating tons of code for "enums" you are only accessing through a hashtable - EU2.Enums.Goods and EU2.Enums.Culture?

1) There are more libs in every exe (include my own EU2 lib). I could have left them seperatey. However, this keeps the tools simple, and more importantly, portable because all you need to do is copy the exe.

2) Doesn't matter much in relation to speed, and handling it like this make sure the values map correctly. True me, I've had bug related to this before (as Hive, he'll acknowledge).
 
I think I'm going to wait till there's some form of GUI before I start mucking around too much. Also, might as well wait for the more catastrophic bugs to be discovered and fixed first ;)
 
It looks superb!

Which patch must i have installed for magellan supporting 2020 provinces? On your site it says earlier than feb 2.
I dont know which that one is, but I have 1.08 from Crusader Kings-cd. Will this one be able to handle your tools?
 
If I am using the straight 1.08 patch and the 1620 prov version, the map is still fully compatible with every version of the game...right? I know this is a dumb question, by the way ;)
 
universalis said:
It looks superb!

Which patch must i have installed for magellan supporting 2020 provinces? On your site it says earlier than feb 2.
I dont know which that one is, but I have 1.08 from Crusader Kings-cd. Will this one be able to handle your tools?
You'd need the feb 02-patch available here .

Alexander Seil said:
If I am using the straight 1.08 patch and the 1620 prov version, the map is still fully compatible with every version of the game...right? I know this is a dumb question, by the way ;)
If it has only 1615 provinces it should be compatible with every EU2-version, yes...
 
Alexander Seil said:
If I am using the straight 1.08 patch and the 1620 prov version, the map is still fully compatible with every version of the game...right? I know this is a dumb question, by the way ;)
If you use the 1615 version, you retain compatibility with the older versions, yes.