Creation of Settlers

kirkham7

Warlord
Joined
Dec 22, 2012
Messages
288
Location
Hayward, CA
I am wondering if there is a place where you can change what happens to a city when you create a settlers unit? It would make for an interesting game to increase a city's population instead of decrease when you create a settlers....
 
I think this makes the game way way way faster.
You make a settler, the town grows, you make another settler etc and before you know it, your country is settled and your land is worked all over with 'free settlers'.
Food becomes obsolete, because hey, just build a settler!
You should build settlers until cities are a size 1001 and all population is turned into scientists, entertainers and taxmen.

I don't know if this would make it fun... there's only one way to find out though ;)
 
Hmm, perhaps you're right. Let's try this out, and also try out having no population decrease as well.
 
Hmm, perhaps you're right. Let's try this out, and also try out having no population decrease as well.
I think having a population increase would make it a totally different game - the only thing you'd worry about would be getting a mfg plant and a nuclear/hydro plant asap and move on from there, the rest is just an endless rush towards size.

That was the genius thing about Civ3: the workers. The job of the expensive settler was taken over by a cheaper guy. It was an investment (loss of pop, and getting a worker) that many players didn't understand.
The single most made mistake in civ3 was not making enough workers to work the tiles your population was working.
In civ1 it's almost the same, the biggest advantage that the human player has over the AI is the usage of settlers and working the tiles.

OT; I think you should ask Darkpanda about this, he knows his way around the .exe file.
 
For English versions of CIV, look for the byte sequence "E9 76 00 B8 1C 00 F7 6E 06 8B D8 FE 8F" in CIV.EXE, and replace the last byte '8F' by '87', so the sequence becomes "E9 76 00 B8 1C 00 F7 6E 06 8B D8 FE 87".

For the French version 474.05, the lookup sequence is "7E 5A B8 1C 00 F7 6E 06 8B D8 FE 8F" instead.

But beware, I tried it a little and it is not as easy as you would expect: when the population grows, the city needs more food for the additional population, as well as food to sustain the new settler... If you build too many too quickly, they will soon die for lack of food... Still an interesting way to ply the game :)
 
I have had quite a bit of fun having cities go up when you build settlers, it's quite the challenge though since this really helps the computer players..
What would I change the 87 (8F) to in order to have the city size not change when you build settlers?
 
Yeah, that makes the game crash. In fact not only the game, but dosbox crashes as well. I managed to take a screenshot of the console before it closed (took a few tries).
 

Attachments

  • dosbox-crash.png
    dosbox-crash.png
    266.2 KB · Views: 123
So, another question. When you build settlers, is city size the only thing you can change? For example, can you increase food storage?
 
Well, we're talking about binary code here, so "in theory" you can change anything you want, as long as you can write the binary code that will do it, and that it fits in there properly.

Replacing "decrease" with "increase" is a matter of changing 1 byte, so it is extremely easy to do. Other changes, more complex, may be much more difficult to implement...

I will look into your issue using the "90" NOP opcode, but right now I am plunged into very exciting experimentations... Namely, advanced possibilities to modify CIV.EXE, in particular making it possible to edit the assembly directly in JCivED -yes, you read correctly- which requires to re-implement a x86 disassmbler within JCivED, and even further, the possibility to add code to CIV.EXE, most notably by adding a new overlay with custom code... Should it be feasible, it would open the road for endless modding possibilities, and, why not, even new features ???
 
Ooh, you've got my attention. Please keep us informed as to your progress. :)
As a side note, I was playing with jCivED and added in some mining to a city built on a hill. I was surprised that it actually stayed... :D
 
... Namely, advanced possibilities to modify CIV.EXE, in particular making it possible to edit the assembly directly in JCivED -yes, you read correctly- which requires to re-implement a x86 disassmbler within JCivED, and even further, the possibility to add code to CIV.EXE, most notably by adding a new overlay with custom code... Should it be feasible, it would open the road for endless modding possibilities, and, why not, even new features ???

That's very interesting!

It would be cool if you could somehow write new features in a high level language like c or java. Perhaps inject code from external .exe files on runtime? Coding in x86 asm makes my head hurt :)
 
"87" and "8F" are single-byte instructions that mean "inc ax" and "dec ax" (or the reverse, I don't remember).

I guess you can try to replace them with "90", which is the "NOP" instruction, meaning that nothing happens... Test it at your own risks :)

Forget I ever wrote the above, it is completely false!

In truth, "87" and "8F" are the second byte of 4-byte instructions "FE 87 73 70" and "FE 8F 73 70" where "73 70" is an offset, to add to the current value of BX register, which then points to the memory, in the current data segment.

So those instructions, fully decomposed are:
Code:
[COLOR="SeaGreen"]FE 87 73 70 [/COLOR]    dec [BX+0x7073] [I][COLOR="DimGray"]; decrease memory byte value at ds:<BX+0x7073>[/COLOR][/I]
[COLOR="SeaGreen"]FE 8F 73 70[/COLOR]     inc [BX+0x7073] [I][COLOR="DimGray"]; increase memory byte value at ds:<BX+0x7073>[/COLOR][/I]

It so happens that ds:0x7073 is the "ActualCitySize" byte of the city with ID 0, and BX is previously set to the current city offset, so BX+0x7073 point to the current city's ActualSize.

So finally, if you want to leave the city size untouched when a settler is built, just replace all 4 bytes with "90", the NOP opcode, and it will work. (this time I tested it ;))
 
Sweet, works perfectly. Thanks a bunch! I am playing a game by myself, but don't want to starve my cities with settlers...

Now, as far as the 'new code' feature you're working on, would it be possible to prevent civ from overwriting the map when you bring up the civilization score screen (f9)? I know this would take a bunch of work, so it probably won't be at the top of the things to do list (fine with me), but once you play around with what you're working on, it would be something interesting to look into. :)
 
Sweet, works perfectly. Thanks a bunch! I am playing a game by myself, but don't want to starve my cities with settlers...

Now, as far as the 'new code' feature you're working on, would it be possible to prevent civ from overwriting the map when you bring up the civilization score screen (f9)? I know this would take a bunch of work, so it probably won't be at the top of the things to do list (fine with me), but once you play around with what you're working on, it would be something interesting to look into. :)

Are you talking about the Arctic anomaly bug (also known as Atlantis bug)?

I could spend some time one it...
As for the "new code" experiments, it is not as simple as I imagined, seems there is actually no way to avoid heavy manipulations to add code (EXE header and relocation table modification, in-code xref adjustments, etc.)
 
Yeah, thought it sounded like a challenge you would enjoy looking into (when you get there). Plus, if you are thinking about adding code, you might as well think about fixing some of the bugs we have found in the forums here.
 
Here's a few more ideas:

Remove and/or increase military unit limit
Ability to disable barbarians
Ability to disable pollution

Of course when I say disable, I just mean using jCivED to modify the game, as usual. Feel free to say yes or no to any of those..
 
So basically you "just" need a C (or Java) compiler for MS-DOS? Mmmmh... I don't think you can count on me for this :p

C compilers for MS-DOS already exists. You would "just" need to make some calls from within civ.exe to an external .exe :)
 
Top Bottom