Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Utilities, Controllers & Bots, Oh My!

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> World in Flames >> Mods and Scenarios >> Utilities, Controllers & Bots, Oh My! Page: [1]
Login
Message << Older Topic   Newer Topic >>
Utilities, Controllers & Bots, Oh My! - 7/23/2020 1:42:39 AM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
...




Attachment (1)

< Message edited by rkr1958 -- 7/24/2020 10:21:01 PM >


_____________________________

Ronnie
Post #: 1
RE: Utilities, Controllers & Bots, Oh My! - 7/23/2020 1:57:51 AM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
I've been busy lately putting the game file editing concepts captured in https://www.matrixgames.com/forums/tm.asp?m=4136832 into code. Python code.

I've successfully built an initial (rudimentary) controller that can "safely" read-in, edit and save a MWiF game file. Examples of which I'll post later.

I also have plans to build several bots to automatically handle certain functions (e.g., allied ASW) based on pre-defined algorithms and rule sets. I hope to one day to even build AI modules to learn for an opponent, or opponents, and better execute these bots.

What you may ask do I mean by utilities, controllers, bots and AIs? Very good question and one which I plan to give you my thoughts on later.

I'm a bit tired right now and have some work to do to pull all this together for posting. So as a bit of a tease I'll leave it here for tonight with the promise of more posts with these details ... hopefully tomorrow.



Now it's bedtime ...

_____________________________

Ronnie

(in reply to rkr1958)
Post #: 2
RE: Utilities, Controllers & Bots, Oh My! - 7/23/2020 2:01:07 AM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
By the way, I wish to thank markb50k whose work on his World War III VERSION 2 mod has inspired me to move forward with putting game file editing concepts to code.

Thanks ...

_____________________________

Ronnie

(in reply to rkr1958)
Post #: 3
RE: Utilities, Controllers & Bots, Oh My! - 7/23/2020 8:23:59 PM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
Before I go into specifics I wanted to layout my (initial) concept for a MWiF game file editing tool suite. My vision to say the least is grandiose and will require community participation to produce anything comprehensive in a reasonable period of time. If left to my own devices, my vision would take multiple decades to achieve.

At the core of my concept is the modification of MWiF game file(s) to achieve various goals, where modified game files remain compatible (i.e., work with) the MWiF game engine.

Though I've initially begun this in python, my vision is one that could/would incorporate computer executables and scripts from multiple languages and developers. However, one important constraint to this, for me at least, is that the end users (i.e., MWiF players) are not required to purchase anything beyond a license for MWiF to use the game file editing suite.

Utilities: This contains the functions, subroutines, methods and data to perform basic operations on the game file. For example, (1) open and save, (2) log changes, (3) flip/unflip units, (4) move counters, (5) change hex control, (6) change version, (7) keep ships/CPs at sea during RTB, (8) toggle "certain" optional rules, ... , (9999) etc.

Controllers: These allow the players to interface with the game file to either perform basic editing functions, run unit tests, integrate files from multiple (2-6) players, execute Bots and AIs to name just a few. Note that my vision includes two concepts for multi-player play. The traditional where up to 6 players play with each in command of a MP. The other is where players are given theater command that include two or more MPs.

Bots: These guys using deterministic rule sets and algorithms are designed to accomplish specific in-game missions/operations/functions. For example, (1) send out ASW escorts & patrols, (2) build convoy lines, (3) move a unit from point A to B changing hex control as applicable, (4) generate pre and post battle reports, (5) analyze various land, air and naval combat situations, ... , (9999) etc.

AIs: Like the Bots these guys are also designed to accomplish specific in-game missions/operations/function, but unlike the Bots learn to do it better over time.




Attachment (1)

_____________________________

Ronnie

(in reply to rkr1958)
Post #: 4
RE: Utilities, Controllers & Bots, Oh My! - 7/23/2020 8:27:07 PM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
I would also like to add that my concept for Bots include the functionality to implemented uncoded version 7 (FE) optional rules, version 8 (CE) rules, half-map scenarios and other scenario variants.

Should have all that done by tomorrow.

_____________________________

Ronnie

