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

Post new mods and scenarios here.

Moderator: Shannon V. OKeets

Post Reply
Divadov
Posts: 100
Joined: Wed Mar 27, 2019 5:21 pm
Location: Barcelona

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

Post by Divadov »

Anybody knows how change the up/down/left/right keys for others? to can move the map with W/S/Q/E.
User avatar
AxelNL
Posts: 2389
Joined: Sat Sep 24, 2011 12:43 pm
Location: The Netherlands

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

Post by AxelNL »

ORIGINAL: Divadov

Anybody knows how change the up/down/left/right keys for others? to can move the map with W/S/Q/E.


AWSD works as well as the arrow keys. Press SHIFT for a bigger step.
ssiviour
Posts: 773
Joined: Fri Aug 08, 2014 7:14 pm
Location: Australia

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

Post by ssiviour »

ORIGINAL: AxelNL

ORIGINAL: ssiviour

I have read somewhere in the forums how to change a saved game from Netplay to Solo.

I haven't been able to find that thread again, but is anyone able to point me in the right direction?

Vaguely, from memory, it is one digit somewhere in the beginning lines of the Gam file.

Change the 2 into a 1 on the last position of the first line

Thanks, that seems to have worked.
User avatar
paulderynck
Posts: 8485
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 'think' 1 = head-to-head but 0 = solitaire. (Could be vice versa though!)
Paul
User avatar
whizar
Posts: 9
Joined: Fri Jun 17, 2011 1:45 pm

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

Post by whizar »

Hello, I need change the Italian Home Nation from Albania to Eritra to avoid a bug.
How I can do it.

Thanks. Whizar
Sus voy a gulagear
markb50k
Posts: 1224
Joined: Thu Jul 01, 2004 1:26 pm
Location: Spring, TX

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

Post by markb50k »

There’s a thread in the bug area where we fix that for someone. Look up my name for a recent post I was involved in
User avatar
whizar
Posts: 9
Joined: Fri Jun 17, 2011 1:45 pm

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

Post by whizar »

Thanks [&o]

I have been able to successfully change the Italian home nation from Albania to Eritrea.
I have used the same solution given for Algeria and Morocco.
Sus voy a gulagear
User avatar
davidc
Posts: 115
Joined: Wed Dec 05, 2007 9:47 am

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

Post by davidc »

Someone asked about gearing previously and in my current game USA gearing was reset to zero for everything somehow.

So, in the save game search for the country code in this pattern:
11,11
11,11
That's for the USA.
The only country not matching this pattern is China because of nationalist and communist, so search for this pattern:
53,53
51,53

Searching is easy if you use Notepad++
Bring up the search dialog - Ctrl-F
For USA again us the following search string:
11,11\r\n11,11
\r\n is the Windows end of line markers
On the search dialog check both Regular Expression and Matches New Line



Either 8 or 9 lines below this match is a string of 16 numbers.
4,0,1,0,0,0,0,0,2,0,0,1,0,0,0,0
This is your gearing even though there are only 12 gearing groups.
The format from left is:
Infantry
Cavalry
Armor
Artillery
Supply
Ship
Submarine
?
Air
?
?
Pilot
Factory
Fort
Offensive
?


Image
Attachments
Gearing_Search.jpg
Gearing_Search.jpg (88.69 KiB) Viewed 765 times
A man can never have too much red wine, too many books, or too much ammunition.
User avatar
rkr1958
Posts: 30001
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

