A Layman's Guide to Successfully Editing the MWiF Game File.

Post new mods and scenarios here.

Moderator: Shannon V. OKeets

User avatar
Courtenay
Posts: 4396
Joined: Wed Nov 12, 2008 4:34 pm

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by Courtenay »

The reason I want to do this is that the US has some long range fighters that at the start of the war I want to give to the CW, where they really help in the fight for the Mediterranean, but in the middle of the war, after the CW has gotten more long range fighters, I want to give to the Chinese, who just don't have very many fighters.
I thought I knew how to play this game....
User avatar
rkr1958
Posts: 29602
Joined: Thu May 21, 2009 10:23 am

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by rkr1958 »

How to Return Lent Air Units.

Returned lent planes from wrong pool (reserve not force pool as per the rules). Editing this post to delete incorrect instruction. Redoing now at the current end of this thread.
Last edited by rkr1958 on Wed Mar 29, 2023 5:38 pm, edited 3 times in total.
Ronnie
User avatar
rkr1958
Posts: 29602
Joined: Thu May 21, 2009 10:23 am

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by rkr1958 »

Courtenay wrote: Fri Nov 18, 2022 9:56 pm The reason I want to do this is that the US has some long range fighters that at the start of the war I want to give to the CW, where they really help in the fight for the Mediterranean, but in the middle of the war, after the CW has gotten more long range fighters, I want to give to the Chinese, who just don't have very many fighters.
Good luck and let me know if things work out!
Ronnie
User avatar
Courtenay
Posts: 4396
Joined: Wed Nov 12, 2008 4:34 pm

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by Courtenay »

No, the lent unit must be in recipients force pool, not the reserve pool. It is not legal to return units in the reserve pool you may only return units in the force pool. This is the same restriction as on lending units by the original owner. I am sure that this should not be too hard a change.
I thought I knew how to play this game....
User avatar
rkr1958
Posts: 29602
Joined: Thu May 21, 2009 10:23 am

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by rkr1958 »

I had the following request via PM for how to edit.
Replace Bismark with CV Yorck
Replace Tripiz with CV Clausewitz
Replace Yamato with CV Meiji
Replace Impero with CV Spariero
Replace Vittorio Veneto with CV Aquita
Replace Littorio with CV Falco
Replace Romana with CV Leonardo da VIt'si

The Peter Stasser is available to be put on the board during setup, and I need a level 2 ME 109E or Ju 87B carrier plane to go with it. I thought I modified the set file for it but either I saved the wrong version of the file or it did not take.

It's a what if, Hermann Görinan had an accident and was killed in the early '30s eliminating a lot of opposition to carriers to Germany, combined with a series of joint military exercises and experimentation in the mid-'30s the results of which the Axis and Japanese did not pursue Battleships and focused on carriers.
Very interesting mod indeed. So I'm going to provide editing instructions in my next post on how one might accomplish this or any similar mod by modifying a (the) game file at the end of setup. The advantage is that no input files have to be edited so you could play this mod and a non-mod game at the same time. The disadvantage is that you need to do these edits for every game you wish to employ this mod.

I didn't make all the above edits but just a couple to illustrate the possible mod. Specifically, Replace Bismark with CV Yorck and the Tripiz with CV Clausewitz. Also, I moved from future to current force pool a couple of Ju 87B carrier planes.

Below are screen caps for: (1) before edit, (2)after edit & (3) differences between the before and after edit files.
Attachments
KM-Pre.jpg
KM-Pre.jpg (350.02 KiB) Viewed 1398 times
KM-Post.jpg
KM-Post.jpg (357.35 KiB) Viewed 1398 times
KM-Pre-Post-Diff.jpg
KM-Pre-Post-Diff.jpg (1.11 MiB) Viewed 1398 times
Ronnie
User avatar
rkr1958
Posts: 29602
Joined: Thu May 21, 2009 10:23 am

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by rkr1958 »

Clausewitz,79,39,1943
0,3173,,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0
.P Plan Z, Grand Admiral Erich Raeder's dream for a fleet that would rival the Royal Navy, was approved by Adolf Hitler in January 1939. Amongst the large number of modern powerful vessels, the plan allowed for the building of four aircraft carriers by 1947 and a further four carriers to be built at some point thereafter. .P This "what if" counter allows the German player to bring forward Plan Z; something that Raeder tried unsuccessfully to convince Hitler to do. The head of the German navy believed that his Kriegsmarine could finish off the United Kingdom before Hitler turned his attention toward the Soviet Union. .P No technical details are available for these later carriers and the ship names are only possible names that could have been used by the Kriegsmarine. Clausewitz would have been named after the great Prussian military theorist Carl von Clausewitz.
10138,42919,0,4757,17407,65535,18432,0,0,0,0,0,0,0,0,5415
-1,UndoData
26784,13394,0,1536,0,0,0

