I recently started learning C++ from online tutorials.
What i want to do is simply “set” the blender game engine to exchange data with c++ functions that i write intsead of scripting python or using th built-in logic processor .
I think this is possible by recompiling the engine and adding functions on naked code.
hold on, relax. Lots of commercial game engines are in fact scritping engines. It is A LOT easier. Why? I wrote my onw engine, and at some point the compilation was already like 1-2 mins, though it was a very simple program. Compilation of BGE may take hours.
Also, rendering is run by GPU. So, when you send data to the video card - it is only the video card that limits performance. Scripts run on CPU.
Sounds cool and I may be wrong but I think it ought to be doable I seem to remember reading the engine was built in C++ as were Logic bricks so they ought to be accessable somehow.
Panda3D, another free game engine, supports python and C++. I would suggest using it. If you are familure with blender modelling and such you can always model in blender and just import the models into Panda. The engine is based off of scripting only (no logic bricks or nodes). Good luck!
if you can find a middle gound -like… if you hate how one language handles classes or whatever, you can somehow make a program which include whatever interpreters you need, and only use the language you don’t like much to call functions, and the one you like to write the code that does the actual work…
-you might need to think about a way to order your data in a file type that either already exists or one you come up with on your own… (this would be your middle ground, and all you’ll have to do is learn how to write and alter this file (or files) and read in whichever language you code in…
but in doing so you’ll be creating a bottle-neck… but if you have more than one working simultaneously…
(seems more trouble than it’s worth, but it’s not at all strange… xml might be fun for you to meddle with)
Can’t you already code C++ scripts right into blender? In some of the files that Twilight 22 gave out they where writing the really intensive visual stuff in C++. If it’s not supported it should be.
Although I highly recommend using python and then converting python into C++, if you need to. That’s how the industry dose it and that’s because python is a lot like C++ only 10 times easier.
Other alternative it’s to do your modules with dotNet and use CLR to integrate it with python.
So as you can see learning python would be a great idea IMO:) You will not be able to do only C++ coding to make a BGE game. You will need scripting eventually.
The problem using C++ in bigger projects is, that C++ code is not readable compared to e.g. Python code. A lot of work gets wasted writing code which nobody understands. That is the main reason one should avoid C++.
Yet stil, these are not arguments when selecting programming language. The language grammar dictates the average style of written programms, and the grammar of C++ is quite a mess by itself. There is no reason why you could not become a good C++ programmer, but compared to modern languages it means more work.
From scratch? Well, yea, if you’re on a quad core system and you set the -j option to 4 (assuming you’re using scons). However, if on a single core machine, it takes more than an hour.
But that is a good point you bring up; compilation times will be a significantly lesser problem in the future, because it’s one of those rare things that can be spread over several processors quite easily.
However, higher level languages, like python, are still more comfortable to work with, in almost all cases.
Absolutely. This is, in my view, the right way to do it.
Learning languages really is not hard once you know the basics of programming. You change only minor things… like how you declare objects/classes/methods/functions, how you call them, and some other basic things.
It’s easy to jump languages… if you are fluent in one, you might spend a few hours to a day learning the specifics of another one. I’d say my first language that I could actually program in was Java, and from there I went to Python, then to C, and now all of them are very easy.
I’d focus less on learning C++ and more on learning programming basics like how object-oriented programming works, what compiling actually does, etc…