Building a mission editor with Visual Basic for beginners-1

Dedicated Forum for developers of programs/utilities. To announce new or updated products, to share knowledge and ideas for development.

Moderator: CrazySchmidt

Building a mission editor with Visual Basic for beginners-1

Postby CrazySchmidt on Wed Dec 15, 2004 8:53 am

Hi everyone this is the first of a on going series of threads I have decided to start that will take you through a detailed step by step approach to understanding and building a simple mission editor using Visual Basic from the ground up. For this series of tutorials I will be using Visual Basic 6 although previous versions will be similar if not exactly the same in coding expressions because we will only be using the more common Visual Basic controls. I intend to progress these tutorials on a weekly basis.

NOTE: From this point forward I will refer to "Visual Basic 6" simply as "VB".

To begin with and before we even start looking at using VB, it is important to understand the structure and format of the mission files that the IL-2 series of combat Sims use and generate.

Very wisely the 1C Maddox team have opted to use a basic text file format (the type of files you use Notepad to read) for storing/describing mission information. I say wisely because in doing so it has opened up a broad scope for third party add-on/utility developers to easily write mission generating and or editing software for the IL-2 series. So easy is it in fact, that this first lesson will show you a fast and simple method of editing existing missions without any programming experience at all!

For this exercise we will us the "P-51D_3.mis" mission that comes stock with the Ace Expansion Pack. This is the mission where you pilot a P-51D to bring down a V1 flying bomb and is a perfect mission to explain some first step concepts because of it's simplicity.

The only editing tool we are going to need for this exercise is Notepad.

Step 1) Open Notepad from the "Start"-"All Programs"-"Accessories" menu

Step 2) Once Notepad is open use the "File"-"Open" menu change the "Files of type:" from "Text Documents (*.txt)" to "All Files" and open the "P-51D_3.mis" file located in the "IL-2 Sturmovik Forgotten Battles/Missions/Single/GB/P-51D" folder.

IMPORTANT: It would be wise at this stage before you go any further to back up the original mission file.
This is only necessary if you are in doubt modifying a text file through Notepad. We will restore the mission file back to it's original state at the end of the lesson.

The contents of the file should look as below:

NOTE: The file contents in Notepad will show text that is not bracketed as being indented. This is as it should be what you see below has all text hard left justified.

Please read on from the bottom of the mission file->

