How do I make levels in MED?


1 Introduction



Would you like to make levels in MED instead of WED? Does skinning seem like it's almost impossible to do large levels in? This tutorial will take the impossibility and hardships out of doing all that and attach a huge rocket to that speed engine as well. I even have some shortcuts available to speed up the process significantly, including skinning the model. Also available are tips and tricks on how to get the most out of this. To me, "speed is the name of the game". If there's a way to do something faster, I'll certainly use it if there are no dangers or problems from it (or if they're minimal). Not only will this tutorial explain how to make levels in MED, but it'll tell you the best ways to do things in terms of speed. In fact, you could almost make a 4096x8192 level (in quants) in the matter of just three hours (for fast users, about 7 or 8 hours for a newbie)! I use this technique all the time for my game's development. Texturing, otherwise, could end up taking days for a level this size and complex, but using my techniques can cut this to just a few minutes where you spend more time plotting the points than texturing (unless, of course, you're drawing the textures). I could almost just make my entire city world in just one day, or a 12-hour period! That's how focused on speed I am. I love using screenshots as they are a powerful guide. The screenshots have been resized as they're very large and would present scrolling and memory issues otherwise. They've been scaled to half the size, which is 400x300. To see the full size version, click on the image. Also, along the way, do not rotate anything, unless specified. This tutorial is highly organized and relates to the layout of version 6.0 of my website.

At the end, section 7, you'll find a collection of tips and tricks that you'll find handy, including a few pieces of code to make better use of the big advantages of doing it this way.

2 Planning



Above all, having a plan is important. Without one, things might look screwy or you might change your mind halfway through or get confused on what you want in a space smaller or bigger than expected. Here is our general plan:



This image above is a 1:16 scale of our plan. Clicking on it will load a 1:4 scale version. It is a scale map of the plan and our level to be made and has been simplified in terms of textures. Black lines indicate the wall, green for the grass, blue on the south for the lake area, red for the carpet, orange for the pool area, and the pool floor colors thrown in.

Let's say that we want some random level that is relatively simple in design. The north side will be a building, perhaps a hotel, and the south side will have a small lake with a bridge crossing over it as I see in some lakes. The map scale is 8 quants is 1 foot. This is the basic concept we'll use for this tutorial. We'll make a small level, although the technique can be applied to levels spanning 100,000 quants in diameter or more, we'll just keep it simple for now. Our level will have a width of 4096 quants (512 feet; x axis) and a length of 8192 quants (1024 feet; y axis) long. The small hotel will take up the northern area of our level. Our hotel will be 12 feet tall (96 quants) with a main floor height (from floor to ceiling) of 10 feet (80 quants). This hotel will occupy a space of about 256 feet (2048 quants) by 96 feet (768 quants). The small, cheap rooms will occupy a 12x12-foot (96x96 quant) space. The more luxurious rooms will occupy a 16x16-foot (128x128 quant) space. There will be a pool and a hot tub as well. The area in the vicinity of the pool and hot tub will have a span of 32 feet for a tiled floor instead of a carpetted floor. This is our main plan.

3 Plotting the points



3.1 The hotel



3.1.1 The floor, ceiling, and roof



To do the floor at high speed, first, you need to think some. If you were to stick to 128 for a square size (in quants), you'd need 192 polygons. Where do I get 192 polygons from? According to our design, the hotel will be 256 feet along the X axis and 96 feet along the Y axis. The Z position doesn't count. In our game, 8 quants is 1 foot. 256 feet means 2048 quants and 96 feet means 768 quants. It's like converting feet to inches, only as if there were 8 inches per foot instead. A square size of 128 would mean that the vertices would span 128 quants and the square would be 128x128, sort of like a terrain of that sort of size. For 768x2048, we divide 768÷128 to get 6 and 2048÷128 to get 16. Using the area method of multiplication, 16×6 = 96. Since there are always two polygons needed for a square, we double 96 to get 192.

However, a larger square size is better for the poly count. The poly count is far more important than skin size, three times as important. Increasing it to the recommended 256x256 square size, you cut the number of faces to only 48. 768÷256 = 3 and 2048÷256 = 8. 8×3 = 24 and 24×2 polies per square = 48 polies. A 256x256 texture size is good for most anything. Using a larger square size is recommended for large, relatively flat areas, but our area isn't going to be all that flat to make it worthwhile. If you implement detail mapping, you can have bigger squares and smaller texture sizes without any real "damage" to the quality. We'll use the basic technique, having the detail in the texture only.

If you don't know what I mean by a "grid", picture our above plan with a grid:



Again, clicking on this image will give a larger version.

Given the fact that the pool area uses 32 feet of space, or 256 quants, there will be three such texture tiles used for the pool area. Unlike WED and textures, you can use any size you need. The skin size, itself, must be a power of two, but the textures inside can be anything, even 173x234 if you need it which is rejected by WED. This is one of the big pros about making levels this way.

Now, to the point, again. Think about the spacing. We're using 256x256 triangle sizes. Since the pool area uses 256x768, we'll need three less. The total needed is 8 wide by 3 high. The pool reduces this to 7 wide by 3 high for the main carpetted area. How do you supposed we make this? The fastest way is by creating a stack. First, let's make a single "tile". Switch to vertex mode and get an empty model. Then, change the move snap to 32, the highest it'll go. Now, create a cube and delete the four bottom vertices. This will delete everything except the top two faces as you don't need the rest at all, unless, in some way, you'll be viewing it, but in this case, it won't. Resize it so that it is 256x256. Do NOT use the scale feature as it causes inaccuracies, move the vertices individually! Using boxed selections is strongly recommended when moving things around. Select a side and move the two vertices together then move the other side and that's about it. You may need to reduce the snap to 16 to be able to position them properly. I've set up MED to have the grid mimic WED's default to make this much easier. For details on how to do this, see section 7. Then, using copy paste, create a second and a third stack of 24 of these. Use copy paste and move that stack to the side. From one of the stacks, remove the top three. The three will be used for the pool area, the 21 will be used for the rest of the floor, and the 24's will be used for the ceiling and, if visible, the roof. The roof will be visible in this case so we'll be using that. They must align perfectly vertically. This'll make skinning far faster and easier later on (see section 4). Now, move the stacks to the side somewhere. See how fast this is so far? Already, the floor, ceiling, and roof are just five minutes from being finished (except in terms of making the actual texture). At this point, we should have something like this:



Why having stacks is explained in section 4, skinning. For now, let's have the stacks to the side so we can work on the rooms.

3.1.2 The luxurious rooms



3.1.2.1 The main walls



Walls are usually 4 to 6 inches thick (larger for outside, especially in colder climates). This is in a moderate climate so the outside walls aren't as thick. We'll have our inner walls 6 inches thick as it's easier to work with (4 quants exactly versus 2 2/3 (as from 8×(6/12) and 8×(4/12)) and the outer walls as one foot (8 quants) thick.

For now, let's just design one room. So, go ahead and create another cube. This time, delete only the bottom two faces (go into face mode and make a boxed selection at the very bottom to select them then delete answering yes then (yes or no) to the questions that come up) then the top two faces (in the same way only the top side instead). For speed, select the top first, then, hold the control key to add to the selection and add in the bottom side. You can't see the tops of walls or the bottoms so there's no sense in having them. Since the walls are 10 feet high, or 80 quants, a snap of 16 will do. First, let's scale the walls so they're of the right size. We'll do the luxurious rooms first, the big ones being 128 by 128 quants (or 16 by 16 feet). Now you'll have to think when it comes to getting the vertices in the right positions. You have to account for entrances and other things like that. The luxurious rooms have a closet and a bathroom in them as well. The bed is special as it isn't a wall so we'll ignore that for now. Plus, since those are decals, it should be a separate model (so you can later make it invisible to increase the frame rate when you go outside of the hotel (like with LOD; see section 7.2 for details on this)). We'll make the entrances 4 feet (32 quants) wide and have them centered for each room. This, however, means having to delete one of the sides of the cube. However, before doing this, we'll create another cube, this time for the inner walls. You'll need to change the snap to 4 to get the 6-inch thick walls. Again, delete the tops and bottoms, but afterword, flip the normals for the inner walls to make the faces face inward. We'll delete the south side on both then add some more vertices to count for the entranceway and a possible door (with an action assigned to it). Build the faces as needed. Use the 3D view for doing so and always go clockwise to make the face "face" the camera by default. If you make a mistake, just either delete the face for flip its normals. To help with the face building, select the vertices you need, such as the outside to build the outside walls or the inside to build the inside walls and so on. You do not need to be in face mode to build faces. Use vertex mode to make face building easier.

This part, after being finished, should look like this:



3.1.2.2 The closet and bathroom



Now we'll create the bathroom walls and the closet walls. The closet will be 6 feet wide by 3 feet long (48 by 24 quants). The bathroom will be 10 feet wide by 6 feet long (80 by 48 quants). Again, create another cube, and delete the top and bottom. This'll be the closet area. Since the closet can be opened in our example game, we'll leave out the doors. Resize the object by moving the vertices (with the snap at 4) as needed. Repeat for the bathroom. The bathroom, however, will have a door next to the wall (for enhanced privacy, given the angle) and the entrance way will be 3 feet (24 quants) wide. This means having the walls "split". Make more cubes for the inner walls as well. However, delete the faces that join up with the adjacent walls of the main room. This'll be of high importance because it'll help save on polygons. Polygons are four times as important as the skin size as they are the slowest for rendering. Just deleting the "edgers" saves 4 polygons. This might not seem like much, but, for a few dozen rooms, it makes a huge difference. The room is basically complete at this point. This is what it should look like at this moment:



3.1.2.3 The rest of the luxurious rooms



In our hotel, the luxurious rooms will be close to the pool. They will also be joined together and rotated some. We'll have 10 of these rooms in all so take out the copy paste and make copies of it. Where are we getting ten rooms from? Consider the width of the building and the room size. The rooms are 128x128 quants each. The width is 768 quants for the whole building. You might be thinking of dividing by 128 to get 6 and pairs to get 12, but then, how are you supposed to get to the western side of the hotel? You have to account for walk space! If we take a room out, making them span 640 quants, we'll leave an acceptable amount of walk space, 64 quants. The 64 comes from an equal amount of space on both sides of the 768, but the 768 does not include the outer walls of the building. 768-640=128. Half of 128 is 64 and 64 quants is 8 feet, plenty wide. For now, we'll just ignore the rotation part of it for speed reasons. The reason for this is covered in section 4. After finishing the luxurious rooms (minus the decals), this is what you might have:



3.1.3 The cheap rooms



3.1.3.1 The main walls



Again, like the luxurious rooms, the process is practically the same, only the rooms are smaller. Instead of 16x16 feet, they're 12x12 feet. This is 96x96 quants. Again, we'll make the cubes, delete the tops and bottoms (add a bunch of cubes at first, then delete the tops and bottoms of the cubes as a whole - it's faster that way). However, the cheap rooms won't have a closet, but they will have a bathroom designed in much the same way only smaller. The bathrooms for the cheap rooms will be 8 by 5 feet (64x40 quants) instead, not much different. The entrance to the room will be 3 feet (24 quants) wide instead of 4. The entrance to the bathroom will remain as 3 feet. A finished version of the room would look like this:



3.1.3.2 Mass production of the cheap rooms



However, now that we have this, we need to figure out just how many rooms there are. The positioning follows the same principal as the luxurious rooms. North side faces north, east to east, south to south and west to west. The rooms are 96 quants each and you have 768 quants available. You could fit exactly 8 of these, but then you couldn't get into the back at all. 48 quants (6 feet) of walk space isn't much from 7 of these rooms, so we'll use 6 of these rooms on the vertical. This provides a generous 96 quants of walk space on the north and south ends of the building, and decent for potential fire escapes. They'll almost always be in doubles starting on the far left side. The hallways are going to be 8 feet wide (64 quants).

This seems very hard to figure out, but the pattern is straight forward: rooms, hallway, rooms, rooms, hallway, rooms, rooms, hallway, rooms and so on. The building is 256 feet wide and 32 feet is reserved for the pool leaving 224. The rooms are 12 and the hallways are 8. For each "room, hallway, room", you get 32 feet. Don't go rushing off yet as you have the luxurious rooms to factor in and a bigger entrance area. The luxurious rooms take up 32 feet alone and another 8 feet for the hallway. This leaves 184 feet of free space (as from 256-32-32-8). The nearest acceptable multiple of 32 is 160 and this works out nicely. Why? Normally, you'd have two rooms being side by side in six rows. This adds another 12 feet. Left with 172 feet, I can have a 20-foot wide entrance area, plenty of space for the checkin/checkout booth and maybe some employee-only areas. For our tutorial, we'll just do the rooms and the checkin/checkout booth area.

The question, however, still remains. How many rooms do I need? The answer is "(160÷32)*12+6", or 66 cheap rooms. The 160 (feet) comes from the nearest acceptable multiple of 32, the 32 comes from how the pattern is spaced, in feet, the 12 comes from how many rooms are in each group and the 6 comes from the 6 odd rooms that join up near the luxurious rooms. That seems like an awful lot though. Each room takes 30 polygons. This would mean using up 1980 polygons from these rooms alone. Sometimes, thinking of using a special form of LOD to render something invisible if it's too far away would help. Throwing in the ceiling, roof, and floor, that's only 144. The sides of the ceiling, however, aren't don't yet. Yes, it's a lot of math and thinking to get the most out of it. Use Windows calculator if you need it. That's a lot of copying and pasting, but remember, you can select multiple rooms that have already been copied and use copy paste on those to speed up the process. The final version looks like this:



3.1.4 The pool and hot tub



The rooms are done for now. Let's set them to the side. The pool is like most any other area. However, it's actually dropping lower into the ground (which means that you'll need to change the pool floor, but we won't worry about this at this moment. Again, like before, create a cube. Delete the top and flip the normals. This is the basic idea of a pool, a constant depth one where the depth remains the same or gets deeper at one rate only. Our pool is going to have a deep end with a steeper slope around the 5-foot mark (40 quants) so let's delete the north side as well. Create a second cube and repeat the process only deleting the south side instead of the north. Our pool is going to be 20 feet wide by 30 feet (160 by 240 quants) long, decent enough. The shallow end is going to be 3 feet (24 quants) deep and the deep end is 11 feet (88 quants) deep. The shallow end will get a 6:1 slope. This means that, for every 6 units forward directly facing the slope, you go up or down 1 unit. The deep end will use a 3:1 slope. To merge the vertices, select the points in which they meet and click on "merge" to merge the vertices into one to solidify the model. Merging vertices, normally, shouldn't be done, but, as long as nothing else is attached, this is fine. The big merge will be covered in section 5. This is how the pool looks, after being moved off the side for the next thing:

It fits the exact slope ratios as mentioned and it's of a decent size.

As for our hot tub, it is going to be 2 1/2 feet (20 quants) deep and remain at a constant depth (we can add stairs and decals later), and be a 10x10 foot square (80 quants). Like with the pool, create a cube, delete the top, flip the normals, and resize it. Then adjust the height and that's it. The hot tub is done in under ten seconds (excluding texturing)!



The only thing left is the checkin/checkout area. This, however, should be considered a "decal" because it's small and doesn't really fit much with the main thing. Next up: Skinning the hotel, but you have the stuff outside yet to to do and this is much easier.

3.1.5 Fixing the pool tiles



Because of the pool, we'll need to make a change to the pool floor design. Without this change, you won't see the pool at all defeating the purpose of it (and wasting polygons and time). The pool will be placed 2 feet from the wall on the north and 6 feet from the east. This way, I only have to edit that one tile and it saves two polygons as well. The hot tub will be centered on the other tile. So, create a "frame" around the pool area that's 256x256 and "remove" the area the pool takes. Here's a screenshot of the fixes after being done and before moved to where the main stack is:



3.1.6 The outer walls



After all, what would it be like when you can see straight through the building (and pass through it like nothing was there) and have a roof on top only showing up when you're high enough? It's weird and makes little sense. To fix this, we're going to do the outer walls. Since we only need 8 across and 3 wide, it's only 22 extra tiles (perimeter, not area) or 44 polies. Start by creating a cube, deleting the vertices on the side you don't need (if you're doing the south side, for example, delete the vertices on the north side). This'll leave everything deleted except the side you need. Again, line them up for speed reasons. Be sure to do all four sides as, in our case, we can see all four sides of the roof. Also, remember that the roof is 12 feet (96 quants) high. Our walls will extend to that height. This goes, however, 2 feet (16 quants) into the ceiling, but it's only the outer walls and no one could see the odd defect otherwise.

Also, remember fire escapes. Every building should have at least two escape routes. The hotel will indeed have two, one on the north and another on the south and close to the pools. There is, however, the fact that you'll need to use other sizes for this part. The entrances/exits will be 8 feet wide. The main entrance, on the south, will be 12 feet wide. This'll cause an odd-length wall but shouldn't be that bad to work with. Also, remember that you can see the sides of the walls at the entrance. If you accidentally delete this part, don't worry as you can just rebuild the faces. For speed, create four vertices and build a rectangle in polies. Then use copy paste to duplicate it like crazy. Also remember that the walls on the outside are one foot thick instead of six inches (or a half of a foot). Here's our stack of walls when finished and stacked:



At long last the hotel is done, outside decals, but that'll be in another model that can be toggled away. In fact, you could almost just toggle away the interior walls and stuff to improve on the frame rate even more. This is covered in section 7.2. Only the exterior would be visible. It's an interesting concept to consider and one of the primary advantages of making levels in MED.

3.2 The outside area



3.2.1 Figuring out what to do next



The outside area is next. Plotting the points is super fast. There's a lake to the south with a bridge crossing over the lake to a small extent, and I'll have some hills to the west next to the lake. The rest of the area is generally flat. For the flat areas, we'll use the stack technique. Since the stacks have been created already, just use some copy paste on the existing ones. How many do you need anyway? Well, for the flat area, we'll use a 256x256 size. For our level, this means we'll need 512 of these. This means 1024 polygons at the minimum. From the hotel alone, it uses up 2824 polies, not including the wall junctions that'll come later on. This might seem like a whole lot, but remember, 48 are taken up from the hotel floor already so there are actually 976 polies to make. This actually isn't that bad, considering the size of the level. I should also have a 12-foot-wide (96 quants) pathway leading from the hotel straight south to the lake.

3.2.2 The main grass



So, let's begin creating the stack. The main area will extend out to the lake. We'll have the lake cover the southernmost 1024 quants (128 feet). The lake area, due to it's design, will be done slightly differently, but follow a similar technique. For now, we'll do the grass part. Yep, more math to do. Our hotel will be 32 feet from the northern edge. Since the hotel itself is 96 feet from north to south, we subtract 128. The lake uses up 128 feet. This all adds up to 256 feet. Our map, as a whole, is 1024 feet from north to south (as from 8192÷8). This leaves 768 feet of free space. So, from the hotel to the lake, we'll need "768÷32" or 24 tiles for the road. The 32 comes from the fact that the tile size is 256x256 and 8 quants make a foot (256÷8 = 32). The lake will use up 64 tiles. 64 because, as mentioned before, there will be 4 tiles from north to south. The width of the level is 4096 quants and 4096÷256, the tile size, is 16. Using the area model of multiplication, 16×4=64. Since the hotel uses up an additional 24, we now know how many tiles to use for grass part as we've eliminated the "unknowns". The level, as a whole, will use up "4096÷256×8192÷256" or 16×32 or 512 tiles. Since 112 tiles are used for other stuff (64 for the lake, 24 for the path and another 24 for the hotel interior floor), this leaves 400 tiles (512-112 = 400). So, take out the copy paste and start copying the 400 tiles. For speed, what I usually do is copy one tile and paste it three times to get four of them. I then box select those four and repeat the copy paste operation pasting three times to get 16. I repeat again for 64. However, Instead of pasting to 256 and using copy paste on those, I continue pasting the 64's to get to 192 (paste twice). I then copy paste those to get 384. I then select 16, using the grid as a guide, and use copy paste on those to get the full 400 I need. It can be done in under a minute (2 minutes for beginners)! Now that's supersonic fast! Here's the progress so far up to this point:



Wow what a stack! 90 seconds or less is all you really need and can be done, if you're fast, in under a minute.

3.2.3 The pathway and base for the lake



Next up is the pathway. The pathway uses 24 tiles. So, from the tallest of the first stacks, we made, use copy paste and make another stack. Boy, the path almost done in 5 seconds!? Wow! For the lake, use some copy paste on the big stack recently created to create another 64. Because I'd like a fade to blue from grass, we'll separate 16 (for the span of the lake's shore) of these tiles. Now the lake is most of the way finished already... or so it seems.

3.2.4 Creating hills and terrain



Now, how do you suppose we create hills and terrain using this technique? You could use HMP, but HMP has limitations, unlike this. For real, more realistic and randomized terrain, we'll need to modify the tiles in some of the stacks. All tiles must still be 256x256 for speed reasons, however. How do you create them then? One way I know of is to create the vertices individually. Start by forming your regular tile (or deleting the faces (answering "no" to whether or not to delete isolated vertices (if you accidentally click yes, click on the undo button and retry the deletion)) on some of those tiles you've already made through copying and pasting), then create some vertices in the center. If you go outside the center, you'll defeat the purpose of the speed (and it may look weird). As before, do not join the tiles together or you'll run into more problems. We'll leave the bottom of the lake to be very simple. Also, when creating vertices, use a relatively high snap. I'm using 16 for this and I wouldn't recommend going below 4 (unless you're using a larger texture size; 8 for this tutorial). Finally, when building the faces, avoid having faces with a tiny width. Try to make the width and height as close as you can get them, although you don't have to and don't have the vertices right next to the edge of the tile, although you may if you want. Having one on the edge is also acceptable, but be cautious about that as the tile it connects to will need the vertex in the exact same spot on the edge to make seemless tiling. Keep in mind though, for every vertex you add in the center, you'll need 2 more polygons to fully "fill the space". If you add, say, 7 vertices, you'll need a total of 16 polygons as 14 of which are extra ones. This only goes for the center area, however. After completion of the 32 tiles for the lake, spread out as shown in the screenshot, including those 16 that were going to have the grass to blue fade:



Yep, this took quite a long while to make, a whole hour for me anyway. What's next? The bridge is next, the last thing to do for level construction.

3.2.5 The bridge



3.2.5.1 The bridge plan



How do you do a bridge? What kind of bridge should we have? We'll have a bridge made of wood planks consisting of 2x8's (which will be 1.5 by 7.5 inches (1 by 5 quants) for simplicity and usually it's less as it is so it's also close). The planks will be 6 feet (48 quants) long and the bridge will span 12 feet. This seems like an awfully thin bridge being only one quant, but if you think about it, it is correct. 12 inches per foot ÷ 8 quants per foot = 1.5 inches per quant. The planks will be spaced by 1.5 inches (1 quant). This bridge will be embedded into the ground by square stumps 6 inches wide and spaced 3 feet (24 quants) apart from each other (by their centers). In WED, using level blocks, something like this will not be acceptable as you'll likely run into errors upon compiling.

3.2.5.2 The planks



Before we begin, let's move the stacks for the lake off to the side as we don't need them at this moment. To build a bridge (and no, you don't need to be that much of an engineer to do it, basic knowledge is good enough), the procedure is practically unchanged. Make a cube (only all sides are visible so nothing gets deleted) and resize it as usual. 1 quant vertical thickness, 5 quants wide and 48 quants wide. Yep, you'll need to use a snap of 1 in order to do that. When done resizing, begin using copy paste to make the stack (again). Question is, how many do we need? Well, we'll need to consider the length of the bridge. Our bridge will span about 12 feet. Since each plank uses 9 inches, or 3/4 of a foot (including gaps), we just divide "12÷3/4" or 16. This means we only need 16 planks. So, use copy paste to 4 objects, then copy those to 16. The planks are done already!

3.2.5.3 The stumps



Now, the question is, how high do we need the stumps? It's always better to overestimate. When estimating, think of it in terms of the skin. Our skin size will be 256 pixels high. For true scale textures, which is what we'll be using, we can have a maximum of 256 quants high. Use it! Having extra texture pixels has practically no impact on the frame rate, unless you're using a shader. If you change it later on, it'll get "squished" or "expanded" and would mean having to retexture the stumps (and again, you could use the techniques described in this tutorial in section 4). So, let's make the stumps. They're 6 inches wide, or 4 quants, and they'll be 256 quants high. We're good to go. Now, if they're spaced 3 feet apart and the bridge is 12 feet long, you'd use 4 stumps, right? Wrong! This is something often overlooked. Think about it and try this. Take 3 coins (any type, even basic objects) and space them 3 inches apart and try to make them span exactly one foot. You can't do it as you're missing one! The same goes for the bridge and since two sides have the stumps, we'll need to double this. We'll need ten stumps in all. After creating all the planks and the stumps, this is what we should have after being moved to the side:



Oh, and delete the bottom faces for the stumps - they'll be buried in the ground and you couldn't see them anyway. Wow! We've come a long way! But this isn't any usable level. It would be a weird game playing it like it is.... Before we make it a usable level, it's now time for skinning. Save a backup of your model after saving it. To do so, after saving it the normal way, just go file > save as. If you'd later want to add something, or make a big mistake while skinning, it'll be easy to fix with the backup. Do it! Next up: skinning!

4 Skinning



4.1 Introduction



Normally, when one thinks of skinning, they think of having to do each individual face separately one by one by one. This can end up taking days to do. The purpose of the stacks is to eliminate this. It's the sheer speed that'll amaze you. I betcha that, in only one hour (90 minutes for a beginner at this), excluding the time to create the real textures, you could have this entire level skinned to it's fullest. This isn't a joke either. However, before we actually begin skinning, we need to create a simple image for the layout of the objects. I use the GIMP to do this. We'll use a texture size that is 256 pixels high and we'll start with 4096 pixels wide (or about 1 megapixel - 2 megs of video memory used). We can always readjust it if needed. Due to a major bug in MED, once mappings are imported, you cannot readjust the skin size without the mappings being messed up (yes, I know about the "adapt skin points" check box, but the X and Y positions are reversed when it gets used), but you can during the early part of this phase. Once mappings are created, take caution.

4.2 Laying out the textures



4.2.1 The plan



First off, we'll need to review each of the objects that we have and their sizes. Here's what we have:



Boy, that's a lot of objects! To make the most out of the skin, the height is the most important. So, let's take out the graphics editor (the GIMP for me) and let's start drawing textures of these sizes.

4.2.2 Positioning textures on the skin



If something is irregularly shaped, your models may look weirder or stretched. To prevent this, we'll create a basic texture, very basic. First, align all of the 256x256 textures so they're side by side. Important! You must provide one pixel of clearance on each side of the texture! Failure to do this could cause problems later on, big ones. The reason for this is explained a little later on. Ignore the odd-sized ones for now as we'll work on those in section 4.4. Also, don't forget to label the textures or give some indication on what they'll be. I've labelled some of the textures, the big ones, and color-coded the smaller ones that would otherwise make it impossible to fit readable text inside. Textures of the same size I use different colors for and put a color key in one of the larger textures nearby or in open space on the side. Here's a screenshot of what we have so far with texturing:



Notice how plain it looks? We'll use an enhanced texture later on, when we're almost done. When saving the file, I give the normal texture name then add "base" to it. So, if the file was called example.xcf (or example.bmp), I'd save this version as examplebase.xcf (or examplebase.bmp).

4.2.3 Dealing with odd sizes



4.2.3.1 Optimizing the skin space



What to do with the odd sizes.... It can be puzzling, but think more closely and you'll see that it's easier than it looks. First off, you have a much bigger texture than you have in what remains. However, we won't do it that way. Instead, we'll learn how to make the most out of the skin space to have the least amount wasted. Always remember that you must have two pixels of clearance between the textures. If not, the edges may look weird and tiling will be weirder when you run it in the engine, plus, when you want to move textures around, repositioning the vertices will be highly problematic and could almost require an entire redo of skinning the entire model.

So, out with the X by 256 textures and in with those marked as special. These textures have sizes of 256x80, 160x240, 80x80, 48x5, and 4x4. The height is the most important so pay attention to that. Note the big 240 (+2) in there. You can slip in a 5 (+2) and a 4 (+2) and still have one pixel of free space (as 240+2+5+2+4+2 = 255; remember the two pixels of clearance rule). That is excellent! For the two 80's, well, those can be separate, but also consider their widths with those on the side. 256x80 is very wide. Place wide textures where narrow ones are together. 80x80 isn't that bad. You might think of joining the 80x80 up to the 160x240 and have the 256x80 below that. After all, you can't fit the 256x80 below the 160x240. This case happens to be an easy one. After positioning the textures, we get this:



4.2.3.2 Odd sizes using repeat textures



For the other odd sides, you have a choice. You can waste skin space and replicate the texture, or the better way, add some additional outlines for enhanced positioning and save skin space. The second option is the best in almost any case, except when you have a lot of wasted skin space (in this case, it wouldn't matter that much). To denote a different outline, use a different color. I'm using a medium green (my favorite color) to denote this, but you can use anything that you feel as necessary. These odd sizes apply to the hot tub and pool. The pool is 88 pixels deep at the deep end and 24 pixels deep at the shallow end. The hot tub is always 20 pixels deep. Also, because the pool has a weird design and a sudden angle change, make use of the positions in MED to figure out where the points go. That is, after 96 quants (texture pixels) to the north, it gets steeper. The shallow end is 24 pixels deep and the point of sudden change is 40 pixels deep. For these, I just mark a bunch of plus signs and where the lines cross is where the vertex goes. At this point, we're all set, except for one thing. Here's what we have so far:



I used many different colors to denote the different parts of the texture and also note the plus signs.

So, what's missing? That answer is quite easy: a grid. Why have a grid? Simple. Remember from a short while ago that you created the vertices in the middle of those squares? Well, if those vertices aren't in the right positions, you'll see odd and uneven stretching effects. Also, the same goes for the walls of the hotel. To make a grid, I have the outside as one pixel thick and the inside areas as two pixels thick. It may seem weird, but the reason for it is simple. Anyway, let's get on with creating the grids. First off, think what needs it. The grass, in general, doesn't need it, but the lake area does. The carpetted floor doesn't need it nor the ceiling or roof. Think about what has vertices in the middle. Then, space the vertices out accordingly as you have them spaced. Take the grass to blue fade. I've set the snap to 16 and the overall size is 256x256. This means that I make a grid of 16x16 squares for that texture. 256÷16 gives the 16 size that we need. For the number of lines to draw, always add 1 (Remember the stump issue with figuring out the number of stumps needed? This is another case of this). The same goes for the water fade texture as well. Sometimes, merely just having measurements is good enough as in the case of the pool floors. I've marked the grid in a medium gray so you can see it over the black outside to help. You can use any color you want, as long as it don't cause conflicts with the other colors you're using. For the walls making up the rooms, I done it in a special way. However, at the end of making the grids, I now have this:



4.3 Applying the textures



4.3.1 Preparing the skin editor



At the beginning, I mentioned having to create stacks and rows evenly lined up. Why? Well, the reason comes down to this moment. Ready? First, we have to configure the skin editor. Open the skin editor up then go edit > convert > true color. Delete that vertex on the top left corner - it doesn't need to be there. Now, import your skin image as a BMP or PCX file. I like BMP better so I'll use BMP. So, I save my XCF file as a BMP file. In the skin editor, I import the BMP file. A notice comes up saying that the bitmap's size does not match. Click okay to import it. If needed, go to view > lines > lines and view > vertices > ticks as this will help a lot with the next parts. The lines are important for lining things up. The vertices can be shown as dots or ticks, but I prefer ticks, though dots is acceptable as well, only a lot harder to see.

4.3.2 The purpose of the stacks



4.3.2.1 Simple stacks



Now for the moment we've been waiting for! Highlight one of the stacks in face mode with a boxed selection such as the carpet floor stack. Then, in the skin editor, go edit > create MD2 mapping. Set the tolerance to 85 and be sure the correct orientation is used. For the carpet floor, a top mapping is what you need. Setting it to 85 prevents the floor from becoming just one line and two vertices. Important: Avoid using the scale tool - it causes strange things to occur. Always use the move tool! What's so special about just four vertices? Try looking at the 3D view in textured mode and see for yourself. You may have to click in the open to "select none" to be able to see anything. What a surprise! All those are textured in the matter of a few seconds! Using the move tool, move the vertices to the proper position on the texture layout. Here, zoom in and position the vertices as close to the edges as you can get. I prefer to, right away, position the top left vertex on the top left part of the texture. I go to other corners if this is not permitting due to other vertices being in the way. Only position them within the black borderlines of the textures and not on the white area outside. There's a bug in MED that prevents you from getting the vertices on the outer edge (not always the case, but often is). Don't worry about that for now. Select none (clicking in the open is much faster), then make a boxed selection on the two vertices and move them as far as you can - on the lines only. When making boxed selections, start the selections 3 or more pixels away from the vertices - too close and you may end up moving them and swapping tools like crazy can slow you down. Only use the select tool when making selections with the important move tool is almost impossible. Finally, make a boxed selection on the bottom vertices and move them as far down as they'll go. Just look at the difference in speed! Don't do anything with them yet, however. Repeat the same for the other common textures - the roof, the ceiling (both of stacks 24 high), and the main grass. You could texture all that in under a minute! That's 448 (well, 469) textures textured in under a minute! That's crazy and it's almost hypersonic fast! That's the reason for the stacks. However, what about the special ones? The screenshot shows what I'm doing after doing the fourth regular stack. At this point, you may start to notice a slow down in the skin editor. It might not be noticeable on a fast system, but it is noticeable on a slower system.



4.3.2.2 More complicated stacks



What's the purpose of the grids? Try adding the stack for the pool floors and see what happens. Uh oh! Extra vertices! No problem: use the grids! That's what they're there for! Just line up the vertices, always making boxed selections, on the grid lines you made. However, I ended up forgetting about the hot tub area! Out comes the GIMP again and reimporting the texture! Reimporting the texture will not affect anything at all, except the textures images themselves (ain't that obvious?). The exception is when you use a different-sized texture. We're well on our way now! But, what about the buildings or those other objects? Here's what the pool floor stack looks like. Seems weird, don't it?



4.3.2.3 Very complicated stacks



In order to do the grass to blue area or even the underwater dirt one, that's where the grid has maximum importance. Go ahead, select the stack of 16 for the grass to blue area and create a top mapping for it. Move the vertices, which seems like a big mess, to where the appropriate place for it is. Because this is difficult, I'll use more screenshots. After being positioned where it needs to be (I always position in the top left corner), we'll have something like this:



It almost looks like a spider web.... All those dots seems very difficult, but, before doing anything, click in the open. This is the select none thing I tend to like. The best and fastest way to do all that is to make a boxed selection as shown in the above screenshot. Notice how there seems to be a blank column? Skip a row and move the vertices you've selected so there is one blank. Usually, I have it so that everything lines up on the left side of the grid (or the top). First, do the columns (or rows), then go onto the rows afterwords (or columns). You can do the rows and columns in any order. To make it easy, do all within a single row (or column) then move on to the columns (or rows). Most of the way through the columns, you'll see this:



Also, note the blank column on the right side as well? Do the same as with the left column, skip one. Doing the rows is done in the same way. Notice that, in the central area that there's another missing row? Again, do the same thing as with any other missing row. Here's what it looks like after processing all of the columns and rows:



Nice and even grid, ain't it? Now let's go and do the other stack like this, the underwater dirt one. The other stack is done because I forgot to take the screenshot. Up to this point, the stack to the right shouldn't be finished at all.

4.3.2.4 Confusing stacks



With the underwater dirt stack, it seems odd and difficult to do with those random skips and bigger gaps. Now, how many skips are needed at position X, Y? If in doubt, check with the graphs in MED. This, like the previous one, is done in the exact same way as before. First, do the columns, then the rows. It can be the rows that get done first then the columns, but it don't make a difference. Here's what it looks like when this stack is done:



Again, you got that nice, even grid! If the grid looks odd or elongated, then you've got a small misplacement. Find where it is and make those adjustments as needed. The grid helps with smoothness and evenness. I took the above screenshot with the vertices selected so you can see how it fits in with the grid and with MED. Neat, ain't it? Now, what about the buildings? First, let's do the planks and stumps and the remainder of the simple ones. Only do the top and bottom for now on the stumps. When doing the planks, set the tolerance to 90 to get the sides. Return it to 85 after doing one of the mappings.

4.3.3 Moving stuff to form stacks



4.3.3.1 The stumps



You may think that doing the stumps, the sides in particular, is nearly impossible. But, why not create a stack by moving them around? Just like we did with the tiles, do the same with the stumps. Line them up. We'll do the front/back sides first. This means that they'll line up on the Y axis. Before doing this, select all of the stumps (from the top view), and move them to a clear area where there's absolutely nothing along the Y axis where the object is. Then, move them so they're all lined up on the Y axis. Use vertex mode to do this. For faster moving, select the top half of the stack of stumps and move them so they're parallel with each other, just like the tiles. Then keep repeating this until they're only one high. Part way into this, you'll see something like this:



Switch back to face mode. Then, as usual, create the MD2 mappings for this (front and back) and move them to where they belong, the big long line just right to the right of the bigger textures. You can do the front and back together, provided it doesn't interfere with other vertices. In fact, without even aligning the objects on the texture, we can go even faster yet.

To go faster, rearrange the stumps (do NOT rotate them) so they are aligned with the X axis and, like before, free of obstructions. Use vertex move to make it easier. Then apply a left and right mapping on them. Think that's fast? Seems like it! After doing all four sides of the stumps, this is what we have:



40 sides down in under a minute is possible using this.

4.3.3.2 The hotel rooms



But, what about the hotel rooms? That's like two thousand polies! No problem! Doing the hotel rooms is the same as moving stuff to form stacks and working with the grid in confusing situations. Not much else, really! To add speed, include the luxurious rooms as well. I made the grid in the texture the way it is to include the luxurious rooms. The cheap rooms are aligned on the left side of the luxurious rooms. Because there's 66 cheap rooms and 10 luxurious rooms, that's one long stack! Apply the moving technique from the stumps on the hotel rooms to put power into that speed engine. Normally, it'd take a whole day to texture those rooms, this cuts it down to just 10 minutes (there are 1440 minutes in one day if you're curious to know the impact of this). Try it and you'll see for yourself. You just did the stack of regular grass, containing 400 objects, in just a few seconds! How long does it take me? Here's a before screenshot (which takes about 15 seconds to process the screenshot (open up MSPaint, paste the image, file > save as, find the big group of files sharing the same name beginning with MED, click on the one with the highest number, add one to the count, then press enter to save the 5.6 MB screenshot)):


And here's the after screenshot:



All those rooms done in that time period! Amazing! It's almost rocket speed! However, it took longer than expected because I ran into a problem. My grid lines weren't complete so I had to end up referring to MED and the actual model to figure it out and I was stumped for some time so I had to check and recheck everything. You can tell from the skin image that the lines are one unit thick in the group of 4 on the farthest right. The front/back part, however, went well. I still had the rooms lined up, but the point was having it textured in record time. That's still extremely fast as otherwise, it'd normally take a whole day or longer for beginners to do the sides one by one by one.

At this point, you may notice a considerable lag in the speed of the skin edittor. It may update positions about 2 to 5 times per second which can get frustrating.

The only thing left are the hotel's outside walls (which are very easy to do), the pool (which is a little complicated due to the odd shape), and the hot tub. Is it just me, or are we about done with texturing? Two day's worth of work in an hour or two? From the screenshots, it seems a lot longer, but, along the way, I'm writing this tutorial which adds on to it. Do the walls in the same way as you did the other things. Line 'em up and make the sides. It seems so easy, doesn't it?

4.3.3.3 The two pools



The big pool may seem weird with the dip involved, however, the hot tub is extremely easy to do. Just do the hot tub like any other object so far. We'll cover the big pool in more depth, however. As usual, move it so that it is out of the way of other objects. Then, do the top view. There isn't much to the top view. Just line it up with the grid and continue on. The deep end back wall (the north side) and the shallow end wall (the south side) are also simple. For the shallow end wall, however, reduce the tolerance to about 60 or something, otherwise you end up getting the pool floor which will, in turn, delete the positioning of the pool floor and make it look odd. If you accidentally do that, delete the mapping you created and remap the floor. Then try doing it again. Line them up with the grid and just continue on. The sides, however, are much different. What's different? Look at this screenshot:



Notice how they are flipped and not oriented properly? For one, do not use the rotate tool in the skin editor it. Does it seem like you're stumped? Actually, not even close. You can flip the texture image! Seem weird? There are two ways of flipping it. The first is that, when creating the other mapping, check the "mirror reverse side" check box before accepting the mapping. The other way is to do it manually. To do it manually, just select the vertices on the left side and move them over to the right side and move those that were on the right side to the left side and there you have it, a first class flip! No problems or anything occur from it. Little have you known, I've been flipping the front mapping (except in the case of the time-test hotel rooms or very complicated mappings (This case hasn't been encountered yet.)) for practically everything (even during making this tutorial, I have been doing that. It's hard to tell though, ain't it? Why do I do that? It was first discovered that, in the main project I'm doing, the platforms' checkerboard pattern design never lined up properly. I did an experiment to find the cause and found that it was the front mapping that was flipped around for some odd reason. Doing the flip with the front mapping fixed the problem and it does not occur on any of the other 5 mappings at all as far as I can tell. If in doubt, use the text. If the text is flipped, flip the mapping to fix it. I've been flipping front mappings ever since.

Anyway, now that the pool sides have been flipped, the orientation is wrong! The pool runs from left to right, not from top to bottom as was originally done. How to fix this? Look at the pool's layout for this particular part. The "high point" is on the top as it goes furthest from the "base". We need the high point on the left side. If you have the wrong flip, you'll need to flip it again. Now it looks like all it needs is a rotation. DO not use the rotate tool! The rotate tool causes big inaccuracies and will mess this up. Do the rotation manually, one by one. The shape should be good enough to give you clues on how it should be done anyway. So, after the last bit of the model is textured, we have this:



See how the pool is designed? I've selected the vertices to denote where they go. So, now that everything is done, what next?

4.4 Finalizing the skin



4.4.1 Introduction



Textures as they are now aren't going to be acceptable. Now, save a backup copy of your model (not required, but a good recommended point of doing so). Now we make the true versions of the textures. However, there's something about tiling that you should know about.

4.4.2 Special notes about tiling



There is something special about tiling. Though it might seem weird, if you use a basic texture, and run it through the engine, you'll see adverse and unexpected effects from this. Don't know what I mean? Consider looking at this in-engine screenshot of this simple texture:



Here's this same texture, tiled using the techniques in this tutorial (with the finalization processed as well (section 5)):



********** VERIFY THE TEXTURING RULE IN THE NEXT TWO LINES BELOW!!!********** Notice the hard edge near the seems? To fix this, we need to use some copy paste. Make your texture based on one pixel smaller. That is, for the 256x256 textures, use a 255x255 texture. Then, use copy paste on the top part of the texture and place the copied part on the bottom. Repeat for the left side. Doing this will create this texture:

********** VERIFY THE TEXTURING RULE IN THE NEXT TWO LINES ABOVE!!!**********


And this texture in the engine:



Notice how the hard edge seems a lot less noticable? This is what the special note is about. Also, extend the texture one pixel past the outer edge. Use the copy paste on the left to get something over here. What you copy on one side must be pasted on both sides to reduce this effect to a minimum. After finishing the textures in full, this is what our skin looks like. But, what about all those stacks and stuff? The finalization is now beginning. Here's the final skin:



After a few hours, this is the final skin. Import this new skin image into the skin editor and we're done with the skin editor! Save the file. Very important: Save a backup at this time, preferrably with the new texture leaving the old version with the "classic" texture. If you make a big mistake and don't have a backup, it's a big loss for you! Getting excited? Now for finalization! The big screenshot has been saved as a JPG due to file size issues.

5 Finalization



5.1 Putting the pieces together



5.1.1 Putting the hotel together



5.1.1.1 The floor



It's now time to move the stacks and stuff around. So, what are you supposed to do with the stacks and how are you going to do it? First, let's have the important stuff first. Let's "unstack" the carpet floor. Do so by selecting it from the top view, move it off to the side then spread the tiles out. During this phase, leave the area around the origin alone as we'll need it later on, and very soon too. Also, when moving the tiles around, select the tiles as a whole, including the interior, especially best done in vertex mode. Also, at this point, you can now have it so that the tiles join together. Don't merge or anything yet, we'll do that later. Here's a view of the carpetted floor (I chose to have a bright red carpet that's very rough-looking) and the pool floor spread out:



In my case, I have the camera facing due north. The pool floor, though it has a weird design, is like any other tile, even the grass to blue fade tiles. Now the hotel floor is officially done.

However, what if you notice that you made a mistake with joining? The fix isn't all that bad. Just enter face mode, make a boxed selection of the faces you want to move and move them to unjoin them. Not much of a big deal, isn't it? This is why you should never merge anything at this point. The merge will happen, but a lot later.

5.1.1.2 The rooms



5.1.1.2.1 The mass rotation


Next, let's do the rooms so we can have space for the rotation. Everything off to the side for now and have room for the rooms. How many rooms need to be rotated? Lots! Since they only need to be rotated along the X and Y axes, we'll stack a bunch (again) on top of each other. How many do we need? Well, first, think of the original plan. Rooms on the south have the entrance on the south side. Rooms on the east have the entrance on the east side and so on. The luxurious rooms are in a 5x2 grid. Two will face the south, 3 for the east, 2 for the north, and 3 for the west. We'll do the east rooms first so, create a stack of three of the luxurious rooms (the big ones). Note: The rooms must not join up!. For the cheap rooms, they're in a 6x2 grid. We have 66 of these rooms. All 6 on the west wall face east. This leaves 5 blocks of the 6x2's. Since 4 on each block faces east, we need "5×4+6" or 26 cheap rooms facing east. Start stackin'. Also, make sure the objects are exactly centered on the origin or there will be inaccuracies.

Before beginning the rotation, make sure the rotation origin is at the origin and that the rotation snap is 45, the highest it'll go. This'll provide maximum accuracy. This is what I mean:



Once you are done with rotating them a full 90°, move them to the side as we don't need them anymore at this moment. We'll do the west-facing rooms next. Now, how many do we need? Well, 3 from the luxurious rooms and "4×5" or 20 for the cheap rooms. Let's get stacking again.

Once stacked, the procedure for rotating is exactly the same, except that you don't have to reset the options again. When done rotating, set those to the side (but don't stack them on top of the other rooms). The north-facing rooms are last. "5×2" or 10 come from the cheap rooms and 2 come from the luxurious rooms. Again, repeat the same process.

5.1.1.2.2 Positioning the rooms


Positioning the rooms isn't hard. It'll take some time, but that's about it. Optimizing, however, will be more tricky, but still isn't hard. First off, let's just get the rooms positioned. We'll need to unstack our stacks before doing anything.

Now, do you remember the plan for the rooms? The walls are one foot thick, or 8 quants. The hallways are 8 feet wide, or 64 quants. So, let's get on moving the stuff around. Since the top view is the most important, we'll make it bigger. To resize the windows, click on and drag the window borders or click on the left side panel with the filled-in area as the top left, the window that is the top view. For a tip to get positioning correct, take what we know. The rooms are centered, right? So, when positioning one of the rooms, have it in the center of the floor. Also, when joining rooms together, join them off to the side then make a boxed selection around the joined rooms and move them all to where they need. After we've positioned all of the rooms, this is what we should have:



I turned the 3D vertices off as we don't need them. This way, you can see the texture in greater detail without all those yellow (or red) dots being in the way. I made use of the boxed selections and stitched the rooms together, all 76 of them, in only 15 minutes.

5.1.1.2.3 Optimizing the rooms


Now try to get closer look at your model where the rooms join up. There's a wall there that seems to behave weirdly! For optimization, this wall, being completely invisible to the player (since we'll don a roof on next), does not need to be there at all. In fact, each of the blocks of the cheap rooms uses up 64 polies from 32 walls. You can't see the walls - delete them! The same goes for those on the far left side. For faster selections, make use of boxed selections. You'll have to zoom in quite close though and a very large top view helps. Use face mode to make the selections - we just need to delete the faces, not the vertices. When deleting the faces, you may, if you want, although strongly recommended, delete the isolated vertices. All of these walls in this screenshot must be deleted:



That's 202 walls or 404 polies in all! That is significant and that's why this is important to do. If you make a selection mistake - selecting the wrong stuff, just click on the undo button. Because of a selection bug, any selections less than 16 pixels wide won't select anything so you'll have to zoom in quite close in order to make any use of it. I went from 4422 polies to 4018. Though a 9% reduction doesn't seem exciting, it'll make a big difference later on.

5.1.1.3 The pools



Adding the pools is extremely easy. Just select them and position them. Remember, when moving things around, use vertex mode as it's much easier to do it that way. Only use face mode to unjoin something from a mistake. That's it! Nothing more, nothing less. Simple, wasn't it? And yet, they fit so snuggly in place!

5.1.1.4 The ceiling and roof



Do the ceiling and the room just like the floor. Unstack them and lay them out in an 8 long by 3 wide grid laying longest from west to east. In fact, when joining the tiles together, you can do it twice as fast. Have the stacks spaced significantly distant from each other on the Z axis (up and down). Then, join the tiles together to form the ceiling and roof. Boxed selections made this go by quite quickly. But now, how far apart do they need to be? If you remember from the original plan, the building was to be 12 feet tall and there's a ten-foot ceiling. This means that they need to be spaced two feet apart, or 16 quants. After donning the roof, we need the side walls. Here's what we have so far:



As you can see from this screenshot, this is about what you'd see when you enter the hotel. However, there seems to be another bug I just found with MED. The texture seems to skip one pixel. That's now 19 bugs. This is how I end up finding bugs. Just doing normal things and I encounter something weird. When I encounter something weird, I have a strong tendency to take screenshots for reference later on.

5.1.1.5 The outside walls



5.1.1.5.1 Positioning the walls


Again, we need to unstack the walls and spread them out. Since there are two sides for the east-west oriented walls and two more for the north-south oriented walls, split each group into two. In case you make a mistake, attach the walls on the outside and, when done, place them back together again. Also, remember that each side takes two walls, one for the interior and another for the exterior. However, it looks like I've run into a problem: no entrance! These sorts of things might come up so I'll add this to this tutorial.

5.1.1.5.2 Fixing problems


5.1.1.5.2.1 No entrance!


If you run into a problem such as me forgetting the entrance, there are several ways to fix it. First off, do not use copy paste on existing skinned objects - it'll cause the skin vertex count to get into the millions with ease (if done in excess)! This could not only cause a gigantic file size, but arouses wasted memory and other possible compatibility issues. This is another one of the bugs in MED, one of the major bugs. A good, easy, and fast way to fix this is to resize the walls (separated from the main walls of course (This is why you must have things separated; it helps make sure you've got everything you need.)). Since our entrance is 8 feet (64 quants) wide, we take this into account. This will cause the skin to "shrink" or "collapse". To fix this, recreate the mappings for them. This is what I mean by "collapse":



