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

Post new mods and scenarios here.

Moderator: Shannon V. OKeets

User avatar
Joseignacio
Posts: 2969
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 »

But, on second thought, I don't think the second one is correct. Here we have Terauchi, which should be Isolated AND Disorganized, the number is 50.175 and he is only Isolated.
Untitled.png
Untitled.png (855 KiB) Viewed 1486 times
User avatar
Joseignacio
Posts: 2969
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 »

Courtenay wrote: Thu Jan 19, 2023 7:20 pm 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!
No, no, the number I get is in that very bit, the fifth one. You can see it in my immediate previous post image.

Maybe it is a new notation or a bug from 5.00.00.10

To be true I have lots of those 50175 and 17407 in the fifth fields, I enclose a copy of a save.
Attachments
NP - 2023_01_19_1758 - USSR.zip
(1.49 MiB) Downloaded 31 times
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 »

Convert everything to binary:

Code: Select all

 1023 = 00000001111111111 not disorganized
 5119 = 00001001111111111 disorganized
17407 = 00100001111111111 not disorganized
21503 = 00101001111111111 disorganized
50175 = 01100001111111111 not disorganized
54271 = 01101001111111111 disorganized
            ^ 12th bit
21503 = 17407 + 4096
54271 = 50175 + 4096
I do not know what the 14th and 15 bits are in 17407 and 50175. but whatever those bits do, they do not affect disorganization.
If one is asking "Is the unit disorganized", all the other bits are irrelevant. Only that 12th bit (counting from zero on the right, not one) matters.
I thought I knew how to play this game....
User avatar
Joseignacio
Posts: 2969
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 »

Oops, sorry, it seemed strange to me that you called bits to each of the numbers separated by commas, but I thought I was wrong.
And of course you didn't. This fits better in what I thought a Bit is.
Ok, so I guess one of these 17407 or 50175 is isolated (and obviously OOS) and the other OOS, being 50175 isolated but organized, like Terauchi is, and the JA at Manchuria, and 17407 would be OOS but organized, like JA units close to Nanyang, Northern China.

3rd Guard USSR in Persia is isolated and disorganized so 50175+4096 = 54271 correct!

So I think we got this too.
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 »

Occasionally, I move a naval unit where it can be intercepted, and, before I any rolling is done, realize I really didn't want to do that move. Sometimes I am able to undo, but sometimes the unit gets stuck, and its move can't be undone. When I look at the game save, there are a bunch of numbers for that unit. I don't know what most of them mean, and don't know which I should change to get the unit back to its original state. I don't want to go back to an earlier save, because since the last save I've done a bunch of other naval moves I don't want to redo.

Eventually it occurred to me that I don't need to know what the numbers are. I save the game, open up that save and an earlier save (the autosave for the Naval Movement step is a good one) and simply copy the numbers for that unit from the older save to the new save. Then I restart from the edited new save. Problem solved. (I still don't know what most of those numbers are.)

This works best for a naval move or a supercombined; a combined will have the number of naval moves wrong, but somewhere in this thread there is something about how to edit the number of naval moves left.
I thought I knew how to play this game....
User avatar
rkr1958
Posts: 29586
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 Jan 29, 2023 7:03 pm This works best for a naval move or a supercombined; a combined will have the number of naval moves wrong, but somewhere in this thread there is something about how to edit the number of naval moves left.
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.

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!
Attachments
editing-Available-Activities.jpg
editing-Available-Activities.jpg (1.02 MiB) Viewed 1408 times
editing-Available-Activities-2.jpg
editing-Available-Activities-2.jpg (165.38 KiB) Viewed 1408 times
Ronnie
User avatar
rkr1958
Posts: 29586
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 Jan 29, 2023 7:03 pm Eventually it occurred to me that I don't need to know what the numbers are. I save the game, open up that save and an earlier save (the autosave for the Naval Movement step is a good one) and simply copy the numbers for that unit from the older save to the new save. Then I restart from the edited new save. Problem solved. (I still don't know what most of those numbers are.)
I use this technique often and for a myriad of edit types. Especially when dealing with cargo loaded on transports or planes on aircraft carriers and vise versa. In fact, I still haven't broken the code for how to load cargo or planes, so going back to a temp or earlier saved version with the cargo loaded, I just copy the the lines for the cargo and it's carrier and replace in the file that I want the edits.
Ronnie
User avatar
rkr1958
Posts: 29586
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

