How do I edit the game so Settlers take only one turn to do their jobs??

Theov

Deity
Joined
Feb 11, 2008
Messages
2,775
Location
Taiwan
I want all terrain improvements to take only one turn. I like fast games.
I know how to do it for myself, but I want the AI to have this advantage too.

Does anyone know where you can edit the game like that??

Thanks.
 
You should modify the terrain characteristics as described by Gowron in this post: Modding Civilization I - Data Tables, section 5. Terrain Improvement

I listed that actual values for all terrain types in this thread: Civ1 Land Value calculation explained

Hereunder is a copy of those values:
Name | Food bonus | Irrig. cost | Shield bonus | Mining cost | Despotism AI-enabled? | Other AI-enabled?
Desert | -2 | 5 | -2 | 5 | no | no
Plains | -2 | 5 | 2 | 15 | yes | yes
Grassland | -2 | 5 | 2 | 10 | no | yes
Forest | 6 | 5 | -1 | 5 | no | no
Hills | -2 | 10 | -4 | 10 | yes | yes
Mountains | -1 | 0 | -2 | 10 | no | no
Tundra | -1 | 0 | -1 | 0 | no | no
Arctic | -1 | 0 | -1 | 0 | no | no
Swamp | 10 | 15 | 2 | 15 | no | no
Jungle | 10 | 15 | 2 | 15 | no | no
Ocean | -1 | 0 | -1 | 0 | no | no
River | -2 | 5 | -1 | 0 | no | yes

In blue is the cost of irrigation, and in red is the cost of mining.

Setting all of them to 1 should do the trick.

In order to do that, you need to hack CIV.EXE as follows:
Code:
offsets:
  EN 474.01 = 0x24FEB
  EN 474.03 = 0x2469D
  EN 474.04 = 0x246A3
  EN 474.05 = 0x24EB7
  EN 475.01 = 0x24FEB
  FR 474.05 = 0x25C8F

original bytes:
    FE FF [color=red]05 00[/color] FE FF [color=red]05 00[/color] 00 00 00 00 FE FF [color=red]05 00[/color]
    02 00 [color=red]0F 00[/color] 01 00 01 00 FE FF [color=red]05 00[/color] 02 00 [color=red]0A 00[/color]
    00 00 01 00 06 00 [color=red]05 00[/color] FF FF [color=red]05 00[/color] 00 00 00 00
    FE FF [color=red]0A 00[/color] FC FF [color=red]0A 00[/color] 01 00 01 00 FF FF [color=red]00 00[/color]
    FE FF [color=red]0A 00[/color] 00 00 00 00 FF FF [color=red]00 00[/color] FF FF [color=red]00 00[/color]
    00 00 00 00 FF FF [color=red]00 00[/color] FF FF [color=red]00 00[/color] 00 00 00 00
    0A 00 [color=red]0F 00[/color] 02 00 [color=red]0F 00[/color] 00 00 00 00 0A 00 [color=red]0F 00[/color]
    02 00 [color=red]0F 00[/color] 00 00 00 00 FF FF [color=red]00 00[/color] FF FF [color=red]00 00[/color]
    00 00 00 00 FE FF [color=red]05 00[/color] FF FF [color=red]00 00[/color] 00 00 01 00
 patched bytes:
    FE FF [color=blue][b]01 00[/b][/color] FE FF [color=blue][b]01 00[/b][/color] 00 00 00 00 FE FF [color=blue][b]01 00[/b][/color]
    02 00 [color=blue][b]01 00[/b][/color] 01 00 01 00 FE FF [color=blue][b]01 00[/b][/color] 02 00 [color=blue][b]01 00[/b][/color]
    00 00 01 00 06 00 [color=blue][b]01 00[/b][/color] FF FF [color=blue][b]01 00[/b][/color] 00 00 00 00
    FE FF [color=blue][b]01 00[/b][/color] FC FF [color=blue][b]01 00[/b][/color] 01 00 01 00 FF FF [color=blue][b]01 00[/b][/color]
    FE FF [color=blue][b]01 00[/b][/color] 00 00 00 00 FF FF [color=blue][b]01 00[/b][/color] FF FF [color=blue][b]01 00[/b][/color]
    00 00 00 00 FF FF [color=blue][b]01 00[/b][/color] FF FF [color=blue][b]01 00[/b][/color] 00 00 00 00
    0A 00 [color=blue][b]01 00[/b][/color] 02 00 [color=blue][b]01 00[/b][/color] 00 00 00 00 0A 00 [color=blue][b]01 00[/b][/color]
    02 00 [color=blue][b]01 00[/b][/color] 00 00 00 00 FF FF [color=blue][b]01 00[/b][/color] FF FF [color=blue][b]01 00[/b][/color]
    00 00 00 00 FE FF [color=blue][b]01 00[/b][/color] FF FF [color=blue][b]01 00[/b][/color] 00 00 01 00