(in reply to rkr1958)
Post #: 5
RE: Utilities, Controllers & Bots, Oh My! - 7/24/2020 4:17:01 PM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
Ok, it's time for me to put some meat on the bones instead of just showing you pretty pictures. Technically I've only shown you one pretty picture so far. Well, I hope you think it was a pretty picture.

I've got a good start on putting many of the "manual" game file editing (gfe) techniques into python. I'm using object oriented programming to do this.




Attachment (1)

_____________________________

Ronnie

(in reply to rkr1958)
Post #: 6
RE: Utilities, Controllers & Bots, Oh My! - 7/24/2020 4:23:12 PM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
The first controller I've built (or am building), also using object oriented programming, is a unit test controller for the first MWIF utilities class (MWIF_Utilities_01.py) that's under development. To date, I've successfully executed 4 units, which I go into more detail and which will show the automated game file editing power of all this.

The second controller which I will soon begin will be a game file editor.




Attachment (1)

_____________________________

Ronnie

(in reply to rkr1958)
Post #: 7
RE: Utilities, Controllers & Bots, Oh My! - 7/24/2020 4:37:16 PM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
To date I've executed four unit tests on the MWIF_Utilities_01.py class. The beauty, or power, of using a controller to run these tests is that I can re-run past in addition to new unit tests on this class as it develops. Re-running past and comparing to previous units test runs will help minimize breakage as this class evolves (i.e., code additions and changes are made).

Below is the log file from the last executing of the unit test controller. I will in the following posts cover in more detail each of these unit tests.

UT.log
======================================================================================================
Unit Test: UT_001
date and time (start): 07/22/2020, 19:55:28
Read in game file: C:\Users\rkrun_000\Documents\Python\MWIF\game_files\UT.GAM
Wrote out game file: C:\Users\rkrun_000\Documents\Python\MWIF\game_files\UT_001.GAM
date and time (finished): 07/22/2020, 19:55:28
======================================================================================================
======================================================================================================
Unit Test: UT_002
date and time (start): 07/22/2020, 19:55:28
Read in game file: C:\Users\rkrun_000\Documents\Python\MWIF\game_files\UT.GAM
Changed verison from 3.1.0.7 to 3.1.0.5
Wrote out game file: C:\Users\rkrun_000\Documents\Python\MWIF\game_files\UT_002.GAM
date and time (finished): 07/22/2020, 19:55:28
======================================================================================================
======================================================================================================
Unit Test: UT_003
date and time (start): 07/22/2020, 19:55:28
Read in game file: C:\Users\rkrun_000\Documents\Python\MWIF\game_files\UT.GAM

move_counters. Success. Found unit.
mc[country,type,year,id key,id,status,x,y]=
Ita,Inf HQ,1934,0,Badoglio,0,60,
successfully moved counter from x,y= 60,42 to x,y= 61,52.
changed counter status to flipped and out-of-supply.

move_counters. Success. Found unit.
mc[country,type,year,id key,id,status,x,y]=
Italian,light aa,1939,0,20mm,0,60,
successfully moved counter from x,y= 60,42 to x,y= 61,52.

move_counters. ERROR. Unable to move and/or change counter status.
mc[country,type,year,id key,id,status,x,y]=
Italian,small aa,1939,0,20mm,0,60,

move_counters. ERROR. Unable to move and/or change counter status.
mc[country,type,year,id key,id,status,x,y]=
German,light aa,1939,0,20mm,0,60,

move_counters. Success. Found unit.
mc[country,type,year,id key,id,status,x,y]=
German,MIL,1936,0,LEIPZIG,99,56,
successfully moved counter from x,y= 56,27 to x,y= 61,52.
changed counter status to flipped and in-supply.

move_counters. Success. Found unit.
mc[country,type,year,id key,id,status,x,y]=
UK,CVL,1913,0,eagle,99,46,
successfully moved counter from x,y= 46,26 to x,y= 38,22.

move_counters. Success. Found unit.
mc[country,type,year,id key,id,status,x,y]=
NED,Convoy,1936,2,1,99,102,
successfully moved counter from x,y= 102,0 to x,y= 44,30.

