Rare and unused messages in CivDos

tupi

Warlord
Joined
Jun 25, 2011
Messages
237
Location
Russia
This thead will be about some unused or very rare messages in the game. Like, I always was fastinating about some messages in KING.TXT (GAPE/CRUSADE/HELPME). I had found only one statement on the forums that somebody saw '*GAPE' message. Btw, I tried to fulfil all conditions for that (and even NOP them), but it still doesn't work and I have no idea why.

First, let's talk about SDI. Apart from it's role as end-game cash cow, it's pretty mysterious, isn't it? Civilopedia says that it protects city from nuclear weapons... When a city with SDI is attacked, you will get message 'SDI protects <City Name>'. But pollution still will be here and city popuation decreases as usually. Also all units around the city will be destroyed. At least units in the city are not destroyed (as usually) if city has a SDI. Presumably SDI does not function properly/unfinished (at least in civdos, maybe it was fixed in civnet - because of multiplayer functionality). Thing is, AI never attacks player's cities which have SDI, so you never can see it in action anyway! Barbarian AI can attack with a nuke, but barbarians can't have nukes. Only way to see SDI message is to get SDI in an AI city somehow and then attack this city (or give some nukes to barbarians:crazyeye:). But AI never builds SDI and even when it captures your city with SDI, SDI will be always destroyed (as a building with number more than 15). So - has anybody ever seen this message in normal game?

mess_sdi.png

Another message I want to talk about was cut from the game altogether. It is '<Civ name> agree to an exchange of ambassadors.' from civ.exe. The conditions for it was presumably following: 1) AI civ just discovered Writing 2) difficulty is Chieftain 3) player has a contact with this civ or any other diplomacy status (?) 4) player don't have Embassy with this civ yet. What does it do? Give you Intelligence Report screen (F3) and Embassy diplomacy status with this civ.

But there's some strange things here... At first everything is ok:
Code:
8b 76 06        MOV        SI,word ptr [BP + param_civ1]
d1 e6           SHL        SI,1
8b 3e ee d7     MOV        DI,word ptr [HUMAN_CIV]
b1 04           MOV        CL,0x4
d3 e7           SHL        DI,CL
03 fe           ADD        DI,SI
81 c7 98 e4     ADD        DI,DIPLOMACY_STATUS //now we have dimplomacy status between player and AI civ in DI...
83 3d 01        CMP        word ptr [DI],0x1 //check for contact (0x1) status... strange that it don't check bit mask, but value...
//We can only guess what it checked next: for >= 1 (any diplomacy status - more likely) or != 1 (don't have a contact yet - doesn't seem reasonable).

But after that:
Code:
1b c0           SBB        AX,AX //what?
f7 d8           NEG        AX //what?
a8 40           TEST       AL,0x40 //some remains from check for Embassy status (0x40), I presume...

Though logically it should be something like that:
Code:
JB    LAB_check_gunpowder_and_combustion //no contact and no any other diplomacy status (just my guessing)
TEST    word ptr [DI], 0x40 //check Embassy status
JNZ    LAB_check_gunpowder_and_combustion //already has Embassy - go further...

Even with some minimal compiler optimizations, this code should not even be in the program at all, because flow never goes here. So I can only presume that probably these SBB, NEG commands was manually inserted here to 'off' this message. Or that there's some kind of bug.

mess_ambass.png mess_ambass2.png

Third message I want to talk about is '*GAPE' from king.txt. Conditions for it should be following:

1) civ is not player civ
2) civ just discovered some tech
3) you have no embassy with this civ
4) this tech was not discovered by anybody before
5) civ knows Navigation
6) player civ doesn't know this tech
then with 1/3 chance game will call function which should show "An emissary from the <civ> wishes to speak with you. Will you recieve him?" message (with -1 x coord, which means it doen't change the camera position). If you agree, game should show you diplomacy screen with GAPE message. And then the game should show civilopedia reference about the tech.

The thing is, it just doesn't work (in both .01 and .05 versions). Why it's so is the mystery for me. By all indications it should. So, my question: has anybody ever seen this 'gape' message? Maybe there's some bug which prevent it from working. Maybe it works in CivWin, I did not check it yet. CRUSADE/HELPME can be not working due to same bug, actually - their realization is very similar to GAPE (interrupt 0x3a for call 'Will you recieve him?' dialog from overlay 6). Though reports about working CRUSADE/HELPME are not that scarce! Maybe they are working in some versions of the game (maybe even not in Dos version).

There's still some other very rare or unused messages to talk about (for example, can city even proclaim independence, as some text in civ.exe suggests?), but I did not reverse engineered all the overlays yet.
 
Last edited:
Welp, you got me curious about what the *GAPE message is.

*GAPE
You are invited to gape with
awe and amazement as the
$US demonstrate the wonders
of $RPLC1. WARNING: Absolutely
no scribes will be allowed.
kek

Nope, never seen that one. Just a wild guess, but I noticed you don't have it down as checking for contact or war status with the civ, just embassy. Maybe it is doing something incorrectly somewhere?
 
Just today I was playing a game and a barbarian diplomat sabotaged my production after his legion “escort” was defeated. That’s quite a rare message, 99%+ of the time they try to run away.
 
From my investigations of civ.exe I knew that when AI builds a wonder of the world in a 'normal' way, without cheating, you should get newspaper message about it. But I thought it's just a useless code/remains of some old logic, because AI can't choose to build a wonder in its main 'select what to build' routine. But... I played as English on Earth today and I got a newspaper message that Russians built Michelangelo's Chapel in Leningrad! After that I checked Leningrad with debug cheat and indeed there it is. Sadly I did not screenshot this message. And now I think that sometimes I already saw this message before... Maybe even always with Michelangelo - can be some sort of overflow bug? Leningrad had a pretty high production too, so maybe AI can select to build a wonder in a city in a normal way after all, but this logic still unparsed by me...
 
Last edited:
The GAPE message is present and works as it should in Civ2.
 
"Independence", sadly, turned out to be not so interesting. I hoped it should switch 1 city to a free civ slot, similar to a civil war, but just one city. But actually it's just an alternative message for city bribery when you play as barbarians. And then city will become barbarian, of course (you will capture it, like after normal city bribery). Nothing is different here, only this message is different (normal one is "<Civ> rebel! Civil war in <City Name>. <Your civ> influence suspected'). Interestingly that game has so many checks for human player as barbarians, like they (well, him, one and only) expected that somebody will play as barbarians.

Though even if you play as barbarians, there are almost no sources of income anyway to bribe a city. No taxes. Even when barbarians capture a city, they don't get any money to their treasury. So you also should cheat some money for you. Though extortion on diplomacy screen may work, I think? Also you can sell buildings.

independence.png
 
Last edited:
"Independence", sadly, turned out to be not so interesting. I hoped it should switch 1 city to a free civ slot, similar to a civil war, but just one city. But actually it's just an alternative message for city bribery when you play as barbarians. And then city will became barbarian, of course (you will capture it, like after normal city bribery). Nothing is different here, only this message is different (normal one is "Civil war in <City Name>. <Your civ> influence suspected'). Interestingly that game have so many checks for human player as barbarians, like they (well, him, one and only) expected that somebody will play as barbarians.

Though even if you play as barbarians, there are almost no sources of income anyway to bribe a city. No taxes. Even when barbarians capture a city, they don't get any money to their treasury. So you also should cheat some money for you. Though extortion on diplomacy screen can work, I think? Also you can sell buildings.

View attachment 577593

What's the logic for having so many checks if player is barbarian?
 
Welp, you got me curious about what the *GAPE message is.

kek

Nope, never seen that one. Just a wild guess, but I noticed you don't have it down as checking for contact or war status with the civ, just embassy. Maybe it is doing something incorrectly somewhere?
I have definitely seen that message before. But I don't remember if that was in Civ1 or Civ2.
Maybe I remember it from Civ2.