I didn't try put odd values, such as 0, which could be interesting.
 
thanks, I've found the Hex Editor, but the .exe unpacker doesn't work (the site is out).
So can I edit this in the unpacked Civ.exe also?
Thing is, I can't find the values you're talking about.
 
I always give offsets and values for original, packed CIV.EXE, never for the unpacked versions.

So basically, although those values "can" be updated in the unpacked version, I did not provide the corresponding offset.

Do you need it for the unpacked CIV.EXE ? You'll need to tell me which version of CIV you play...

No, I can't find it in the unpacked .exe
475.01
 
No, I can't find it in the unpacked .exe
475.01

It is at offset 0x2CD7A:

Code:
0002cd40h: 03 47 65 6D 73 00 00 00 00 00 00 00 00 02 03 01 ; .Gems...........
0002cd50h: 00 04 00 0B 46 69 73 68 00 00 00 00 00 00 00 00 ; ....Fish........
0002cd60h: 01 02 03 00 02 00 01 52 69 76 65 72 00 00 00 00 ; .......River....
0002cd70h: 00 00 00 01 03 02 01 01 02 09 [color=blue][B]FE[/B] FF 05 00 FE FF[/color] ; ..........[color=blue]þÿ..þÿ
0002cd80h: 05 00 00 00 00 00 FE FF 05 00 02 00 0F 00 01 00 ; ......þÿ........
0002cd90h: 01 00 FE FF 05 00 02 00 0A 00 00 00 01 00 06 00 ; ..þÿ............
0002cda0h: 05 00 FF FF 05 00 00 00 00 00 FE FF 0A 00 FC FF ; ..ÿÿ......þÿ..üÿ
0002cdb0h: 0A 00 01 00 01 00 FF FF 00 00 FE FF 0A 00 00 00 ; ......ÿÿ..þÿ....
0002cdc0h: 00 00 FF FF 00 00 FF FF 00 00 00 00 00 00 FF FF ; ..ÿÿ..ÿÿ......ÿÿ
0002cdd0h: 00 00 FF FF 00 00 00 00 00 00 0A 00 0F 00 02 00 ; ..ÿÿ............
0002cde0h: 0F 00 00 00 00 00 0A 00 0F 00 02 00 0F 00 00 00 ; ................
0002cdf0h: 00 00 FF FF 00 00 FF FF 00 00 00 00 00 00 FE FF ; ..ÿÿ..ÿÿ......þÿ
0002ce00h: 05 00 FF FF 00 00 00 00 01 00[/color] 41 6C 70 68 61 62 ; [color=blue]..ÿÿ......[/color]Alphab
0002ce10h: 65 74 00 00 00 00 00 00 00 00 00 00 00 00 FF FF ; et............ÿÿ
0002ce20h: 43 6F 64 65 20 6F 66 20 4C 61 77 73 00 00 00 00 ; Code of Laws....
 