move_counters. Success. Found unit.
mc[country,type,year,id key,id,status,x,y]=
Commonwealth,Oil,1936,2,2,99,47,
successfully moved counter from x,y= 47,26 to x,y= 42,26.

move_counters. Success. Found unit.
mc[country,type,year,id key,id,status,x,y]=
German,u-boat,1939,1,4838,10,39,
successfully moved counter from x,y= 39,22 to x,y= 45,34.
changed counter status to organized and in-supply.
Wrote out game file: C:\Users\rkrun_000\Documents\Python\MWIF\game_files\UT_003.GAM
date and time (finished): 07/22/2020, 19:55:28
======================================================================================================
======================================================================================================
Unit Test: UT_004
date and time (start): 07/22/2020, 19:55:28
Read in game file: C:\Users\rkrun_000\Documents\Python\MWIF\game_files\UT.GAM
change_hex_control. following hexes changed to germany control (cid= 79):
change_hex_control. ERROR. invalid coordinate pair. x,y= 5000,45.
change_hex_control. ERROR. invalid coordinate pair. x,y= 0,-1.
[60,40],[60,41],[61,40],[61,41],[61,42],[62,42],[62,41],
change_hex_control. following hexes changed to japanese control (cid= 49):
[81,140],[84,140],[89,141],
change_hex_control. ERROR. invalid country input
following hc line not processed. Note. hc[0]=invalid country input.
bad_country_input,0,0,0,0,
Wrote out game file: C:\Users\rkrun_000\Documents\Python\MWIF\game_files\UT_004.GAM
date and time (finished): 07/22/2020, 19:55:28
======================================================================================================

_____________________________

Ronnie

(in reply to rkr1958)
Post #: 8
RE: Utilities, Controllers & Bots, Oh My! - 7/24/2020 4:46:05 PM   
Courtenay


Posts: 3816
Joined: 11/12/2008
Status: offline
Were you expecting the two ERRORs in your log file? Or should those have worked?

_____________________________

I thought I knew how to play this game....

(in reply to rkr1958)
Post #: 9
RE: Utilities, Controllers & Bots, Oh My! - 7/24/2020 4:57:02 PM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline

quote:

ORIGINAL: Courtenay

Were you expecting the two ERRORs in your log file? Or should those have worked?
I'll cover that in more detail, but they were intentional. I like to also test my error handling logic. Well at least the errors that I'm trying to handle.


_____________________________

Ronnie

(in reply to Courtenay)
Post #: 10
RE: Utilities, Controllers & Bots, Oh My! - 7/24/2020 5:13:26 PM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
The game file that I'm starting with, "UT.GAM", is a copy of my solo game that I'm currently playing. This will serve as my "original" game file and against which I will compare the computer generated edited files.

Note that I'm currently running the public beta MWiF version 3.1.0.7





Attachment (1)

< Message edited by rkr1958 -- 7/24/2020 5:24:42 PM >


_____________________________

Ronnie

(in reply to rkr1958)
Post #: 11
RE: Utilities, Controllers & Bots, Oh My! - 7/24/2020 5:26:38 PM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
All this functionality is worthless unless the edited file produced is compatible with the MWiF game engine. So the first unit test that I ran was to confirm that I could read-in (UT.GAM) and save (UT_001.GAM) a game file.




Attachment (1)

< Message edited by rkr1958 -- 7/24/2020 5:27:16 PM >


_____________________________

Ronnie

(in reply to rkr1958)
Post #: 12
RE: Utilities, Controllers & Bots, Oh My! - 7/24/2020 5:30:47 PM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
My second unit test was to confirm that I could change game file versions. This is important if one wants to revert to an earlier version of MWiF due to a the introduction of a bug in the MWiF game engine or to stay compatible with a player using an earlier version of MWiF.




Attachment (1)

_____________________________

Ronnie

(in reply to rkr1958)
Post #: 13
RE: Utilities, Controllers & Bots, Oh My! - 7/24/2020 8:40:02 PM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
Unit Test 3. Move & Change Status of Units (1/2).





Attachment (1)

< Message edited by rkr1958 -- 7/24/2020 8:51:46 PM >


_____________________________

Ronnie