The SDI message I've also seen, I think when nuking a city - I'm not sure why you say that the AI doesn't build them.
 
The SDI message I've also seen, I think when nuking a city - I'm not sure why you say that the AI doesn't build them.
Because there's no rules in the game for AI to build SDI, if I understand code of the game correctly. Same with mass transit. So lucky you. I have never seen that. Sometimes AI actually builds strange things (carriers, even wonders without cheating), probably because of memory corruption, but it should not do that.
 
I'm reversing .5. I have been playing as Earth England today in my free time because of your post. At the moment my lovely Russians are conquering Americas and building '203'/-53... 'something' in two cities (max number for building should be, I think, -46, Cure for Cancer?). This -53 thing has no name at the city screen. Also they are building United Nations in one of their cities (214/-43). I should research more. Either there's some additional rules or the game is really pretty buggy for big AI empires. And if it is this buggy, SDI is not beyond of possible.

Another thing is that AI rarely even research superconductors: if it researched robotics first, it will not do any further research. Sometimes it does superconductors before that, but often it doesn't. At least I can say that (for now) I've never seen that AI builds something for which it has no technology (code to create 'what city can build' list works properly every time). Well, with exception of -53 thing...

Honestly, I even have very vague memories from my childhood that I indeed saw this message. But I decided that's just false memories. I trust the code more. Another thing is that in my opinion SDI reaction is pretty buggy/unfinished (but maybe I'm wrong and it was intended that way).

Edit: strange production happens in cities number 0 and 1 (Moscow and Babylon). Now they are building 140/-116 thing. It costs 5 rows. -53 costs 3 rows. Well, game simply read some data in memory after city improvements/wonders array. When city finishes such a... thing, nothing happens. Also just now they moved their capital 2 times in the row in one turn.

Edit 2: sadly, Russians researched Robotics first and now their science rate is 0%, so they won't research superconductor. So no luck about SDI. But they did not build another 'forbidden' for AI city improvement anywhere: mass transit. SDI should be not different. If AI can do it, it should be a very rare glitch.

And finally: it can be simply be different in early versions. But I don't believe that. Rules to 'what to build' are pretty simple and I don't think that they was changed at all. Should check it someday, though.
 
Last edited:
I'm reversing .5. I have been playing as Earth England today in my free time because of your post. At the moment my lovely Russians are conquering Americas and building '203'/-53... 'something' in two cities (max number for building should be, I think, -46, Cure for Cancer?). This -53 thing has no name at the city screen. Also they are building United Nations in one of their cities (214/-43). I should research more. Either there's some additional rules or the game is really pretty buggy for big AI empires. And if it is this buggy, SDI is not beyond of possible.

Another thing is that AI rarely even research superconductors: if it researched robotics first, it will not do any further research. Sometimes it does superconductors before that, but often it doesn't. At least I can say that (for now) I've never seen that AI builds something for which it has no technology (code to create 'what city can build' list works properly every time). Well, with exception of -53 thing...

Honestly, I even have very vague memories from my childhood that I indeed saw this message. But I decided that's just false memories. I trust the code more. Another thing is that in my opinion SDI reaction is pretty buggy/unfinished (but maybe I'm wrong and it was intended that way).

Edit: strange production happens in cities number 0 and 1 (Moscow and Babylon). Now they are building 140/-116 thing. It costs 5 rows. -53 costs 3 rows. Well, game simply read some data in memory after city improvements/wonders array. When city finishes such a... thing, nothing happens. Also just now they moved their capital 2 times in the row in one turn.

Edit 2: sadly, Russians researched Robotics first and now their science rate is 0%, so they won't research superconductor. So no luck about SDI. But they did not build another 'forbidden' for AI city improvement anywhere: mass transit. SDI should be not different. If AI can do it, it should be a very rare glitch.

And finally: it can be simply be different in early versions. But I don't believe that. Rules to 'what to build' are pretty simple and I don't think that they was changed at all. Should check it someday, though.
Have you tried nuking them?
 
