• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
superman3275

C++, should I switch?

28 posts in this topic

I started learning C++ some time ago, and feel I am a competent programmer. However I've read using C# and Java makes developing applications and games much quicker, and theres a less steep learning curve. I know about how dealing with bugs is easier in those languages, however that doesn't make me want to switch. Essentially, I am asking if I should switch to C#. I've succeeded in making a tic tac toe game and Simple R.P.G. in C++, and know a lot about the language. I really like C++ and so far have had fun learning how to program with it. So should I give up on C++ and switch to C# now that I'm a few months in. (For clarification, C++ is my first language.
0

Share this post


Link to post
Share on other sites
[quote name='Serapth' timestamp='1347676416' post='4980263']
Once you've programmed in a sane language, C++ feels SOOOOOOO much *more* painful. I need to make my own ??what??, to do what?? Really..... sheeesh.
[/quote]

C++ is the only sane language.

Once you know c++ there is no reason to use anything else. Unless of course you want the best speed possible in that case you would use assembly (sometimes I use it inline with c++ just for speed). As for making your own code for complicated things you can either have fun and do it yourself or use a third party library.

I tried learning JAVA, I decided it was just like c++ but slower and with too many rules. Edited by ic0de
-16

Share this post


Link to post
Share on other sites
[quote]Oh, really? Please, do enlighten us on how you write GPU shaders. Do you cobble them together from C++ macros? Or perhaps you write them directly in IL assembly, hardcore-style? Also, how long does it take you to write a tool that replaces sequences of bytes in a binary buffer? Still waiting, cause in Python I'm done: buf.replace(). Oh, yours is... what? Faster? Oh, but I was only going to use it for a 10kb file anyway.[/quote]

I'm sorry that came of so rudely but what I meant was for making games, yes scripting languages like python and javascript are great for doing small automation and I admit I use them from time to time, but if you are writing games the bulk of it is usually time critical and should be written in a fast language like c++, that said languages like GLSL are useful but they are incredibly application specific, they really just supplement other languages and not replace them.

More specifically c++ is in my opinion the best general purpose language for writing games.
2

Share this post


Link to post
Share on other sites
[quote name='ic0de' timestamp='1347715365' post='4980362']
I'm sorry that came of so rudely but what I meant was for making games, yes scripting languages like python and javascript are great for doing small automation and I admit I use them from time to time, but if you are writing games the bulk of it is usually time critical and should be written in a fast language like c++, that said languages like GLSL are useful but they are incredibly application specific, they really just supplement other languages and not replace them.

More specifically c++ is in my opinion the best general purpose language for writing games.
[/quote]
That's a lot more defensible (and I'm sorry if I came off as rude, too - it wasn't my intention). I don't really agree too much on the "bulk of writing games is usually time critical" - from a graphics point of view it's all handled by the graphics API and driver so from that perspective C++ gives you no special speed advantage. From a game logic point of view, it is true that performance matters, but usually game logic isn't all that intensive (perhaps AI). Physics can be a bottleneck, but surely you are using an existing library which is already compiled in C++ and has bindings in your language (like bullet).

Of course it's very game specific, some games are more intensive than others. AAA games sure are time-critical, but I'm not so sure a tetris, tic-tac-toe, amateur FPS or hangman needs the full horsepower of a modern processor, so in this case I would happily trade some performance for faster development time, for instance.

I'm not sure I'd call GLSL or other shader languages "application-specific". If anything they're incredibly important since they are the *only* languages that can run on graphics cards, so if you ever want to use the GPU, you must learn them - there is no going around that (though note that OpenCL 1.2 has a stripped-down-C++ kernel compiler now! though you still need to learn the API and how to effectively program with it, no more inline assembly and pointer hacks)
1

Share this post


Link to post
Share on other sites
There is no right or wrong answer. As many have said, it's not like switching to C# as your main language will mean you can never program in C++ again, so it's completely fine. If you're asking this question, though, it probably means the answer is yes. If you're curious about another language, then do what a little kid would do: Check it out. Don't ask for permission from the guys on the forums. Maybe you won't like many of the other languages. So what? Just stick with C++. Maybe you'll realize C++ is a horrible nightmare. Great! Enjoy whatever new language you're using. As long as you're programming, I don't think it quite matters what language you're using.
1

Share this post


Link to post
Share on other sites
Games programming is generally done is c++ especially the engine code. c++ is a fine language, though one of the hardest to use correctly.

Because it is such a low level language, you will learn more about computers in general programming in c++. Which is why it makes such a great starting language, when you decide to learn something like c# and java you will appreciate all the work they do for you. And learning them will be really easy.
0

Share this post


Link to post
Share on other sites
Why would you completely transfer from the use of one language you already are competent in all to seek learning a new language, when you can be competent and use C++, and many other languages, libraries, engines, etc.

C++ is not perfect and no language will be, but knowing more languages is always a bonus.
0

Share this post


