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

Post new mods and scenarios here.

Moderator: Shannon V. OKeets

User avatar
rkr1958
Posts: 29983
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

jesperpehrson wrote: Sun Nov 10, 2024 10:02 am Heya!
In our netplay game the chinese got a partisan that sneakily could be placed in Canton where there were two japanese transports.
For some reason the game rolled for each trs twice. The first set of rolls sunk one and aborted the other, the second set of rolls sunk the other and aborted the first one. So both TRS were destroyed.
I don´t think there should have been two rolls per TRS so I think one TRS should be safely back in a japanese harbour.

Is it possible to fix?
Yes. Two ways. The first you can do yourself. Make sure set die rolls is selected. Go back to the partisan phase and reproduce your rolls. Next, set the second die roll for each TRS to the first.

The second way would require some advance edits of the game file which I and a few others here could do.

If you're unable to do the first above then attach your game file with instructions on which destroyed TRS you want back and where?

P.S. Just saw this is a net play game. I'm not experienced with that mode of play so the second way would require someone's expertise other than mine to accomplish. So, maybe the first way is best?
Ronnie
User avatar
paulderynck
Posts: 8482
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 »

The same methods work, but you have to ensure the repaired file is in use by both players when you start your next session.
Paul
User avatar
Joseignacio
Posts: 3022
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 »

jesperpehrson wrote: Sun Nov 10, 2024 10:02 am Heya!
In our netplay game the chinese got a partisan that sneakily could be placed in Canton where there were two japanese transports.
For some reason the game rolled for each trs twice. The first set of rolls sunk one and aborted the other, the second set of rolls sunk the other and aborted the first one. So both TRS were destroyed.
I don´t think there should have been two rolls per TRS so I think one TRS should be safely back in a japanese harbour.

Is it possible to fix?
There shouldnt have. I have seen double rolls without a reason (wrong behaviour of the program) many times, and in different phases.
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 »

Hello Ronnie,

I finally bit the bullet and started to learn to edit MWIF game files, using this thread and your excellent .docx file. So far I managed to move a unit on map in order to defeat the air rebasing bug and to bring the missing two German CBV units in 5.0.0.1 to the Reserve Pool in game turn 1. I feel confident to be able to organise/disorganise units as needed.
In a game just started we want to play with the yet not fully coded optional rules Frogmen and Guards Banner Armies. How exactly can I bring the Italian frogmen unit to La Spezia?
I was sure, I read before, how you did it already, but cannot find it neither in this thread nor in the .docx .
User avatar
rkr1958
Posts: 29983
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: Sat Jan 25, 2025 12:21 pm Hello Ronnie,

I finally bit the bullet and started to learn to edit MWIF game files, using this thread and your excellent .docx file. So far I managed to move a unit on map in order to defeat the air rebasing bug and to bring the missing two German CBV units in 5.0.0.1 to the Reserve Pool in game turn 1. I feel confident to be able to organise/disorganise units as needed.
In a game just started we want to play with the yet not fully coded optional rules Frogmen and Guards Banner Armies. How exactly can I bring the Italian frogmen unit to La Spezia?
I was sure, I read before, how you did it already, but cannot find it neither in this thread nor in the .docx .
Just saw this. Let me look and I'll post the necessary edits.
Ronnie
User avatar
rkr1958
Posts: 29983
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: Fri Jan 31, 2025 9:33 pm
Angeldust2 wrote: Sat Jan 25, 2025 12:21 pm Hello Ronnie,

I finally bit the bullet and started to learn to edit MWIF game files, using this thread and your excellent .docx file. So far I managed to move a unit on map in order to defeat the air rebasing bug and to bring the missing two German CBV units in 5.0.0.1 to the Reserve Pool in game turn 1. I feel confident to be able to organise/disorganise units as needed.
In a game just started we want to play with the yet not fully coded optional rules Frogmen and Guards Banner Armies. How exactly can I bring the Italian frogmen unit to La Spezia?
I was sure, I read before, how you did it already, but cannot find it neither in this thread nor in the .docx .
Just saw this. Let me look and I'll post the necessary edits.
Ok. I have the edits to get the Italian frogmen on the map. But, I'm not sure how they'll play given the optional rule isn't (fully) coded.

