Hi ;
I am a newbie, and here is my question : how do we make games using blender ? Do you only use Python ? Can I use Python and blender combined with some other compiled programming language like C or C++ ?
this is the answer I received in blender’s forum

"you don’t need to use python

it helps

you can’t use c/c++ without either:
modifying blender or
writing your c/c++ as a python module
ask on more “how to do such and such in blender” questions"

I don’t get it…

What I am saying is : I don’t want to use blender and export runtimes - I want to make an application myself able to use the files created by blender - for example if I make 2 different characters - how can I make a program (with c++) to make them move and control their collisions and everything ? is that what we call a game engine ? how is it supposed to read for example the files containing the 3d charaters…

I am kind of lost here and I would really appreciate an answer to my question or any link to a nice tutorial.

  • thank you very much for your replies - :smiley: ?

ah, now that is quite different

you’ll need to write a python exporter to your model format, and write your engine and stuff to load these files

I did this once, with an incredibly simple exporter [format was text and supports only triangles, and vertex colors. it also stored normals but the display routines didn’t use them: no lighting], and a 1500 line [c] game.

If you haven’t done anything like this before it is a good idea to not bite off more than you can chew [so that is so hard you’d give up].

well anway, if you get bored, you can look at my code [no makefiles, sorry linux users, you’ll have to do that: it must be linked to SDL and opengl iirc] on [copy/paste] (1.2Mb)
[a couple .blend files with my exporter are there too]

windows binary: (725k)
linux binary: (847k)
[I don’t have the how you play docs in them, and I really don’t want to explain it right now]

well anyway, I should probably get around putting a license block on that source code [atm it only says it is copyright me], oh well. don’t steal it, it isn’t worth it [except maybe text.c]

oK so how do I make a program in c++ which loads files containing the 3d objects or whatever ? I want to manipulate blender files with an external program ? is it possible ?
Thanx for your replies

Well I guess what I am trying to say here is : is it possible to build an external c++ program which loads and controls an animation (its frames or propreties…etc) made with blender ? if yes , how ?
Thanks for your replies

again, you’d have to export it from blender, probably to your own format

it isn’t trivial to simply load a .blend file in a game

As zero already mentioned:

You’ve got to write your own game engine, either writing it from scratch or using a game engine framework like for example Crystal Space, Irrlicht or Ogre (Use Google for finding their websites.).

If you’re writing your own engine from scratch then write a loader for any of the many 3d file formats that Blender can export. If you’re using a framework then export your objects in a format that the game engine framework can load. Same thing with textures.
Some frameworks have a basic collision detection and usually don’t have any physics. You’ve got to write your own physics engine or use an existing.

If you want to export the objects with any logic bricks then you’ve got a problem, because you can’t access those from Blender Python yet, AFAIK.

For explaining how to write your game with C++ this doesn’t seem to be the appropriate forum. Also, you can’t expect people to tell you how to develop your own game engine in a forum. Do a little search, learn how to code, learn how to use a game lib and then ask specific questions that match the problems that you’ve encountered in the appropriate forum. Asking “how do I write may own game in C++?” is like asking “how do I build my own moon rocket?”…