The left side is the collapsed wall (as you can see from the top view), and the right side is the normal version. Notice a difference in the pixels? See how the pixels are closer together on the horizontal axis? Simply retexturing these two walls is all you really need. Since it shrunk by 64, take note of this and move the vertices as needed. However, due to the design of our texture with the path, we'll need to have one side have the entrance near the edge. The main entrance is 12 feet wide, the width of the path. If you retexture something, the original skin vertices and faces get deleted and the replacements appear ready for you to move. When positioning the vertices, always have it so that the skin vertices are at least one pixel from the outside edge of the skin or you may see some rendering problems, the "smoke effect" as I may call it. If you need to, call out your grid texture to help position by importing it then, when you're done, reimport the main texture collection.

If you really would like to use copy paste, first, save your file. Check the skin vertex count (by going to view > model properties). Make sure your walls are untextured. If they are textured, create a mapping for it then click on the delete tool in the skin editor to delete it and untexture your wall (no need to position it or anything). Then use copy paste and, upon pasting, check the skin vertex count. If nothing changed, continue on. If it did change for some reason, first make sure that you only had those walls selected and nothing else. If those were the only things selected, close MED without saving (the point of saving the file beforehand) and reopen it and the file and try again. Closing and reopening will "reset" MED so you'll have to use copy paste again. Don't just go to a new or blank file, close MED entirely. Restarting your computer is not required unless it happens again right away after closing and reopening. Yep, this is that skin vertex bug again.