[MAIN]
MAP NetIslands/load.ini
TIME 13.0
CloudType 2
CloudHeight 1500.0
player gb0100
army 1
plenum 0
[Wing]
gb0100
[gb0100]
Planes 1
Skill 2
Class air.P_51D
Fuel 50
weapons default
[gb0100_Way]
NORM FLY 38944.08 23473.49 1300.00 350.00
NORM FLY 38965.73 26432.67 800.00 350.00
NORM FLY 19876.62 26629.00 500.00 300.00
LANDING 15185.02 21325.08 0 0
[Stationary]
0_Static vehicles.artillery.Artillery$PzIIIN 2 38313.20 26293.02 690.00 0.0
1_Static vehicles.stationary.Stationary$VW82 2 38378.87 26472.43 690.00 0.0
2_Static vehicles.stationary.Stationary$VW82 2 38380.77 26469.47 690.00 0.0
3_Static vehicles.stationary.Stationary$OpelBlitz6700A_radio 2 38421.76 26383.48 600.00 0.0
4_Static vehicles.stationary.Stationary$OpelBlitz6700A_radio 2 38425.98 26384.75 600.00 0.0
5_Static vehicles.stationary.Stationary$OpelBlitz6700A_radio 2 38434.22 26384.12 600.00 0.0
6_Static vehicles.stationary.Stationary$OpelBlitz6700A_radio 2 38423.02 26461.23 600.00 0.0
7_Static vehicles.stationary.Stationary$OpelBlitz6700A_radio 2 38428.09 26462.08 600.00 0.0
8_Static vehicles.stationary.Stationary$OpelBlitz6700A_radio 2 38438.45 26458.06 600.00 0.0
9_Static vehicles.stationary.Stationary$Kettenkrad 2 38440.40 26372.67 660.00 0.0
10_Static vehicles.stationary.Stationary$RSO 2 38448.42 26363.28 360.00 0.0
11_Static vehicles.stationary.Stationary$OpelBlitzMaultier 2 38462.55 26354.07 360.00 0.0
12_Static vehicles.stationary.Stationary$OpelBlitzMaultier 2 38462.62 26349.99 360.00 0.0
13_Static vehicles.stationary.Stationary$Wagon1 1 38505.05 26388.95 360.00 0.0
14_Static vehicles.stationary.Stationary$Wagon1 1 38504.99 26384.66 360.00 0.0
15_Static vehicles.stationary.Stationary$Wagon1 1 38504.99 26380.37 360.00 0.0
16_Static vehicles.stationary.Stationary$Wagon1 1 38505.06 26375.95 360.00 0.0
17_Static vehicles.planes.Plane$P_51D5NT 1 14996.93 21375.03 524.10 0.0 GB
18_Static vehicles.planes.Plane$P_51D5NT 1 14990.38 21400.63 524.10 0.0 GB
19_Static vehicles.planes.Plane$P_51D5NT 1 14982.53 21426.55 524.10 0.0 GB
20_Static vehicles.planes.Plane$P_51D5NT 1 14975.27 21452.47 524.10 0.0 GB
21_Static vehicles.planes.Plane$P_51D5NT 1 13784.63 21143.34 434.10 0.0 GB
22_Static vehicles.planes.Plane$P_51D5NT 1 13807.28 21154.45 434.10 0.0 GB
23_Static vehicles.planes.Plane$P_51D5NT 1 13857.86 21163.23 434.10 0.0 GB
24_Static vehicles.planes.Plane$P_51D5NT 1 13879.29 21174.81 434.10 0.0 GB
25_Static vehicles.planes.Plane$P_51D5NT 1 13903.70 21181.76 434.10 0.0 GB
26_Static vehicles.planes.Plane$P_51D5NT 1 13930.34 21180.61 434.10 0.0 GB
27_Static vehicles.planes.Plane$P_51D5NT 1 13956.11 21185.24 420.00 0.0 GB
28_Static vehicles.planes.Plane$PBN1 1 17823.80 23116.04 300.00 0.0 GB
29_Static vehicles.planes.Plane$PBN1 1 17897.45 23090.65 300.00 0.0 GB
30_Static vehicles.planes.Plane$P_51C 1 14933.94 21450.82 434.10 0.0 GB
31_Static vehicles.planes.Plane$P_51C 1 14903.28 21442.15 434.10 0.0 GB
32_Static vehicles.planes.Plane$P_51C 1 14868.08 21432.41 434.10 0.0 GB
33_Static vehicles.planes.Plane$P_51C 1 14830.66 21422.40 434.10 0.0 GB
[Rocket]
0_Rocket Fie_V1_ramp 2 38430.24 26450.27 360.00 1.0 9999 20.0 947.16 27020.88
1_Rocket Fie_V1_ramp 2 38430.24 26370.09 360.00 2.0 9999 20.0 952.33 26988.22
[Buildings]
0_Bald House$IndustrialFactoryConstruction1 1 38580.55 26469.63 360.00
1_Bald House$IndustrialFactoryConstruction1 1 38580.40 26425.25 360.00
2_Bald House$IndustrialFactoryTank1 1 38369.26 26277.73 360.00
3_Bald House$IndustrialFactoryTank1 1 38395.14 26277.97 360.00
4_Bald House$IndustrialFactoryTank1 1 38421.25 26277.97 360.00
5_Bald House$IndustrialFactoryTank1 1 38447.94 26277.97 360.00
6_Bald House$IndustrialFactoryTank1 1 38370.78 26250.70 360.00
7_Bald House$IndustrialFactoryTank1 1 38396.30 26252.44 360.00
8_Bald House$IndustrialFactoryTank1 1 38422.99 26250.70 360.00
9_Bald House$IndustrialFactoryTank1 1 38447.94 26251.86 360.00
10_Bald House$IndustrialFactoryHouse1 1 38489.13 26437.51 360.00
11_Bald House$IndustrialFactoryHouse1 1 38489.13 26421.85 360.00
12_Bald House$IndustrialFactoryWarenHouse1 1 38286.65 26277.39 675.00
13_Bald House$IndustrialFactoryWarenHouse1 1 38307.54 26258.24 675.00
14_Bald House$IndustrialFactoryWarenHouse1 1 38328.42 26240.84 675.00
15_Bald House$IndustrialFactoryWarenHouse1 1 38268.67 26297.70 675.00
16_Bald House$AirdromeBarrelBlock1 1 38496.67 26275.07 675.00
17_Bald House$AirdromeBarrelBlock1 1 38510.01 26278.55 675.00
18_Bald House$AirdromeBarrelBlock1 1 38501.31 26286.09 675.00
19_Bald House$AirdromeBarrelBlock1 1 38526.84 26277.97 675.00
20_Bald House$AirdromeBarrelBlock1 1 38522.20 26290.15 675.00
21_Bald House$AirdromeBarrelBlock1 1 38515.81 26288.99 675.00
22_Bald House$AirdromeBarrelBlock1 1 38538.44 26283.77 675.00
23_Bald House$AirdromeHangarT1S1 1 38515.23 26526.86 360.00
24_Bald House$AirdromeHangarT1S1 1 38470.56 26526.86 360.00
25_Bald House$AirdromeControlTowerBig 1 38376.66 26343.86 360.00
26_Bald House$AirdromeBarrack 1 38412.00 26342.93 360.00
27_Bald House$AirdromeBarrack 1 38434.12 26342.93 360.00
28_Bald House$AirdromeControlTowerSmall 1 38376.93 26411.95 360.00
29_Bald House$AirdromeControlTowerSmall 1 38376.71 26425.13 360.00
30_Bald House$AirdromeRadar1 1 38414.68 26419.54 540.00
31_Bald House$PortBaseSegment 1 38428.09 26425.58 540.00
32_Bald House$PortBaseSegment 1 38428.05 26421.74 540.00
33_Bald House$PortBaseSegment 1 38428.10 26417.89 540.00
34_Bald House$PortBaseSegment 1 38428.10 26413.96 540.00
[Target]
3 0 1 330 501 14466 21114 3000
[StaticCamera]
38332 26466 2
38233 26321 2
38539 26297 2
38460 26405 2
38080 26497 2
38199 26686 2
38045 26144 2
38972 26716 100
[Bridge]
[House]

