Difference between revisions of "Map Editor"

From FA Forever Wiki
Jump to: navigation, search
(another part)
Line 131: Line 131:
  
 
== Making it playable ==
 
== Making it playable ==
 +
 +
Once you have your map set out properly it's always a good idea to try it out and check that the scale is right. To start up a game you need to do the following (assuming you already have the tool window open):
 +
 +
=== Create start markers ===
 +
[[File:Editor marker.jpg|right]]
 +
First we create two markers which serve as the starting points where the ACU's will gate in.
 +
# Open to the Markers Layer (or just press F6)
 +
# Create two blank markers by dragging the "blank marker" icon out onto your map (they should appear in the markers tool window as "Blank Marker 00" and "Blank Marker 01")
 +
# Rename "Blank Marker 00" to "ARMY_1" and "Blank Marker 01" to "ARMY_2" (by clicking on them twice slowly)
 +
* If you double click marker editor will zoom in to this marker, so you can see which one you are renaming. This is important while making team game map to make sure Even vs Odd Auto-teams will work correctly.
 +
 +
=== Create armies ===
 +
[[File:Games layer.png|right]]
 +
Next we create armies. Defining an army is important for the game scripts, everything a player can control belongs to a specific army. So for a 2 player map, we need 2 armies.
 +
 +
# Open the armies layer (or just press F2)
 +
# Create two armies (click the leftmost new army button)
 +
# Open the games layer (or just press F1)
 +
# Click on "add a configuration" and rename the configuration to "standard" (by clicking on it twice slowly)
 +
# Click on "add a team"
 +
# Drag the two armies ("ARMY_1" and "ARMY_2") into the teams box
 +
 +
What we want to do next is rename the team to FFA, however the editor doesn't work very well here so we have to do it manually:
 +
 +
* Save your work and close the editor
 +
* Go to your "\Supreme Commander\Map\YourMapName" folder
 +
* Open the YourMapName_scenario.lua file with a text editor
 +
* Add the new parts to this file
 +
 +
  Configurations = {
 +
      ['standard'] = {
 +
          teams = {
 +
              { name = 'New Team 1', armies = {'ARMY_2','ARMY_1',} },
 +
          },
 +
          customprops = {
 +
          },
 +
      },
 +
  }}
 +
 +
* Change the "New Team 1" bit to "FFA" so that it looks like this:
 +
 +
  Configurations = {
 +
      ['standard'] = {
 +
          teams = {
 +
              { name = 'FFA', armies = {'ARMY_2','ARMY_1',} },
 +
          },
 +
          customprops = {
 +
          },
 +
      },
 +
  }}
 +
 +
* Save the YourMapName_scenario.lua file, now the map is playable.
 +
 +
=== Adding a startup script ===
 +
We also need to add a lua script file to get the game running:
 +
* Create a file called "YourMapName_script.lua" in the same folder
 +
* Copy and paste the following in (a detailed explanation is in the scripts section)
 +
 +
  local ScenarioUtils = import('/lua/sim/ScenarioUtilities.lua')
 +
 
 +
  function OnPopulate()
 +
  ScenarioUtils.InitializeArmies()
 +
  end
 +
 
 +
  function OnStart(self)
 +
  end
 +
 +