Record #1. Unit Header/Name record.
Clausewitz,79,39,1943 --> Name,Country id,unit type,year

Record #2. Force Pool Record
0,3173,,0,0,0,0,0,0,0, 0, 0, 0,-1, 0, 0, 0, 0, 0, 0, 0 --> Force Pool Record. (NOTE: -1 => in that force pool).
1, 2 ,,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 --> Force Pool Record Field #.
x, x ,,x,0,1,2,3,5,6, 7,NA, 8, 9,10,11,12,13,14,15,16 --> Force Pool #. NOTE: Starts at field #4. No force pool 4 (i.e., jumps from 3 to 5). Field #11 is skipped.
Force Pool #0 (Field #4). On Map
Force Pool #1 (Field #5).?
Force Pool #2 (Field #6).?
Force Pool #3 (Field #7). Reserve
Force Pool #4. -- SKIPPED --
Force Pool #5. (Field #8). Production
Force Pool #6.(Field #9). Construction
Force Pool #7.(Field #10). Repair
Force Pool #8.(Field #12). Force Pool
Force Pool #9.(Field #13). Future Force Pool
Force Pool #10.(Field #14). Lend Lease
Force Pool #11.(Field #15). ?
Force Pool #12.(Field #16). ?
Force Pool #13.(Field #17). Conquest
Force Pool #14.(Field #18). Scrapped
Force Pool #15.(Field #19). Removed
Force Pool #16 (Field #20). Turn arrives from production or construction pool. 0=JAN/FEB, 1=MAR/APR, 2=MAY/JUN, 3=JUL/AUG, 4=SEP/OCT, 5=NOV/DEC

Record #3. Unit (text) description.

Record #4. Unit Status Record (USR).
10138,42919,0,4757,17407,65535,18432,0,0, 0, 0, 0, 0, 0, 0, 5415
1 , 2 , 3, 4 , 5 , 6 , 7 ,8,9,10,11,12,13,14,15,16