(in reply to rkr1958)
Post #: 14
RE: Utilities, Controllers & Bots, Oh My! - 7/24/2020 8:40:29 PM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
Unit Test 3. Move & Change Status of Units (2/2).


======================================================================================================
Unit Test: UT_003
date and time (start): 07/22/2020, 19:55:28
Read in game file: C:\Users\rkrun_000\Documents\Python\MWIF\game_files\UT.GAM

move_counters. Success. Found unit.
mc[country,type,year,id key,id,status,x,y]=
Ita,Inf HQ,1934,0,Badoglio,0,60,
successfully moved counter from x,y= 60,42 to x,y= 61,52.
changed counter status to flipped and out-of-supply.

move_counters. Success. Found unit.
mc[country,type,year,id key,id,status,x,y]=
Italian,light aa,1939,0,20mm,0,60,
successfully moved counter from x,y= 60,42 to x,y= 61,52.

move_counters. ERROR. Unable to move and/or change counter status.
mc[country,type,year,id key,id,status,x,y]=
Italian,small aa,1939,0,20mm,0,60,

move_counters. ERROR. Unable to move and/or change counter status.
mc[country,type,year,id key,id,status,x,y]=
German,light aa,1939,0,20mm,0,60,

move_counters. Success. Found unit.
mc[country,type,year,id key,id,status,x,y]=
German,MIL,1936,0,LEIPZIG,99,56,
successfully moved counter from x,y= 56,27 to x,y= 61,52.
changed counter status to flipped and in-supply.

move_counters. Success. Found unit.
mc[country,type,year,id key,id,status,x,y]=
UK,CVL,1913,0,eagle,99,46,
successfully moved counter from x,y= 46,26 to x,y= 38,22.

move_counters. Success. Found unit.
mc[country,type,year,id key,id,status,x,y]=
NED,Convoy,1936,2,1,99,102,
successfully moved counter from x,y= 102,0 to x,y= 44,30.

move_counters. Success. Found unit.
mc[country,type,year,id key,id,status,x,y]=
Commonwealth,Oil,1936,2,2,99,47,
successfully moved counter from x,y= 47,26 to x,y= 42,26.

move_counters. Success. Found unit.
mc[country,type,year,id key,id,status,x,y]=
German,u-boat,1939,1,4838,10,39,
successfully moved counter from x,y= 39,22 to x,y= 45,34.
changed counter status to organized and in-supply.
Wrote out game file: C:\Users\rkrun_000\Documents\Python\MWIF\game_files\UT_003.GAM
date and time (finished): 07/22/2020, 19:55:28
======================================================================================================





Attachment (1)

< Message edited by rkr1958 -- 7/24/2020 8:46:10 PM >


_____________________________

Ronnie

(in reply to rkr1958)
Post #: 15
RE: Utilities, Controllers & Bots, Oh My! - 7/24/2020 9:19:01 PM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
Unit Test 4. Change Hex Control (1/2).




Attachment (1)

_____________________________

Ronnie

(in reply to rkr1958)
Post #: 16
RE: Utilities, Controllers & Bots, Oh My! - 7/24/2020 9:19:30 PM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
Unit Test 4. Change Hex Control (2/2).

======================================================================================================
Unit Test: UT_004
date and time (start): 07/22/2020, 19:55:28
Read in game file: C:\Users\rkrun_000\Documents\Python\MWIF\game_files\UT.GAM
change_hex_control. following hexes changed to germany control (cid= 79):
change_hex_control. ERROR. invalid coordinate pair. x,y= 5000,45.
change_hex_control. ERROR. invalid coordinate pair. x,y= 0,-1.
[60,40],[60,41],[61,40],[61,41],[61,42],[62,42],[62,41],
change_hex_control. following hexes changed to japanese control (cid= 49):
[81,140],[84,140],[89,141],
change_hex_control. ERROR. invalid country input
following hc line not processed. Note. hc[0]=invalid country input.
bad_country_input,0,0,0,0,
Wrote out game file: C:\Users\rkrun_000\Documents\Python\MWIF\game_files\UT_004.GAM
date and time (finished): 07/22/2020, 19:55:28
======================================================================================================




Attachment (1)