Continued...

For the rest of the tutorial we will only concern ourselves with the following portion the above file and in particular the portions marked in bold:

[MAIN]
MAP NetIslands/load.ini
TIME 13.0
CloudType 2
CloudHeight 1500.0
player gb0100
army 1
plenum 0
[Wing]
gb0100
[gb0100]
Planes 1
Skill 2
Class air.P_51D
Fuel 50
weapons default
[gb0100_Way]
NORM FLY 38944.08 23473.49 1300.00 350.00
NORM FLY 38965.73 26432.67 800.00 350.00
NORM FLY 19876.62 26629.00 500.00 300.00
LANDING 15185.02 21325.08 0 0

Next start AEP and click the "Single Missions" button at the top of the screen. Then for "Air Force" select "RAF". If you have not added any additional mission folders to the game the "Mission Type" should read "P-51D" and the "Mission" list should have "P-51D-5NT N1" selected. If you haven't flown this mission before I recommend starting the mission and having a very brief fly about just to get a quick feel of the default plane and environment settings before we start the editing process.

Ok, now that you've done that lets start the editing.

Firstly, using the standard windows key strokes "Alt" + "Tab" flick back to the mission file open in Notepad.

Because being able to change aircraft type is probably the most enjoyable part of editing (for me anyway) lets start with that.

So firstly change the line of text in the file that reads:
Class air.P_51D
to read:
Class air.P_40M

Then save the file.

Now using the standard windows key strokes "Alt" + "Tab" flick back to AEP. If you haven't already done so click back to the "Mission" list window where the "P-51D-5NT N1" mission is selected.

IMPORTANT: Clicking back to this window is essential before flying the edited mission because it is at this stage that AEP instructs the mission file to reload and thus reading back in the contents of the file we have just edited.

So now try flying the mission again. Well what do you know..., you're now flying a P-40M instead of a P-51D. Ok now that I have you interested and you are starting to get an idea of how the mission file works lets play with some other mission settings.

Change the line of text in the file that reads:
TIME 13.0
to read:
TIME 5.0