Finished! You should now see the map in the Supreme commander maps list and you should be able to play it! Please try to do so and if you can, you can skip ahead to the next lession. If not, the following should help you out (although it's a bit extensive, so just ignore it if you can actually play the map).

Revision as of 17:10, 30 March 2015

Introduction

Editor splash.png

Welcome! This guide will take you step-by-step through the creation of a small 1v1 map entitled Summer Duel. Before you continue reading, please ensure you have all the necessary tools and everything set up: Map Editing Tools

If you’ve already taken a look at the Supreme Commander map editor, you’re probably a little confused. At first glance it doesn’t seem like there is a whole lot there. You’ve also probably noticed that there isn’t quite as much polish as Supreme Commander itself. This is because the tool was first built for internal use. Don’t let that get you down! This is the same editor that GPG uses at their studio. We are very lucky to have access to it. Everything you need to create rich maps like the ones that shipped with the game can be found in the editor, once you get used to it.

A word of caution: a good map takes many, many hours to complete. A lot more goes into maps than throwing up a heightmap and slapping down some textures. Doing those things is easy enough, but doing them in an interesting and gameplay promoting way is very difficult. If you have the patience, however, playing on a map you designed yourself can be a rewarding experience.

Create a new map

Go ahead and start the map editor. You will be greeted by a familiar splash screen. The editor integrates directly with the game engine, and it puts it to some pretty cool uses. The splash screen will disappear to a black window once loading is complete. If the window starts out maximized, double click on the top blue bar to resize it down. (When maximized, the editor simply stretches the image over the screen. This can confuse you when you try clicking around or zooming in and out, so it’s easiest to just use the default size.)

  • Size of the main window can be changed in this file: C:\Users\<USERNAME>\AppData\Local\Gas Powered Games\SupremeCommander\Editor.prefs
  • Edit height and width in Main to your values.
  • If your editor start everytime maximized, change maximized value from true to false
   Windows = {
       Main = {
           y = 5,
           x = 10,
           height = 800,
           maximized = false,
           width = 600

Under the File menu, select New map icon.PNG New. A dialog box will appear.

New map.png

The options are mostly self-explanatory, but just to be clear:

Map sizes
km Game Units
5x5 256x256
10x10 512x512
20x20 1024x1024
40x40 2048x2048
80x80 4096x4096
  • Name: The name of your map. The directory your map is saved to will be the same as this.
  • Description: A short description of your map. This is the same description you see when browsing the maps before hosting a game.
    • Both Name and Description can be changed later in Edit - Scenario... or in MAPNAME_scenario.lua file located in your map folder.
  • Use existing map: You can create a new map based off of another map. For instance, if you wanted to modify Sentry Point to remove the civilians, you could fill in the Map File field with the path to Sentry Point. This is effectively the same as opening a map and saving it with a different name.
  • Create new map: Starts a new, completely blank map. Selecting this will allow you to check and uncheck the Water field.
  • Width/Height: Size of the map in game units. A 5x5 km map is 256x256 game units wide.
    • You don't need to make square maps. Either select different Width/Height here, or later you can set playable area so map is cut.(Example Winter Duel)
  • Initial Elev.: How high the default terrain is. A good number is usually 64. Very low or very high initial elevations may cause problems later on when you are editing your heightmap.
  • Water: Enables or disables water.
  • Water Elev./Deep Elev./Abyss Elev.: The threshold values for rendering water. If the heightmap is below these values, the appropriate type of water will be rendered. It is important to keep these in mind if you are designing a map with water. (These values can be changed later in Water Layer - Properties icon.PNG Edit Water Properties)

Name your map whatever you would like. This guide will refer to it as Summer Duel, since we’re going to make a map similar to Winter Duel. You can leave the Description field blank if you’d like. Check the Create new map box. If you want to use water, keep the Water box checked; otherwise, uncheck it. Keep the map size at 256x256 and the initial elevation at 64. Click the Create button.

Coordinates editor.PNG

A new map will be created and displayed. Click the save button on the toolbar or go to File > Save. Saving your work is never a bad thing. You should do it as often as possible. The map editor is stable, but there are certain elements beyond your control. The last thing you want is for your power to flicker and erase three hours of hard work! Take a moment and get accustomed to the feel of the editor. Zooming works the same as in Supreme Commander. You can scroll with Middle Mouse Click + Drag and rotate with Alt + Middle Mouse Click + Drag. The current world coordinates of the mouse cursor are displayed in the lower right of the window.

Working Map Preview

Map Vault automatically generates preview images for you, if you wish to have a working preview, there are two key things you must do.

  • Do NOT host your map online, under the name you will upload it with, without it being in the vault (this will cause everyone online to generate a non working preview and hence when the map is uploaded to the vault, they will have no preview image for that map when it is hosted).
  • Delete any preview images in the folder before uploading. (this will ensure the preview is accurate and not of a previous version of the map).
  • Make sure that your map file names (before the extensions) are the same as the folder name or the vault will just say "no valid map datas" or something similar when you try to upload it.

Heightmap editing

Go to the View menu and ensure that Layers and Tool are checked. If not, check them now. Select the Elevation layer at the bottom of the Layers window:

Layers window.png

The Tool window should change if Elevation was not previously selected. It should look like this:

Elevation window.png

At the top is choice of all available terrain brushes. The terrain will be raised up or down in the same shape as the brush. Blue means the terrain will be raised, red means the terrain will be lowered. The other options are:

  • Strength: How much your brush changes at a time.
  • Size: How large the brush is in world units.
  • Maximum: The maximum height allowed by the brush. If you are raising the terrain, a plateau will form at the height you specify here. Using a brush on terrain with a higher elevation than Maximum will cause the terrain to be lowered to Maximum.
  • Minimum: The minimum height allowed by the brush. It functions the same as Maximum, except that it acts as a lower boundary.

Before you set out to shape the map, it is very helpful to have an idea of what the final map should look like. As mentioned previously, this guide will create a map similar to Winter Duel. Go ahead and open up Winter Duel through File > Open. It can be found in the SCMP_013 directory. If the editor gives you a black screen, simply restart the program. If you encounter this problem frequently, you can start multiple instances of the map editor to switch between maps. Zoom around and pan the camera to get a feel for the landscape.

You should notice that the map is slightly bowl shaped. The terrain begins level where the players start, and gradually slopes downward into a small valley below. This is the first feature we are going to replicate. Smooth slopes such as this are set up by first creating a stairstep pattern. Select the round1k brush from the Elevation Brush window. Set the Maximum field to 65 (remember: our initial elevation is 64, so this will create a step 1 unit high). Draw a line down the center of the map, slightly off to the left. Now set the Maximum field to 66 and repeat, placing a line slightly to the left of the first step. Repeat this all the way to the left edge of the map. The result should look similar to this:

Tutorial-4.jpg

How closely together you space your steps will determine how steep the slope is. The leftmost side of this image has a height of 73; the center has a height of 64. When designing the rest of the map, we need to keep in mind that the final product will be rotationally symmetrical. Although this takes some of the feel and personality away from the map, it does guarantee an even playing field, and that is an important consideration. Additionally, it will make texture and decal placement much easier, as we will see later. Since the map will be symmetrical, we only have to work on the left side of the map. Changes on smooth terrain can be tricky, so we will keep the slope as a stair-step for now. Next we will add a cliff face protruding into the middle, similar to what Winter Duel has:

Tutorial-5.jpg

As you design cliffs, you will want to make sure you are actually creating cliffs. Go to View > Debug and click Slope. (Hotkey: O) Green indicates that land is flat enough to construct buildings on. Red indicates that land is too steep for units to traverse. Colorless means that units can traverse that land, but it is too steep to build on.

What next? Maps on Winter Duel frequently break into short stalemates in the center with massive defenses on opposing cliffs. Let’s add another cliff above the first to spice things up a bit. This cliff will shadow the one we just added, such that if an opponent can gain hold of it, they will gain a tactical stronghold against the enemy’s defenses. Terrain height is an important consideration when designing cliffs. A height difference of 2 is not passable by units, but such a low cliff is difficult to work with. Cliffs should typically be at least 4 units high. After some tinkering, the result should look similar to this:

Tutorial-6.jpg

The next logical step is to do something with the lower left of the map. However, without visualizing the lower right, it’s difficult to make a good call. This is where Photoshop comes in. With the Elevation tool selected, click the property button Properties icon.PNG on the top toolbar. Next click on Export Heightmap where your brush choices used to be. Save the .raw file in your map’s directory with a distinct name.

  • Note that the editor will not prompt you if you try to overwrite an existing file.

Editing the heightmap in photoshop

Open up Photoshop (or Paint Shop Pro) and load your .raw file. Important: .raw files do not contain any sort of default header information. It is up to you to supply the image properties. In our case the dimensions are one greater than the world dimensions. If this is not Photoshop’s guess, put in 257x257 as the image size. Make sure the image is loaded as a 16-bit, single channel image. The byte order is IBM PC. The dialog box should look similar to the following:

Photoshop raw.jpg

Select the left half of the image using the marquee tool. An easy way to get exactly half is to choose Style: Fixed Size at the top toolbar. Set Height to 257 and Width to 127 or 128. With these properties set, click on the image. Click inside the selection box and drag it to the left of the image. The selection should snap to the edges. Press Ctrl + C to copy the selection, and then press Ctrl + V to paste it. Press Ctrl + A to select the entire image, and then press Ctrl + T to open up the transformation controls. At the top toolbar, set the rotation angle to 180.0° and press Enter. You should now see a rotationally symmetrical image. If the rotated image did not move over to the right, select the arrow tool and move it there manually. Go to Layer > Flatten Image, then save the image as a .raw file in your map directory. Make sure the byte order is set to IBM PC!

Before importing heightmap back to editor, save your map in case something goes wrong, maybe even make a copy of your map folder. Back in the Supreme Commander map editor, click on Import Heightmap. Load in the heightmap you just saved from Photoshop. Be careful with this feature, because it is not undoable. You should see the following:

Tutorial-8.jpg

The next step is to complete upper cliff we started. Do so on the bottom half so that it gets mirrored to the top next time we go through the Photoshop process. To get back to the brushes, click on the brush icon Brush icon.PNG at the top toolbar or press B. After that, feel free to improvise a little. Experiment with the different brushes and settings to make something interesting, and keep in mind that your map needs to be fun to play. Focus your efforts on the left hand side of the map. When you are all finished, repeat the Photoshop mirroring procedure and load the new heightmap. Hopefully it will look something like this:

Tutorial-9.jpg

Things are shaping up nicely! Now that the basic outline of the map is established, we can smooth it out a bit. With the Elevation layer selected, click the blur icon Blur icon.PNG at the top toolbar. You’ll notice a selection of four blur brushes. Blur128 and Unsharp128 are good general purpose blurring tools, while unsharp128_hard is great at getting into close areas. Select unsharp128_hard. Go through the stair-steps on the left-hand side of the map and blur them into a single smooth slope. Next, add some ramps to your cliffs by blurring the edges. Once again, repeat the Photoshop mirroring process and load the new heightmap. This is what the map looks like now:

Tutorial-10.jpg

Blur window.PNG

We’re almost there! There are two things left to fix. The first is that there is a noticeable seam down the middle of the map. This is easily fixed by with the blur tool. Whether or not you use Photoshop to make the map perfectly symmetrical again is up to you. The second problem is a trickier one. If you zoom in on one of the cliffs, you’ll notice that it doesn’t look quite right. It has a noticeably jagged edge, and triangles are either missing or protruding out into the ground below. To fix this, go to the blur tool within the Elevation layer. Select blur128 as your brush. At the bottom you’ll notice a dropdown box. Choose the Impulse option. With a size that slightly extends to either side of the cliff face, run the brush along your cliffs. You can make them look much better with a bit of massaging.

Tutorial-11.jpg

Congratulations, you’ve just completed your first heightmap! The cliffs in this case are not perfect and do show some popping. If you feel particularly ambitious, you can go through and add some small height variations to the map. Flat terrain is convenient for gameplay, but it looks rather dull and a little slope can dramatically improve the look of a map.


Making it playable

Once you have your map set out properly it's always a good idea to try it out and check that the scale is right. To start up a game you need to do the following (assuming you already have the tool window open):

Create start markers

Editor marker.jpg

First we create two markers which serve as the starting points where the ACU's will gate in.

  1. Open to the Markers Layer (or just press F6)
  2. Create two blank markers by dragging the "blank marker" icon out onto your map (they should appear in the markers tool window as "Blank Marker 00" and "Blank Marker 01")
  3. Rename "Blank Marker 00" to "ARMY_1" and "Blank Marker 01" to "ARMY_2" (by clicking on them twice slowly)
  • If you double click marker editor will zoom in to this marker, so you can see which one you are renaming. This is important while making team game map to make sure Even vs Odd Auto-teams will work correctly.

Create armies

Games layer.png

Next we create armies. Defining an army is important for the game scripts, everything a player can control belongs to a specific army. So for a 2 player map, we need 2 armies.

  1. Open the armies layer (or just press F2)
  2. Create two armies (click the leftmost new army button)
  3. Open the games layer (or just press F1)
  4. Click on "add a configuration" and rename the configuration to "standard" (by clicking on it twice slowly)
  5. Click on "add a team"
  6. Drag the two armies ("ARMY_1" and "ARMY_2") into the teams box

What we want to do next is rename the team to FFA, however the editor doesn't work very well here so we have to do it manually:

  • Save your work and close the editor
  • Go to your "\Supreme Commander\Map\YourMapName" folder
  • Open the YourMapName_scenario.lua file with a text editor
  • Add the new parts to this file
  Configurations = {
      ['standard'] = {
          teams = {
              { name = 'New Team 1', armies = {'ARMY_2','ARMY_1',} },
          },
          customprops = {
          },
      },
  }}
  • Change the "New Team 1" bit to "FFA" so that it looks like this:
  Configurations = {
      ['standard'] = {
          teams = {
              { name = 'FFA', armies = {'ARMY_2','ARMY_1',} },
          },
          customprops = {
          },
      },
  }}
  • Save the YourMapName_scenario.lua file, now the map is playable.

Adding a startup script

We also need to add a lua script file to get the game running:

  • Create a file called "YourMapName_script.lua" in the same folder
  • Copy and paste the following in (a detailed explanation is in the scripts section)
  local ScenarioUtils = import('/lua/sim/ScenarioUtilities.lua')
  
  function OnPopulate()
  	ScenarioUtils.InitializeArmies()
  end
  
  function OnStart(self)
  end

Finished! You should now see the map in the Supreme commander maps list and you should be able to play it! Please try to do so and if you can, you can skip ahead to the next lession. If not, the following should help you out (although it's a bit extensive, so just ignore it if you can actually play the map).