Skip to content
tacozmeister edited this page Sep 13, 2012 · 20 revisions

OpenRA comes with a easy understandable map editor. With this tool you can create or edit maps that already exist. Though there is a limit of what you can do in this program, we'll try to cover the most things in this document. Right now OpenRA does not provide graphical tools for SHP editing, however it's command line tools allow you to convert 8-bit PNGs with an indexed palette (this is important) to SHP files so you can use the image editor of your choice to do the actually editing and OpenRA's tool for conversion. You can even use scripts or interface it with source code from OpenRA.Game.exe to automatize this. There are also other tools like SHP Builder (can only view/edit, but not save in RA1/TD SHP) or XCC Utilities that have a graphical interface.

How to use OpenRA Utility?

Linux users are normally familiar with the command line ("terminal" application), so they should simply add mono or mono --debug (additional information if something goes wrong) in front of all the following commands. Another note for Linux is that the files are normally found in /usr/share/openra. cd to there instead.

Windows users should run cmd.exe. Simply double clicking OpenRA.Utility.exe will not work as it is not a GUI-capable application.

Navigate to your OpenRA directory: cd Program Files cd OpenRA Execute OpenRA.Utility.exe to see a help windows with it's syntax: OpenRA.Utility.exe


Usage: OpenRA.Utility.exe [OPTION] [ARGS]

  --settings-value KEY     Get value of KEY from settings.yaml
  --shp PNGFILE FRAMEWIDTH     Convert a single PNG with multiple frames appended after another to a SHP
  --png SHPFILE PALETTE [--noshadow]     Convert a SHP to a PNG containing all of its frames, optionally removing the shadow
  --extract MOD[,MOD]* FILES     Extract files from mod packages
  --tmp-png MOD[,MOD]* THEATER FILES      Extract terrain tiles to PNG
  --remap SRCMOD:PAL DESTMOD:PAL SRCSHP DESTSHP     Remap SHPs to another palette
  --r8 R8FILE PALETTE START END FILENAME [--noshadow] [--infrantry] [--vehicle] [--projectile] [--building] [--wall] [--tileset]     Convert Dune 2000 DATA.R8 to PNGs choosing start- and endframe as well as type for correct offset to append multiple frames to one PNG named by filename optionally removing the shadow.
  --transpose SRCSHP DESTSHP START N M [START N M ...]     Transpose the N*M block of frames starting at START.

How to convert an icon with OpenRA Utility?

The procedure not very complicated, although it has it's quirks due to the nature of the SHP format.

  1. Get the palette of the game, e.g. Red Alert: OpenRA.Utility --extract ra temperat.pal
  2. Extract the SHP file you want to edit or use as a template from the .MIX archives: OpenRA.Utility --extract ra ttnkicon.shp with ttnkicon.shp beeing the cameo for the tesla tank.
  3. Get a PNG file with the right palette settings by extracting it using the right palette setting: OpenRA.Utility --png ttnkicon.shp temperat.pal
  4. Use Photoshop, Paint.NET, GIMP (or any other program that uses the palette formats) to open the newly created ttnkicon.png and save the color table of the picture or edit the PNG file right here. If you want to start from scratch be sure convert your PNG format to 8bit/channel, using the custom palette saved before otherwise the in-game result will be pixel garbage.
  5. OpenRA.Utility --shp YourPNGfile.png 64 with 64 beeing the width of the cameo file

How to read Dune 2000 DATA.R8

