Page 1 of 1
C++ API for Game Engine?
Posted: Sat Apr 29, 2006 10:00 am
The Game Engine can be manipulated in Python but I was wondering if it can also be accessed using C++. As a C++ programmer I believe that any other language will simply be much slower and will therefore impact performance.
Is there a C++ API for the Game Engine?
Posted: Sat Apr 29, 2006 10:16 am
Never mind. I found the answer on the Elysum forum.
It is and it isn't possible it seems. It's possible if you have in-depth knowledge of Blender but it's not just a simple API.
For performance reasons I'd like to see a C++ API.
For know, I'll try my hands at Python, though. Although I don't really like learning a new computer language, it seems I have no choice.
Posted: Sat Apr 29, 2006 11:47 am
Hello, Blender use some engine, Sumo and Bullet.
Bullet is a library (this is the more recent) you can download it from http://www.continuousphysics.com/Bullet/index.html
Posted: Tue May 02, 2006 7:56 am
I think this is the first time I hear of a C++ coder wanting to use the Blender GE, usually it is more the GUI users complaining that they have to know programming at all to overcome something that is not feasible with the logic bricks
I don't know what the Elysiun thread discussed, but I dont think adding a C++ API would be impossible at all .. at least if you just hack it on top of the Python API, which is just C(++) functions anyway.
But mainly my comment to you is that for a programmer it is often good to learn new languages - many good programmers I know now tens of languages. They may teach you something.
Also, Python is usually well fast enough for game logic - the compiled engine is doing the typical CPU intensive tasks anyway. For example Civilization IV uses Py for gamelogic, and OTOH people have written fast paced arcade games in it too.
Feel free to report back your experiences, would be interesting to hear the stumbling blocks. One thing you should know is that in Python everything is a reference, also everything is always passed and returned as a reference (in C(++) terms you can usually think that every variable is a pointer). That is different from e.g. Java where things are passed and returned as values. If you would be coming from Lisp, you might also be interested in the fact that also functions and even classes are objects in Python, so you can also pass and return them to functions, but that is perhaps not so exciting from a C++ background
(btw Lisp has been used in e.g. Nintendo games)
Posted: Tue May 02, 2006 9:42 am
an-toni wrote:One thing you should know is that in Python everything is a reference, also everything is always passed and returned as a reference (in C(++) terms you can usually think that every variable is a pointer).
do simple ints and floats get passed as reference too?
Posted: Wed May 03, 2006 6:35 am
Immutable objects like floats, ints, tuples, etc I think are passed as a reference as well, but it doesn't matter because they are immutable
You can treat them as values.
It seems like it would be really stupid to make a c++ api based on the python api. Better would be to improve the engine coding to the point where adding new features on to it are like working with a c++ api
Posted: Wed May 03, 2006 7:13 am
ah, thanks! i got slightly confused by this.
Posted: Wed May 03, 2006 10:46 am
If you look up shedskin,
it can be used to give python close to native C++ speed, however you need to do a bit of C++ programming to make use of it.
I'd recommend learning python, it is a beautiful language and very easy to learn and very powerful.
Then if the python is a bottle neck, you can use shedskin to gain speed where needed.
Posted: Wed May 03, 2006 11:10 pm
I think bigpilot is more interested in having an easy C++ layer for people who want to link their own language directly to Blender and use it programaticaly.
Something like Blenderapi.dll, Blenderapi.obj for windows and Blenderapi.a for mingw or linux with a bunch of header files so that people can make the linkage to whatever scripting language they want to use with Blender.
No doubt that Python is powerful but that's not the point. Also this isn't about downloading the source, compile it and link it ourselves to whatever parts of the Blender we want. This C++ layer is already made for python so the only thing he needs to do, i believe, is to download the source compile Blender into a bunch of .dlls and create the necessary object libraries. This should be easy to do right?
Posted: Sat May 06, 2006 12:11 am
All I'm saying is that a c++ api on top of the python api would only be gaining familiarity for c coders - and as a c coder python really isn't a stretch to learn. If it was lower level, that would be cool, but I think that any new api's shouldn't be just bolted onto whatevers there. The engine should be well designed to work well with the api.