On the off chance anyone’s interested in how I have been building my game, I thought I’d share some of what I have learned by going through my working process of designing and building the maps. Here is my current workflow.
Make a floor plan in Photoshop, 4096 x 4096 is a good resolution to use.
We’ll need to export one .JPG for the floor texture (left) and one black and white outline .JPG where white is floor and black is wall (right).
Open the black and white outline image in Inkscape (or another vector graphic application), Vector trace the image and export as .SVG (scaleable vector graphic)
4. Import to 3D Software
Import the .SVG file into blender as a curve and (in the curve settings) Extrude the shape upwards.
5. Create a Mesh
Convert the curve to a mesh (alt-c), and ‘recalculate normals’ to ensure all polygons are facing outwards. At this point, it appears as though our mesh is ready to be used in our game, but if we take a look at the wire-frame we find something of a complete mess. Our poly’s have massive size differences and some of them are stretched very thin. This will make texturing a problem and cause collision glitches. We really don’t want either of these.
6. Optimize Your Mesh
To fix this issue, we apply some mesh modifiers. First we use Decimate’ on the ‘planar’ setting to optimize the poly count. This looks very elegant in blender, but when we come to import it into unity, It will draw similarly weird polys to the ones we see in stage 5. This is because unity will transform our mesh into one made only of triangles during the import process. Also, many of our edges and vertices are sharing the same space but not joined, which (trust me) is a big problem.
8.Make Pretty (optional)
At this point, we have a solid and efficient mesh that can be moulded and sculpted however you want. In this instence, I have used the ‘subdivision surface’ modifier to smooth off the edges and give a more organic feel.
9.Assign UV map
This is an essential part of any 3D game object. We need UV coordinates to map the image space of a texture image onto our object. A UV map is the part of our object, that wraps a 2D texture onto the 3D surface. This can be done in many many different ways. I like to use the ‘Smart-UV project’ function of blender as I find it excellent for tiled textures like the one I will be using.
10.Import to your game
Super Cube Smash 3D is built using Unity 3D, but hopefully this advice transfers to many other engines one may be using. In the import settings for our wall mesh, we can un-check anything related to animation as our mesh is static. No need to import textures as I have some materials ready to go in Unity. We will also need to generate colliders so that things can bump into our walls. After creating some ‘Normal Maps’ which is another story altogether, I place our floor texture (exported in step 2) on a single plane facing upward. I then position and scale the wall object to fit the plane.