• 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
blewisjr

Considering move to C++

15 posts in this topic

This is probably a rather pointless topic but I will go for it anyway and see where it goes.

Many here know I am a huge proponent of C. As of late I am considering a move to C++ due to some of the C++ 11 features. One such feature is std::unique_ptr.

Keep in mind I am not a huge proponent of OOP way to easy to abuse and mangle the ability to maintain code. What other advantages besides the obvious would I gain?
0

Share this post


Link to post
Share on other sites
Expanded library support. std::function, the other smart pointers. Not sure how obvious those are, though they would serve non-OO C++ programmers well.
2

Share this post


Link to post
Share on other sites
The STL containers/iterators are very useful too. Sure you can implement them yourself in C but having them built into C++ makes them far easier to work with and are more likely to be better optimized than what most people could come up with on their own.
1

Share this post


Link to post
Share on other sites
Although I am no Master at C++, I have done some programming in the lanquage. Besides being widely used ( This is the reason I am making an honest effort to switch ), I do not think that OOP is strictly enforced ! ? If you do not want to Isolate routines so that you do not want keep re-writing the code over and over vs Cut and paste. (personally I find that to be much faster in setting up a knew program, especially if I Already solved that routine say 6 times already ) you really do not have to do OOP.
I have been using OOP from my Pascal days. But I have found that larger programs runn faster in C++.
0

Share this post


Link to post
Share on other sites
C++ is a multi-paradigm language. It supports you if you want to do OOP. It supports you if you want to do imperative. It supports you if you want to do metaprogramming. It supports you if you want to do functional programming. It gets out of your way of you choose not to use those paradigms.

The biggest and best thing about C++ is it supports the RAII paradigm (which requires a certain amount of OOP). That alone makes C++ stand head and shoulders above C or Java and any other language with non-deterministic destruction. You can use RAII using only std::unique_ptr and lambdas if it's important that you avoid the appearance of using classic OOP.
2

Share this post


Link to post
Share on other sites
std::string and std::vector. I cannot overestimate their importance in managing code. String gives you a lot of clean functions (eliminates the most of buffer overruns), has its operators overloaded (that means no more concat) and is not zero-terminated (you can store whatever you like there). (C++ streams are also good for these reasons excluding the last one.) Vector gives you an easily resizable array and it stores its size for you, so no more arraysize integers. Both of them most definitely ease the development process.


OOP is great, but not everything is an object. That is why I do not like languages thet shoehorn OOP to situations where it does not work. C++ does not force you, however – it lets you choose.

There is clearly no reason nowadays why would not someone want to use C++ (except in circumstances where the STL is nonexistent). I would recommend you to switch.
1

Share this post


Link to post
Share on other sites
[quote name='Álvaro' timestamp='1355409083' post='5010230']
I don't like OOP myself. It's like nail-oriented roofing. Objects are useful constructs, but they aren't the only tool around.

C used to be my primary language, but I have been using C++ for about 11 years now. The things I couldn't live without if I were to go back to C are:[list]
[*]std::string
[*]Containers (primarily std::vector, std::map, std::unordered_map)
[*]RAII
[*]Operator overloading for math classes, like vectors and matrices.
[/list]
[/quote]

It's funny that your list from C to C++, reads almost identical to one I would create about what I miss going from C# to C++... :)[list]
[*].NET class libraries, vastly superior string handling
[*]generic containers and LINQ, especially LINQ, also not having to deal with C++ terrible template syntax and error handling
[*]sensible automatic memory management
[*]operator overloading I'm rather meh towards. So instead I will go with the lack of multiple inheritance and existence of interfaces.
[/list]


With C++ 11, I think there are a number of things you can add to the list. lambda functions, automatics, those would be useful in non-OO programming.
-2

Share this post


Link to post
Share on other sites
Thank you very much everyone. The info was very helpful. So many features I could find use for. It has been quite a while since I touched c++ at all. I will have to give the plunge a go as I think it would be excellent for my programming style. I can only help to remember what it is like to not have to manage tedious void* casting to get the right effect. I think std::function is my biggest turn on at the moment.
0

Share this post


Link to post
Share on other sites
Object-Oriented programming hardly produces error-prone, mangled code. In fact, I would say (And this is someone who came from only procedural programming to C++ around two years ago) that object-oriented programming reduces errors, nevermind making your code far [b]more [/b]understandable.