So apparently there's a bug in the latest MWIF public beta release, 5.0.0.10, with the CBV optional rule. Specifically, 2 German CBVs (SS Freiwill & I Slovak CBV MILs) aren't available to be built (for free) during turn 1 production. It takes 4 simple edits to include them as shown below. The left hand side shows the game file before edits and the right high side shows it after edits. I've also "red penciled" in the required edits on the left hand side screen cap.
Attachments
999-GER-CBV-edit-1.png
999-GER-CBV-edit-1.png (81.95 KiB) Viewed 1345 times
Ronnie
User avatar
rkr1958
Posts: 29586
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

Of course these edits need to be made before German production is finished, which they were and are shown below.
Attachments
999-CBV-German-edit-2.png
999-CBV-German-edit-2.png (164.65 KiB) Viewed 1344 times
Ronnie
User avatar
rkr1958
Posts: 29586
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

And here the are in the German reinforcement pool for Nov/Dec 1939.
Attachments
999-CBV-German-edit-3.png
999-CBV-German-edit-3.png (142.25 KiB) Viewed 1343 times
Ronnie
User avatar
rkr1958
Posts: 29586
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

For those interested in building the ultimate MWIF game file editing document. I've actually started pulling one together, on the "side", in MS Word. What I decided to do, initially for my own benefit, is to visit this thread when I need to make a specific edit (e.g., trade agreements), copy the relevant posts including graphics and paste it in Word in an appropriate entitled sections (e.g., Editing Trade Agreements).

When I get this document to a state where I've included the majority of editing topics (as individual sections) in that document I'll post it for review, edit, comments for those interested. This may take a few weeks, as I producing this document on as needed basis. If there's anyone interested in helping "add" sections to copying (from the forum) and pasting into the document let me know and I'll post it as is. Eventually, after we get everything in and clean it up, we can convert it to pdf for wide use & distribution.

Please let me know what you think.
Ronnie
Angeldust2
Posts: 416
Joined: Tue Apr 28, 2020 4:24 am

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

Post by Angeldust2 »

Excellent initiative! And if you are satisfied with the feedback from the community to this document, it can be the basis for an easy-to-use .gam file editing tool?
User avatar
rkr1958
Posts: 29586
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

Angeldust2 wrote: Fri Mar 24, 2023 10:07 pm Excellent initiative! And if you are satisfied with the feedback from the community to this document, it can be the basis for an easy-to-use .gam file editing tool?
Not only feedback but original contributions. My goal is for this document to be the collective knowledge of the users, which is far superior than anyone's knowledge; especially mine.

I do want this document to be a community document.
Ronnie
User avatar
rkr1958
Posts: 29586
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: Sun Nov 20, 2022 9:26 pm 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.
FYI. Instruction using the correct pools to follow.

By the way, I'm up to 25 pages in my word document, "MWIF-Game-File-Editing-Capture-Document". I'm pulling together this document from instructions provided in this thread, updated as I'm doing know with better/more current knowledge. I'm pulling in the original graphics that I posted with the instructions so as to minimize degradation.

Within the next week or two I hope to have all that I've posted here pulled into the document with a section per edit topic.

I hope to solicit any and all that wish to help; specifically, (1) review, (2) editing, (3) [better] document organization & (4) [other] original game file editing contributions.

As a team, so far a team of one, once we get this to an agreeable (initial) form we can publish the 1st edition (e.g, pdf) for the community in general.

Please post here or PM me if you wish to help with this project.
Ronnie
User avatar
rkr1958
Posts: 29586
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.

