Converter Series: The Rest of the World

One of the things that makes this converter interesting is that the geographic scope of CK2 and EU3 are different. CK2 covers Europe, Northern Africa, the Middle East, and a little of Central Asia. EU3 covers all of Earth. This means we have to fill in data for everything outside the European region. Fortunately, all of this data is in an open format, so I just have to grab it from the EU3 install.

I create a class for EU3 provinces (creatively named EU3Province). For now it just stores its province ID number and the tag corresponding to its owner. The tag is a three character identifier for an EU3 country. Interestingly, I don’t have to input anything about these anywhere else at this point. EU3 seems good about filling in missing data. The class knows how to output itself and initialize itself given a parsed data file.

Now the tricky part: identifying which provinces need this data. Our province mappings are stored in a data file of the form

# Iceland
link = { ck2 = 1 eu3 = 370 } # Vestisland -> Reykjavik
link = { ck2 = 2 eu3 = 371 } # Austisland -> Akureyri

which will allow me to generate a map (or dictionary in some languages) that allows me to specify an EU3 province and get a list of corresponding CK2 provinces. At this stage I copy the code to do that from the EU3 to V2 converter. As well, I bring over code that generates a reversed version of this map. Knowing a CK2 province, you can get a list of EU3 provinces. I use this to define the rest of the world (ROTW) provinces. Given an entry in the data file like this

link = { eu3 = 572 eu3 = 573 }

(note the lack of a CK2 province number), the EU3 provinces will map to CK2 province number 0, an invalid number.

In EU3World, I create the function setupRotwProvinces(), which takes as input the inverted province mapping. I find all EU3 provinces corresponding to CK2 province 0, open their data file, parse it, and pass the parsed file to a newly created EU3Province instance. That done, I store this instance in EU3World.

I also update EU3World’s output() function. It now calls all stored EU3Province instances’ output() function.

The resulting code works as expected. I only put the two entries above in the relevant data file, so just a little bit of the ROTW appears appropriately. Still, the groundwork is laid.

Relevant repository links:
ROTW provinces get ownership from EU3 install

Leave a Reply

XHTML: You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>