(1) ?
(2) Game ID #
(3) ?
(4) Unit ID #
(5) Org & supply status. 1023=Org & in supply, 5119=flipped & in supply, 17407=org & out of supply, 21503=flipped & out of supply, 9215=reorganized & in supply
(6) ?
(7) (Force Pool #) x 2048 + (wrap flag?)
NOTE: Force Pool # = floor(USR(7)/2048). Not sure how the wrap flag folds in but this floor calculation will give the force pool.
Also, wrap flag only applicable when unit is on the map (i.e., Force Pool # = 0, so 0 x 2048 + wrap flag = wrap flag?)
(8) Encoded hex location. EHL=512 x Row # + Column #.
NOTE: (a) EHL=EHL-65536 if > 65536.
(b) Game file may be edited and saved with EHL > 65536 and unit will be placed in the correct edited location.
When that edited game file is loaded and saved MWIF will take care of the wrap around and "properly" caculate the values for field (7) & (8).
(c) One only needs to be concern with this wrap around when searching for a unit at a location where EHL warps around.
That is, they need to search for the wrapped EHL value. However; when moving a unit a EHL value > 65536 will place the unit where you wish.
(9) ?
(10) ?
(11) ?
(12) If saved oil or BPs then = # Oil (BPs) x 256
(13) 224=can move, 232=moved this impulse, 228=combat ready.
NOTE: If you moved a unit but wish to undo the move but can't due to some prior condition in MWIF that won't let you, you could edited the unit's
EHL (field 8) back to his original location and reset this flag to 224.
(14) RTB flag. 0,1=returing to base. 2=staying at sea. Setting this flag for CPs to 2 that were returning to base "on their own" has often been a lifesaver for me many times!
(15) ?
(16) 1517=Senty flag enabled.

Record #5. -1,UndoData

Record #6. 26784,13394,0,1536,0,0,0 --> Significant for CPs as this record contains the number of CP points. Also, this record not present for saved BPs & saved oil.
1 , 2 ,3, 4 ,5,6,7
(1)?
(2)?
(3)?
(4) If CP, # CP points
Ronnie
User avatar
rkr1958
Posts: 29602
Joined: Thu May 21, 2009 10:23 am

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by rkr1958 »

(1) So to move units from one pool to another the appropriate edits to the force pool record (record #2) must be made to including toggling off -1 to 0 (remove from current pool), toggling on 0 to -1 (moved to new pool) and if moved to production, construction or repair pool setting the date for leaving that pool (i.e., last field to 0,1,2,3,4, or 5).

(2) Also, USR(7)=2048 x Force Pool #.

Also, I'd appreciate any and all review of my previous post for correctness and understanding ...
Ronnie
User avatar
rkr1958
Posts: 29602
Joined: Thu May 21, 2009 10:23 am

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by rkr1958 »

Courtenay wrote: Sun Nov 20, 2022 10:52 pm No, the lent unit must be in recipients force pool, not the reserve pool. It is not legal to return units in the reserve pool you may only return units in the force pool. This is the same restriction as on lending units by the original owner. I am sure that this should not be too hard a change.
Ok. Good to know. FYI. Just modify the instructions to move a plane from the borrower's force pool back to the lenders. Hopefully I've provided enough "fishing gear and instructions" for one to do so?
Ronnie
User avatar
paulderynck
Posts: 8465
Joined: Sat Mar 24, 2007 5:27 pm
Location: Canada

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by paulderynck »

I had messed around with trying to read the number of CPs in sea zones and the route resources were taking to factories or storage. I recall finding the CP locations are the hex numbers for the zero box (if they were hexes). I was thinking of coming up with something that would do a better job with optimizing CW/JP resource transportation, but the first couple sentences here is as far as I got.

Even if that could be done, it would have to be read back into the production lists and avoid the program redoing its routing.
Paul
User avatar
rkr1958
Posts: 29602
Joined: Thu May 21, 2009 10:23 am

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by rkr1958 »

paulderynck wrote: Tue Nov 22, 2022 8:03 pm I had messed around with trying to read the number of CPs in sea zones and the route resources were taking to factories or storage. I recall finding the CP locations are the hex numbers for the zero box (if they were hexes). I was thinking of coming up with something that would do a better job with optimizing CW/JP resource transportation, but the first couple sentences here is as far as I got.

Even if that could be done, it would have to be read back into the production lists and avoid the program redoing its routing.
Getting the number of CPs in sea zones is pretty straightforward. However; figuring out which RPs use which routes is a very different thing. I haven't been able to decipher that from the game file. In fact, I suspect that routing is controlled within the code and not within the game file. That's why I believe MWIF recalculates each route every time you reload, redo things or add/subtract CPs from sea zone(s).
Ronnie
User avatar
paulderynck
Posts: 8465
Joined: Sat Mar 24, 2007 5:27 pm
Location: Canada

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by paulderynck »

I don't think it was tough to find. Search the file for "RouteHexList". Way down towards the bottom. They start with reference to a resource and I think it's set up for 3 lists, normal, default and override.

But I agree the program might do something to them even if you set them all as override.
Paul
User avatar
Mayhemizer_slith
Posts: 9330
Joined: Wed Sep 07, 2011 2:44 am
Location: Finland

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by Mayhemizer_slith »

I have problems finding code for hexes. I thought it was 512X+Y so that Port Morespy 128.176 = 65712 but I can't find anything with that. Am I doing something wrong?
If your attack is going really well, it's an ambush.

-Murphy's war law
User avatar
craigbear
Posts: 769
Joined: Tue Jan 21, 2020 2:30 am
Location: Calgary, Alberta

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by craigbear »

Subtract 65536.
User avatar
Mayhemizer_slith
Posts: 9330
Joined: Wed Sep 07, 2011 2:44 am
Location: Finland

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by Mayhemizer_slith »

I don’t understand. What is the correct answer?
If your attack is going really well, it's an ambush.

-Murphy's war law
User avatar
Mayhemizer_slith
Posts: 9330
Joined: Wed Sep 07, 2011 2:44 am
Location: Finland

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by Mayhemizer_slith »

I see. That is the max value of hex coordinate. I will subtract.
If your attack is going really well, it's an ambush.

-Murphy's war law
User avatar
craigbear
Posts: 769
Joined: Tue Jan 21, 2020 2:30 am
Location: Calgary, Alberta

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by craigbear »

Page 3 of this thread, about midway, explains it.
User avatar
rkr1958
Posts: 29602
Joined: Thu May 21, 2009 10:23 am

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by rkr1958 »

rkr1958 wrote: Tue Oct 25, 2022 6:07 pm How to Increase the Number of Remaining Activities.

(1) The following edit will show you have increase the number of remaining activities for a given Major Power and action taken. For example, France takes a combine, which gives her 1 naval move, but wishes to move all her subs in port and in supply for free.

(2) As always backup up your game file before beginning any edits in case you really mess it up.

(3) Get the country id (cid) of the country of interest (e.g., France=80).

(5) Locate the section in the game file that holds the country's remaining activities. This section is the same section that contains the country's reserve pool. The 4 lines that end that section are:

-1,CSet
-1,CSet
-1,CSet
-1,MCSet


The 2 lines that begin that section are ~12 lines above and are:

cid,cid
cid,cid


(6) The line that contains the activity limits is 2 lines above the first -1,CSet that ends the section.

(7) The line that contains the number of activities remaining is just above that line. This is the line to edit to increase the number of remaining activities. The activities on that line, and the one below, are in the same order that's used in the MWIF "Activities Available" form. That is, the order is: Air, Naval, Rail, Land Moves, Land Attacks.

(8) For the example in the screen cap below shows that I successfully edited the game file so give France 2 more, for a total of 3, naval moves (remaining) in order for her to be able to move her 2 subs for free.

(9) NOTE: If I had, for example, taken a land with France I still would have been able to edit her activities remaining to get these 2 free naval moves. However; she would NOT have been able to have initiated any naval searches. I've got this on my list to track down and figure out how to do. Why? If one wants to use WIF CE O-points rule to take a land and also make one naval move for example.

editing-Available-Activities.jpg

(10) PS. Just noticed that my initial screen cap got saved without the game file edit not shown. It was on there but got lost in the save. Below shows the game file post edit.

editing-Available-Activities-2.jpg
Addition. It took me a while to figure this one out. If two major powers share the same action limits (e.g., Germany/Vichy France, USSR/CCP), then activities if changed for one must also be changed for the other in the same manner. I kept trying to add a second naval move to Germany who took a combine and every time I reloaded the file it wasn't there. This was after Vichy was installed. Took me about 90 minutes to figure that one out. I had to add the extra naval move to both Germany and Vichy in order to get it!
Ronnie
User avatar
Joseignacio
Posts: 2970
Joined: Fri May 08, 2009 11:25 am
Location: Madrid, Spain

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by Joseignacio »

Ok, guys, maybe someone already posted this but I haven't seen it.

When I tried to edit the status of Yamashita (which should have been disorganized because of the Isolated Reorg optional, but wasn't, most probably because we changed optionals while checking them)...

... I followed the instructions of the first pages with the 1023 and the 5119 in the fifth position as directed to, but found that now some HQs have a different number, concretely 17407 in that position. Maybe it refers to being organized AND Isolated?

It would be

4*4096 + 1023 = 17.407 isolated and not disorganized (= organized)?
11*4096 + 5119 = 50.175 isolated and disorganized?
User avatar
Courtenay
Posts: 4396
Joined: Wed Nov 12, 2008 4:34 pm

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by Courtenay »

That number is a set of bit fields; each bit is independent of all the others. Disorganized is the 12 bit, so to make a unit organized or not, add or subtract 4096.
Add to disorganize, subtract to organize.

To the best of my knowledge, what the other 15 bits in the number do is unknown, but if all you want to do is organize and disorganize, subtracting and adding as needed. Don't subtract from an organized unit or add to a disorganized unit!
I thought I knew how to play this game....
User avatar
Courtenay
Posts: 4396
Joined: Wed Nov 12, 2008 4:34 pm

Re: A Layman's Guide to Successfully Editing the MWiF Game File.

Post by Courtenay »

We can guess at what some of the other bits do: things that show up in a unit's display or its status dots: unsupplied, moved, movement points remain, transported, transporting and sentry. There are other possibilities. If someone wants to, they could investigate this -- put a unit on sentry, see what changes, move it a hex, move it its full movement allowance, etc. So far, I don't know that anyone has bothered. (No, I am not going to.)
I thought I knew how to play this game....
Post Reply

Return to “Mods and Scenarios”