(1) There are two Italian frogmen (1936 & 1941).
(2) Search for:
Frogmen,89,53,1936
Frogmen,89,53,1941
(3) Made the following edits below (left panel is original & right panel is the edits).
Frogment-Edit.png
Frogment-Edit.png (34.81 KiB) Viewed 629 times
(4) Edit place frogmen in La Spezia.
Frogmen.png
Frogmen.png (3.28 MiB) Viewed 629 times
(5) Text file (zip) with original (pre edit) and edited frogment.
Frogment.zip
(1.36 KiB) Downloaded 6 times
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 »

Worked like a charm, thanks Ronnie!

I did choose ANSI encoding instead of original TNF-8, as you suggested, while saving the file. I see, some German special characters are now missing in unit counter names and unit description. Will this not lead to problems in the future with these specific counters?

I don't know yet, how exactly we will handle an actual attack by ITA Frogmen on Allied ships, but I think, we can always do it manually off-game by implementing any results via editing. But now with the counter present, we will have already the correct target profile in La Spezia in case of an Allied Port Attack.
User avatar
rkr1958
Posts: 29983
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 Jan 31, 2025 11:54 pm Worked like a charm, thanks Ronnie!
Good deal. You're becoming an editing expert now!
Angeldust2 wrote: Fri Jan 31, 2025 11:54 pm I did choose ANSI encoding instead of original TNF-8, as you suggested, while saving the file. I see, some German special characters are now missing in unit counter names and unit description. Will this not lead to problems in the future with these specific counters?
I don't believe it will. The only instance(s) that I aware of where exact name(s) with special characters are necessary are special action(s) based on unit name(s). For example, (1) US entry action interning the French CV Bearn, (2) Upgrading ships, such as the KM BB Gneisenau.
Angeldust2 wrote: Fri Jan 31, 2025 11:54 pm I don't know yet, how exactly we will handle an actual attack by ITA Frogmen on Allied ships, but I think, we can always do it manually off-game by implementing any results via editing. But now with the counter present, we will have already the correct target profile in La Spezia in case of an Allied Port Attack.
Please keep us advised how well you're able to implement this uncoded optional rule. Maybe as a community we can develop the edits and guidelines to implement them all.
Ronnie
User avatar
Orm
Posts: 30853
Joined: Sat May 03, 2008 7:53 pm
Location: Sweden

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

Post by Orm »

rkr1958 wrote: Sat Feb 01, 2025 5:08 pm
Angeldust2 wrote: Fri Jan 31, 2025 11:54 pm I did choose ANSI encoding instead of original TNF-8, as you suggested, while saving the file. I see, some German special characters are now missing in unit counter names and unit description. Will this not lead to problems in the future with these specific counters?
I don't believe it will. The only instance(s) that I aware of where exact name(s) with special characters are necessary are special action(s) based on unit name(s). For example, (1) US entry action interning the French CV Bearn, (2) Upgrading ships, such as the KM BB Gneisenau.

There is an issue with some MIL when they arrive as reinforcements, if my memory serves. Dusseldorf MIL, for example, can not be placed without the special charachter in the units name (or editing).
Have a bit more patience with newbies. Of course some of them act dumb -- they're often students, for heaven's sake. - Terry Pratchett

A government is a body of people; usually, notably, ungoverned. - Quote from Firefly
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 »

Yes, the problem with placement of certain MIL with special characters in name I had in mind. But I assume, they can be placed manually by editing, if they do not show up automatically? Or they show up normally, but there will be a message, they cannot be placed?
User avatar
Orm
Posts: 30853
Joined: Sat May 03, 2008 7:53 pm
Location: Sweden

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

Post by Orm »

There will be a message that they cannot be placed, if my memory serves.

Editing them in is no issue (if one knows how).
Have a bit more patience with newbies. Of course some of them act dumb -- they're often students, for heaven's sake. - Terry Pratchett

A government is a body of people; usually, notably, ungoverned. - Quote from Firefly
User avatar
Joseignacio
Posts: 3022
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 »

Some feedback about Magic:

It did not "see" a French TRS which was at the Belgian Congo, so I couldnt edit it's location, that was "causing" the MWIF to hang at Vichy Creation.