and change the line of text in the file that reads:
Planes 1
to read:
Planes 4

NOTE: Do not edit the minutes settings with the time. It is more complex than it appears and we will cover this in a later lesson.

Then save the file.

This as you can imagine changes the time from 1:00pm to 5:00am and also changes the quantity of planes present in the player flight group from 1 to 4.

Ok, "Alt" + "Tab" back to AEP again and make sure you go back to the "Mission" list window where the "P-51D-5NT N1" mission is selected, then fly the mission again.

Wow... more planes and early morning environment settings, damn that was easy.

Ok, one more example for this weeks lesson and then I'll leave you to enjoy experimenting with your new found knowledge. This time we'll take a look at altitude and speed settings. These settings are not handled by separate lines this time but as separate entries on the same line.

Right then, change the line of text in the file that reads:
NORMFLY 38944.08 23473.49 1300.00 350.00
this is the first "NORMFLY" line

to read:
NORMFLY 38944.08 23473.49 2500.00 400.00

To explain, the "1300" segment refers to altitude and the "350.00" segment refers to speed. The other 2 large decimal values that follow the "NORMFLY" statement are X and Y map co-ordinates and we will not touch these at all.

So, as before "Alt + "Tab" back AEP, and make sure you go back to the "Mission" list window where the "P-51D-5NT N1" mission is selected, then fly the mission again.

Now you notice you start at a much greater altitude and at a higher speed. The speed shift may not be as noticeable as the altitude shift but if you have your speed bar visible you should see some difference.

Ok that's it for this week don't forget to set the changed values back to the original settings if you desire or perhaps you may wish to leave this file as it is for some more experimenting. Next week we will begin putting this lesson onto a VB interface (I need to assume that you will have a basic understanding of VB for this).

Finally following is a near complete list of flyable aircraft codes for the mission files for AEP. If you wish you may copy and paste or type these into the mission file as we did earlier with the P_40M code so that you may have some fun with a greater variety of planes.

Please post comments and/or questions if you wish and enjoy!

Cheers, CrazySchmidt. :)

Aircarft Code List:

BI_1
GLADIATOR1J8A
HurricaneMkIa
HurricaneMkIIb
HurricaneMkIIc
HurricaneMkIIbMod
I_153_M62
I_153P
I_16TYPE18
I_16TYPE24
I_185M71
I_185M82A
IL_2_1940Early
IL_2_1940Late
IL_2_1941Early
IL_2_1941Late
IL_2I
IL_2MEarly
IL_2MLate
IL_2T
IL_2Type3
IL_2Type3M
LAGG_3SERIES4
LAGG_3SERIES29
LAGG_3SERIES35
LAGG_3SERIES66
LAGG_3IT
LA_5
LA_5F
LA_5FN
LA_7
LA_7B20
MIG_3EARLY
MIG_3UD
MIG_3UB
MIG_3SHVAK
MIG_3AM38
MIG_3U
P_11C
P_38J
P_38L
P_39N
P_39Q1
P_39Q10
P_40E
P_40EM105
P_40M
P_47D10
P_47D22
P_47D27
P_51B
P_51C
P_51D20NA
P_51D5NT
P_63C
P_80A
SPITFIRE5B
SPITFIRE5BCLP
SPITFIRE5BLF
SPITFIRE5BLFCLP
SPITFIRE9C
SPITFIRE9CCLP
SPITFIRE9E
SPITFIRE9ECLP
SPITFIRE9EHF
TB_3_4M_17
TB_3_4M_34R
YAK_1
YAK_1B
YAK_3
YAK_3P
YAK_7A
YAK_7B
YAK_9
YAK_9B
YAK_9D
YAK_9K
YAK_9M
YAK_9T
YAK_9U
YAK_9UT
A6M2
A6M5A
CR_42
BF_109E4
BF_109E4B
BF_109E7
BF_109E7NZ
BF_109F2
BF_109F4
BF_109G2
BF_109G6
BF_109G6Late
BF_109G6AS
BF_109G10
BF_109G14
BF_109K4
BF_109Z
BF_110G2
F2A_B239
FW_190A4
FW_190A5
FW_190A6
FW_190A8
FW_190A9
FW_190D9
FW_190D9LATE
FW_190F8
G50
GO_229A1
HE_111H2
HE_111H6
HE_162A2
IAR_80
IAR_81A
IAR_81C
JU_87B2
JU_87D3
JU_87D5
JU_87G1
KI_84_IA
KI_84_IB
KI_84_IC
ME_163B1A
ME_262A1A
ME_262A1AU4
ME_262A2A
TA_152H1

