Advertisement
Civilization Fanatics' Center

Go Back   Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - General Discussions > Civ4 - Bug Reports

Notices

Reply
 
Thread Tools
Old Mar 03, 2012, 11:34 PM   #1
Lord Parkin
aka emperor
 
Lord Parkin's Avatar
 
Join Date: Apr 2004
Location: New Zealand
Posts: 6,369
Game-Crashing Bug: City names with % in the event log

It seems that weird and/or catastrophic things can happen when the % character is used in a city name. Specifically, the issue seems to occur when the city name is written to the event log – e.g. finishing an item in a build queue, or notifying of a nearby enemy. When the following combinations occur anywhere inside a city name which is posted to the event log, here is what happens:

% c – will clear the rest of the city name
% d – will replace with a number around -1 billion
% e – will replace with a number around -1*10^-290
% f – will replace with 0.000000
% g – will replace with a number around -1*10^-290
% i – will replace with a number around -1 billion
% n – will immediately crash the game
% o – will replace with a number around 27.7 billion
% p – will replace with BF800000
% s – will immediately crash the game
% u – will replace with a number around 3.2 billion
% x – will replace with bf800000

I’m not a programmer so I’m not sure of what specifically is going on here, but one thing is clear: a % character in the city name causes complete havoc. It probably should have simply been disallowed as a character choice many years ago during bug testing, but apparently it was obscure enough that no-one ever noticed it. For the record, it happens in single player games as well as multiplayer games – whenever a city name which contains one of these combinations is posted to the event log, the result is madness.

To see the bug in action: download the save attached below, load it up in Hotseat, change the city name to one of the combinations above (or leave it as is), press Enter to end turn twice, and watch the ensuing insanity.
Attached Files
File Type: zip Crash Test.zip (8.8 KB, 1 views)
__________________
Lord Parkin / emperor
Read all about my adventures in the Realms Beyond Pitboss 4 game!
All Leader Challenge games: ALC #26: Willem van Oranje/Dutch
Sisiutil and Lord Parkin take on eight AI teams in a Multiplayer Team Game battle of wits!
Member of: Team Innovia - Civ4 MTDG | Team Saturn - BTS MTDG | Team Sirius - BTS MTDG II
Looking for Civilization III maps? Check out the Parkin Creations CFC Map Library.

Last edited by Lord Parkin; Mar 03, 2012 at 11:41 PM.
Lord Parkin is offline   Reply With Quote
Old Mar 05, 2012, 02:48 AM   #2
karadoc
AI programmer
 
karadoc's Avatar
 
Join Date: Oct 2005
Location: Australia
Posts: 1,518
I just tested and confirmed the bug.

I assume that the bug is due to the city name being fed directly into a 'formatted string' function, like sprintf. It's a silly programming mistake for a professional to make...

In the formatted string, the percentage sign signals that there a variable should be inserted at that point in the text. %c represents a single character, %d represents a decimal number, and so on. The problem is, no data has been prepared to fill those place-holders; and so unpredictable things can happen.

Anyway, thanks for posting it. I'm going to see if I can fix the bug in K-Mod.
__________________
K-Mod: Far Beyond the Sword
karadoc is offline   Reply With Quote
Old Mar 05, 2012, 05:41 AM   #3
karadoc
AI programmer
 
karadoc's Avatar
 
Join Date: Oct 2005
Location: Australia
Posts: 1,518
OK.. I've looked into this a bit, and as far as I can tell the fatal substitution of the % things is not fixable. ie. it happens somewhere in the .exe part of the game, for which we don't have the source code. However it is possible to strip the % characters out of the city names. I mean, I can't make it so that the % works correctly, but I can make it so that % is simply disallowed.

While testing this, I noticed some other related behaviour.. You can type the name of text-keys from the game and they will be substituted in as your city's name. For example, if you rename your city to "TXT_KEY_WB_EXIT", your city will be called "Exit World Builder" - in the language set in the game options. -- Most of the text key names are too long to be allowed as city names, so there isn't much fun to be had here...

One thing that is kind of fun though is that if you are renaming units, special keywords are substituted into their corresponding symbols. For example, if you name your unit "[ICON_CULTURE]", then it will be called . So you can get legitimate game messages that say things like "Your has destroyed a warrior!"
__________________
K-Mod: Far Beyond the Sword
karadoc is offline   Reply With Quote
Old Mar 05, 2012, 05:43 AM   #4
Lord Parkin
aka emperor
 
Lord Parkin's Avatar
 
