Advice and roadmap for a particular project?

Hello all, I’m learning blender and c++ for a project I have in mind, and I need a bit of direction as to what steps I should take. In windows (and perhaps later, port to linux), I would like to be able to manipulate a 3D figure I’ve modelled and rigged in blender, and do it in a window. The basic idea is I fire up the program, and a 3D figure sits down and via AI or random number generation, moves in either a premade animation, or via puppet control (individual limb rotation and movement).

I’m not unfamiliar with programming, and I’m willing to go through the docs, and although I’m a bit afraid of low level matrices and would like to avoid it if possible, I would still consider learning the math required. I’ve browsed the crystal space 3D site, and am still trying to figure out where to begin there.

Basically I’m asking:
Where can I go to learn how to import a blender3d model into a c++ program and use the rigging?
Do I need low level 3D math to do this?
Would it be easier to use an engine such as Crystal Space?
Where is the Crystal Space 3D blender related documentation?
Is there an easier way than using Crystal Space 3D?
If so, where?
Would I be able to put this into a window?
Where do I look to learn about that?

I hope my questions aren’t totally ignorant, I realize I’m at the beginning of an abyss, so I’m not expecting to finish this in the near future, but would like to know where to go to move the milestones. All feedback appreciated, thank you for taking the time to read this!

Where can I go to learn how to import a blender3d model into a c++ program and use the rigging?

The easiest way to do this would be to use cal3d. Do a search. There really is nothing aside from the game engine that imports a blender3d model. So you’ll have to export a format that supports animation. You could use crystal space, but it would be a big overkill since it’s a full blown game engine unless that’s what you want. You can also use Ogre, which might be a slightly better solution. The simplest of all is to use the Blender game engine. I’m not sure why your not mentioning that. Is it just that you want to use c++?

Well, for the visual stuff, it doesn’t really matter how I do it, so yeah, the Blender Game Engine is looking really good right now. (lol) I did, however, plan to control the puppet via a low level AI, and for that I needed C++.

I’ve no idea how to communicate between python and C++ (I know nothing about python) other than having them constantly read and write to an address in a single file. Would you know if I could have a separate C++ program communicate with the Game Blender Engine (and I’m supposing the python code I’ll be writing in it) as to what movement or animation needs to occur?

Why do you need C++? Any language will work (or do you have an AI api that you would like to use that is already in C++?).

As limited as your programming experience sounds, you would probably make far faster progress just learning python (it is trivially simple to learn relative to other languages - if you have any prior programming experience a few hours should get you productive in python, and the debug time is far faster since you don’t need to compile…).


However you could add C++ directly to Blender if desired, depends on the license you want your code to be under.


If I’m doing massively recursive operations and a large amount of data i/o with pointers, would I be able to match C++ in terms of speed?

nope probably not, depends on what you are doing specifically… generally what is done is write first in python, spot your bottlenecks (python has really nice and easy to use profiling tools), and rewrite as needed in C/C++ (or use python numerical or other libraries that are written in C for the raw speed…).


Does it need to be done within Blender3D or can I separate the two programs? (Thanks for all the help, by the way.)

Python is a pretty friendly language with c++, it’s generally pretty easy to make a wrapper to a dll or shared object library. There are some programs like swig that help with it. I’ve never done it though. There are also some fast python compilers like pyrex but I don’t know if they can be used with Blender. Probably, though, it would be best to get comfortable with the Game Engine first. Find out what you need for A.I. and if c++ is really necessary.

Do you know where I can get Game Engine specific docs? I don’t know anything about it, really. I’m using the old 2003 blender manual, would that have what I need to know?

Probably. There’s a reference here:

There’s the GameLogic functions here:

You’ll have to look at the examples for some of the newer bullet physics stuff.

Ah! Thank you very much :slight_smile:

I’m doing Python & C++ working together just fine. I’m creating a themed variation of checkers and my team’s goal for the AI is to be able to make a game decision in less than 7 seconds, with at least 7 layers deep into a minimax tree…python would be WAY too slow for this. I’m using boost to call a C++ DLL from python code. - site of primary development - easy installer for visual studio

it takes some setting up/including of libraries and such but it works fine. I’m having some problems getting it to work on a machine other than the one I’m currently on but I think it’ll be an easy fix (once I find it). I’ll keep you posted on progress. I’ve got another thread dealing with this same issue.

Oooh, very helpful, thank you o_o

my problem was a dependency issue, I have proved it DOES work…for now I’m locked into using it for windows, but once we get the majority of the functionality tested out I can work on getting it to be cross-platform (it’s a .dll issue, something to do with my compiler since I’m using visual studio rather than the primary build tool for boost called “bjam”)