Some CW units Libya have got OOS and, even though they shouldnt be Isolated for end of turn reorg matters(they can trace an unlimited hex route to a supply source), with the current 10 hexes rule the game considers them so.

For those not OOS it is no big deal because soon enough at the turn start, the CW will send fleet, but right now the OOS should have reorganized. Unfortunately, as I mentioned in one post earlier, the code for Isolated and Isolated + OOS are not handled by Magic, so it cannot be done with it.
User avatar
Joseignacio
Posts: 3022
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 »

Joseignacio wrote: Fri Jan 20, 2023 12:12 am 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
rkr1958
Posts: 29983
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

Joseignacio wrote: Sat Mar 08, 2025 9:38 pm
Joseignacio wrote: Fri Jan 20, 2023 12:12 am 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.
Inferring from what Steve has provided and what's in the user manual I'm confident that he's extensively using word packing (i.e., storing multiple value in a single word or variable in his code). The below (attached) zip file was taken from an earlier post by Steve in this thread. In fact, if you take a look at the post (and zipped txt file), he explicitly provides details of the bit masks for multiple values stored in a single word. Now, the rub is that when the file is written out in csv format that these individual pack words are split over numerous ascii values. As far as I can tell, for example, I don't see a 1-to-1 correlation between his pack Data0, Data1, ...., Data7 variables and what's written out in the csv *.GAM file. There is some correlation but (again, as far as I can tell) isn't 1-to-1.

My approach to game file editing (whether by text editor or by computer code; i.e., MAGIC), is a layman's equation style (e.g., encoded hex location = (512 x Row) + Col) vs a mathematical purest approach using bit masks and bit shifting.

Code: Select all

// ****************************************************************************
// Data3
(*
Bits Mask Data
0-8 $000001FF Column (9 bits = 512).
9-16 $0001FE00 Row (8 bits = 256).
17-23 $00FE0000 Sea area (7 bits = 128).
24-26 $07000000 Section (3 bits = 8).
27-31 $F8000000 On/Off map location (5 bits = 32).
*)
Attachments
game-file-word-packing-info-posted-by-Steve.zip
(4.67 KiB) Downloaded 7 times
Ronnie
User avatar
Joseignacio
Posts: 3022
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 »

Thanks. I think I understood about the half of what you wrote and could have a general idea of what you mean.

Dont know much how it relates to what I wrote, which was also based on the states I observed in the organized/disorganized - Supplied/unsupplied field when units were Isolated, but I guess what you mean is that you dont want to tangle too much with the CSV because you are not sure 100% on how it works.

As I said, it is not a (bad) critic, quite the opposite, the utility helps a lot. Just giving feedback.
User avatar
rkr1958
Posts: 29983
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

Joseignacio wrote: Tue Mar 11, 2025 7:54 pm Thanks. I think I understood about the half of what you wrote and could have a general idea of what you mean.

Dont know much how it relates to what I wrote, which was also based on the states I observed in the organized/disorganized - Supplied/unsupplied field when units were Isolated, but I guess what you mean is that you dont want to tangle too much with the CSV because you are not sure 100% on how it works.

As I said, it is not a (bad) critic, quite the opposite, the utility helps a lot. Just giving feedback.
No problem. I have made additions, improvements and some bug fixes to the version I'm using. I haven't documented any of it. It's a shame we've lost so much of our community.
Ronnie
User avatar
Joseignacio
Posts: 3022
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 »

rkr1958 wrote: Wed Mar 12, 2025 12:22 am
Joseignacio wrote: Tue Mar 11, 2025 7:54 pm Thanks. I think I understood about the half of what you wrote and could have a general idea of what you mean.

Dont know much how it relates to what I wrote, which was also based on the states I observed in the organized/disorganized - Supplied/unsupplied field when units were Isolated, but I guess what you mean is that you dont want to tangle too much with the CSV because you are not sure 100% on how it works.

As I said, it is not a (bad) critic, quite the opposite, the utility helps a lot. Just giving feedback.
No problem. I have made additions, improvements and some bug fixes to the version I'm using. I haven't documented any of it. It's a shame we've lost so much of our community.
Have we? I am always the last to know :o
User avatar
Joseignacio
Posts: 3022
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 »