Join Date: Apr 2004
Location: New Zealand
Posts: 6,369
Interesting stuff, thanks for the input. I like the idea of making unit names appear as icons, that seems cool. Will have to give that one a try.
__________________
Lord Parkin / emperor
Read all about my adventures in the Realms Beyond Pitboss 4 game!
All Leader Challenge games: ALC #26: Willem van Oranje/Dutch
Sisiutil and Lord Parkin take on eight AI teams in a Multiplayer Team Game battle of wits!
Member of: Team Innovia - Civ4 MTDG | Team Saturn - BTS MTDG | Team Sirius - BTS MTDG II
Looking for Civilization III maps? Check out the Parkin Creations CFC Map Library.
Lord Parkin is offline   Reply With Quote
Old Mar 13, 2012, 07:51 AM   #5
r_rolo1
King of myself
 
r_rolo1's Avatar
 
Join Date: May 2006
Location: Lisbon, Portugal
Posts: 13,818
Quote:
Originally Posted by karadoc View Post
OK.. I've looked into this a bit, and as far as I can tell the fatal substitution of the % things is not fixable. ie. it happens somewhere in the .exe part of the game, for which we don't have the source code. However it is possible to strip the % characters out of the city names. I mean, I can't make it so that the % works correctly, but I can make it so that % is simply disallowed.

While testing this, I noticed some other related behaviour.. You can type the name of text-keys from the game and they will be substituted in as your city's name. For example, if you rename your city to "TXT_KEY_WB_EXIT", your city will be called "Exit World Builder" - in the language set in the game options. -- Most of the text key names are too long to be allowed as city names, so there isn't much fun to be had here...

One thing that is kind of fun though is that if you are renaming units, special keywords are substituted into their corresponding symbols. For example, if you name your unit "[ICON_CULTURE]", then it will be called . So you can get legitimate game messages that say things like "Your has destroyed a warrior!"


That is simply sloppy coding :/ There is no way that a user input should be able to wreck havoc like that in a multi-level aplication like Civ IV is

Hopefully the damage ends there ...
__________________
" I'm the Lord of the lords, not the servant of the serfs" - D. Joćo II of Portugal

My Civ lema: Qui vincit non est victor nisi victus fatetur

Lonely Hearts Club Bullpen / You , Yourself and your shadow : Some lessons on isolated starts
r_rolo1 is offline   Reply With Quote
Old Apr 24, 2012, 11:19 AM   #6
ruff_hi
Live 4ever! Or die trying
 
ruff_hi's Avatar
 
Join Date: Oct 2005
Location: an Aussie in NY
Posts: 8,193
Images: 2
ahh - get over it. It happens . But look at the fun that can be had. I am totally trying this out.
__________________
My Blog [Getting Old, Getting Cranky], Wife's Series! [The Prism Series - book 4 The Wood at World's Edge coming soon!]
BUG Mod - BtS Unaltered Gameplay [ Forum | Download | FAQ | Known Issues | Report Bugs | Troubleshooting | BUG Wiki | Modding Tutorial | BUFFY ]

"I found this great mod! Have you heard of it? It gives me everything I need!" - Troy Goodfellow's wife talking about the BUG mod | Spawn Busting: All the cool guys are doing it!

I've finally registered a domain. My site can now be found at www.ruffhi.com.
ruff_hi is offline   Reply With Quote
Old May 15, 2012, 04:18 PM   #7
ruff_hi
Live 4ever! Or die trying
 
ruff_hi's Avatar
 
Join Date: Oct 2005
Location: an Aussie in NY
Posts: 8,193
Images: 2
Quote:
Originally Posted by karadoc View Post
One thing that is kind of fun though is that if you are renaming units, special keywords are substituted into their corresponding symbols. For example, if you name your unit "[ICON_CULTURE]", then it will be called . So you can get legitimate game messages that say things like "Your has destroyed a warrior!"
That works for units but not for city names .
__________________
My Blog [Getting Old, Getting Cranky], Wife's Series! [The Prism Series - book 4 The Wood at World's Edge coming soon!]
BUG Mod - BtS Unaltered Gameplay [ Forum | Download | FAQ | Known Issues | Report Bugs | Troubleshooting | BUG Wiki | Modding Tutorial | BUFFY ]

"I found this great mod! Have you heard of it? It gives me everything I need!" - Troy Goodfellow's wife talking about the BUG mod | Spawn Busting: All the cool guys are doing it!

I've finally registered a domain. My site can now be found at www.ruffhi.com.
ruff_hi is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - General Discussions > Civ4 - Bug Reports > Game-Crashing Bug: City names with % in the event log

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Advertisement

All times are GMT -6. The time now is 04:48 PM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
This site is copyright © Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR