When you so called pros/cons of c++, people tend to mention AI and powerful as pros. Why so? Doesn't power depend on the capability of a computer and the storage of an app; and aren't most common languages capable of, at the end of the day, making a simple AI? My question simply is why should these be listed as pros if most languages today are also capable of doing this?
> When you so called pros/cons of c++, people tend to mention AI and powerful as pros. Why so?
I think of
a. the ability to support high level abstractions at minimal cost and
b. first class support for RAII
as the two major strengths of the language.
C++ is good at high performance computing. It does not bog the code down with unnecessary hidden babysitting features like garbage collection or bounds checking -- the programmer adds that if wanted and skips it if not needed.
C++ has nothing to do with AI. AI programs can be coded in C++ and often are because of the performance I mentioned, c++ does not directly support AI nor was it designed to do so (there are, or were, a couple of languages that were designed for this type of coding, but they may be defunct now). Yes, any language can make a simple AI (think what, tic-tac-toe?). Ive coded that one in a spreadsheet using cell formulae! But now talk about a complicated one.. again, its the performance. When you start running millions of sums of products through a big network or loads of data through even a smallish one, poor performing languages will be sluggish in places where c++ is not.
Power is how you define it, but I would say most people are referring to the fact that the language does not prevent the programmer from doing things. Some languages do prevent the user from doing various things like using pointers, embedded assembly, recursion, or other such things.
C++ is an old language, so it has a LOT of libraries and tools available.
c++ is very friendly about mixed language programming, so you can write parts in other languages if the other language is better at some task.
The list of pros is subjective to whoever was making it. My first java book, the first chapter was a list of crap about why java was better than c++. The entire point was that the author didn't like c++, probably because he didn't understand pointers and how to code with them without screwing it up-- at least that was MY takeaway from it. (I have nothing against java, just that author, lol). AI being a pro is sort of circular logic... a lot of AI stuff was written in C & C++, so because the tools and libraries are there, a lot of AI stuff continues to be written in C++ … tie all that together, c++ is a high performance OLD language... back when a CPU had 1 core and was trucking along at 100 MHz instead of 4GHZ, c++ was already established in the AI field, and we used it because the slowdown between languages was much, much more of a problem at those speeds than it is now. Even a slow language can do a LOT of work on today's computers, but c++ established itself in the AI field when that was just not possible.
I've never heard AI mentioned as a pro of C++.
And of course the power of the machine is important, but C++ can potentially use the machine more efficiently than some other languages.
Thank you ever so much for putting that efforts and heart into your post, jonnin! I read the entire post in awe, I've never been so happy to be able to code in c++! Currently making first game in cocos2d-x, I was just getting cold feet on if it'll make my games run quick and smoothly.
Rascake you shouldn't be bothered about 'performance' when you try to pick something to develop with. Just my opinion. You must choose something that is convenient for you. Because the fact of the matter is, because of how computers have evolved, the 'performance' difference between languages, say, is not something an indie developer like you should be worried about.
If it were the case that performance should be opted over everything then everybody would be writing in assembly right now. So you should know that its your choice. There are some environments for game development that even kids can use to connect dots and make a game out of it. Then of course there are limitations to what you could do with it.
And so you should pick the perfect balance for you. I know you're doing good with cocos2dx though, because you're really very active on their forum (you were when I saw a while back when you had asked a question about cocos2dx over here) so I guess you should stick with it. But I was just saying my opinion.
And so you should pick the perfect balance for you. I know you're doing good with cocos2dx though, because you're really very active on their forum (you were when I saw a while back when you had asked a question about cocos2dx over here) so I guess you should stick with it. But I was just saying my opinion.
You're right, previous cocos2d-x projects haven't even really proven laggy. You could say I've become "nationalist" towards cocos2d-x
you need a pretty beefy task to notice performance problems for sure. To put in in perspective again, we had an embedded system running OCR on video and it had to process each frame, I think the camera system we had rigged up for it did a whopping 10 or 15 fps. The AI we built for it was a severely bloated thing that included segmenting the image (at times, pixel by pixel) to search for 'likely letter' shaped things, then pushing all those through the OCR AI... and it did fine on a system from before year 2000. The amount of what you can do on even a 5 year old machine is staggering. Don't worry about it too much. Its FUN (at least for me) to make stuff go faster, but its no longer the constant driving goal; hardware is just too good now.
I see. You see I am planning to make a Hex game in cocos (https://en.wikipedia.org/wiki/Hex_(board_game)), but Hex ai will need to be very intricate. as in Hex there are MANY possible moves and several possible wins. I wanted to know if c++ would make this any easier
the pure language c++ won't really help much. Libraries for AI will, but those exist in other languages too. There is no easy way out... just pick a language that has the tools you need that you like to code in and use that one. This sounds a little chess-ish, eg looking at possible moves ahead and selecting the 'best' one... thats been done to death and plenty of how-to on the topic.