Let's get back on track again. The north entrance will have one part of the wall cut off and the south entrance will have the entrance split with the tiles to match the path. However, I also noticed that I forgot about the outer walls for the east and west sides of the building. Fixing that, however, was quick and easy. When copying and pasting with skinned objects, watch the skin vertex count very closely and do not recopy anything and paste it. Once you copy a textured object and paste it, paste what you copied as many times as you want or need, but if you want to do it in bulk, or change what you paste, close MED and reopen it each time to "reset" it. Yes, it's a major bug. Here's the fixed version of the walls before attaching them:



5.1.1.5.2.2 Fixing the entrance at roof area


Now we attach the walls to each other and now the hotel is done. Not! The sides of the entranceway are blank! There's nothing there at all and if playing the game normally, you could see the grass on the other side which makes no sense. The fix, unfortunately, cannot be done since we've already attached the walls (and for me, cannot undo because I already saved my file). No worries though. Just build the faces normally. Then, when skinning, select faces on one side only (the south side only or the north side only, not both). Create the mappings as needed and position them. For speed, create the mapping and have them close by. Then select the other side and create the mappings for them and position them on top of the ones you had from the previous run. Now box select the whole thing and position them then. Now, what about the area just above the doorway? We'll need to create another mapping to fix this.... Since all of the walls have been joined up, we'll have to create it separately. However, since only the outside can be visible, we only need to do the outside. Our player can't get between the roof and ceiling. So NOW, officially, the hotel is done, unless I catch another mistake somewhere. This is what our hotel looks like from standing on the side of the big pool:



5.1.2 The outdoor region



5.1.2.1 The path



Let's now put the path together. First, unstack it. Tile it along the Y axis. Then, position it where the entrance is and that's all there is to the path. You might be wondering about the grass. Just leave the grass alone for now. Here's the path after being joined together:



5.1.2.2 Grass to blue



Remember the grass to blue fade texture? We're doing that one next. These get lined up with the X axis (as from the plan). As usual, unstack them. However, select the whole tile, not just the vertices in the middle or coming short. Doing otherwise would cause a big stretch to occur. Now the question is, where do we put this thing in relation to the path? Remember that the hotel was centered? The hotel is 2048 quants wide and the whole level is 4096. It's a clear indication. Since the hotel and path are already joined together, select them as a whole. Now, have it so that the left side of the hotel is 1024 quants right of the X axis. This puts 1024 on the left and right sides of it, dead center. The grass to blue fade just lines up with the X axis. Also remember that the hotel building is 32 feet (256 quants) from the north side. Position the hotel like so then join the grass to blue fade tiles. With that done, here's where we're at:



5.1.2.3 Underwater dirt



We'll do the underwater dirt texture next. Boy, we're so close to done! Look at the stack of the underwater dirt. The vertices are more compact on the top part and are basic tiles at the bottom. These need to be rearranged so that the dense ones are to the north and the basic ones are at the south. From that, unstack them along the X axis. Ain't this fast? Ready for the grass? 400 tiles seems overwhelming, but it can be done in less than 5 minutes. Here's what we have at this moment:



We only have three stacks left ya know!

5.1.2.4 The grass



Seem like 400 is tough? It's not even close, except for trying to make selections of course. We know that one tile is to the north of the hotel. There are 8 tiles to the east and west of the hotel (4 on each side) for three tiles south. Then, there are 15 tiles for the rest of the way which skips over the pathway. Let's start by unstacking 28 from the big stack and forming the full northern area and the area along the hotel. Now, select 15 from the big stack and move them to the side. Select another 15 and move them to the same level as your other stack of 15 but, move them to the south some. Repeat the unstacking of 15 at a time and moving the small stack to the south. If needed, feel free to move the area set to the side downward as long is it won't cause "interference".

After unstacking the whole thing from the 15's, we now spread across the X axis. With the path in the way, just how many spaces do we advance before we "jump"? Look at the design. Each tile is 256x256. Four tiles can fit within each 1024x1024 grid square. There's 2 1/2 grid squares to the path. This means we need 10 tiles on the west side of the path and 5 tiles on the east side. Not much to it, huh? Spread them out and at the end, we have our level except the bridge:



Yep, this is what we've got so far. Now for the bridge. One thing: we'll have to get in close to do it.

5.1.2.5 The bridge



Now for our bridge. This bridge uses very small objects so we'll have to get in quite close and use a small snap value. First, let's move the bridge supplies and unstack them before doing anything else though. It seems like only the planks need to be unstacked. The original plan called for the planks to be spaced one quant apart. Let's do that. What about the stumps? Those were spaced 3 feet (24 quants) apart along the bridge. Start by placing one stump on the center with the related ones off to the side. Place another stump at each end and find the mid point for the remaining ones. With the grid, it's easy. Also, we need to know how much the stumps stick out. We'll have it so that they are three feet (24 quants) higher than the bottom of the planks. Now, all we gotta do is position the bridge connecting to the path and we're done! Not quite though. Here's what the bridge looks like from human-eye level:



5.2 Finalization



5.2.1 Backup



Before beginning the finalization, now that we've constructed our level entirely, we'll do another backup. If you don't, it'll be harder to make a big adjustment on the heights of the vertices. This backup is not required, however, only recommended.

5.2.2 Changing the heights



The point in 3D Gamestudio is 3D. We already have a 2D flat layout. Let's put some height into this design. We'll have some hills on the west side near the lake and a small dip near the southwest corner of the hotel. The hotel will be placed 16 feet above the shore line, or 128 quants. The area near the lake will dip downward and continue into deeper water. For the rest, let's just make up some random heights: some high areas and some low areas, usually only of steps of 4 feet (32 quants). However, do not adjust the points on the floor or on the edge of the building. Of course, don't have the vertices higher than the bridge. Either keep those the same height or lower. Either that or raise the bridge. I left the bridge the same and went up close to make those minor changes. After changing the heights, here's what we have:



Now that looks a lot more like it! However, there's still one more critical step yet. The big screenshot has been saved as a JPG due to file size issues.

5.2.3 Critically important backup and the mass merge



Remember before that, when we joined the tiles together and to not merge the vertices? Well, this is the time we do, but, first, we MUST do a backup. If you refuse or forget to do backup, you won't be able to make changes (except height adjustments) to the area at all. Although it can still be done, it'll take a long time to fix. If you want to change something later, use the old version, make the change, and repeat the backup (replacing the main file). Once you're done with the backup, all that's left now is to select everything and click on the merge tool. The merge might take a while to do, however. If you want, you might want to take note of the vertex count. For me, I had 5658 vertices before (not skin vertices), and 3461 vertices after. Also, after doing so, you'll notice that everything now becomes smooth and even. This causes the model to become solidified - all as one continuous model. Everything is affected. Now, try selecting a vertex without the boxed selection and adjust it. Yep, nothing else appears and that vertice affects all faces it's connected to. The last thing we need to do is center the entire level. So, use the select all tool and center everything. Use the grid as a guide to help and zoom out to a point where the grid shows everything in more detail. Pan around and zoom in and out to check to make sure the vertices are lined up properly on the axes. So, at long last we're done! Here's three screenshots of the final version of our level:



This is an aerial view of the whole level. I have an enlarged 3D view to show detail. This is from almost exactly 250 feet above sea level (the lake water surface anyway at 0 Z position). Nice view, ain't it? The big screenshot has been saved as a JPG due to file size issues.



Here, we're standing on top of the highest point overlooking the lake and bridge. This is human-eye level as well. You can't see the underwater dirt, but, if you think about it, you'll certainly see the water of the lake once that is added. The big screenshot has been saved as a JPG due to file size issues.



Is it just me, or is this from WED or some trick image manipulation? This seems a lot like it came from WED, but, this is for real in MED. Yes, I'm that skilled at it, and this is a relatively simple design. As for what this is, this is a view inside the hotel looking into the luxurious rooms on the left and the pools on the right barely visible. This, too, is at human-eye level.

5.3 The model for download



Wanna see more than just screenshots, but see the actual model? You can! This 418 KB ZIP file is the finished version, as from the last three screenshots. You may use it only for the purpose of this tutorial - seeing the finished version. You may use it in noncommercial projects or as a guide for commercial projects (to learn from it, especially the techniques given in this tutorial).

6 The pros and cons



6.1 Introduction



Why go through all this when you can make some of the levels in WED using blocks? Rendering speed, one-second build times, texture size freedom, and more are strong reasons. Here's the full list of pros and cons.

6.2 The pros



Doing it this way has many advantages, a lot of which are quite strong. Here are the list of advantages (from best to worst) with the scale of 5 to 10 (5 being neutral and 10 being indefinitely advantageous using the half-step technique*):

9.7 - No long builds at all! In fact, the build, at almost any setting, would take but two seconds instead of days regardless of complexity, even for four million polygons!
9.5 - Levels built in MED render faster in the game engine than level geometry, especially when optimized. Using the special LOD (section 7 covers this), you can add even more speed.
9.4 - More freedom with LOD. You can add and remove models to speed up the already fast rendering, but this requires some skillful thinking and some scripting (see section 7.2 for details).
9.3 - Levels built in MED give great freedom on the design of the levels from simple stuff to very complex stuff WED otherwise can't do.
9.1 - Almost unlimited level size - levels can extend well past even a million quants in diameter. With good LOD scripting and level design, you can have a large portion of your giant-sized level in the view (like 50,000 quants visibility or more) and run at 60 fps!
8.8 - You can get a preview of what your level would look like. WED only shows it as a blue object (default settings).
8.2 - You get more freedom with the texture sizes and arrangements. With WED, they always have to be a power of 2. In MED, they can be abstract values, but the skin size itself must be a power of 2. Yes, this means that you can add a screwy 413x228 texture if you need it - impossible to use in WED without resizing it (losing quality along the way).
6.8 - Fewer snapping restrictions - unlike WED where everything has to be snapped to integer values for blocks, making levels in MED doesn't have this limitation, so feel free to have a wall at 327 3/8, -82 1/2, 144. MED, however, lacks higher snap values - puny 32 is the max, horrible for making levels in.
6.3 - Levels can be textured faster than with WED.
5.9 - No size restrictions - if you need something that's 1/2 by 1/2 by 13 3/4 quants, feel free to use it, unlike with WED this is impossible. The bridge in this tutorial uses something of a width of 1, something that'd normally cause all sorts of problems in WED.

6.3 The cons



There are, however, some disadvantages to this. Here are the disadvantages (from best to the worst) with the scale of 0 to 5 (5 being neutral and 0 being indefinitely disadvantageous using the half-step technique*):

4.3 - You'll still need to include one block in your level to avoid the no geometry error. Position the block so that it is hidden (such as inside a wall) and not smaller than 2x2. Just use the default texture if needed. For best results, use a 4x4x4 block. If you still have problems with that, use a bigger block.
4.0 - Lacking high snap values, MED, with a puny maximum of 32, makes it more difficult to move and position things over great distances. I've had cases where even 1024 for the snap would be useful, very useful.
3.2 - If your textures fill slightly over half of the skin size, you'll end up with a lot of wasted space. If you can, use richer or bigger textures to use up more of the skin space.
2.3 - Requires extensive planning and thinking to make the most out of this. It's better to overestimate if in doubt. 1.9 - Textures cannot be rotated as easily as with WED - they always have to be parallel along the x and y axes. 1.4 - Tough for beginners to get a grasp on - this tutorial eliminates most of this.
1.1 - Texture sizes, must be square for optimal results and not exceed 1024 pixels on each side (unless mipmaps are used). If you use a 8192x128 texture, almost no one could use such a thing nowadays due to graphics card limitations.
1.0 - MED is quite buggy (most of which are minor bugs and otherwise harmless), but, due to all my bug reports for it, this'll likely change soon.
0.8 - No lightmaps - you must script lighting (best way), create another model posing as a shadow mapper (next best way), but bad for complex models due to increased rendering speed) or use more skin space and texture it in manually (not recommended).

7 Tips and tricks



7.1 Tips



7.1.1 Introduction



