What am I un-aware of?

Started by
40 comments, last by Baraclese 18 years, 4 months ago
Quote:Original post by massive-war
So why do people use c++ then? Granted, it's fast, but would it be worth the effort in game development?
Depends on your game. It's not worth it for some game genres. But things get trickier when there are parts in your game that really need the speed. Then you could write part of the code in C or C++ and part of it in some easier language. But you'd need to know two languages well (assuming you're a lone indie developer) and you'd need to write wrapper code so that C++ and the other language can communicate. Many think that it's not worth the hazzle and just write everything in C++. If their game ends up requiring lots of processing power, they need not worry about speed since they're already developing in a language that allows one to write almost as optimized code as possible.
Advertisement
I think if you learn C++ well you can learn any other languages easily, because C++ is a relatively low level language. Having control of everything let's you have the flexibility of doing anthing. But of course your purpose is one of the most important parameter in determining which language to learn. If you need to communicate with hardware in your programs than I would exactly recommend c++ however if you have nothing to do with hardware than c++ would be a heavy burden for you.
In the end most languages are compiled to machine (or byte for java) -code

The fact that C++ requires you to start with a lot of basic things lengthens development time rapidly this is why a good coder should try to reinvent the wheel all the time but in stead should look for libraries that feature the desired functionality


ok C# has its garbage collector and some other nice features, but if you design your software carefully you won t have trouble with memory leaks or horrible pointer crashes that seem to appear random


Since I use the STL I hardly have such bugs anymore. Its just a question of the right libraries and their proper usage

One think speaking for C++ is its huge source of reference code and the still huge community and a lot of people even in the industry still use c++ and will for still quite some time

What about the MONO project for linux? did they implement a good .net framework?
or did microsoft already try to stop it?

http://www.8ung.at/basiror/theironcross.html
Quote:Original post by hplus0603
In C++, you have to make sure that you don't overwrite the end of arrays, that you don't use pointers after you've deleted what they point at, and that you actually remember to delete what you've allocated when you're no longer done with it.


Comments like the above usuallly come from people that try to use C++ as they did C. Proper C++ design techniques actually make C++ a very safe and robust language to use, without sacrificing much or anything in terms of efficiency. Using std::string instead of arrays of characters, using std::vector and other containers instead of raw pointers to new'ed arrays, using smart pointers instead of raw pointers, and using iterators to iterate over a container make C++ a very elegant, safe, and efficient tool. Couple all of that with templates and generic programming and you add type-safety and the ability to catch more errors at compile time instead of runtime compared to other languages and you've got one sweet programming experience.

Unfortunately, many people aren't well versed in proper C++ design and implementation, and it could be said that it's difficult to become an expert. I believe it's more difficult to find good resources like books to learn from, but after they are found and exploited, it's not much harder to become competent than many other languages.

Unfortunately, many people still think of C++ as "C with classes", and they end up doing more harm than good by passing on their faulty knowledge.
yeah, i was surprised at university as they wanted to teach use c++

the gave us a cvs repository with prebuild classes and we had to enhance their code

it was really a mess, they used pointers all over, i think they have never heard of references *cough*

and what made me fed up was they repeated use of c strings with pointers

man whats the STL for then if they don t use it

that should just serve as an example why c++ is sometimes said to be c with classes

http://www.8ung.at/basiror/theironcross.html
Yeah, that's the other problem. Most universities don't even have a clue what they're doing.
C++ is somewhat faster and more portable than other languages (c# etc). I'm not going to get into a holy war on the subject, just to say that C++ is useful for game development since you are more or less coding to the metal (since often you want to use your own memory allocation routines, and other nasty optimisation tricks) . It also has far more opensource libraries and code examples available than any other language, which does make things a lot easier during development.

C++ has obvious pre-compiled inflexibility problems, however most people circumvent these by integrating a scripting language (ie, lua, squirel, python etc), so on the whole you still get flexibility at runtime (assuming you've designed the engine properly).

On the whole, C++ allows you to adopt strategies that may not be great examples of correct software engineering, however are nessecary to squeeze a few extra CPU cycles out for your engine, that are not possible with higher level languages.
Quote:Original post by RDragon1
Unfortunately, many people still think of C++ as "C with classes", and they end up doing more harm than good by passing on their faulty knowledge.


I agree 100% with your entire post.

It really amazes me the way some people (especially on gamedev) talk about C++ as if it were some incredibly dangerous, low-level language. Admittedly, C++ forces you to make a conscious choice to go down the safe route (pointers are still available even though you have referencens as well, using the STL over C-style alternatives, etc.), but those safer choices are there and they do work.

What I find even more baffling is the way people suggest huge gains in development time through the use of other "higher-level" languages like C#. That's very true if you're primarily developing native GUI apps, but there isn't a huge difference when it comes to game development. Most of your core code is going to be logic and neat, compact C++ code can actually be a boon for development time there.

Don't take this the wrong way: I'm not saying C++ is inherently better than any other language, but it's certainly not worse. If you're already familiar and comfortable with C++, I really don't think there's any compelling reason to switch to another langauge for large projects. Personally, most of my projects are done in C++, with tools in C# and scripting in Python. Use the right tool for the right job.
I find that if you are a decent C++ programmer, you've written your own ways to manage memory, etc or used a 3rd party library like boost. After the first or second project, those shouldn't be an issue. After that I think the time savings between game development in C++ vs Java isn't much if any. I personally don't believe language specifics to be the most difficult aspect of game development. Unless you are learning the language and game development at the same time. If that's the case, then ya, C++ has a slight learning curve in the memory management department. For a seasoned developer, this should be neither hear nor there.

Some of the issues I've had with Java are making sure that the user has a VM installed and also what version of the VM is installed. This can get tricky. For instance, lets say someone installed the oracle demo, which will install it's own jvm implementation and throw itself into the path. Now your game is trying to load with the oracle vm implementation and who knows what type of crazy results you'll get. You could spend hours trying to help a user debug this. It's a turnoff for people who get frusterated because they can't get your game to work, thinking they've installed the latested VM but really that old one was never removed and is still taking priority.

I imagine .net is a little better because you don't have all these implementations of the framework floating around. Though I'm sure there are some users who don't have the framework installed and won't want to install it just to try your game.
Quote:Original post by d000hg
People learn C++ because for most coding JOBS it is still the standard. Or because most people use it (and so most tutorials and articles assume C++ knowledge).

You might like to just get a book or something on C# which you'll find pretty similar to C++ but with some useful additions as others have already said. It's getting more and more widely used in the (no-game) industry, and also lots of people on these forums are starting to use it so you'll still get lots of useful advice!


Is it really fair to say that "MOST" coding jobs use C++?

The entire web development field, for example... does NOT use C++... and that is a VERY large field - not just for ecommerce sites, but also for all the enterprise applications sitting on the servers of all the businesses that need them in the WORLD... think of how many of these are out there...

Then you have to think about other business software (shipping applications, etc.) and even pre-packaged software. A lot of this stuff uses Java and C#, etc.

In fact, from my (small amount of) experience in the business world,when it comes to do a task - C++ is typically the last language you consider, unless there are some weird circumstances (like a true need for every last bit of juice - and no need for a GUI (e.g. a server application)).
FTA, my 2D futuristic action MMORPG

This topic is closed to new replies.

Advertisement