[MoO] MOO negative fleet fix

sargon0

Warlord
Joined
May 30, 2007
Messages
109
Location
England
MOO negative fleet fix
It can be frustrating when the negative fleet bug strikes in MOO so I looked to provide an automated way to fix this. The Oreo editor can fix this but only for fleets at planets and is likely to disclose spoiler information apart from which it apparently removes Future Tech from all players. My solution is a Rexx script which resets any ship count of 32,000 or more to zero whether in a fleet enroute or at a planet. Rexx interpreters are freely available and sample ones tested are mentioned (it should be easy to convert to other languages provided they have functions for handling binary data).

Setting up Rexx & script
1. Download Regina Rexx from http://regina-rexx.sourceforge.net/ (or R4 Rexx from http://www.kilowattsoftware.com/r4Page.htm ) and install into its own folder
2. Download my mooFleetFix.rexx.zip below and unzip to the same folder
3. Optionally create batch invocation file (eg. moofix.bat) with single command regina moofleetfix.rexx (or r4 moofleetfix.rexx)

Fixing negative fleet
1. Copy save file(s) SAVEn.GAM with negative fleets into rexx folder – the script will look for SAVE1.GAM to SAVE7.GAM
2. Open command window (Start->run->cmd), change to rexx folder and type command regina moofleetfix.rexx (or r4 moofleetfix.rexx) or simply run batch file created above from Windows Explorer
3. Follow script prompts on whether to start, to fix negative ship groups found and to exit
4. Backup original save file before replacing with updated one from rexx folder

Sample Output (from edited save)
mooFleetFix - by sargon0 from CFC & RB Master of Orion forums
Fixes negative fleets in moo save files SAVEn.GAM (n=1-7) in current folder.
It will show negative fleet sizes in each save file then prompt for Y to fix.

Hit Y and return to continue or anything else to exit
y
SAVE1.GAM
No bad fleets in SAVE1.GAM
SAVE2.GAM
Bad ENROUTE ship count for player 3 = 32000
Number of negative ship groups = 1
Fix bad fleets in SAVE2.GAM - hit Y to confirm or anything else for next file
y
Bad ENROUTE count for player 3 = 32000 reset to zero
SAVE3.GAM
Bad PLANET ship count for player 4 = 32000
Number of negative ship groups = 1
Fix bad fleets in SAVE3.GAM - hit Y to confirm or anything else for next file
y
Bad PLANET count for player 3 = 32000 reset to zero
SAVE4.GAM does not exist in current folder
SAVE5.GAM does not exist in current folder
SAVE6.GAM does not exist in current folder
SAVE7.GAM does not exist in current folder
Hit enter to exit

Details (for those interested)
Ships enroute are stored at x’4DA0’ with each fleet 28 bytes long and space for 260 fleets. The first byte of each fleet entry is the race number (0-5) else invalid (usually x’80’+) and the 6 ship counts are in 2 byte pairs from position 11 in standard Intel format (little endian).

Ships at planets are stored at x’74BA’ for player0 (that’s you) then x’828E’, x’9062’, x’9E36’, x’AC0A and x’B9DE’ (x’DD4’ or 3,540 bytes apart) for players 1-5 as they appear on map screen. Fleet entries are 24 bytes long with room for 108 planets (huge galaxy). The 6 ship counts are again standard 2 byte entries from position 13 but there is no validity check so all entries are scanned.

Nothing else is changed including total ship count or maintenance cost. If these need adjusting the program will automatically recalculate them. If you want more details of the save file layout for this ship data or other things not shown in editors then see my other thread: http://forums.civfanatics.com/showthread.php?t=275055

Please let me know of any failure (or success!) you have with this little utility and post your save with negative fleets so I can learn more about them.

Rexx script: View attachment 181827
 
I will fire up my backup PC and look at the Rexx as I have Kedit running on that machine. In case you did not know the name I use stands for Virtual Machine eXtended Architecture.

VM and its repalcements ran on main frames back in the 70's and one of the tools that was developed was Rexx that ran on CMS as part of VM. I was a systems programmer at that time.

IBM came out with microcode that ran VM to allow them to partition the mainframe and run MVS without having to install VM. I knew it right away as the msgs that came out were DMK...... That was the first three characters in all the code modules in VM.
 