Link to post
Share on other sites
When I was a young lad in the early 90s - assembly code and C++ were still really the only things worth my time learning if I wanted to make games. But if I were starting today, C# would seem like the smart choice.

Right now, if you want to be a AAA console developer, you still need C++ and I wouldn't expect that to change for the next console cycle. But current gen consoles and handhelds already support (and feature) smaller scale games written in managed languages including C# and Java. Android games are written in Java. 10 years from now, console development could look a lot different.

I work for a PC developer that has had two games published in the last 2 years - one is built on a C++ engine and the other on a C# engine. When I started my current job a few years ago, I spent some time in the interview with the studio head looking at a demo video for Unity 3D, with him (a veteran programmer from the days when only assembly would cut the mustard for games) enthusing about it. Now we have two Unity projects in the pipeline.

IMO Java and C# are superior to C++. C/C++ has long since been shunted to the sidelines for commercial software development and is already being voted against by indie and AAA game devs alike. I wouldn't bet against managed languages taking the place currently occupied by C++ in the industry in the near future.

Performance already has a lot less to do with the language used than it did 5 years ago. The benefits of languages (like C#) that lend themselves better to software engineering principles, more rapid development, and fewer bugs, are getting more attractive to developers and producers alike.
0

Share this post


Link to post
Share on other sites
[quote name='ic0de' timestamp='1347715365' post='4980362']
t if you are writing games the bulk of it is usually time critical and should be written in a fast language like c++,
[/quote]

Although, when you're writing a modern game, the stuff that's [b]really[/b] time critical is the stuff that's running on dedicated hardware. A GPU shader (whatever language it's written in) looks the same in a C++ game as it does in a C# game as it does in a Java game as it does in a Python game. What you then become concerned with, more than the algorithms running on the CPU, are the overheads involved in making graphics API calls. The worst benchmark I have ever seen comparing C++ to Java is one that concluded Java was bad at OpenGL because it took much more time to make a single immediate mode call to the GPU. People still often cite this benchmark and others derived from it as a reason why managed languages would perform badly for games, despite the fact that no modern realtime game would be making a vast amount of API calls per frame (much less using immediate mode!).

In broader terms, all languages have their own pitfalls when used naively. Just as C++ programmers have to understand the platform their code will execute on, so Java programmers and C# programmers need to understand the JVM or the CLI to write well performing code. e.g. much the time when Java programs are a lot slower than their C++ equivalents, it isn't because of the overhead of the JRE per se, but because the way code is written is causing unnecessary extra work in that layer by invoking the garbage collector too often. Quite often, when C++ programs are less stable than their Java or C# counterparts, it's because the programmer is ignorant of the memory leaks they are causing, or of precisely what they're doing with pointers. etc, etc
0

Share this post


Link to post
Share on other sites
[quote name='JamesTheNumberless' timestamp='1347745352' post='4980484']
I wouldn't bet against managed languages taking the place currently occupied by C++ in the industry in the near future.
[/quote]

I wouldn't be surprised if C#/.Net based languages took the place of C++ for many things, although I suspect you'll end up with a mixed mode of things. Some stuff, like the rendering backend, might well stay in C++ but higher level logic might well shift to C# and the like for ease of development with the option of pulling in C++/C/Unsafe code as an optimisation.
(I say this because as good as compilers are there are still times when you need to get in there and hand massage some intrinsic based vector code into the mix because it simply can't do it due to lack of context about the operations being performed.)

Maybe this will finally get game play programmers to think in terms of 'threads' and 'tasks'... *sigh* Edited by phantom
2

Share this post


Link to post
Share on other sites
Well, I try not think of myself as a C++ programmer, but simply as a programmer, with C++ experience.
I've already gotten my hands dirty with Java, Asm, Pascal, C#, Lua, Phyton... Even some more 'alternative' languages like Prolog and Haskell for a couple of weeks each... The fact is, when I need a language for any reason, I'll learn it the best I can, and it is usually enough. If I need some reinforcement, my library will get an addition...

Try not to shackle yourself up to a language, or it will you down a lot when doing something. Sometimes you can learn a language and program your tool faster than you would if you were trying to do it with your favorite one. [color=#696969][i]Ever tried combing your hair with a knife?[/i][/color] Edited by dejaime
0

Share this post


Link to post
Share on other sites
I don't see why there's a need to "switch" to a language from another one. From my limited knowledge, it's my understanding that once you've mastered a lower level language such as C++, you're able to accomplish MUCH more than you ever can from higher ones, such as C# or Java (which both require virtualization) Instead of "switching" you should be "adding".

The good thing about Java is that almost EVERYONE has the JVM, so programming in that will mean almost everyone will be able to run your programming. Also, you don't have to worry about optimization for every machine on the market. The bad thing is, being it's a higher level language, it will run slower, and you have less control over what the program can do.

The good thing about C# is that, with XNA, you can make games for the XBox. The bad thing is the craziness you have to deal with when trying to monetize said game. From what I understand, it's friggin nuts trying to deal with them. With java, you can make games and sell them on countless websites, even Steam. Then again, you can do the same with C#, I would imagine.

The moral is, don't SWITCH your language...add to your repertoire! Don't stop using C++ while you learn other languages, continue keeping it fresh in your mind and fingers, and when you start to feel like you've brought yourself up to par with your knowledge in another language as compared to your knowledge in C++, either learn more in C++, or add another language! From what I understand, every language can do everything, but some languages do some things better than others. If you know all these languages, you'll know what's good for what, and what you should avoid using for such and such!
0

Share this post


Link to post
Share on other sites
Agreed with many posters. Different languages have different strengths. Learn other languages AS WELL. Looks good on the resume too. As far as high level vs low level... I like to view it as driving an automatic vs driving a manual. For the ultimate in performance, drive manual. But be warned, if you're a bad manual driver you'll leave your gearbox on the road if not crash and burn. Myself, I'm happy to drive auto these days, as most of the time I just want to get from point A to point B with the least effort.

C and C++ are great for learning how computers work (as is assembly), good for writing super-optimised functions, and they're good for accessing low level APIs. But trying to find/write the right library to do something I consider standard, dealing with memory allocation/deallocation, header files, pointer arithmetic, arcane parameters and return codes from Windows APIs? Yech. Not for me.
0

Share this post


Link to post
Share on other sites
Do not switch, at least not for the reasons you listed.

I was in a similar situation, I was coding in C++ for many years, then I thought I am too outdated and should switch to the modern Java. I tried it for a week and... switched back :) Yes, these other languages have some nice tricks (loved the Java string manipulation, C++ without doubt have it far too primitive), no doubt, still... I simply have not seen that much difference between Java and C++ (Java lovers, feel free to kill me for this statement :D) except that my old habits were not working anymore. Plus C++ has advantages on it's own. Maybe if you were starting and deciding which one to learn without already having prior experience, then maybe, just maybe...

Also, take into account your "I really like C++" part, I think such statement adds +2 points to the language desirabilty :) Likes and dislikes are very important and will affect how efficient you are with that language, even if the language was inferior on it's own (not that I imply that C/C++ is inferior to anything, I'm C++ lover too :))
1

Share this post


Link to post
Share on other sites
[quote name='Acharis' timestamp='1347876259' post='4980828']
Do not switch, at least not for the reasons you listed.

I was in a similar situation, I was coding in C++ for many years, then I thought I am too outdated and should switch to the modern Java. I tried it for a week and... switched back [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] Yes, these other languages have some nice tricks (loved the Java string manipulation, C++ without doubt have it far too primitive), no doubt, still... I simply have not seen that much difference between Java and C++ (Java lovers, feel free to kill me for this statement [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img]) except that my old habits were not working anymore. Plus C++ has advantages on it's own. Maybe if you were starting and deciding which one to learn without already having prior experience, then maybe, just maybe...

Also, take into account your "I really like C++" part, I think such statement adds +2 points to the language desirabilty [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] Likes and dislikes are very important and will affect how efficient you are with that language, even if the language was inferior on it's own (not that I imply that C/C++ is inferior to anything, I'm C++ lover too [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img])
[/quote]
I like development in C++. however for home projects I switched to C# as I know both languages anyway. But the reason behind the switch for home dev in C# is more that I rather like writing code that is useful instead of having to write layers of biolerplate code before I can actually do the thing I want to. I only want to spend an hour here and there at home, I like to do other things as well in my own time then sit in front of a PC, I do that at work, where I do use C++, for 8 hours on end anyway.
0

Share this post


Link to post
Share on other sites
[quote name='Acharis' timestamp='1347876259' post='4980828']
I simply have not seen that much difference between Java and C++ except that my old habits were not working anymore.
[/quote]
To effectively use a new language you really need to develop new habits in line with the idioms and common usages of that language. Using Java (or C#, or Python, or...) the same way as you use C++ will not yield an ideal experience.
0

Share this post


Link to post
Share on other sites
Well, I stuck with C++ and have started learning SFML. So far I've programmed the bulk of pong (Without a tutorial!). All I need to do is fix the collision detection when I get home and add an extra line of code to the enemy A.I. I hope everyone isn't that mad at me for that "Definitive Language War" Thread, Most of that stuff was pulled from here. :(
2

Share this post


Link to post
Share on other sites
In my opinion, you shouldn't really *switch*, learning more languages will just expand your job opportunities, and also solve solutions to other languages problems, and vice versa.

For example:
C++ has an issue with cross-platform compatibility, like if on Windows you write it, you have to write it differently for Mac, and Linux. Java solves that problem. "Write once, run anywhere"
Java has an issue with how you have to download a JRE, and install it; plus, Java is not RAM friendly. C++ runs off the OS it's running on.

Also in my opinion, Java is more effective than C++ because Java is MUCH more easy to learn than C++, therefore making it a great beginners language, next to Python; and Java includes it's own graphics and GUI libraries.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0