Sign in to follow this  

Character Programming

Recommended Posts

??????????    100
Hello everyone,

This is a very broad question...I apologize, and I hope this is an appropriate topic to discuss on this forum. I am learning some C++ right now and understand how some aspects of that can be applied to games in general. However, I am curious about how game characters are actually programmed? I know that modeling, rigging, texturing and so forth is done via software like Softimage/Maya/3ds Max, etc. and that these end up being imported into game engines and what not, but what is the next step after that? What kind of programming/scripting languages and methodologies are often used in getting characters actually ready be responsive to player input to do the things that they need to get done? Where is the line drawn between the programming and the creative sides of gaming?

Again, sorry about how ridiculous of a question this must sound...I'm just very interested in what makes all of our favorite game characters tick.

Can anyone please explain or point me in the right direction to learn more about this on my own?

I really appreciate it! :-)

Share this post

Link to post
Share on other sites
lauris71    841
I think the best way would be to download some free game engine (actual game engine, not simply rendering engine like Ogre) and look, how such things are implemented.

I am not professional developer, so I can only tell, how I am myself implementing things in my project.

In minimum there should be the following layers:

[list][*]Game world with at least minimal physics - i.e. ground height calculation, collision detection (impenetrable objects, active objects, NPC-s), proximity testing (is any enemy close to you) and so on.[*]Rendering code for game world (environment, objects, animated characters)[*]Animation controller - this can play, mix and possibly synthesize required animations. May interact with game world - for example detection of ground height, to adjust walking animation appropriately[*]Character controller - has to interact both with animation controller and game world. Implements high level movement - like walking to certain direction, stopping if movement ahead is not possible, hitting enemy with sword and so on. It gets data from game world, instructions from player/AI and asks animation controller to play specific animations.[/list]I think these layers are normally implemented inside game engine. Scripting is one level above character controller, controlling things like what to do if you meet some specific character, how are your health affected by enemy attack and so on. Of course, good engine implementation allows you to control lower level things by scripting too - like creating specific characters from data (model(s), animations, animation graph definition and so on).

Share this post

Link to post
Share on other sites
NickGomes    142
Generally 3D artists will animate the models used in the game using skeletons and key-frames that dictate the position of the object's mesh in 3D space . When they save their fully animated/textured/modeled every single vertex/keyframe/texture coordinate is output into a file format of the artists choosing. Next the model data is generally parsed from the generic file format into a file format that better serves the game engine. During the run-time of the game, a resource manager will decide when its most appropriate to load that data from disk memory to RAM (load times). Now when you press the W key and see your character moving there is a whole hell of a lot going on but to generalize, an input handler will fire an event saying "HEY HE PRESSED THAT KEY THAT DOES STUFF" and any of the subsystem listeners(physics/animation/rendering) that care will go into their appropriate subroutine for said event. Now scripts allow you to adjust engine behavior after the game is compiled and running. Basic scripts will generally allow you to adjust health, name, text, or physics properties. Advanced scripts will actually expose engine functions for you, allowing you to modify AI behavior or adjust animation hierarchy details.

I mean your asking a question that not even 600 page books can fully cover :)

There are some good introductory book for game engines:
Game Engine Architecture by Jason Gregory or Game Coding Compelte 3rd Edition by Mike McShaffry to name a few.

And if you really want to see it in action look at Quake 3's source code or even come up with a game idea that will make you code your own (Always develop games....not engines)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this