I will fire up my backup PC and look at the Rexx as I have Kedit running on that machine. In case you did not know the name I use stands for Virtual Machine eXtended Architecture.

VM and its repalcements ran on main frames back in the 70's and one of the tools that was developed was Rexx that ran on CMS as part of VM. I was a systems programmer at that time.

IBM came out with microcode that ran VM to allow them to partition the mainframe and run MVS without having to install VM. I knew it right away as the msgs that came out were DMK...... That was the first three characters in all the code modules in VM.

Are you sure it was the 70's? It felt like the 80's to me.:lol: Mind you I left VM to the old hands while I played MVS sysprog. I still work with IBM mainframes and MVS (aka z/OS) under PR/SM or rather order other people to (officially). Now my Rexx is rusty at best and does not have your heritage so go easy on the critique although any suggestions are of course welcome.
 
I was at the first shop to have VM on the West coast in 1973 if I got the date correct. It did not have Rexx of course. Prism s the microcode I mentioned. I want ot say that cam out around 1990 or so, but I am not sure of the date.

I have been retired for a lot time. The CMS came out of Cambridge as I recall and was called Cambridge Monitoring System or something like that rather than Conversational Monitoring System as it is now.

Z/OS was after my time.
 
I am sure your dates are correct, vmxa. I joined the party later in the early 80's when MVS/XA and VM/XA were appearing. You are right about Prism and CMS, of course, also. Anyway let's see if anybody else recognises Rexx or makes use of it.
 
I don't follow all the programming history, but: the negative fleet doctor is IN!!! Thank you sargon0. :goodjob: I'm thinking I will try using it on my "Another Meklar Corner" game once I finish the new Imperium game.
 
I looked at the rexx code and was going to try a test, but I must be really old, yeah I am. Anyway, if I got your numbers right and I have loaded the save I see in Moo1 into the hex editor, I am not finding the fleets.

So I had the end of the RBO game where I had left Rhilus for the Humans and I had 9 ships sitting on it so they could not send out any ships to colonize. I looked at the data sheet and it said player 1 started at 81C0. I presume that is really player 0 the human player (me).

You had listed the location of the player tech data as 821E. Looking at that and the example you had for player 4, I figured the total offset was CE to the planet data. That may be wrong, I only had one location. The 5E stayed constant for Empire to tech offset for all, so I made an assumption, dangerous.

Anyway I started looking for player 0 *me* to see if I could find the fleet counts. I thought I found the first two fleets, not the rest, so I was not sure.

My plan was to zap in a 32000 fleet on one of mine and load up Moo and see if it shows up with that count. If so, then I could run your app to clear it and see if it worked.

So I guess my question is what is the offset to the planet data, is CE? I should say for fleets at planets, not those enroute. The planet fleet data is 18 hex long correct?
 
If you start at the Empire Data (73EC for you) then the Tech Data is at offset 5E (so 744A) and the ship planet data is at offset CE (so 74BA) and these offsets hold for each player, as you guessed. However you are Player 0, first listed on map screen and the AI are players 1-5, the second to sixth listed on the map screen. Player 1 would be the first AI and use 81C0 for Empire, 821E for Tech and 828E for ships at planets. The ships at planets data is 18 hex long per planet, as you say.

You certainly should be able to zap in 32,000 ships and see them in game and use Rexx on it.
 
Ok, I was not sure as to the the relationships as sometimes it was refered to as player 1 and other player 0 for the start.
 
Had I looked closer at the Rexx app, I would have seen the 74BA start. oh well. Anyway I was able to find the fleet and alter it. It was strange as the fleet did show up with -125 or whatever value I was using 7d7d or 32125.

I finally hit next and then it shows the familiar 32000, even though I had set it to 00FD. For those reading that F would be 61,440 and the D is 13 so 61,453.

Now the problem is that I don't have a true Rexx app, so I got the RX msgs. I have a subset macro support for Rexx that runs with Kedit. So I now have to rewrite the program as a macro to test it.

I am sure it will be fine, just not sure if it is required as it is easier to zap it, but I may do it to jog my memory. Note I will keep the author as Sargon in the help. :D
 
jkk, that negative fleet bug - and many other settings - for MOO1 are fixed in the GOG version of MOO1.

MOO1.jpg
 
Top Bottom