Hello all,

I am asking without too much hope...

I am positive that we wanted to play without Combat Engineers, and I am almost positive (as much as I can be) that we did not select them. However be it for a bug or because I am wrong in this, the Optional is ON, so I am having a lot of Factories damaged just because of conquest, and what is worse, Major ports that behave as minor.

This is a serious handicap for the Axis, so I would like to know if there is a way to edit this optional, and if not, how can I "undamage ports and factories".

I guess else we will have to add BPs and delete oils every turn and, what is worse, never have Brest, Burdeaux, Antwep and Rotterdamm, Copenhaguen, Danzig, and the future conquests but like minor ports all the game.
User avatar
paulderynck
Posts: 8482
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 know about the factories but the options are easy to edit, meaning easy to change, but some of them could confuse the game so much that it cannot be continued. All you can do is try it. Open the file with a text editor like Notepad. The sixth line down contains all the options in one line that ends with "OptRules". There are 82 entries counting that last one and they are all either a zero or a -1. Zero is off, -1 is on. Count the first entry as zero, the second as 1, the third as 2 etc. You want number 74. In other words the 7th one to the left of the word "OptRules". If it's on it will be a -1 and you want to change it to a zero and save the file and if NetPlay, share the file with your opponent before continuing.

You might want to also check #27 (i.e. the 28th entry counting from the start of the line). That is Factory construction and destruction but please check the wording of those options in the RAC as I cannot remember if they are related.

I've attached a pic of the complete list. Note that just because an option exists in the list (Frex: Kamikazes), it does not mean it is coded. If it is greyed out when you select options to start a game, changing it here will make no difference or make things worse.
Optional rules.jpg
Optional rules.jpg (379.13 KiB) Viewed 399 times
Paul
User avatar
Joseignacio
Posts: 3022
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 »

Thanks a lot. I'll try it right away and will report, so that people can have feedback.

P.D.: In case someone has the same problem, after reading the description that the game does on the "Factories construction and destruction" optional, I dont see anything related except this, which would only need to be considered for repairing the factories and ports (which most probably I will have to do) but in this case it would make it easier to repair because of the lack of need of Constrution Engineers anymore, for repairs.
Factory Destruction & Construction [RAW option 30 section 22.2, 13.6.8]

This optional rule allows a player to build new factories and rebuild destroyed factories. Because factories
cost a lot to build and take 4 turns to arrive, it is not always obvious if building a new one is a good thing to
do. Repairing destroyed factories is cheaper and faster than building new ones. The only downside to repairing
a factory, rather than building a new one, is that the repaired factory will be in the same hex in which it was
destroyed at least once already.

For World in Flames building a factory is as close to a capital investment as a player can get. You give up
near term build points (8 of them) with the expectation that you will get more than that back in the future.
Since the factories won't start producing until they arrive 4 turns hence, and you need for them to be
operational for at least 8 turns to repay the original investment, we are talking about not seeing any
return/profit on your investment until 2 years from when you build them. Even then, they are only worth
something if you have unused resources sitting around continuously.

Each major power can build a maximum of 1 new factory a turn. They cost 8 build points each and take 4
turns to arrive. When a new factory does arrive, it is a blue factory and it must be placed in a city hex in the
major power's home country. For the Commonwealth the only home country in which a new factory can be
placed is Britain (until Britain is conquered). There can never be more than 2 blue factories in a hex.

If a preexisting factory is destroyed, you don't have to rebuild it from scratch. Instead you can repair it.
This is cheaper and faster (4 build points and 2 turns). Note that you can't repair newly constructed factories,
only ones that preexisted at the start of the war (prior to 1940). If you are playing with Engineer units as
construction engineers, you can't repair a destroyed factory unless an engineer unit is stacked in the factory
hex on the turn you pay for the repair.


All factories can be destroyed by Strategic bombardment. When there is a choice, the blue factories are
destroyed before the red. An enemy player may also destroy a blue factory if one of his land units (this
includes partisan units) is in supply in the factory's hex during the victory check step. Each land unit can only
destroy 1 factory a turn. Specifically, if a hex has 2 blue factories, you may only destroy both in the same
turn if you have 2 land units there.
Post Reply

Return to “Mods and Scenarios”