< Message edited by rkr1958 -- 7/24/2020 10:27:20 PM >


_____________________________

Ronnie

(in reply to rkr1958)
Post #: 17
RE: Utilities, Controllers & Bots, Oh My! - 7/24/2020 9:22:39 PM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
Alright, I think that's enough pulling together charts on this for now. It's time to do some more coding, but more importantly to do some more playing. After all, that is what all of this is about. Playing the game and having fun.

_____________________________

Ronnie

(in reply to rkr1958)
Post #: 18
RE: Utilities, Controllers & Bots, Oh My! - 7/25/2020 4:04:43 AM   
markb50k

 

Posts: 1224
Joined: 7/1/2004
From: Spring, TX
Status: offline
Me likey. Good job man :)

(in reply to rkr1958)
Post #: 19
RE: Utilities, Controllers & Bots, Oh My! - 7/25/2020 3:49:31 PM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline

quote:

ORIGINAL: markb50k

Me likey. Good job man :)
Thanks!


_____________________________

Ronnie

(in reply to markb50k)
Post #: 20
RE: Utilities, Controllers & Bots, Oh My! - 8/1/2020 4:53:11 PM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline
I've been pittling away at developing a game file editor controller. I haven't been rushing but I expect to have one with a basic (i.e., crude) interface in a couple of weeks. I'm not sure if this initial version would be classified as an advance alpha or a "premature" beta. Maybe it's a premature alpha.

If there's any interest in getting your hands on this version, I can package it in something like a windows bat (i.e., cmd) file that, when run, asks for a text file containing your editing inputs/commands.

Also, if there's any interest on getting your hands on the source code for the initial and, as applicable, following versions, I'd always be happy to share that too.

I'm using Spyder 4.1.4 (installed through Anaconda distribution) as my python development IDE and I'm running Python 3.8.3 64-bit version for Windows 10.

So, if there's any interest for either or both you can respond in this thread or PM me.

Honestly, I wouldn't mind sharing this limelight (joking of course) with one or more coders who could help take all this to something grander that I could/can achieve on my own.




Attachment (1)

_____________________________

Ronnie

(in reply to rkr1958)
Post #: 21
RE: Utilities, Controllers & Bots, Oh My! - 8/1/2020 9:45:02 PM   
AxelNL


Posts: 2374
Joined: 9/24/2011
From: The Netherlands
Status: offline
Promising work.

I can envision bots for convoy guarding, which does the cyclical guard duty in the Faroes and NA with one click. Maybe even production optimisation?

Alas - my programming days were in the 80's (Turbo Pascal and a meriad of other lanquages but not for long). So the only contribution would be defining functional specification.

hope you succeed!

(in reply to rkr1958)
Post #: 22
RE: Utilities, Controllers & Bots, Oh My! - 8/2/2020 1:13:51 AM   
rkr1958


Posts: 20412
Joined: 5/21/2009
Status: offline

quote:

ORIGINAL: AxelNL

Promising work.

I can envision bots for convoy guarding, which does the cyclical guard duty in the Faroes and NA with one click. Maybe even production optimisation?

Alas - my programming days were in the 80's (Turbo Pascal and a meriad of other lanquages but not for long). So the only contribution would be defining functional specification.

hope you succeed!
Thanks!

I cut my teeth on FORTRAN IV and BASIC in the late 70's. The BASIC I learned on had a max variable length of 2!

Worked with both BASIC and FORTRAN early in my career through the mid 90's. In my early career (80's) worked with FORTRAN on card-decks.

I eventually moved on from FORTRAN to MATLAB, java and python. Did a lot of MATLAB programming. Now I'm retired and program for fun.


_____________________________

Ronnie

(in reply to AxelNL)
Post #: 23
RE: Utilities, Controllers & Bots, Oh My! - 10/12/2020 8:49:09 PM   
TrogusP96

 

Posts: 142
Joined: 6/15/2015
Status: offline
Can any of these tools be used to change unit costs? I am thinking of the divisions in particular. Thanks. Looks ambitious.

(in reply to rkr1958)
Post #: 24
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> World in Flames >> Mods and Scenarios >> Utilities, Controllers & Bots, Oh My! Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.164