Questions about modding the exe

Information, How-to's, and discussion about mod'ing Master of Orion II.
User avatar
Flenser
Posts:3
Joined:Tue Oct 25, 2005 11:50 am
Questions about modding the exe

Postby Flenser » Tue Oct 25, 2005 2:41 pm

Hallo everbody,

I have read most of the posts here, and I would like to ask a few questions about the process of modding the game.

Firstly, I assume that the exe allocates a chunk of memory for the game status, and this chunk is what gets saved out when you save your game. Under this assumption, that chunk of memory has to be initialised when a new game starts, and gets filled in with further data as the game progresses. The values must come from the executable. So this imples some basic correspondence between known patterns of values (from the save file format) and patterns of values buried in the exe.

How do you go about identifying the bytes in the exe which control the factors you want to change? Dmitry's OCL made finding table entries for various data points (techs, buildings, equipment etc) very easy, but you seem to have moved well beyond that.

How do you handle the switches? Is it a jump to a command line parser which then modifies the exe in memory? Or have you actually got source code for the v1.40 build?

I can read through the disassembly of the exe (although my x86 is very rusty) but without a symbol table it's extremely hard to trace which procedures are responsible for which calculations. If you are not working from source code, how are you modifying the game's procedures?

And finally, can I help? I'm not sure what skills I could offer, but I would like to try. What are the main issues waiting to be resolved? (OK, I expect that's a BIG question...)

I reinstalled MoO2 a few days ago after my son asked me what the best game ever was. No contest there! I Googled around, and was delighted to find that it still has an active and intelligent following. Siron helpfully pointed me here from his blog. I still have all the stuff I downloaded years ago - I'm checking through it (my filing was a bit chaotic back then) to see if any of it has relevance today. Once that's out of the way, I'll start looking more seriously at the correspondences between the codespec and the disassembly.

User avatar
Lord Brazen
Site Admin
Posts:162
Joined:Mon Jul 18, 2005 10:16 pm
Location:Toronto, Canada
Contact:

Re: Questions about modding the exe

Postby Lord Brazen » Wed Nov 02, 2005 3:01 pm

Hi Flenser,

Welcome to our forum.

I'll answer a couple of your questions.
Firstly, I assume that the exe allocates a chunk of memory for the game status, and this chunk is what gets saved out when you save your game. Under this assumption, that chunk of memory has to be initialised when a new game starts, and gets filled in with further data as the game progresses.
Yes the game allocates chunks of memory for various data that is used by the game. For the most part this data is copied byte for byte to the save game file when you save.
The values must come from the executable. So this imples some basic correspondence between known patterns of values (from the save file format) and patterns of values buried in the exe.
Most of the values in the save game file are generated by the code in the exe. For the most part there is no correspondence. Its not simple at all.
How do you go about identifying the bytes in the exe which control the factors you want to change?
I use a debugger to locate the code related to some aspect of the game I want to modify. Once I find the code the rest is simple.
How do you handle the switches? Is it a jump to a command line parser which then modifies the exe in memory?
I modified the exe file to add some more code blocks. I altered the command line parser to jump to some code in the new code blocks where it processes the switches and jumps back to continue processing normally.
Or have you actually got source code for the v1.40 build?
Nope. No source code for orion2. I only have an understanding of small parts of the exe.
I can read through the disassembly of the exe (although my x86 is very rusty) but without a symbol table it's extremely hard to trace which procedures are responsible for which calculations. If you are not working from source code, how are you modifying the game's procedures?
I dont use a symbol table (although there seems to be one in the exe). I modify the procedures the same way I added the switches (see above answer).
And finally, can I help? I'm not sure what skills I could offer, but I would like to try. What are the main issues waiting to be resolved? (OK, I expect that's a BIG question...)
You certainly can help. I dont know if there are any issues to resolve. I'm just doing this as a hobby. Progress is slow and I have no real plans or direction.
"Stars are holes in the sky from which the light of the Infinite shine through." - Confucius.

User avatar
siron
Posts:504
Joined:Fri Jul 22, 2005 12:35 pm
Location:Hamburg
Contact:

Postby siron » Thu Nov 10, 2005 6:49 pm