[/b]
Last edited by CrazySchmidt on Wed Dec 22, 2004 7:42 am, edited 1 time in total.
User avatar
CrazySchmidt
Utilities Developer
 
Posts: 358
Joined: Wed Dec 08, 2004 1:59 am
Location: Auckland, New Zealand

Thanks CrazySchmidt!

Postby Richard on Wed Dec 15, 2004 2:41 pm

I hope this tutorial will be updated often. I am interested in creating my own mission editor, can you share more documentation on all IL2 config files? I have been working with VB for several years, just need help with specific IL2 details.
Richard
Air Cadet Level 1
 
Posts: 3
Joined: Wed Dec 15, 2004 2:22 pm
Location: Dallas, TX

Postby CrazySchmidt on Wed Dec 15, 2004 5:45 pm

Hi Richard and welcome to the developers forum.

I will progress/update the lessons on a weekly basis. The lessons will go through all the steps required for building a simple mission editor and I will endeavour to break these steps down finely enough so that all that are interested will have a good enough understanding at the end of it all to continue further development of the programme unassisted at their own pace.

But remember this forum is here for both new and experienced programmers as a source of ideas, information and help, so even after the lessons have concluded you may (and I hope you do) continue to visit this forum to gain further knowledge.

The lesson that is currently running will not look at the conf.ini file as this is not a requirement for building a simple editor programme. We may look at this as a tutorial at sometime in the future however (as the principles of editing it are the same as a mission file).

Please note that the aircraft codes listed at the bottom of the tutorial are the codes to describe each aircraft within the mission file itself and absolutely nothing to do with conf.ini file (just in case you were thinking something along those lines).

I look forward to communicating with you further in the future,

Cheers, CrazySchmidt. :)
User avatar
CrazySchmidt
Utilities Developer
 
Posts: 358
Joined: Wed Dec 08, 2004 1:59 am
Location: Auckland, New Zealand

Postby 4Shades on Thu Dec 16, 2004 10:48 am

Nice idea - the more people that learn about this the better. There are certainly some tricky bits to it, but the general structure is straightforward. Congrats on the initiative CrazySchmidt!

FYI, you can see the source code of Scorched Earth's mission analyzer and builder at http://cvs.sourceforge.net/viewcvs.py/seow/DCS/ . It is written in Visual Basic .NET.

Cheers,
4Shades
4Shades
Air Cadet Level 2
 
Posts: 13
Joined: Thu Dec 16, 2004 10:42 am

Postby CrazySchmidt on Thu Dec 16, 2004 6:43 pm

4Shades wrote:Nice idea - the more people that learn about this the better. There are certainly some tricky bits to it, but the general structure is straightforward. Congrats on the initiative CrazySchmidt!

FYI, you can see the source code of Scorched Earth's mission analyzer and builder at http://cvs.sourceforge.net/viewcvs.py/seow/DCS/ . It is written in Visual Basic .NET.

Cheers,
4Shades


Hi 4Shades,

Thanks for your comments. Please feel free to comment on the tutorial as it progresses if you so desire, as you know each individual programmer has a style and a favoured method of handling specific potions of code and I am no exception. I you (meaning any forum member) see something that could possibly be handled better please express you views, so long as it stays constructive and does move into the argumentative.

Cheers, CrazySchmidt. :)
User avatar
CrazySchmidt
Utilities Developer
 
Posts: 358
Joined: Wed Dec 08, 2004 1:59 am
Location: Auckland, New Zealand

Postby keithb77 on Fri Dec 17, 2004 1:18 pm

I've posted my convert-mission-to-html program source at

http://members.lycos.co.uk/keithb77/

A bit rough and ready but includes code for reading mission files

Cheers,
Keith
keithb77
Air Cadet Level 1
 
Posts: 4
Joined: Thu Dec 16, 2004 12:47 pm
Location: UK


Return to Developers Central

Who is online

Users browsing this forum: No registered users and 1 guest

cron