Edit tribes

rhaul

Warlord
Joined
Mar 25, 2010
Messages
242
Location
Madrid
Hi everyone.

The tribes (civilizations) in the game, use both the singular and the pluran, investigating a little I was able to find out that 2 different forms were applied for the plural.

In one, it automatically adds an "s" to the singular, as is the case with Aztec, Zulu, Mongol, etc., and in the other, in the rest of the civilizations, the plural can be modified directly in hexadecimal.
I would like to know if there is any way to modify the plural of Mongolian, since I am not interested in automatically adding the s. Another option, I could use that automatically instead of adding "s" let it be "es" but only for Mongolian.

a greeting.

upload_2021-11-21_17-50-37.png
 
Last edited:
In packed EXE, this part of data is sorta... packed, so it's not so easy to edit this data manually, even if it's just a simple RLE, it seems. In unpacked exe everything is very easy. 16 bytes for a leader name, after that 16 bytes for adjective/singular and another 16 bytes for a plural name. You can use whatever plural form you want. Even 2 totally different words for adjective/singular and plural. Game adds "s" automatically only if plural form is empty (just "\0", end of string symbol). Don't forget to add end of string (00 byte) after last symbol.

Barbarian name does not use this table at all, to change their name you should edit it in the table of default names (with Suppiluliumas etc.)

You can find tool for exe unpacking here:
https://forums.civfanatics.com/threads/modding-civilization-i-data-tables.331078/
This is a dos program, so run it in dosbox.

Some shenanigans about overlays after .exe is un-packed you can read in the same Gowron's thread: https://forums.civfanatics.com/threads/modding-civilization-i-data-tables.331078/#post-12284742 Actually, we should better to find where .exe stores overlay addresses to fix this problem properly, but for now I have no idea.
 
Last edited:
@tupi

Thank you very much for answering.

If you are not able to do it, I do not even try. My knowledge is very limited, basically I limit myself to substituting one character for another with the hexadecimal editor and little else I can do.
Did you try to change the plural of the Mongolian tribe?
 
Sorry, link in a Gowron's thread is 404 now, I did not check it. So I added unpacker to attachments. It's .exe in .zip.

What do you mean? You can easily edit that, but only after when you unpack exe. CIV.EXE is a compressed executable.

Well, we have problems with overlays after that... But Gowron's workaround works, even if it's not very pretty.

So I presume I should search for overlays addresses to make unpacked exe works properly? For now, I have no idea how to found them. You need darkpanda or some other guy for that.

I think unofficial russian translation hack (according to its size) actually uses uncompressed exe, which means it somehow fixed overlay addresses! Maybe if I will compare russian version with the original, I will find where this data about addresses of overlays stored.
 

Attachments

  • unp.zip
    12.4 KB · Views: 26
Last edited:
thanks for your help.
The truth is that I will not be able to do it without help.

I have to watch Gowron's show but I don't think I'll be able to understand it. Have you been able to change the Mongolian tribe with the program?

PD: I am translating this game into Spanish so I need to make all those changes. It is for version 2.0.
 
Last edited:
Hi there,

Cross-posting from the Replay thread since this is the original discussion for plural form.

First thing: rhaul you keeping mentioning "Mongolian", but in CIV they're just "Mongols" (singular form: "Mongol").

In all the CIV.EXE versions I have, those strings are NOT packed, and simply padded with spaces (hex value: 20), so it's very easy and basic to modify...

Just lookup the the "Mongols" string in your CIV.EXE, and change it to what you want.

Example:
  • in Civ 474.01, at address 24D67h, there is hex strings: 4D 6F 6E 67 6F 6C 73 20 20 20 20 00, which is "Mongols \0"
  • you can just change it, for example, to: 4D 6F 6E 67 6F 6C 69 61 6E 20 20 00, which is "Mongolian \0"
 
Yes, I hope you'll forgive me for confusing the words, but I really mean Mongol (singular, in Spanish it would also be "Mongol") and Mongols (plural, in Spanish it would be "Mongoles").

I think I know where the error is.
That chain is not the one that needs to be changed, the one that interests us would be (Civ version 475.01) the 260b0h



In the French version, it can be easily changed since it contains both the singular and plural strings, but in English it only has the singular string, and automatically adds the "s" (plural).



some civilizations use that automatic "s" and others if they can be easily edited since it contains the string in both singular and plural.

pd: In the French version all civilizations contain both the plural and the singular easily editable.
 
Last edited:
Ok after more investigation I see the problem, and at this point I can only concur with tupi...

In fact, after disassembly in IDA, I had created a data structure for each "AI Leader data", and it shows that plural name can be set, but if no plural is present, then the default behaviour is to simply add an "s" at the end:

upload_2022-3-2_23-40-52.png


So let's try the other solution: add "es" instead of "s".

First, here is the piece of ASM that adds "s" to the Civ name for plural in replay:

upload_2022-3-2_23-47-20.png


When taking a look at the string as_4, we see it comes just between a 2-byte word storing the replay length, and the victory string "The entire world hails":

upload_2022-3-2_23-49-46.png


Note: all strings require a '00' value at the end, to mark their end.

If we want to add "es" instead of "s", we need to make room for one extra character. It will be hard to touch the CurrentReplaySize value, but maybe we can touch the following string by shortening it, for example use "The whole world" instead of "The entire world", this spares us exactly the 1 char needed.

