views:

1223

answers:

10

I have always wondered, how do game programmers tie together game characters done in an external 3d modeling software like maya or 3d max and the actual game logic done in there favourite programming language e.g c or c++.

How do you get to combine this two things together, and what is the actual process of building a game from modeling characters to programming?

Some of the things that make me wonder are like, do you program characters movements from the code or from the 3d model?

Examples would be really nice to see.

+2  A: 

I don't have a lot of game programming experience myself but I have found the XNA framework and resources pretty enlightening. You can find ton of examples and how to's and a pretty helpful forum here http://creators.xna.com/en-US/

Drakinfar
+9  A: 

Most of the information, like characters movements, is actually stored outside the code. It's quite a simple process actually:

  1. An artist makes a 3D model in Maya or whatever, and then saves it in a file. Let's say they called it 'Gollum.3D'.
  2. Now 'Gollum.3D' contains a whole lot of numbers representing the model points, textures and everything else.
  3. The program code then reads the file 'Gollum.3D' - all of its model points, textures and everything, and then does a lot of maths to calculate what the 3D scene is going to look like given all the numbers representing the model.

It turns out that everything in a game ends up being stored separately from the code, and the code just reads it and combines it all together when the game is run. When I say everything - I mean EVERYTHING! All of the text, the stats for the hit points and weapon damage amounts, the menu screen images, and even the artificial intelligence is stored separately from the program code in scripts. The program code ends up doing very little.

You may have heard of people making mods to games. Modders are people who edit the data that sits outside of the program code, which in turn changes the game to how it suits them. They're just taking advantage of the fact that basically everything about a game (except for a few core things) are not written into the program's code.

Ray Hidayat
You call a game engine "doing very little"? That's seriously stretching reality...
Wouter Lievens
Agree, complex math, physics, and AI aren't things I would consider to be "very little" effort.
Chris Ballance
I think he didn't mean that its very little effort, perhaps he means that its a small percentage of the game content compared to what's stored in script files etc
Click Upvote
+1  A: 

Animations can be done from within the 3D modeling software, and then its up to the code to 'run' different animations based on game logic. The models get from the modeling software into the game through common formats. For example, the XNA framework can natively read some of the most common model formats.

Mongoose
+2  A: 

Take a look at the Blender Game Engine Tutorials, and also their Project Apricot, which was an open project to create a 3D game with the Blender Game Engine.

Paul Dixon
A: 

Think a while about how you do this all in 2D, it's pretty much same with 3D, the algorithms are just different and there's different aspects to care about.

The rest of what you ask is a design question and is dependent for game and the programmer. One may write a complex simulation for moving their characters, while someone else may rely only to skeletal animations. Someone may store game logic along 3d models and others just don't.

Examples? Perhaps quake source code is a good source to look into.

Cheery
+1  A: 

3D character creation and programming of your 3D game are two distinct processes.

Usually you sculpt your 3D character in a 3D modeler (Blender, Maya, 3D studio Max, etc), you export this character to a file (.obj, .md2, etc) and you have written the code to your 3D game in order to handle the import of the character in your engine.

While this sounds quite difficult, 3D game engines do support all those stuff without writing millions line of code and re-inventing the wheel.

Take for example Ogre3D, a 3D open source game engine. You don't have to be a programming guru in order to have a simple example up & running in minutes. I suggest you take a look at their wiki and their tutorials.

For example this is a simple tutorial for creating and exporting your simple models from 3D Studio Max and importing them to Ogre 3D

Stelabouras
A: 

Writing a game engine is a complex task, my suggestion is to use one of the existing engines, (pick from the list: http://www.devmaster.net/engines/).

When picking the engine you need to take in account the following:

  • License (you want to publish, do you have a budget, is it open source)
  • Programming Language/Scripting (which language are you most comfortable with)
  • Target platform (Windows/Linux/Mac/Console/Phone)
  • Pipeline (are the exporters from your 3D modeling tool and importers into the engine)

Your question is more related to the last item, you should pick an engine that can import assets you produce in say 3DS, Maya into the engine in a way you don't have to worry with file formats, because that will make you more productive since you are only focusing into the game.

Paulo Lopes
+1  A: 

You should use a 3D rendering engine. A lot of them are free (Ogre3D is a good one) and usually they have facilities to import nearly any type of mesh created from common modeling software.

tunnuz
+3  A: 

Unlike the favorite answer, I would venture and say that this is actually quite a big task if you refer to having a character that have animaton to it.

The end result would be to enable most of functionality tied via script and config files (in other words - data driven), but the process to build such a system is not simple.

Usually you start with an external modeler where you do the following: 1. construct a skin model. 2. construct a skeleton and attach to the skin according to weights etc.. 3. apply all textures and material as desired. 4. export to your engine.

Now you can start build your animation bank for this character skeleton or any similar one if you associate it to more than one (usually that's the case if the skeleton is close enough or modular). Some of the animations will contain only partial hierarchy (to be able to blend only part of the animation - for example, lower body is running while the upper body can use a different animation or inverse kinematics - shooting at an enemy during the run is a good example for that).

Now finally you get to the code part. You need to build a system that will associate the animations to the skeleton and render it correctly. This system also needs to be able to blend between animations and IK (for example - shifting between standing to running), and be able to combine several animation and partial animations - for example, walking (full body animation), looking at someone (IK for the upper body), waving a hand (IK with partial animation) and breathing (partial animation) at the same time would combine 4 different partial or full blendings.

I did not mention the fact that you need to build the importer and there is also a difference between action and the animation for the action. Action can have several animations combined or picked randomly - they will be associated via a data mapping file.

I would suggest taking a look at XNA - it has many examples, importers and much more and contains a lot of the basic stuff in libraries so you don't have to start from scratch. As people also mentioned - Blender3D is a good choice for editor+ and so might be Torque just for the experience of a game engine.

One last word - if you are going to try it out, it's not going to be a walk in the park, but hey - so much fun and the results will make you proud of yourself.

Adi
A: 

Visit Unity3d.com and you will be making your game in no time. Animations are done in the modeling software Maya, etc, but some are done in the engine. Unity makes physics easy and you are more or less creating your world and linking how objects interact.

Example - You have a camera -> You can set the camera from the UI to follow the main character and the XYZ transformation of where the camera is placed. It can also be done visually.

Check it out it is a lot of fun and less code then you would imagine. From there you can of course write your own code to do your own unique gameplay. It's easily explained as writing a script and dragging it onto the object you want the script to run on.

That's about as layman as I can get. Cheers.

TouchGameDev