1. As always, make a backup of your game file before making any edits. That way if you really honk things up you can always go back.

Lend Lease Pool
Return-LL-Air-Units-0.png
Return-LL-Air-Units-0.png (134.76 KiB) Viewed 1300 times
2. In this example, the French have a A-22 Maryland, Lend Lease from the USA in their force pool, which they wish to return.
Return-LL-Air-Units.png
Return-LL-Air-Units.png (217.2 KiB) Viewed 1300 times
3. So to return a Lend Lease Air Unit it must be in the borrows' Force Pool, which it is as you can see above. So, I've got that part correct (I hope) this time.
Ronnie
User avatar
rkr1958
Posts: 29586
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

4. In the game file that are multiple representations of Lend Lease Air Units. One for each potential borrow and one for the owner. To return it, we need to only be concerned with locating and editing the one for the current borrow, who wishes to return it, and the owner.

5. To locate the plane we first we need to get the country codes for the borrow (e.g., France=80) and the owner (e.g., USA=11).

6. Next we need the name of the plane (e.g., A-22 Maryland) and the year (e.g., 1939) which we can get from the panel that pops up when we select the plane. It's very critical to get the name, including spaces, exactly as it appears.

7. Then we need the unit type code for the plane type (e.g., Land Bomber=57). You can get the this code in vol 2 of the player's manual (11.2.3.5 Unit Type Codes, pps 204-205).

8. Next we construction the 2 search strings to find the beginning record for the borrowers' and owners' representation of that air unit in the game file. Generically that is --> [name],[country code],[unit type code],[year]
(a) borrowers --> A-22 Maryland,80,57,1939
(b) owners --> A-22 Maryland,11,57,1939

9. First locate the borrower's representation (i.e., A-22 Maryland,80,57,1939) and edit the force pool and unit status records to move it from the borrower's force pool to their future force pool.
(a) Force Pool Record Edit (borrower, before & after)
0,1293,A-22++Mary-+land,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0
0,1293,A-22++Mary-+land,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0

In a previous post (section) we count the fields in this record as, 1,2,x,3,4,5,...,20 In general I seen a null value (i.e., 1,2,,3,4,5,...,20) for x but in this example we have a value To be consistent with the previous post (section), I've relabeled the counting of the fields in the force pool record as, 1,2a,2b,3,4,5,...,20. Where 2b is usually null (i.e., 1,2,,3,4,5,...,20), but not always.