This tutorial covers a large portion of the most common circumstances, but there are some odd cases and some other unmentioned ways of putting power into that speed engine. This section also reviews what you've learned in the main tutorial in a more detailed version with extra details for potentially odd cases. The rest are to just help with speed or make more use out of it.

7.1.2 Construction phase



These tips and tricks deal with the construction phase, covered in section 3. They help with the main construction of the level: plotting the points and building the faces.



7.1.3 Skinning phase



These tips and tricks deal with texturing your model, covered in section 4. They help with designing the textures and how to do things the best (and/or fastest) way.



7.1.4 Finalization phase



These tips and tricks deal with finalizing your model, covered in section 5. They help with optimization and after the texturing has been done.



7.1.5 General tips and tricks



These tips and tricks are for general cases that otherwise wouldn't fit in the other categories or would fit in many categories. Multicategory tips and tricks are noted in parentheses in relation to the section number of the main tutorial.



7.2 How to use LOD



7.2.1 How to code it



One of the major advantages of making levels in MED is more control on LOD, a lot more. In our tutorial example, we have a building. If you're inside the building, you can't see the outside areas at all unless near the entrance. If you're on the sides of the building where you can't see inside, there's no need to render the interior of the hotel. If you're on the roof of the hotel, you can't see the interior. So, how do you make the most out of this? The best way of doing it is to assign an action to each object using a bunch of if statements in a while loop (I'm certain that there's a better way though). Also, you'll need to know how things are positioned. To find the position of something, just place the mouse arrow over the vertex in question to get it's position. Here's the positions of the 4 corners, the most important parts, in order of X, Y, then Z positions (bottom then top):

These are the important positions and does not include the entrance. Besides, the entrace will later have doors, that you can't see through until you open them, but let's say that the doors remain open (hot day with a good breeze). This is a rough idea on what the script would look like:

text LOD_warning_message
{
   pos_x = 8; // warning appears near the upper left corner down a ways
   pos_y = 128;
   font = _a4font; // the default font
   layer = 15;
   // string and flags defined through functions
}

action use_some_LOD
{
   /*
   To choose the entity, set the my.skill1 variable to what you'd like.  We'll use 1 for the
   room decorations (the beds, nightstands, lamps, etc.) and 2 for the interior rooms
   (including the interior walls).
   */

   if (my.skill1 == 1) // the room decor
   {
      while(1)
      {
         if (((camera.x < -1024) || (camera.x > 1024)) && ((camera.y > 3840) && (camera.y < 3072)))
         {
            my.invisible = on; // if on the sides outside the building regardless of height
         }

         if (((camera.x > -1024) && (camera.x < 1024)) && ((camera.y < 3840) && (camera.y > 3072)) && (camera.z > 208))
         {
            my.invisible = on; // if above the building on the roof (or directly above it)
         }

         if (((camera.y > 3840) || (camera.y < 3072)) && (camera.z < 208))
         {
            my.invisible = on; // if just outside the entrances (the beds in the big rooms are hidden behind a closed door)
         }

         if (((camera.x > -1024) && (camera.x < 1024)) && ((camera.y < 3840) && (camera.y > 3072)) && (camera.z < 208))
         {
            my.invisible = off; // if inside the building, everything is visible
         }

         wait(1);
      }
   }

   if (my.skill1 == 2) // the interior rooms
   {
      while(1)
      {
         if (((camera.x < -1024) || (camera.x > 1024)) && ((camera.y > 3840) && (camera.y < 3072)))
         {
            my.invisible = on; // if on the sides outside the building regardless of height
         }

         if (((camera.x > -1024) && (camera.x < 1024)) && ((camera.y < 3840) && (camera.y > 3072)) && (camera.z > 208))
         {
            my.invisible = on; // if above the building on the roof (or directly above it)
         }

         if ((camera.y > 3840) && (camera.y < 3072))
         {
            my.invisible = on; // if north or south of the sides regardless of east-west position and height
         }

         if (((camera.x > -1024) && (camera.x < 1024)) && ((camera.y < 3840) && (camera.y > 3072)) && (camera.z < 208))
         {
            my.invisible = off; // if inside the building, everything is visible
         }

         wait(1);
      }
   }

   if (my.skill1 == 0) // if you forgot to change it
   {
      LOD_warning_message.string = "You forgot to specify the entity number (use skill1)!";
      LOD_warning_message.visible = on; // always remain on for a sturdy reminder

      while(1)
      {
         my.pan += 15*time; // rotates the object to give a warning on what object is at fault

         if (my.pan >= 360)
         {
            my.pan -= 360; // if the pan is too high, set it back in range
         }
      }
   }
}


This is just a simplified concept. It takes a bunch of complicated if statements to do this but the reward is fast rendering. If you were on the roof or a few thousand feet above it, you can't see on the inside at all. This is quite logical. Also, the same goes for viewing from the outside on the sides where there's no way to see the interior. You can use nested parentheses like you do in mathematics to make the engine do the innermost part first. Here's an example. In this if statement:

if (((camera.x > -1024) && (camera.x < 1024)) && ((camera.y < 3840) && (camera.y > 3072)) && (camera.z > 208))

what this is saying is that if the camera's X position is between -1024 and 1024 (like being at 480) and that the camera's Y position is between 3840 and 3072 (like being at 3500) and that the camera is above the top of the ceiling, the entity is invisible and is not rendered. Since the X position between -1024 and 1024 and the Y position between 3840 and 3072 is in the area of where the building is, it's the Z position, the height, that makes the difference as, if you're above the ceiling, you can't see anything and there's no way for the camera to get in there (provided that you have a camera collision script). So, while you're above the building, the interior and room decorations won't be visible and thus won't be rendered giving a higher frame rate. For like 7000 polies, that's a HUGE difference. Take it for granted, even though it can be confusing to figure out.

The text object will give a warning in case you forgot to set up the entity identifier. Because, naturally, you can't see this effect directly, especially on fast systems and/or simple objects, this warning will let you know as the default is 0. Other warning indicators could be to having it look weird - make it rotate when it's unnatural or make the objects in an abnormal spot or something such as adding my.z += 128;

If I were to add decoration for the roofs, such as vents and other things common up there, being inside the building would render those invisible naturally so turn the invisible flag on.

7.2.2 Creative use of the special LOD



Why bother creating the interior decoration for all those rooms when you can get away with a lot less? Think about it. Look at the interior rooms. The luxurious rooms are special. The cheap rooms, however, are special in a different way. Think about it. You're on the far west side walking along. You can't see the interiors of the rooms across the hall behind the others, right? Why make models for those? In fact, you can do away with just twelve such rooms. How? Look at the design. If you're at the X position of -864 and the Y position of 3584, you'll see rooms on the left and right sides only and can't see the other rooms. The interiors of just 12 rooms could be visible at once. So, like with the LOD script, a code like this might work in addition to what we have above:

   if (my.skill1 == 1) // the room decor
   {
      while(1)
      {
         // other instructions for basic LOD...

         if (((camera.y < 3744) && (camera.y > 3168)) && (camera.z < 208)) // always true if inside the building
         {
            if ((camera.x > -1016) && (camera.x < -760))
            {
               my.x = -888 // assuming your model is centered and mimics the room design
            }

            if ((camera.x > -760) && (camera.x < -504))
            {
               my.x = -632 // exactly 256 quants different
            }

            if ((camera.x > -504) && (camera.x < -248))
            {
               my.x = -376 // exactly 256 quants different
            }

            if ((camera.x > -248) && (camera.x < 8))
            {
               my.x = -120 // exactly 256 quants different
            }

            if ((camera.x > 8) && (camera.x < -264))
            {
               my.x = 136 // exactly 256 quants different
            }
         }

         wait(1);
      }
   }


In this case, since everything is evenly spaced out, adding and subtracting 256 is all you need to do. For faster results, add the numbers yourself (use Windows calculator if you need to). And remember, when subtracting a negative number, you add.

If you have a whole city visible and want to be able to go inside the various buildings, you can make use of this special LOD to use similar designs for the buildings to create seemingly over-detailed worlds. If your buildings are evenly spaced, you can add a small little math formula like this:

special_posx = int(camera.x/1024+0.5)*1024

What this does is takes the camera's X position and divides it by 1024 (supposedly if the buildings are spaced 1024 quants apart from each other) and adds a half to account for rounding. It then takes the integer part of this dropping the stuff after the decimal then multiplying it by 1024 to keep the position a multiple of 1024. If your area is off-center, add or subtract the variation. Repeat for the y position as well.

Footnotes:
* The half-step technique is where, after each half-step toward the limit (0 or 1000, sometimes 0 to 10), the effect is 4 times greater. This means 250 or 750 (or 2.5 or 7.5) is 4 times stronger than 500 (or 5) and 100 or 900 (or 1 or 9) is 25 times stronger than 500. 100 is 100 times stronger than 750 and 900 is 6 1/4 times stronger than 750. 0 and 1000 (or 0 and 10) are impossible to have. This is described in greater detail here (see the table).

Page 1: Section 1; Page 2: Section 2; Page 3: Section 3.1.x; Page 4: Section 3.2.x; Page 5: Section 4.1 and 4.2.x; Page 6: Section 4.3.x and section 4.4.x; Page 7: Section 5.1.1.x; Page 8: Section 5.1.2.x; Page 9: Section 5.2.x; Page 10: Section 6.x; Page 11: Section 7.x;