You certainly can help. I dont know if there are any issues to resolve. I'm just doing this as a hobby. Progress is slow and I have no real plans or direction.
Most of the things you have done so far were related to MP. How about something like an AI-Taskforce? I think you have some clues how to alter the strategy of the AI (you prolly detected the passage in the exe), but I assume that this is not your priority. Other players might be more interested to fix this part of the game....and it seems a lot of work where many players could help to document several test runs of modified AIs....

User avatar
Brent15
Posts:59
Joined:Fri Dec 02, 2005 2:42 pm
Location:United States of America
Contact:

Postby Brent15 » Sun Dec 04, 2005 4:32 pm

I would appreciate any assistance that can be given to get me started editing the ORION2v1.40 exe. I downloaded OCLplus v0.3 and unzipped it into C:\MPS\ORION2, but I'm not sure what to do next. I assumed that I should simply execute OCLplus but nothing seems to happen. I get the following in my DOS box:

OCLplus 'Orion2v140' editor, v0.3 Oct 2005.
Built from original code (c) Dmitry Yulmukhametov, Feb. 2000.

Format: ocl_v021.exe [-e] <filename>

I thought maybe I needed to change <filename> to equal <Orion2v140> or <Orion2v140.exe> but I didn't see a way to do this, and at this point I realize I am just speculating.

User avatar
siron
Posts:504
Joined:Fri Jul 22, 2005 12:35 pm
Location:Hamburg
Contact:

Postby siron » Tue Dec 06, 2005 3:03 pm

Here is a small description how I use it:

1. You should use a different folder when you use it quite often. My folder name is ORIONOCL

2. Copy OCLplus.exe into this folder

3. Generate 2 shortcuts of this OCLplus.exe. I have called them
oclplus extract.exe
and
oclplus modify

4. Edit the command line of these 2 shortcuts
My command lines are:
oclplus extract.exe:
C:\MPS\ORIONOCL\OCLPLUS.EXE -e orb21.txt
and
oclplus modify:
C:\MPS\ORIONOCL\OCLPLUS.EXE mod.txt

5. Hit oclplus extract.exe shortcut and the data is extracted to a textfile called orb21.txt

Edit the txt file and rename it to mod.txt and hit the oclplus modify shortcut.

6. Enjoy :P

User avatar
Brent15
Posts:59
Joined:Fri Dec 02, 2005 2:42 pm
Location:United States of America
Contact:

Postby Brent15 » Tue Dec 06, 2005 11:48 pm

Many thanks Siron, I am not that familiar with DOS. Your information worked flawlessly.

User avatar
yurop
Posts:21
Joined:Tue Sep 06, 2005 6:48 am
Location:Sol III, Hungary

Postby yurop » Wed Jul 05, 2006 9:25 am

which version is working with with 1.40b23? I've tried it different ways but I don't get the txt file. (I've copied the editor in the game directory, edited a shortcuts, but nothing..)

the ocl 0.21 works fine with the windows version


Ok, It works now :)

Sputax
Posts:15
Joined:Mon Jun 19, 2006 1:23 pm

Postby Sputax » Sun Sep 20, 2009 6:22 am

Ive found an old OCL text file i made some modifications to. What i cant remember is how to get it back into the game.

Sputax
Posts:15
Joined:Mon Jun 19, 2006 1:23 pm

Postby Sputax » Sat Oct 10, 2009 11:31 am

Any suggestions?

User avatar
Green_Knight
Posts:61
Joined:Wed Jul 18, 2007 3:10 am
Contact:

Postby Green_Knight » Sat Nov 07, 2009 2:44 am

Use the ocl to compile it and then replace outputed files in MOO2 directory.

Sputax
Posts:15
Joined:Mon Jun 19, 2006 1:23 pm

Postby Sputax » Fri Dec 25, 2009 5:08 pm

Ive tried the OCL modfy but doesnt seem to work. Every tim i start a new game nothing has changed. I tried them in the MOO2 folder, in their own folder. Do i have to name it mod.txt or can it be whatever i like as long as the command line is the same?


Return to “Game Modifications”

Who is online

Users browsing this forum: No registered users and 33 guests