The force pool flags begin at field 4 = force pool 0 (on map). See previous post (section) for enumeration of fields (force pool #s) to force pool.

In our example, we need to move the borrowers plane from the force pool (pool #8, field #12) to future force pool (pool #9, field #13). Since the future force pool is only 1 above the force pool all you need to do is change -1 to 0 and in the next field up change the 0 to -1.

Finally for the borrower, we need to edit USR[7] = force_pool_number x 2048 + wrap_flag. Since the unit is NOT on the map there's no need to worry about the wrap_flag (i.e., =0). So change the current value of USR[7] = 8 x 2048 = 16384 to USR[8] = 9 x 2048 = 18432

Unit Status Record Edit (borrower, before & after).
10264,43065,0,1294,17407,65535,163840,0,0,0,0,0,0,0,6043
10264,43065,0,1294,17407,65535,18432,0,0,0,0,0,0,0,0,6043

10. Now we locate the owner's representation (i.e., A-22 Maryland,11,57,1939) and move the plane from the lend lease force pool (pool #10, field #14) to the owner's force pool (pool #8, field #12).

Force Pool Record Edit (owner, before & after)

0,232,A-22++Mary-+land,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0
0,232,A-22++Mary-+land,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0

Unit Status Record Edit (owner, before & after)
1432,34233,0,233,17407,65535,20480,0,0,0,0,0,0,0,0,2119
1432,34233,0,233,17407,65535,16384,0,0,0,0,0,0,0,0,2119

Note: USR[7] = 10 x 2048 = 20480 (lend lease) & USR[7] = 8 x 2028 = 16384 (force pool).

11. Game file diff before & after both edit sets
Return-LL-Air-Units-2.png
Return-LL-Air-Units-2.png (101.79 KiB) Viewed 1298 times
Ronnie
User avatar
rkr1958
Posts: 29586
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

12. Lend Lease Plane now returned from French force pool & back to the USA force pool and no longer shows in the Lend Lease pool.
Return-LL-Air-Units-3.png
Return-LL-Air-Units-3.png (198.51 KiB) Viewed 1297 times
Return-LL-Air-Units-4.png
Return-LL-Air-Units-4.png (117.81 KiB) Viewed 1297 times
Ronnie
User avatar
rkr1958
Posts: 29586
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

Adding Oil and BP counters.

(1) This one is definitely one of the more dangerous edits so BACKUP your game file before attempting or there’s a good chance you’ll be sorry.

(2) So to explain this we're going to be adding one saved CW Oil point in Ottawa, Montreal and a saved French BP in Paris.
add-oil-bp-1.png
add-oil-bp-1.png (1.07 MiB) Viewed 1285 times
(3) So first, we need to get the first line of each counter type which are:
(a) CW saved oil -> ,201,69,1936
(b) French saved BP -> ,80,70,1936

(4) Before adding counters I always like to first search the game file for any of that type that may have been removed and if found use that counter instead of inserting a new one.

(5) So for CW saved oil point I found one and did the necessary edits to
(a) chance the force pool from remove to map (force pool and USR(7) record edits as shown)
(b) move it to the location I want (e.g., Ottawa=[58,31]=30009=USR(8))
(c) make it 1 saved oil point (e.g., USR(12) = 256 x # saved oil points = 256).
add-oil-bp-2.png
add-oil-bp-2.png (455.26 KiB) Viewed 1285 times
Ronnie
User avatar
rkr1958
Posts: 29586
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

(6) Unfortunately, there was only 1 removed CW oil point. So for the 1 saved oil I want added to Montreal I made an exact copy of the Ottawa oil point I just created and pasted that directly below it.

(7) Now, this is important. When you add (or remove) a counter from the game the count must be adjusted appropriately or MWIF was hang on load up of the game. And if that happens you'll have to use Windows task manage to kill MWIF.

(8) The counter count is just before the first game counter. In this example I increased it from 3804 to 3805 to account for the copied CW oil point I added.

(9) Now back to the copies oil point. The only other edit needed is to move it from Ottawa to Montreal (i.e., 30009 to 30011), since it's on the map and of strength.

(10) By the way, for edits like this I tend I verify them after each counter is added. That way if I screw up I don't have to start over.
add-oil-bp-3.png
add-oil-bp-3.png (555.08 KiB) Viewed 1284 times
Ronnie
User avatar
rkr1958
Posts: 29586
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

(11) Now to the French BP I wanted added (saved) to Paris. Unfortunately, when I search my game file I don't find any French BP either on the map or removed. That is, no instances of the string ,80,70,1936 found in the game file.

(12) So we'll need to add a counter, which requires increasing the number of counters by 1 to 3806 in this example. But where to get the counter?

(13) I turn to my trusty counters library in such cases. I find a (Free) French saved BP in Senegal, Dakar. So I copy it but were to paste it?
add-oil-bp-4.png
add-oil-bp-4.png (152.2 KiB) Viewed 1281 times
(14) I search the game file for the first instance of any BP and paste the BP before that instance. The search string I used was ,70,1936

(15) I paste the copied BP, change the encoded hex location (USR[8] from Dakar=51206 to Paris=28189) and verify the strength is 1 BP (i.e., USR[12]=256 x # BPs = 256 in this example).

(16) I then load the file and confirm the edit.
add-oil-bp-5.png
add-oil-bp-5.png (749.21 KiB) Viewed 1281 times
Ronnie
Post Reply

Return to “Mods and Scenarios”