Add a new map: Maps and php

From SEOW Wiki
Revision as of 03:33, 19 December 2012 by PA-Dore (talk | contribs) (→‎Edit the others php files)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Create new map folder

In Windows Explorer, go to the "\Scorched Earth\MP4public\" directory of the Scorched Earth installation

  • Here you will see all the directories for the SE Map sectors currently supported.

Create a new directory with the name of the new map sector you wish to add.

  • If possible and for simpler integration in the PHP files later on, use a single name with no spaces.

Now, which current Scorched Earth map do you think is most similar to the one you wish to add? In this I mean; the size of the map, the number of districts and the amount of cities & airbases in the drop down lists etc. that you think will be similar to your new map. If its a large and complex map you will find a lot of files in the directory eg. Moscow, GulfOfFinland.

Use that map folder as an example of what you will be creating.

  • When having a look at the files be careful that you don't make any changes otherwise that map may not work properly or at all!

Copy PHP files from another map folder

The fundamental files you will need to create in your new map folder are: (just copy these from another map folder and edit the names)

default.php

"NewMap"-intel.php (this PHP file controls the sector, district and city drop down lists and the links on the main map image)

"NewMap"-sector.php

"NewMap"-districts.php

"NewMapCity".php


Note that the sector, district and city php files are the same internally but are just edited to suit. I'll explain further below.

Note that some of the PHP files have a jpg image file that go with them. Have a good look at your reference map folder and see how this has been done.

Before we edit the content of the PHP files to suit the new map lets get some images to go with them.

Image Capture

Please allow me to assume you have a good understanding of the FMB and a good quality graphics application. Otherwise this would be a very long process to descibe.

I'll use the the Imphal map as an example. In game and the FMB this is the Burma map. It was named "Imphal" in SE as this map mostly deals with the Battle of Imphal in March 1944.

To create good resolution images ensure the graphic settings in game are at least 1024x768 x32bit in resolution. I used 1152x864 x32 when capturing the images for Imphal.

The intel page

How to get a quality map without texts:

This could be useful for the intel image: Use a map without texts and replace with your own texts.

  • With modded maps, use ed_m01.tga in the maps folder.

- In Il2 main folder, look for fb_maps??.SFS of the map. Open it with sfs.exe extractor and "extract all" in a folder.

- Look for the ed_m01.tga file: generally, it's one of the max size file, rename it ed_m01.tga.

- Now you can edit it and use it for SEOW graphics.

  • Choose what sectors you will capture. It would be nice to have 2 different sizes for each sector, one normal size for low and medium definition size monitors (e.g. 1250 x 1000) and another large one for wide resolution size monitors (e.g. 2500 x 2000).
  • Use different layers for each category: map, airbases, texts... It will be easier to modify later.
  • Here is an example of the intel image for West Front 44. Note that all sectors, cities and airbases will be linked.
Error creating thumbnail: Unable to save thumbnail to destination

Sector and District Maps

First one to capture is the whole map view. This will be used to create both the districts-small and whole sector maps.

Open the Full Mission Builder (FMB) and open the map you are adding.

Ensure that the whole map is visible and take a screen capture (print screen). Make sure the grid coordinates are visible along the edges.

Put an object in 2 edges of map (top-left and bottom-right) and save as xxxsector.mis to get coordinates of image in FMB.

Note that it is useful enable the SNAP function when you want to locate the object exactly on the map grid. e.g. 5000 (meters)

Open graphics program (ie PhotoShop or PaintShop etc) and open the screen capture file you just made. This will be "grab0000.tga" in your game screenshots directory.

Use the Rectangular Marqee tool to cut out the map from the overall screen grab to trim the image of the surrounding FMB sliders and frame. If the map doesn't completely fill a full grid then trim along the grid lines **only if the grid line in question is very close to the edge of map!!** This makes mapping the FMB co-ordinates to the image a lot easier.

Copy selection

Create new file

Paste

Save as Jpg file (adjust the JPEG compression to keep the file size reasonable (I use 10%), i.e. don’t make a 5 MB map image!)

Take a note of the image size in pixels. This is needed for the PHP file.

Here is Imphal_Sector.jpg as an example:


Error creating thumbnail: Unable to save thumbnail to destination


You may see that the very top of map was trimmed . This was OK to do so as the edge of actual playable map was within the viewable image. This is how it was in the FMB and the map co-ordinates for the sector map had to be adjusted to suit as seen in the file below.

Do the same for each sector, airbase and city.

Edit Sector map PHP File

Here is Imphal_Sector.php. This was copied from another map folder and then edited to suit Imphal. The highlighted text is what you need to edit to suit the new map.


Error creating thumbnail: Unable to save thumbnail to destination


As you can see there is not a lot that you need to change.

All your doing is editing the names, the image size in pixels and the FMB co-ordinates that the image shows. The above PHP is an example for all the district and city php files as well!

Its the same file with appropriate changes made for each district. Look at another map folder and you will see how they are all the same bar the changes as made above.

  • The critical and probably most time consuming aspect of this process is getting the FMB map co-ordinates correct for your image file. You can't do that with any accuracy unless you have an operational Scorched Earth system to test it in. Enable the "ShowRoads" and railways section above when tweaking the Latitude and Longitude co-ordinates once the map is basically functional. This ensures you will be able line everything up nicely on top of your image.

Edit the "intel.php" file

This file brings all the php's and Jpeg's together.

Again, the highlighted text is what is edited to suit. At this point I like to think that you are getting an understanding of what the different lines in the file are actually doing.



Error creating thumbnail: Unable to save thumbnail to destination

Edit the others php files

There are 3 files that need to be edited, MP-Admin.php, MP-Connection.php and default-green.php. I have added a Ukraine sector to my SE setup for a new sector that I am working on. Let's look at each one;

FIRST: backup these 3 files

MP-Admin.php

Towards the top of this file look for these lines, insert your sector in the appropriate place, mine is Ukraine so goes at the end of the list;


Error creating thumbnail: Unable to save thumbnail to destination

MP-Connection.php

The connection data is in alphabetic order so navigate down the list to where your sector should fit and insert - Ukraine goes at the bottom;


Error creating thumbnail: Unable to save thumbnail to destination

default-green.php - default-sepia.php - default-iron.php

There are 2 areas in this file, the first area defines the Sectorlink, it's in alphabetical order so navigate down to where your should fit in and insert. Then determine which region you are going to put your sector, in my case I've put Ukraine in the Eastern Europe region, navigate to where you want to insert your sector eg in my case immediately after Tunis and insert there.


Error creating thumbnail: Unable to save thumbnail to destination

End of work: check all sectors

For all sectors, airbases and cities php files, change the lines:

$ShowRoads=false; to $ShowRoads=true;

$ShowRailways=false; to $ShowRailways=true;

Then, check in the MP for each view that roads and railways are at the right place. If not, modify the lines:

$mincX=xxx; //Min longitude of image in FB coords

$maxcX=yyy; //Max longitude of image in FB coords

and/or

$mincY=xxx; //Max latitude of image in FB coords

$maxcY=yyy; //Min latitude of image in FB coords