THANKS!!
I didn't find the 'offset' but just searched for the string of code and adjusted it.
Tell me, I understand that 05 means 5 turns, but sometimes I changed 00, 0F and 0A to 01... what did I do there?
Thanks a lot. I'm right in my understanding that this will help the AI also, right?

This saves me so much time and will speed up the AI also I hope.
 
I didn't find the 'offset' but just searched for the string of code and adjusted it.

You know, by 'offset' I simply mean the position or address of the bytes within the file, i.e. the first byte of the file is at position 0 (0x0), the second byte is at position 1 (0x1), etc...

Also, I am not sure why you insist on using an unpacked version of CIV, because you don't have to, but anyway...

Tell me, I understand that 05 means 5 turns, but sometimes I changed 00, 0F and 0A to 01... what did I do there?

Well, 0F means 15 turns, 0A means 10 turns, and 00 means... 0 turns. To be honest, you don't need to modify the 00's, I just made a massive replacement of all turn-costs to 1, including 0 values.

Thanks a lot. I'm right in my understanding that this will help the AI also, right?

I suppose it does, because you're changing the game configuration totally, but I'm not very familiar yet with all the details of how the AI improves terrain, so the best way you'll know is by experimenting.
 
You know, by 'offset' I simply mean the position or address of the bytes within the file, i.e. the first byte of the file is at position 0 (0x0), the second byte is at position 1 (0x1), etc...
alright, I'll keep that in mind when I think of something else to adjust.

Also, I am not sure why you insist on using an unpacked version of CIV, because you don't have to, but anyway...
I don't insist. The link you sent in your first reply goes to a write up of someone who mentions unpacking the exe file before editing. This wasn't necessary... so no big deal.

Well, 0F means 15 turns, 0A means 10 turns, and 00 means... 0 turns. To be honest, you don't need to modify the 00's, I just made a massive replacement of all turn-costs to 1, including 0 values.
Ooooooooooooooooooooooohhhh. I get it. So were there things that take 0 turns that now take 1 turn?? How can an action take 0 turns?

Yeah, experiment, we'll see if we run into other things. I remember that the AI 'cheats' its way through the game, they don't actually build things by working tiles. Sometimes they just have something. Only in Civ3 does the AI actually play the game so to speak.

I suppose it does, because you're changing the game configuration totally, but I'm not very familiar yet with all the details of how the AI improves terrain, so the best way you'll know is by experimenting.
I guess it does - there's only one way to find out ;)
Play the game!
 
What (and where) would you change to make roads and railroads take only one turn?

In the code of EN 474.01, the turn-cost of creating road/railroad is calculated as:
RoadCost = 2 * TerrainMovementCost;
RailroadCost = 4 * TerrainMovementCost;

So it could be altered by playing with Terrain Movement Costs... But now I am rather thinking about hard-coding the Turn Cost check code to make it "1" always...

Then, it should also be done for De-pollution (which is hard-coded to 4 turns) and Fortress building (didn't find this one yet in the code).

I found some references in 474.01 code, but for some reason, I have a really hard time finding the same in other versions... I will post again when I have found all values that need to be patched.
 
And here it is! :)

Well, at least for road and railroad to take 1 turn only:

Code:
offsets:
  EN 474.[B]01[/B] = 0x550B
  EN 474.[B]03[/B] = 0x5359
  EN 474.[B]04[/B] = 0x5359
  EN 474.[B]05[/B] = 0x553D
  EN [B]475.01[/B] = 0x550B
  [B]FR 474.05 [/B]= 0x5621

original bytes: [COLOR="Red"]8B C8[/COLOR]      [I][COLOR="DimGray"]-> mov cx, ax; sets 'cx' value to the actual road/rail turn cost  [/COLOR][/I]
 patched bytes: [COLOR="Blue"][B]B1 01[/B][/COLOR]      [I][COLOR="DimGray"]-> mov cl, 1;  sets 'cx' value to 1 (ch is already '0' from previous assignment)[/COLOR][/I]

