   Do you need C++ to write a modern game?
  I am planning to make a very complex simulation game with many elements in it.So I figured to make it in C++ to keep track of all the different elements/objects now problem is I have been out of the loop for years so I know old C++ not the new stuff.On the other hand I am very good at C working with it daily for the last 14 years.What should I choose?? the new modern C++ makes me crazy.. Do you need it to write a modern game?   
  No, but it helps (in some cases).If you can get your head around object orientation then some problems are relatively trivial. It can be difficult to do though if you are deeply entrenched in the old C style (structured programming) methodologies.Having said that, not every problem lends itself to object oriented techniques.Look at what you are trying to create and see if you can break it down into models. If you can (and easily) chances are an OOP approach will help.Let the solution fit the problem, not the other way around.   ;  There's a free book called Thinking in C++ (see the bottom of this post) that is very nice for transitioning from C to C++ (chapters 4-6 in particular are great, minus the various void* ugliness).But then again, learning a different language, such as C# or Python, might be a better use of your time.   ;  You make me belive that I can do it without C++. So I will! Perhaps adding some object oriented thinking with structures and pointers to functions.Thanx   ;  You only need a good scriptable game engine.   ;  You don't need C++ to write a game.  I prefer to write most of my programs in C# whenever I can.If you don't really want to learn a new language I would just use C since you already have so much experience in it.   ;  Why not just use what you're comfortable with in C++ if you already have a bunch of stuff in C you want to take advantage of?  Since, for the most part, you can directly use your C code.There are definitely things that C++ makes simpler.  No one said you had to use all the stuff in modeern C++ - most C++ programmers rarely use a large percentage of it.  And even when they do, one must be careful not to use it wrong since it's so easy (aka every object in existence inherits from some common base object is a common pitfall that bites people).  Point being, you don't have to use features just because they are there.  Use what helps make your code clearer, more maintainable, and less bug-prone - even if it starts out as just adding member functions to your structs.[Edited by - popsoftheyear on April 1, 2010 10:58:40 AM];Quote:Original post by mrrYou make me belive that I can do it without C++. So I will!It is certainly feasible, but my opinion is that writing sizeable simulations in plain-old-C is unnecessarily painful. If you don't have to use C (platform limitations, etc.) then I would recommend using something else (Java, C#, or something more esoteric if you are familiar enough with it: Haskell, OCaml, etc.).That said, if C is your go-to programming language, by all means stick with it.   ;  Hey Mrr!For what it's worth, all game developers I have talked to and worked with basically take what is good of C and what is good of C++ and combine them.For instance, nobody that I know uses cout, string streams or file stream functions.  Instead, we all use the *printf style functions, fopen, fread and fwrite (unless of course you are working on a console with it's own file operations APIs!).However, new and delete are a major step up from malloc and free, so people tend to stick to that.Some game companies use the Standard Template Library (STL), but most big games realize that using STL, you don't have enough control over memory allocations so for instance, EA publicaly says that they've written their own replacement for STL, and the unreal engine has it's own dynamic arrays and maps etc as well.One C++ thing i've seen used a lot in games is polymorphism (class inheritance w/ virtual functions).This is really useful in a couple situations...#1 - having a base class objcet that ALL objects in your game derive from.  Using virtual functions you can make an interface that the engine can talk to all objects through to be able to do things like garbage collection and serialization.  Using this common ancestor, you can also do things like keep lists of game objects that aren't necesarily the same type if you want to.  Like for instance, making a tree of such objects to represent a game level in memory.#2 - let's say you have both players (local and over the network players) and AI's in your game.  You could have a base class CEntity and from that derive 3 classes CLocalPlayer, CNonLocalPlayer and CAIPlayer.  All of these players have a GetHitPoints function, a SetHitPoints function, a GetHostileTarget function, etc but may all be implemented differently for each of the 3 players.  They may also all have a Tick() function which is called once per frame to do the per frame logic for each different kind of object.  Using virtual functions you could have a list of players (CEntity's) and just loop through them, removing the ones that are dead, calling update on the rest, etc without having to know what type each one is.Also believe it or not, the OOP idea of accessors is really handy.  IE Get and Set functions such as GetPosition and SetPosition.You might wonder "well shoot why dont i just make position public and let people modify it directly".The reason you don't want to do that is if you are trying to debug a bug where an object is moving smoothly down a path and suddenly teleports 6 feet off the path, then gets back on the path and keeps moving, you probably are going to want to put a conditional break point in "SetPosition" to see what the heck is making the object move so far (and off the path) in a single frame.Also, if you use accessors, you can toss more logic in such as setting an "ObjectIsDirty" flag whenever someone calls SetPosition, or change the internals of how position is stored such as taking in 3 floats but bitpacking it into a 16 bit integer which is smaller for sending over the network.Anyways hope this helps!Moving from C to C++, especially in game development isn't too scary and don't worry, you won't lose all the nice *printf, file io or string manipulation functions you liked in C (:   ;  a vast majority of mdern games are made in C++, but it doesn't meamn you have to use, it just makes it easier to find references. However, it's not a straight forward language, and starting with C helps (pointers, memory allocation deallocation on the heap, the memory stack)> If you know C, C++ is a natural step. C# is also an option, however your platforms will be limited.   