Have you tried nuking them?
I added 1 nuke near every of russian 35 or so cities in jcived. It was fun and even useful: I have found that I was mistaken about nuclear pollution chance. It's 2/3, not 1/3. Fixed it in CivGenesis. But of course no SDI messages, because there are no any SDI in AI cities.
 
What's the logic for having so many checks if player is barbarian?
Well, for example, in AI city production logic there's a check "if human player plays as barbarians, do not build a diplomat". Because AI builds diplomats only to steal tech and there's nothing to steal from barbs... I can't remember anything else right now, but I think I saw some other places...
 
Because there's no rules in the game for AI to build SDI, if I understand code of the game correctly. Same with mass transit. So lucky you. I have never seen that. Sometimes AI actually builds strange things (carriers, even wonders without cheating), probably because of memory corruption, but it should not do that.

Are you telling me, that some things in this game work BECAUSE of Bugs? I could swear it should be the other way around according to my education XD
 
Actually, there's almost no any more interesting stuff. Some unused space ship texts (I don't fully understand space ship building logic yet). Technical messages (low memory etc.).

But you can find this kinda interesting text in exe: "Nearest civilization: close moderate far away isolated Coastal Inland river valley on a grasslands on a plains on a small island. large island. small continent. medium continent. large continent. Skills: Settlers+ +". As you can guess, these are supposed to be used during spawn of new civ, apparently for debugging purposes. All according to https://forums.civfanatics.com/threads/number-of-starting-settlers-and-techs.494994/ And actually final game does use this text, game always writes corresponding info into a string (this string buffer is used almost for every message in the game), but in this case, this string is not drawn anywhere. You can see a result string only with some external memory viewer.

Also default names of civilizations and leaders, but I think they are pretty well known:
Barbarian/Barbarians (0, red) - Attila
Roman/Romans (1, white) - Caesar
Zulu/Babylonians (2, green) - Shaka
Mongol/Germans (3, blue) - Genghis Khan
Aztec/Egyptians (4, yellow) - Montezuma
Persian/Americans (5, cyan) - Xerxes
Muslim/Greeks (6, pink) - Saladin
Hittite/Mongols (7, gray) - Suppiluliumas

Plural names are final, though (even germans are here!). But all the names don't have "end of string" symbol after the last letter, it's all spaces until 12th symbol.

Game initializes corresponding strings with these values, but when your game starts, they are overwritten with correct data. For barbarians, default names are never replaced by anything during the game. You still can see these spaces in "barbarian ", "barbarians " and "Attila " in the final game.

You can see names 4-7 in some debug menus with shift+5,6 cheat if only 3 civs was selected in "level of competition". Also you can see them in JCivED data. But normally, civs 1,2 and 3 are always in game, so you cannot see that default name of 3rd civ is Mongols. For 1 and 2 it's the same as one of actual civ of this color.
Probably these civs were planned early in development. But it can be that they always were just placeholders.

EDIT: also in civil war logic there's call of *SCHISM message from king.txt, if civil war happened with your civ. But because of some previous conditions civil war code can be called only for AI and civil war can only happens with AI civ (*ESCHISM message is called in this case). And *SCHISM message does not even exist in king.txt, so we can only guess what that message was...
 
Last edited:
About "They agree to an exchange of ambassadors" message.
It looks like this is some compiler shenanigans/bug after all.
Today I stumbled upon another SBB, NEG piece (in "Negotiations with comp. player" logic). I have found some info about this construction here: https://reverseengineering.stackexc...me-register-as-first-and-second-operand/14133 but I still don't understand how it's supposed to work. At least we can say that 1) Ghidra ignores this code for "exchange of ambassadors" message in its decompilation, and 2) this code does not seems to work in practice anyway. But Ghidra does NOT ignore very similar code in negotiations logic for some reason... Which is very strange. Actually I think it should not work in this case too.
Diplomacy logic is b-i-i-i-g and not very understandable, btw. It will take a long time to finish.
 
Last edited:
Top Bottom