Note that you can specify your own, hard-coded, turn cost for railroad, by replacing the 2nd patch byte ('01') with any other hex value: '00' for 0 turns, 'FF' for 255 turns, and everything inbetween...
 
Hereunder is a similar patch to build a fortress in 1 turn only, whereas normally this value equal to 4+TerrainMovementCost:

Code:
offsets:
  EN 474.01 = 0x5387
  EN 474.03 = 0x521B
  EN 474.04 = 0x521B
  EN 474.05 = 0x53B9
  EN 475.01 = 0x5387
  FR 474.05 = 0x549D

original bytes: [COLOR="Red"]05 04 00[/COLOR] xx xx xx xx [COLOR="Red"]8B C8[/COLOR]      [I][COLOR="DimGray"]-> add ax, 4; xxx; mov cx, ax; sets 'cx' value to the actual fortress turn cost  [/COLOR][/I]
 patched bytes: [COLOR="Blue"][B]2A ED 90[/B][/COLOR] xx xx xx xx [COLOR="Blue"][B]B1 01[/B][/COLOR]      [I][COLOR="DimGray"]-> sub ch, ch; nop; xxx; mov cl, 1;  sets 'cx' value to 1[/COLOR][/I]

[I]Note: [B]the 4 'xx' bytes above must be kept untouched[/B]; they
represent a +1 increment in the Settler's "special moves", and
are different for each version of CIV.EXE, because the memory
address of the Settler's data differs from version to version.[/I]

Same as above, you may change the last byte's value to hard-code another number of turns to build a fortress.
 
And finally, a patch to clean polluted squares in 1 turn only, instead of the original 4 turns:

Code:
offsets:
  EN 474.01 = 0x5215
  EN 474.03 = 0x50CF
  EN 474.04 = 0x50CF
  EN 474.05 = 0x5247
  EN 475.01 = 0x5215
  FR 474.05 = 0x532B

original bytes: [COLOR="Red"]04      [/COLOR][I][COLOR="DimGray"]-> cmp [Settler's special moves], 4;   [/COLOR][/I]
 patched bytes: [COLOR="Blue"][B]01      [/B][/COLOR][I][COLOR="DimGray"]-> cmp [Settler's special moves], 1;[/COLOR][/I]

That's it for now!
 
Darkpanda,
I'm afraid the terrain multipliers are still in effect as it took a few turns to road a mountain.
Do you know where to edit that part?
The rest goes as smooth as I hoped for - thanks a lot for that.
 
Darkpanda,
I'm afraid the terrain multipliers are still in effect as it took a few turns to road a mountain.
Do you know where to edit that part?

Was it just road or railroad ?

I have started a game myself with this patch, and everything is going fine, including roads on mountains. I didn't reach railroading yet...

There's one thing that is not patched yet, though, which is "terraforming": transforming jungle into forest still takes several turns... I'll look into that at a later time.
 
So here it is, the final patch to make terraforming take only 1 turn as well:

Code:
offsets:
  EN 474 01: 0x590D
  EN 474 03: 0x56B5
  EN 474 04: 0x56B5
  EN 474 05: 0x5944
  EN 475 01: 0x590D
  FR 474 05: 0x5A28

original bytes: [COLOR="Red"]05       [/COLOR][I][COLOR="DimGray"]-> cmp [Settler's special moves], 5;[/COLOR] [/I]  
 patched bytes: [B][COLOR="Blue"]01       [/COLOR][/B][I][COLOR="DimGray"]-> cmp [Settler's special moves], 1;   [/COLOR][/I]

Note: for this patch, CIV has actually hard-coded that terraforming using "Mining" always takes 5 turns, regardless of the terrain type... For "Irrigation" terraforming, CIv looks at the terrain movement cost instead, so patching the terrain movement cost is enough to have 1-turn terraforming with irrigation.
 
Back
Top Bottom