[CODE]
if (Object.size() < Object.MaximumSize)
{
Object.IncreaseSize;
}
[/CODE]
This code makes sense, rather than having to use weird structs and arrays, or collections of values that require commenting to explain the correlation. I also recently wrote an article on [url="http://www.gamedev.net/blog/1563/entry-2255490-structurec11-the-auto-variable/"]The Auto Variable[/url] (A great new C++11 feature).

As a list, well, I'm not sure. Here are some (very useful) highlights:[list]
[*]The Auto Variable
[*]Constexpr
[*]Vectors
[*]Objects, in General
[*]auto pointers
[*]weak pointers
[*]etc.
[/list]
There are just far too many great C++(11) features. C hasn't been updated since 1999, also, which means many C++ features that are commonplace in many programming languages now might never reach C (However I hope they make a new standard, it's definitely rejuvinate the language). Edited by superman3275
0

Share this post


Link to post
Share on other sites
[quote name='superman3275' timestamp='1355456670' post='5010458']
C hasn't been updated since 1999
[/quote]
Well, there is the C11 standard, which came out in ... 2011.
2

Share this post


Link to post
Share on other sites
[quote name='superman3275' timestamp='1355456670' post='5010458']
Object-Oriented programming hardly produces error-prone, mangled code. In fact, I would say (And this is someone who came from only procedural programming to C++ around two years ago) that object-oriented programming reduces errors, nevermind making your code far [b]more [/b]understandable.

[CODE]
if (Object.size() < Object.MaximumSize)
{
Object.IncreaseSize;
}
[/CODE]
This code makes sense, rather than having to use weird structs and arrays, or collections of values that require commenting to explain the correlation. I also recently wrote an article on [url="http://www.gamedev.net/blog/1563/entry-2255490-structurec11-the-auto-variable/"]The Auto Variable[/url] (A great new C++11 feature).

As a list, well, I'm not sure. Here are some (very useful) highlights:[list]
[*]The Auto Variable
[*]Constexpr
[*]Vectors
[*]Objects, in General
[*]auto pointers
[*]weak pointers
[*]etc.
[/list]
There are just far too many great C++(11) features. C hasn't been updated since 1999, also, which means many C++ features that are commonplace in many programming languages now might never reach C (However I hope they make a new standard, it's definitely rejuvinate the language).
[/quote]

I am not saying OOP is error prone what I am saying is that OOP can lead to abstractions that go too deep which leads to harder to maintain code. You can find numerous threads here in the GDNet forums where people have a hard time finding certain bugs because their abstractions are far to complex for the problem they are trying to solve. The issue arrises because people tend to abuse inheritence. From a side node understandable is more of a personal preference. For instance I find it easier to understand and learn procedural libraries then heavily abstracted libraries. It is not that I have a problem with OOP I use it when it makes sense in Python all the time when writing scripts and such the issue with it have have is the over abstraction and abuse that comes from it.

Yes the C11 standard came out very close to the C++11 standard the issue with C at the moment is none of the compilers care to implement the newer C standards to this day the only full C99 compiler I know of is Pells and maybe Intel. GCC has some support and MSVC has terrible support.

It comes down to the fact for me that there are certain aspects of C++ in the new 11 standard that I really like and really wish were in C. In all honesty one feature that would make a world of difference in C is namespaces but they still don't exist in any compiler I have used.
0

Share this post


Link to post
Share on other sites
Yes, OOP can lead to unnecessary abstractions in hands of an inexperienced programmer. Functional programming can lead to overcomplicated, not understandable and unclean code. None of these pitfalls is a reason not to use these paradigms, just a reason not to use libraries which abuse them. Edited by ifthen
1

Share this post


Link to post
Share on other sites
[quote name='blewisjr' timestamp='1355480989' post='5010555']
Yes the C11 standard came out very close to the C++11 standard the issue with C at the moment is none of the compilers care to implement the newer C standards to this day the only full C99 compiler I know of is Pells and maybe Intel. GCC has some support and MSVC has terrible support.
[/quote]

Clang has the best support for both C11 and C++11 at the moment as far as I am aware. GCC is second place with C++11 support. MSVC has no support at all for any C dialect other than ANSI C and has poor C++11 support (comparatively speaking). Intel I have no idea about other than they have good support for C99. No idea about C11 or C++11.
0

Share this post


Link to post
Share on other sites
I agree Clang has the best support with GCC as a close second right now I use GCC for my toolchain through MinGW due to better windows support than Clang which requires a bunch of muck around to get to work properly. If I was running Linux or a Mac I would use Clang in a heartbeat but even on Linux it would require custom building of all your libraries. Microsofts compiler is great but they are just too slow to implement standards.
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