In that case, we can replace: "s\0The entire" with "es\0The whole", those 2 strings have the same length of 12 characters.

If we do this, we also need to modify whichever code is referencing the victory string, which fortunately is only used in 1 place:

upload_2022-3-2_23-54-19.png


Let's see the equivalent ASM using this code:

upload_2022-3-2_23-55-59.png


... and the equivalent HEX for this ASM:

upload_2022-3-3_0-2-51.png


The B8 90 40 instruction should be read:
  • B8: move some value into AX register
  • 90 40: read as short endian, means 4090h (in decimal it is 16528)
Looking back at the previous view on data, we see that the string "The entire world ..." is in deed located at position "dseg:4090".

We don't need to care about dseg here, because we see that 4090 is the value directly used in the code, so if we push the string 1 byte further, we imply need to change it to 4091, and it should work fine.

Now, I'm always working on the unpacked version of CIV.EXE when disassembling, so we need to find our locations in packed CIV.EXE for patching.

In CIV 474.01 (which is almost same as 475.01):

upload_2022-3-3_0-3-2.png


We see the "s\0The entire" starts at adress 2884Dh.

If we change it, we have initial bytes for our patch:

upload_2022-3-3_0-5-11.png


At 2884Dh:
  • 73 00 54 68 65 20 65 6E 74 69 72 65 is replaced with 65 73 00 54 68 65 20 77 68 6F 6C 65
Now for the code modification, which calls the string "The whole world...", luckily enough the data adresses in memory do not change between packed and unpacked version, so we simply need to find the correct hex "B8 90 40" and replace it with "B8 91 40":
upload_2022-3-3_0-11-3.png


More luck here, there is only 1 occurence of this hex, so we are sure this is the correct location, so more bytes to patch:

At 39087h:
  • B8 90 40 is replaced with B8 91 40
Now let's test this !

upload_2022-3-3_0-24-31.png


I think it does the trick :)

BUT, in fact, in only does the trick in the Replay !!!

As a matter of fact, the code to append a "s" to the Civ name is duplicated is several places where an "s" needs to be added, in particular at game init time (if you are prompted your civ name) and also when a SCHISM occurs... There could be other places too...

So, indeed, not a simple task !
 
I'm not a programmer, but I am aware that playing a code is complicated, especially one as old as this game.

The only thing to keep in mind is that I only need "es" for Mongolian, since the rest of the civilizations that add the "s" automatically are fine with the plural "s".

Thank you for your effort and help, I really appreciate it.
 
Ok so it must be done by packing the bytes in the right place...

Is there any other Civ, which has special plural form (Chinese, French, English), but that you don't need because an automatic "s" would be fine for you ?

If it's the case, we may play with manual repacking of bytes only in this area, I think it's achievable...

Or another way to progress: can you share the complete list, of Civ names in spanish, singular and plural ? That would give me a better idea.
 
Hello again.
In the morning I work and that's why I couldn't answer, the message I wrote was just before I left home to go to work.

The google translator is correct.

  • Germans
  • French
  • English

You don't have to worry about these since the plural can be edited hexadecimal without any problem.

Zulu would have to add the famous "es" for it to be spelled correctly. I didn't tell you anything because phonetically it doesn't sound bad with the "s" at the end but the correct thing would be to add the "es".

pd: Thanks for the help, I guess you know that I'm translating this game.
 
Hello again.
In the morning I work and that's why I couldn't answer, the message I wrote was just before I left home to go to work.

The google translator is correct.

  • Germans
  • French
  • English

You don't have to worry about these since the plural can be edited hexadecimal without any problem.

Zulu would have to add the famous "es" for it to be spelled correctly. I didn't tell you anything because phonetically it doesn't sound bad with the "s" at the end but the correct thing would be to add the "es".

pd: Thanks for the help, I guess you know that I'm translating this game.

Did you successfully change for Germans, French and English ? Because in spanish they have more characters, and if you edit the packed CIV.EXE, you may have problems if you modify with longer strings (overwrites packing data).
 
Yes, in Spanish those civilizations have more characters than in English, but I did a trick and I was able to solve it. Don't worry about those civilizations, the Mongol and Zulu are the problem, especially the Mongol (I have nightmares).

At the moment with the Mongol I have changed it to the Hun civilization, which is not the same but it is a bit similar.
 
Last edited:
Yes, in Spanish those civilizations have more characters than in English, but I did a trick and I was able to solve it. Don't worry about those civilizations, the Mongol and Zulu are the problem, especially the Mongol (I have nightmares).

At the moment with the Mongol I have changed it to the Hun civilization, which is not the same but it is a bit similar.

Almost successful, but I am 1 character too long !

I removed the special "Chinese" plural, since in spanish it uses additional "s", but it only spares 7 chars, whereas "Mongoles" has 8 chars :/

I'm going to update to "Mao Tse Tung" using modern pinyin writing "Mao Zedong", this will spare 2 more chars.
 
Last edited:
What a great news.
Remember that my version of the translation is 475.04.

With Chinese you can edit perfectly in both singular and plural hexadecimal and both words contain fewer characters in Spanish. You can even remove more characters if you need them (singular).

English version


"Spanish" version
 
Last edited:
these old programs are a real headache.
If you end up giving up let me know.
 
Top Bottom