never mind ... thought I'd figured something out but haven't ran it through all the way. [:(]
Ronnie
User avatar
rkr1958
Posts: 30001
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

ORIGINAL: Divadov

I have found how to change the turn that reinforcements arrives to resolve the bug that you can't put it in a full city.

III SS Arm,178,22,1944
0
100,2275,,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[4] > [0 to 5] 0=Jan/Feb 1=Mar/Apr...
Historical text
22811,22806,0,2931,1023,65535,0,30764,0,0,12,0,224,0,0,0
Thanks again for this. Question for ships, transports and amphs with two build cycles. Do you know where the indicator is for the first or second build cycle is?
Ronnie
markb50k
Posts: 1224
Joined: Thu Jul 01, 2004 1:26 pm
Location: Spring, TX

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

Post by markb50k »

It’s on the last line for ships. Just do a new Global War scenario and compare ships like the Saratoga and Bismarck to see how they differ
markb50k
Posts: 1224
Joined: Thu Jul 01, 2004 1:26 pm
Location: Spring, TX

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

Post by markb50k »

ORIGINAL: rkr1958

ORIGINAL: Divadov

I have found how to change the turn that reinforcements arrives to resolve the bug that you can't put it in a full city.

III SS Arm,178,22,1944
0
100,2275,,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[4] > [0 to 5] 0=Jan/Feb 1=Mar/Apr...
Historical text
22811,22806,0,2931,1023,65535,0,30764,0,0,12,0,224,0,0,0
Thanks again for this. Question for ships, transports and amphs with two build cycles. Do you know where the indicator is for the first or second build cycle is?

Oh and to change where on the production cycle the ship is you do have to change that last digit on that line like Divadov says but you also may need to change the 12 in that example he shows. That represents the year from 1932. So For example on stuff that shows up on Nov/Dec 1939 you’d see a 5 on the Last slot on 2nd line, and a 7 in the slot bolded above
User avatar
rkr1958
Posts: 30001
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

ORIGINAL: markb50k

It’s on the last line for ships. Just do a new Global War scenario and compare ships like the Saratoga and Bismarck to see how they differ
Ok, I give. I flunked the test. [:(]

Below is the last record (fields 1-7) for a number of ships in their 1st cycle, 2nd cycle and for the Saratoga in the repair pool. I just don't see a pattern that tells me the difference between the three (i.e., 1st vs 2nd vs repair).

Well, unless it's in column 3? 4000's indicate 1st cycle, < 1000 2nd cycle and 8000's repair? Is that it?

By the way, are you a teacher/professor? Force you students to figure out the answer instead of giving it to them? [:D]

Image
Attachments
cycle.jpg
cycle.jpg (82.05 KiB) Viewed 762 times
Ronnie
markb50k
Posts: 1224
Joined: Thu Jul 01, 2004 1:26 pm
Location: Spring, TX

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

Post by markb50k »

Lol sorry. I normally read the boards on my phone and usually when I’m about to go to bed. So I can’t give specific answers since I don’t have the game or save files readily available at the time.

I’ll look on my laptop tomorrow and tell you where it’s at.
markb50k
Posts: 1224
Joined: Thu Jul 01, 2004 1:26 pm
Location: Spring, TX

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

Post by markb50k »

Oh and FYI repair pool isn’t on that line. By and large the pool of a unit whether that’s Force pool, future force pool, repair pool, construction pool etc are represented in two ways

For ships on the second line there’s a bunch of zeroes. The position of the -1 in that line represents the pool. In Addition the 7th number on the 4th line shows that as well. For units in non map pools you’ll see multiples of 2048 in that slot.
markb50k
Posts: 1224
Joined: Thu Jul 01, 2004 1:26 pm
Location: Spring, TX

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

Post by markb50k »

Here's what I've figured out. Using process of elimination I figured out the 1st cycle (face down) indicator

On the sixth line of a ship entry, looks like this

45312,1360,0,1024,0,0,0

1st number is sum of:
(2ND CYCLE COST) * 8192
(RANGE) * 512
(MOVEMENT) * 32

2nd number is sum of:
(BOMBARDMENT) * 4096
(AA) * 256
(ATK) * 1
(AIR FACTORS) * 4096
(DEFENSE) * 16
(notice both Bombardment and Air Factors use the same mechanic, normally this is bad since the game couldn't discern which is which, but since a ship can't have both, the game knows based on the unit type)

3rd number is sum of:
(BUILD TIME OVERRIDE?) * 2048 (boolean, either yes 2048 or no 0)
(In 1st Cycle of production?) * 4096 (boolean 4098 or 0) (this means face down)
There is something else included in this number, and I am not positive, but evidence says it represents something about the date it is sunk
Here's my guess based on the data, about 99% sure
(SUNK HISTORICALLY?) * 1 (not if its sunk in your game, just the historical data) (boolean yes 1 or no 0)
(day of month sunk) * 32
(month of year sunk) * 2
(damaged currently?) * 8192 (just figured this one out, see below)

4th number is sum of:
(BUILD TIME) * 256
(Year of sinking) * 2048 (the question is from what year to start with, the math says 1922, no clue why)

The date sunk stuff I just figured out but the math works

The only thing that isn't fully explained here is the 8192 for the Saratoga in the 3rd slot. I THINK that may mean either:
- is currently in Repair Pool
or
- start scenario in Repair Pool

The reason why there's a question here is that repair pool, like i mentioned is determined by other numbers

Saratoga,11,39,1920
0,2464,,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0
(HISTORICAL DESCRIPTION)
1423,1447,0,4048,17407,65535,14336,0,0,0,0,0,0,0,0,5725
-1,UndoData
35008,17234,8192,1536,0,0,0

Repair pool is the "7th pool" and so the -1 is the 7th slot of the zeros on line 2 (you dont count the first 0 in the 4th slot, i think thats for AT SEA indicator) and the slot on 4th line is 7 * 2048

So its Possible the 8192 ALSO means repair pool but i dont have enough data to confirm. BB Maryland and BB California also have the 8192 so it must have something to do with being in repair pool, but to prove it you need to put a ship in the repair pool during normal game play and see if the 8192 shows up in that slot. if it doesn't then 8192 must mean "Starts the scenario in repair pool"

UPDATE: Or, and this just occurred to me, it may just mean damaged. Yeah, thats probably it.

Anyway hope this helps

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

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

Post by rkr1958 »

ORIGINAL: markb50k
In Addition the 7th number on the 4th line shows that as well. For units in non map pools you’ll see multiples of 2048 in that slot.
Thanks! By the way, I think I finally figured out that this [7th number] is the key to determining whether or not the encoded target hex, which is just after this number, is wrapped. Let me explain.

I've named this record the USR=unit status record. For land units this is record #5 in its game file sequence. So for this unit, which is the UK 2nd Inf division, it's encoded hex is stored in USR[8]=10933. For the sake of those who don't remember the encoded hex is given by the formulas,

USR[8] = 512*row + column, for row < 128
USR[8] = 512*row + column - 128*512, for row >= 128

However, one could edit the file and move a unit to row=149, column=181 by setting USR[8]=149*512 + 181 = 76469 without worrying about the wrapping. However, once the game is loaded (and saved again) MWiF will dutifully set USR[8]=10933 while the unit remains in row 149, column 181.

So let's look at the converse of this. Suppose we pull this (wrapped) encoded hex coordinate for this unit out of the game file and convert it using the formulas,

row = floor(USR[8]/512) = floor(10933/512) = 21,
column = USR[8] - 512*row = 181.

The question is how would we know to unwrap the row, i.e., row = 21 + 128 = 149. The answer is in the field just before USR[8]. That is, it's in USR[7]. If USR[7] is odd then you need to wrap the row. So the formulas for converting an encoded hex coordinate to a row, column are:

row = floor(USR[8]/512) = floor(10933/512) = 21,
column = USR[8] - 512*row = 181,
if USR[7] is odd, row = row + 128.

Note that you only unwrap the row (if applicable) after you calculate column.


Record 1: 2nd Inf Div,76,0,1936
Record 2: -1
Record 3: 96,1756,,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Record 4: [historical text]
Record 5: 9815,9728,0,2412,5119,60398,1,10933,0,0,0,0,224,0,52099,16384
Record 6: -1,UndoData
Record 7: 0,65
Ronnie
User avatar
rkr1958
Posts: 30001
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

ORIGINAL: markb50k
Here's what I've figured out. Using process of elimination I figured out the 1st cycle (face down) indicator

...

Anyway hope this helps
THANKS! Extremely impressive how you've figure all this out and EXTREMELY helpful!

[&o]
Ronnie
markb50k
Posts: 1224
Joined: Thu Jul 01, 2004 1:26 pm
Location: Spring, TX

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

Post by markb50k »

Actually, those two fields act very close to what you are saying. I actually posted this somewhere else a while ago I think.


Essentially, the 7th element in that row has a 1 added to it if the hex its in is in the Southern half of the map, or >= row 128.

The 8th field (and i believe all fields) have a max value of 65536 which is a common limit in programming for hexadecimal kinds of values. So to get around that, Steve just broke up the map into 128 rows for group 1 (index 0) and the rest in group 2 (index 1).

Just like you said,
1st group of hexes: USR[8] = 512*row + column, for row < 128
2nd (southern) group of hexes: USR[8] = 512*row + column - 128*512, for row >= 128

but for the 2nd group you had to remove the 128*512 so how do you keep track of that, well, by putting the 1 in the 7th slot.

You'll notice that all other things that get put into that 7th slot are even. So the 1 is available to designate 2nd group of hexes:

Sea Zone Id * 2
Sea Box * 256
pool * 2048
(second set of hexes ?) * 1 (boolean)
User avatar
rkr1958
Posts: 30001
Joined: Thu May 21, 2009 10:23 am

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

Post by rkr1958 »

ORIGINAL: markb50k
So its Possible the 8192 ALSO means repair pool but i dont have enough data to confirm. BB Maryland and BB California also have the 8192 so it must have something to do with being in repair pool, but to prove it you need to put a ship in the repair pool during normal game play and see if the 8192 shows up in that slot. if it doesn't then 8192 must mean "Starts the scenario in repair pool"

UPDATE: Or, and this just occurred to me, it may just mean damaged. Yeah, thats probably it.
Here's a the Mar/Apr 1941 repair pool for I game I'm playing (when I'm not coding all this.)

I've include a (work in progress) snipped of a counter summary report produced by my editor and imported into excel. The "Pool_Wrap" column (in yellow) is the 7th field of the 4th ship record (i.e., USR[7]) and they "Cycle" column (in orange) is the 3rd field in the last line for ships (i.e., LL[3]).

I think you're right on the money with all this. Thanks again for your help. [:)]

Image
Attachments
repair_pool.jpg
repair_pool.jpg (378.77 KiB) Viewed 762 times
Ronnie
Post Reply

Return to “Mods and Scenarios”