Archive

Archive for the ‘Game design’ Category

Creating A Demo Scene In 3D Studio Max

August 15, 2011 1 comment

My apologies for the slow pacing of this series. Things are pretty hectic for me at the moment, with work and personal circumstances. Fortunately today I had some spare time to put the following together:

Scene render

The above was created in 3D Studio Max 2010. it consists out of four rectangles: floor, large side, small side and window. Further two instanced pillars and a tilted pyramid are used. The two small sides/walls are instances of each other, meaning that they’ll mirror each other’s appearance and other qualities except for position and orientation. When you copy a selected item using Ctrl+v, you get offered to either make a copy or an instance. A copy is independent, an instance is as described earlier. Using the right choice here can make life much easier 🙂

To prepare the elements of this scene for use with jPCT-AE we will have to export each of them to a suitable 3D object file format. I picked OBJ (Wavefront .obj file) because it’s the most common and light-weight of all: http://en.wikipedia.org/wiki/Wavefront_.obj_file

The demo provided on the jPCT-AE page uses 3DS format files, which are relatively huge and complex to parse. OBJ on the other hand are ASCII format and can be read and corrected by a human with a text editor. This makes them far easier to debug as well. Another thing the demo does is serialize the 3D object files using a serialize function only available in the desktop version of the engine. We’ll look at that one later as it can provide a nice speed boost to the loading of resources. For now we’ll keep it simple.

In 3D Studio Max you can export to OBJ files using the standard export feature which I assume you can find. Select the mesh you wish to export, go to export and select ‘Export Selected’. On the next screen pick a name for the mesh and select OBJ as the file type. After clicking next, you get the OBJ export dialogue. The default settings are fine, although you want to make sure you’re exporting materials too (first two checkboxes). Check the 3DS manual if you want to know what each feature does. Do be sure to click the Map Export button. On this screen you’ll want to disable ‘use map-path’, enable ‘extended map-params’, ‘convert bitmaps’ and then pick a suitable map format. This will be used for the textures added to the mesh. I picked PNG here since that’s a nice portable and small format for mobile applications. TGA is more suitable for high-end purposes, and isn’t as widely supported.

Now, just keep exporting each mesh in the scene until you’re done and have a folder filled with OBJ, MTL (material) and PNG files. In the next installment I’ll show you how to take all these loose bits and reassemble it into a coherent whole again, inside the game environment 🙂

Until then,

Maya

Getting Started With Game Design

August 12, 2011 7 comments

When looking at a finished 3D game’s levels it’s often hard to visualize how they were put together, or which tools were used. The easiest way to understand the basics is to imagine building a house from scratch. You start off with the foundation, either the floor or a terrain mesh in the game. Then you add the walls and ceiling, the rest of the bits which make up the structure or organic environment.

I won’t go too far into the basics, so I’ll assume that you know a bit about vertices and 3D meshes already. There are two important things to keep in mind while putting a game’s level together: mesh and vertex count. When designing a level it’s a good idea to minimize the vertex count per mesh, say a wall or floor segment. Mesh count in a level is also important, as each mesh is rendered separately unless you’re doing batch processing on a number of identical elements, say a hallway filled with tiles. OpenGL allows you to render all those elements in one go, which is a lot more efficient. Don’t go overboard with this, though, as not everything you’re rendering may be visible and would be a waste of effort, lowering the frames per second (FPS) count.

Fortunately the latter detail should be taken care of by the game engine, and we got one. If it’s smart enough it’ll take care of such rendering issues for us, leaving just the vertex count issue. The number of vertices we can render in a scene on a given hardware configuration isn’t a static number, sadly. The applied textures, lighting and particle effects applies to the scene… they all take processing time away from rendering raw, unshaded vertices. To find out what level of vertices, texture detail and effects in a scene works best will be a matter of trial and error. See where it makes the FPS go below 25 FPS or whatever feels playable and tune down the level of detail until things go smoothly.

That about covers it for the basics of designing a game level… the exact looks of it will depend on the game’s setting, and the total size of a level on the maximum vertex count. In upcoming articles I’ll show some detailed examples of how to put a level together using a demo level.

Moving on to the next important step in designing a level, the level editor and mesh and map editing tools. What a level editor is I probably won’t have to explain too much. It’s where you take all the bits and pieces, put a mesh up somewhere, stretch and manipulate it until it’s the right size and shape and apply a texture and other maps to it.

A quick note about maps here, as they’re an essential part of making a level look more than just ‘nice’. They come in a bewildering number of types, including regular texture maps, bump maps, height maps, shadow maps, environment maps and so on. Each applies a different effect to a mesh, to colourize it, give it depth, allow it to be used for a terrain or so, give detailed shadow effects, or give the illusion of an environment reflecting in a surface. Sadly the Android platform is sufficiently limited that we can not use many of those maps, and especially not dynamic lighting. Look forward to a PC-oriented series of articles on more advanced object mapping 🙂

When it comes to creating meshes and maps, there’s a bewildering number of tools out there, both free and paid. Personally I use Autodesk 3D Studio Max 2010 and Adobe Photoshop Extended CS5. The former is good for creating meshes, the latter good for colourizing and creating other map types. For more advanced mesh editing and mapping work there are applications such as Mudbox (http://en.wikipedia.org/wiki/Autodesk_Mudbox) which can do things like 3D sculpting which is hard to do in 3D Studio Max and its direct competitor Autodesk Maya. You’ll soon find out that you’ll want to use more than just a few tools as each is better at certain tasks.

I have heard good things about Blender 3D as of late. Back when I first used it in 2002 or so it was absolutely unusable, with a user interface only its own developer could like, and which was less intuitive than Vi in general usage. Recently the UI has been completely redesigned, however, and should be a nice, free (open source) alternative to paid apps such as 3DS and Maya, both of which cost about 1,000 Euro a piece. For Photoshop I can’t really think of any good, free alternatives, though. The Gimp is extremely hard to use and will require a very steep learning curve, while still doing far less than Photoshop can do. Maybe find a used copy of Photoshop CS4, which isn’t that much of a step down from CS5. I’ll gladly hear of free alternatives you are using successfully. The best ones I’ll list in a future article 🙂

Next article should be more than just a wall of text. I’m currently quite busy finishing up this Android project for a client, which is taking away most of the time I could be spending on making fun Android games. Life just isn’t fair, is it?

Maya

Categories: Game design