Let's pick a fight :) Not with Gadaffi, but with the C++ camp! NAVO gunships ready? C++ Anti-Aircraft guns ready? Propaganda machines ready?
Are you like me, doing 100 things at the same time for your projects? Yesterday it was ambient lighting, today controls, tomorrow a sound system. Professionally-wise, probably not the best way to get things done. But, since I'm not making this game(engine) on a professional basis anyway, I don't care. As long as it is fun. Motivation is key-factor #1 when it comes to accomplish big things.
So, one of the tasks is updating the sound module to FMOD. OpenAL is nice (and free), but FMOD comes with free coffee, bonus points, and a cool badge. For example, FMOD has a tool called Designer to make the sound libraries. It supports many formats. It does a lot of memory and sound priority management for you. It is multi-platform. It has 3D reverbs. And especially sweet: you can define 3D geometry for sound occlusion. So, I'm making a DLL wrapper, see pic. More details will come when I'm done implementing it.
Engine22? Yeah, we figured a name would be handy. Not the most creative name ever, but I like simple names (Like "Source", brilliant). It doesn't imply to be the best thing since sliced bread. It just does what it's supposed to do: Run Tower22!Funny detail. Instead of Delphi, I chose C++ to write this wrapper DLL. For two reasons: don't want to make FMOD headers. And B: it's good to refresh the skills once in a while, it has been a while. I use C pretty often for microcontrollers & shaders, but it’s really not the same as C++. The problem of using less popular languages like Delphi, is that you have a limited source of info, downloadable units, examples and forums with helping hands. Then again, I always get reminded why I like Delphi so much when doing C++. First, the old MSVC 6.0 IDE was kind of minimal comparing to the rich Delphi IDE. That changed with MSVC 2005 and higher, which is an excellent environment if I may say so. However, old grumpy C++ himself didn't change a bit of course.
How to put it... C++ is like rocket science, playing with dangerous Godlike powers, reinventing the wheel every day, talking old traditional Chinese to kids, baking a cake with the CERN, flying a thunderbird VI with Russian instructions, reading the entire Bible every day just for fun, sadomasochism for the advanced, bit tripping, writing pyramid hieroglyphs.
Choosing the path of agony for the Greater Good.
First there is C. Basic, pure, yet mighty. Kind of cryptic when comparing to more readable languages like VB or Pascal. And of course, pointers don't have remorse for beginners. But you'll love it as soon as your microcontroller is doing a LED disco. You don't need to understand the whole concept of OOP, mastering hundreds of libraries, API's, frameworks or design strategies made up by other people. It's just you and C, blood brothers. Type what you want, and go.
Then there is C++... The evil little brother of the old friendly giant C. Still pure compared to other languages, not that much different at a first glance, but expanded with OOP in a rather horrible way. Not horrible in a functional sense - it's probably the most powerful language there is - but horrible in terms of user-friendliness. Where other languages tried to simplify things by presenting coding strategies with some human-logic, C++ took the bumpy path.
The already difficult syntax got even more tricky, and countless of options and boobytraps will make sure the newcomer pees his pants. I wasted hours and days, with vague errors. The compiler doesn't help you with "look here sir, you can't assign text to a numeric value.". Instead it barks angry C++ compiler messages that require a translator. And once you thought you solved them, the program still doesn't run because of that #@#$! Linker. Things got re-declared, Header files included in a wrong way, strange symbols, whatever.
Off topic. Another room for the next demo in progress. Far from done though, all the interior objects still have to be made, and all the textures have to be replaced with our own work. But ok, previous week it was still a MS Paint drawing.I know, it's a matter of learning. And still, C++ is the most popular language when it comes to gaming engine. Because of its purity, and thus potential performance (IF, IF you use it right). And probably because "the others do it" as well... ? So, the good news is that there are many forums and helpers on the internet to save the day... However, it strikes me that many C++ programmers are just as user-friendly as their language is. Jesus Christ. While other communities are relative friendly, helpful, and patient, the C++ disciples are strict and edgy. Little Jimmy, 8 years old, from Illinois wrote:
"Dear friends,
why is this not compiling:
. float factorDiv = 1 * 2 + 3;
. int a += b; // <- error
"The first answer never try to advise something. It's just: "Is this C or C++?(angry)". "Which compiler are you using?". "I can't solve the problem without seeing the entire code". “read the forum rules.”, or "why are you using factorDiv"? Valid questions maybe, but the undertone is like “get lost boy, we don’t take your kind around here.”. Yes, you should feel stupid.
It's if those C++ guru's are frustrated by their own difficult language. Pissing about small details, and always in a bad mood. Ok. ok, ok... a little nuance. It's not all that bad of course. I got helped more than once by C++ guru's, in a kind way. And remember, languages don't put spelling or grammar errors on paper, you do. And... it has to be said, some guys just don't know how to ask. How many times I've read something like
"Hello. having probs wit code blow. could u look @ it plz? I ned quick reply becuz this is
for school tomorow :#
--- 500 lines of (shit)code ---
"Yet, while searching the internet when having a Johny Quest error message again, the atmosphere in some C++ forums is just different. This language is the hardest to master, maybe that brings some arrogance to the pro's. But allright, my C++ DLL runs now, and it can be used by a Delphi program. Not without a struggle of course. C(++ whatever) thinks it's a good idea to change the export names of your functions. Even when using declarations like
-
extern "C" __declspec(dllexport) void __stdcall lickMyButt(){}the "mangling" still happened. I had to use "dependency walker" (nice little free tool to analyze the exports of a DLL and what other libs it needs) to discover why my Delphi app couldn't find the entry-point. Strange, because another DLL with exact the same declarations DID work. When replacing __stdcall with __cdecl, the problem was gone. Uh... ok. Trying to find a logical explanation - no way.
Call me a n00b R-Tard amateur, but how come that ALL other languages I know don't have this crazy backstabbing tricks? I know why C++ changes names: so you can overload the functions with different parameters. But why not warning about it, or disable name-decorations and forbid overloading export functions by default? I'm sure the C club has arguments, but fact is that other languages solve this problem with ease.
Just another typical C++ struggle I had last days. Hey, C++ is not crazy, the rest of the world is crazy. But it works now, and especially with a hardcore language like C++, that feels good.
What kind of sound to put here?Compiling:
error C4430: - 22 bad-English syntax errors - \blog.h 46
error C2310: - 3 falsehoods found - \blog.h 47
warning: - don’t take it all too serious! -
Happy debugging! --