This is automated in OpenRA.Mods.D2k/Widgets/Logic/D2kExtractGameFilesLogic.cs and there are graphical tools like Dune2k+ Toolkit, but I am documenting this anyway. It currently only works with the Dune 2000 1.03 *.R8 files.

  1. OpenRA.Utility.exe --r8 DATA.R8 mods/d2k/bits/d2k.pal 206 457 "rifle" --infantry will extract the rifleman. The numbers are the frame range to locate the images in the DATA.R8 (you have to adjust the path or copy it into OpenRA's main directory. It will be svfed as rifle.png and the parameter --infantry makes sure it calculates the offset values correctly (which is hardcoded into DATA.R8) and reorders the frames so that the units facing rotate counter-clockwise.
  2. OpenRA.Utility.exe --shp rifle.png 48 to convert this to rifle.shp.
  3. This will still look ugly because Dune 2000 infantry animation still differ in frame order so use OpenRA.Utility.exe --transpose rifle.shp 8 8 6 56 8 5 112 8 3 136 8 5 to fix this. Only infantry and the ornithopter require this step.

If you want to create a file for use with OpenRA tileset builder use OpenRA.Utility.exe --r8 BLOXBASE.R8 mods/d2k/bits/d2k.pal 0 799 BASE --tileset which will append all tiles in a 20x40 (with 32 pixel tile size) PNG.

How to create a new tileset using OpenRA TilesetBuilder?

OpenRA.TilesetBuilder slicing a Dune 2000 tileset This one is a user-friendly GUI tool, but it is currently not distributed with a release (issue 2316) so you have to start Compiling yourself. You need to edit defaults.yaml in the OpenRA.Tilesetbuilder folder if you don't want to edit Dune 2000 tilesets. Once done start OpenRA.TilesetBuilder.exe It will ask you for a palette (or extract it from the file itself) and a tile size. RA and CnC use 24 (default) while D2k uses 32. You can select tiles by keeping the mouse pressed and assign terrain types using the buttons on the left. Toggle the overlay in the main toolbar to see which is already marked. Click save to save a *.tsx XML file next to your .png file and export to find them in your My Documents\OpenRA\Tilesets folder together with the .yaml file required for OpenRA.

Converting a 3D infantry model to sprites

Here is the required software for this tutorial. Please note that you can use any palette aware image editor (like Photoshop) and 3D editor (like the Open Source Blender).

Open up 3DsMax.

blank scene

Create a 3D model (image shows a pikeman for a medieval mod). If you have no idea how to create a model, read a tutorial elsewhere.

pikeman

It's important to have body parts such as arms, legs and head as movable parts because they will be animated later. As you can see there is no need to create a very detailed model because they will be reduced to few pixels later anyway.

When coloring the model be sure to use

  • R: 196-150
  • G: 172-131
  • B: 98-74

as a team color (for Red Alert [Palettes and Remaps](Palettes and Remaps)). Also use a color that can be easily identified for the shadow.

Bones

Now use the Bones Tool on all relevant body parts. At least feet, upper legs, lower legs, torso (addition 2-3 bones make the model more flexible), head, upper arm, forearm and hands. Link the body parts to the bones, but don't forget accessories like hats. The weapon should consist of only one part which will be animated separately.

Now animate your character. Create a cuboid far below the figure and link it to the main bone of the figure. No you can create the different angles and have the shadow always on the correct side. Copy your animations and simply change the angle of the cuboid. Don't render the cuboid (check it's settings). It is suggested to hide everything except Bones and the cuboid.

Lightning

Use two spotlights. One should create a light shadow, the other none lighting up the figure from the other side (otherwise it might stay black). Use the sun-light option in 3DsMax.

Spotlight 1:

  • light direction: X=31.377; Y=0.0; Z=-24.935
  • light multiplicator: 0.301
  • light color: 255,255,255
  • shadow color: 99,99,99
  • shadow density: 0,0

Spotlight 1:

  • light direction: X=31.377; Y=0.0; Z=-174.868
  • light multiplicator: 0.611
  • light color: 255,255,255
  • shadow color: 0,0,0
  • shadow density: 0,76

Because sun light is simulated the spreading and length is not important.

Cameras

To get the object in the correct size adjust the camera distance. Only the angle is important (~63°). Use the photo finish camera with aim set to 0,0,0 and object center at z=0.

Sprite Renderer

50x39 is the standard infantry frame image size Westwood used in their early games. If you want to use OpenRA.Utility.exe for SHP conversion you need a single "film-strip" with all frames appended to each other, so select SpriteSheet: Image Width = Frame Width (50) * Number of Frames (124) = 6200 in this example and set Image Height to 39. You might want to experiment yourself with the settings, but be sure to turn off Anti-Aliasing otherwise the sprites will be blurred and useless.

gimp

Now open GIMP and load the image. Do some cleanup at first. Remove any help lines. To apply the RA palette go to Image-Mode-Indexed.

indexing

If you don't have it saved use OpenRA.Utility.exe (see above) to extract a SHP, convert it to PNG and extract the palette with GIMP. When applying the palette some things might go wrong. Often the team color is affected (fix it manually).

palette

To edit images in GIMP you need to go back to RGB mode. Be sure to only use the colors from the palette. Set the background to black and the shadow color to neon-green (top row in RA palette). If the shadow is gone after the palette has been indexed undo and manually colorize shadows neon-green before indexing. Index the image again with the RA palette and save it. You can now use OpenRA.Utility.exe --shp your.png 50 with 50 being the frame width.

helplines

If you want to use XCC Utilties (might get annoying) you need to do some cutting. Use the Pixel every x plugin in Gimp. Check if all frames are in it's boundaries with the feet centered.

Guilliotine

Now use the Guilliotine to Layers tool in Gimp. Remove the blank layers and use the Rename Layers tool. Press Export Layers to save every layer in a single PNG and use a mass renamer tool of your choice and rename it to filename000.png to filename213.png starting at zero and not using more digits than necessary. In XCC Utility right-click on filename000.png and select Convert to SHP. Be sure to have the correct palette set in the menu settings.

Now set up your [sequences](Sequences Introduction and Initialization) in OpenRA and see our [Modding Guide](Modding Guide) on how to create a new unit. You might also want to share your SHP at http://content.open-ra.org/?p=units

Clone this wiki locally