Author Topic: Tips on how to create Craft maps from SketchUp  (Read 6770 times)

Offline Alex_D

  • Colonel
  • ****
  • Posts: 498
    • View Profile
Tips on how to create Craft maps from SketchUp
« on: February 24, 2019, 03:09:22 am »
So, after my 1st attempt to create a craft map from scratch, I was asked on how to make more. So I put together this tutorial/tips on how to do it, based on my experience.

Programs needed:
- SketchUp.
- A good image editor. I use my old and trusty Paint Shop Pro 7.04.
- MapView II.
- MCEdit.
- Notepad ++ or any other text editor.
- The game, of course. :)

Overall Workflow:
1. Prepare model with SketchUp. Save image views to be used by the image editor.
2. Open image editor and using layers to assist, populate the boxes required by the PCK format. Save the sprite sheets.
3. Import the sprite sheet with MCEdit. Create the blocks types as required.
4. Assemble the map in MapView II.
5. Test the map in a quick battle in OXCE.
6. Repeat 1 to 5 as needed.
7. ....
8. Profit! :)

Working with SketchUp:
- There are plenty of internet resources on how to use SketchUp, so we skip this part, except as noted.
- Create your own model, or download one from the internet.
- Prepare the model until it suits what the game needs, such as the scaling. I personally assume that the tiles in the game are between 1.2 to 1.5 m wide. So keep that in mind when preparing the model.
- Use as many auxiliary boxes as needed to scale the model, such as 1.2x1.2x1.61 m, to help visualize the game proportions, levels, etc. Hide what you don't need for the screenshots.
- The game uses a 2:1 ISO, which is not an available standard view in SketchUp. To create one, we need to draw a triangular prism to help:
    - Let's assume the green axis is (in game terms) positive going north east (or north in the minimap). The red positive is south east (or east in the minimap). The blue axis positive is up.
    - First we draw a right triangle with thickness (so it's a prism). The height (along the blue axis positive) is 2 units. The length at the base is 1 unit and it's on the red axis positive. The thickness (along the green axis) can be anything, say 1 unit. Now it's a solid prism object.
    - We rotate the prism about the blue (vertical) axis, exactly 45 degrees clockwise if looking from the top.
    - We pick the hypotenuse surface of the now rotated triangle prism, right click and align view. Now the model view is aligned.
    - Zoom/Pan the view until the whole model fits on the screen. Save the view using Scenes. Uncheck from the Scenes view things that are not needed, such as hidden layers, and view cut planes.
- Recommended to perfectly align the craft model along one of the main axes (green or red) of the plot.
- Recommended to only use in the SketchUp model colours that are part of the game Sprite palette. This will save headaches later.
- Add cut planes (normal and reversed) to the model so the views of the different levels are available for reference.
- Export the views in 2D images, png format. Use a custom size for the image. Write down the size (eg. 1500x1000 pixels). This will be used (and changed) later.
- It's recommended to export one test image for reference and scaling, as one will return to the model at least once more.

Working with the image editor and image files:
- Besides the screen captures from the model, there are two files that will be used to create the game image files. Examples of these files ("example_ISO.psp", and "example_blocks.psp") are attached. They include boxes that follow up the ideas from these fantastic tips.
- Import into example_ISO as a new layer the text image generated by SketchUp. Figure out the amount of scaling required so the image is of the pixel size to it fits the game. The sprite rectangles are 32x40 pixels, and a floor height is 24 pixels. To determine the scaling factor lets use an example.  Say the intended floor height in the image measures 78 pixels. Then this need to be scaled down to 24 pixels. Thus the scaling factor is 78/24 = 3.25. Then the size of the image exported from SketchUp changes by this factor. Example width: 1500/3.25 = 461 pixels. Height 100/3.25=308 pixels.
- Return to SketchUp and export the views images using the new size (e.g., 461x308). Now it's time to extract the sprites.
- Import into example_ISO all images generated from SketchUp, each in its own layer. You can delete the test image layer as it's not longer needed.
- Activating and deactivating the layers, align the images along so they superimpose perfectly. Now the fun part begins.
- Structure of example_ISO: There are these diamond blocks, each in their own layer. The way these are ordered is in the same order the game renders these blocks. Only a subset of blocks are included in the example. More are needed for larger crafts. It's important to keep the names organized so we can keep track of where each block belongs to. I used Z,Y,X, or Floor, Row, Column, as they are assembled in MapView. Also important is to have all blocks properly assembled so there are no gaps between the images. Selections of the images here are copied to example_blocks.
- Structure of example_blocks: This is the PCK sprite sheet. It's 10 columns and 25 rows of 32x40 blocks with one pixel spacing and one pixel frame all around. The selections imported from example_ISO into one or more layers.
- The work consist of:
    - Isolate the image of floor to work with. Maybe make it semitransparent or blend it with luminosity so it can be see-through.
    - Also activate (and add as needed) all the blocks for said floor.
    - To copy the portion of the sprite, select the layer of the target block, then use the magic wand selection tool (feather off) to select the side of diamond or block (they are each solid colours). Add more sides (say a wall, top or bottom) as needed.
    - Switch to the floor layer without losing the outline of the selection. Copy and Paste into one available slot of example_blocks.
    - Return to example_ISO and repeat the process for another location, either another tile (object), or a wall, or a floor.
- Once the sprite sheet is populated in example_blocks, it is time to export into a png. Switch off the layers that are not used (such as iso boxes). Save a copy of it into the png format.
- To prevent white outlines, reopen the png file and remove the white matte of the layer. Re-save. Note that the background remains transparent and the colours are still 24 bits (16 millions). If the original model in SketchUp contained only colours from the proper palette, the next steps should be easy. Now the image is ready to be used in MCEdit.
- It is recommended to leave the first block of the sprite sheet blank (empty), and start placing the image selections after the first block. This way the first block can be used for ghost tiles (useful for mini map symmetry).
- Tip: Once a image is placed in a position in the example_blocks sprite sheet, do not change it, to prevent future mis-indexes if one re-import the png in MCEdit.
- Remember that an image can be a West or North wall, floors, or object. Ideally they should circumscribe to the 32x24 sizes (from the blocks). However if a small detail is outside, it can be included as long as it stays in the 32x40 boundary frame.
- It's recommended to perform the intermediated animated images (e.g., doors opening, other animations) on separate layers in example_blocks.
- Plan ahead in the plan symmetry of the model, when selecting the boxes for the sprites. This will come in handy later.

Tips for working with MCEdit and MapView II:
- The best way is to take one existing set and modify/overwrite over it. This applies to all 5 types of files needed (*.map and *.rmp modified by MapViewII; and *.mcd, *pck, and *.tab, by MCEdit).
- Craft maps are 10x10, 20x10, or 20x20. Ideally multiples of 10.
- There are plenty of posts about MapView II and MCEdit, so only additional tips are put here.
- To import the png sprite sheet, before select the spacing and frame of one pixel in the settings. Also 10 images per row (default). The image should be imported with the transparent colour automatically assigned to the index 0.
- Remember: A single image box (PCK) can be used multiple times by different tiles, each with their own minimap view icon, properties, and LOFTs. Then a single tile can be used multiple times in a map.
- Use vertical offsets to create the illusion of partial elevation. This works on floors, walls, and objects. The maximum offset that can be done before a walking unit refuses to step on it is 8 pixels. There are two types of offsets, units and PCK images, and they are treated separately in each tile.
- However, if a floor on the ground level is offset, this would leave a black diamond on the ground as the game doesn't render the terrain tile if said tile is supposedly occupied by a craft ground tile. To avoid this make the floor tile an object instead. Then the game would render the terrain tile underneath. However, if said tile is a starting tile (spawn point) for a X-Com unit, the unit won't spawn there. So there must be an image on the floor else it will look ugly.
- Once the tiles are assembled in a map, sometimes, due to different constraints or regular snafus, symmetry in the tile assemble is not achieved. Therefore, additional ghost tiles (using this empty 1st image) can be created using different minimap images to create the illusion of symmetry.
- You will be working back and forth between the image editor (with both files open), MapView II, and MCEdit. At the moment MapView II, to update the files created by MCEdit, requires to close and re-launch the program. MapViewII (latest version) can now re-load the maps, plus the minimap view info (ScanG) is available from the map editor. MCEdit can re-import a sprite sheet at any time. Just don't forget to save.
- I personally do not make editions to the PCK using the native editor of MCEdit, as I prefer to do all the editions using the image editor. That way, if I re-import a new version of the sprite sheet my changes if they were made in PCK edit will not be lost. The exported png sprite sheets from PCK edit may be a hassle to work with, as the background colour (black) is flattened with the palette and it's difficult to re-edit later. Other people prefer to do the image editions within PCK. To each their own :).


Well, that is how I did it. I'm not by any means an expert, after all I only did this once  :P, so there may be better ways to do things. Comments are appreciated.

I may add more info to this Tutorial/Guide if I discover more useful stuff, when I prepare more maps.

(Credits to: Solarius, BulletDesigner, and the creators of MapViewII and MCEdit.)
(EDIT 2019-02-27: Update info about MapViewII)
« Last Edit: February 28, 2019, 05:33:06 am by Alex_D »

Offline davide

  • Commander
  • *****
  • Posts: 565
    • View Profile

Offline luke83

  • Commander
  • *****
  • Posts: 1559
    • View Profile
    • openxcommods
Re: Tips on how to create Craft maps from SketchUp
« Reply #2 on: February 24, 2019, 11:57:34 am »
ooooo i need to try Sketchup by the sounds of it... I use 3d Software at work ( Solidworks, Inventor and Autocad) so i cant image Sketchup will be very hard for me to learn. Thanks for the Tutorial.

Offline Alex_D

  • Colonel
  • ****
  • Posts: 498
    • View Profile
Re: Tips on how to create Craft maps from SketchUp
« Reply #3 on: February 25, 2019, 12:10:09 am »
ooooo i need to try Sketchup by the sounds of it... I use 3d Software at work ( Solidworks, Inventor and Autocad) so i cant image Sketchup will be very hard for me to learn. Thanks for the Tutorial.

Well the benefit of SketchUp is it's easy to use, and maybe because of that there are lots of available models to "borrow" from.
However professional programs like the ones you mentioned ought to work the same if not better. All that is needed from them (and SketchUp for that matter) is the ability of consistently exporting good images (in the 2:1 ISO view) so they can be further processed by the image editor.

Offline kevL

  • Colonel
  • ****
  • Posts: 482
  • pitchforks and torches
    • View Profile
Re: Tips on how to create Craft maps from SketchUp
« Reply #4 on: February 27, 2019, 05:39:54 am »
At the moment MapView II, to update the files created by MCEdit, requires to close and re-launch the program.

the latest release of Mv2 should see a Filemenu item "Reload terrain" -- it reloads the Map and Routes also, so it isn't actually "Reload terrain", I just labeled it that because it's really a combobulation to extract the reloading of terrains from just reloading the whole darn tileset ...

Note if Map or Routes have changed, you ought see a prompt to save them before proceeding. (further testing needed, so pls be careful)


/just a heads up, great looking chopper imho