Editing code?

lamotti

FFH2 addict
Joined
Mar 27, 2005
Messages
61
I've noticed maximum cities is 512 and maximum civilizations is actually 32 not 31. I notice these to be factors of two (obviously for machine code reasons) There is quite a few more factors that are based on this. So SOMEWHERE in the code there is an exponet of 9 for the cities and an exponet of 5 for the civilizations. If we or someone somehow could change it to 10 so now you could have a maximum of 1024 cities or 6 on the civilizations we could have 64. There has to be a way to change this. Either by decompiling the program and finding the binaries, or in a modification somehow. All I know is thru decompiling but I have no idea what language it was written in. Any thoughts on this... anyone? (and yes I did reach a maximum of 512 total cities by playing with all 31 civs and playing the DYP mod so it took awhile on a VERY huge map, only reached late medival age/early industrial) Anyways hope someone knows how :) thanks for reading
 
Well, you could try editing the EXE file with a hexeditor. But, have fun -- those are probably very common values.
 
And while you're at it, look for the max unit numbers as well (4096 for PtW); ). Otherwise increasing the city numbers won't help you at all. While reaching the 512 cities will simply prevent you from founding more, exceeding the units is a lot more nasty.

But seriously, forget it. The Civ code is comparable to the DNA of an age-old species, patched/mutated/rewritten/new parts added over and over again.
 
CivIII is likely to be in C++, possibly some Python.
 
I don't think that such data are stored as exponents of 2...
The max of 256 cities is possibly due to the fact that the counter / id number or what is stored in a byte, although i don't see any reason to not use a 16 or 32 bit integer.
 
512, limit of cities = 2^9
32, limit of civs = 2^5
4096 (8192 in C3C), limit of units = 2^12 (2^13)

I'm sure there are others too. I believe many are exponents of 2... wouldn't 16 and 32 bit integers require more CPU/memory for the game to run?
 
Yes, they are exponents of 2. What i tried to say is that those limits are never stored as exponents. Say the limit of something is 8192 (2^13). You'll find around the exe file the number '8192' and not '13'.

Using 16/32 bits integers usually don't require extra cpu load, since there are ASM instruction to deal with 32 bits registers. They require more memory... but with 512MB or ram for a low-end pc memory is hardly an issue.
 
excellent I do have visual C++, I was trying to find my hex editor last night, don't know where I've stored it. Anyway to some of you who might not understand it when I said exponets of 2. It's binary or hexadecimal code, which hexadecimal is just an easier way of reading binary with fewer digits. In binary there is only 0 and 1. Hence two digits, hence exponets of 2. Such as decimal in our number system 0 thru 9, so exponets of 10. I never came across the max units but I'll find that somewhere. The game will take more memory to run, once it reaches maximum, it just means beyond max it will be a little slower unless you have a computer that has a substainial amount of memory. I run on 1GB.
 
also the reason why I wanted to do this is because all of you have created so many new units, leader heads. So I wanted to be able to add more civilizations to the game, and the ability to have more units as well as play on large maps that won't run out of city memory before you run out of land.
 
Of course, considering that the *data* about those cities/units/whatever is stored in tables, you would have to find where the tables are, and then adjust all addresses within the program to access different locations...

The only way to do that with any guarantee of success is to start with the source code, modify it, and recompile it. Of course, CivIII is so heavily patched and rewritten, that you will almost certainly miss something somewhere, and the *new* game would never work. Then again, if you ever *did* get your hands on Civ3 source code, I imagine Firaxis' lawyers would want to have a chat with you. ;)
 
Well I've managed to decode it into machine code, you know that "push, pop" code with Hex lines before hand. Now if I could only get my C++ to read it like that and put it into C++ language I could more easily tell where to start. It is possibly to change anything this far and save it... however, honestly I have no idea what part I'll be changing because there's no distinction. WEll at least the first step is done...
 
I believe you. I had just never heard that before.
 
Just about all windows programs were programed in C++ (Visual C++ that is). I've used several programming languages and Visual Basic and Visual C++ is pretty much what all Win32 applications were made from. Including all your Dll, and Vxd files too. So far I've found a few interesting lines that might be what I'm looking for but, this is far more than just complicated because there's about 50,000 lines of code (well maybe a bit less) And when it's in machine code it's complied, I need a decompiler to put it into visual C++ 's language, if ANY of you have such a program or know where to get one let me know. It would make this of great ease. (Visual C++ won't let me do it thru their program, (i have enterprise edition) so either I'm looking over something or this could be impossible.... (either way has been worth a shot... I've rewritten programs doing this way but that was very VERY small programs such as... "mine sweeper, solitare, pinball..." and most of microsofts games that come with the operating system.
 
lamotti said:
Just about all windows programs were programed in C++ (Visual C++ that is).

Not Microsoft programs. They use Visual Basic.
 
Actually, I'd've thought it was a good bit more more than 50,000 lines of C++ code. You've got my interest piqued and I'll have to break down and look.

BTW, I can confirm that it was Visual C++.
 
Top Bottom