473,609 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Still Using C++?

Hi,

I am a game developer, sometimes "indy" and sometimes for a small-sized
company. I can't speak for all game developers, but everywhere I've ever
seen people working on games, execution speed has always been the most
important constraint in writing code. Writing readable and maintainable
code is important, but takes a back seat to execution speed.

I work with DirectX and/or OpenGL, always in C++. There are plenty of
things that I'd like to see improved in C++. But as far as I have seen,
C++ continues to be the workhorse of the gaming business. I've noticed, as
I was searching for examples of how to do some particular trick in D3D, a
few samples written in C#.

But what I know about C# is two things: 1) managed code, and 2) garbage
collection. These are both deal breakers for execution speed, in my
opinion. Trying to squeeze the maximum number of triangles and shaders
through the graphics pipe using code running on a virtual machine seems...
well, silly. And as for garbage collection, I've found that any serious 3D
code I've written has needed very explicit control over when things are
allocated and deleted. Rendering 3D invloves lots of very large buffers of
data, many of them changing drastically in size (meaning possible
reallocation) between every frame. Minimizing the expense of
allocation/deletion/reallocation through intelligent code is crucial.

Anyway, it just seems like C++ has been the "big hammer" for game
development for long enough that we've figured out what's good and what's
bad about it. I certainly have my own fairly long list of annoyances, but
I'm not really interested in opening that can of worms here, since it's
already been debated to death.

But I am interested in looking for alternatives. Am I wrong about C# -- is
it a viable alternative for serious programming, or is it a toy? How about
"D? "I've heard good things about it, but I don't know how widely
supported it is. Having well-supported tool chanins, libraries, IDEs,
documentation, and other resources is important.

Just wondering...
Jun 27 '08 #1
53 2615
None wrote:
But what I know about C# is two things: 1) managed code, and 2) garbage
collection. These are both deal breakers for execution speed, in my
opinion.
An opinion based on prejudices and rumors, I assume. You should base
your opinions on actual experimentation , not on what some C hackers tell
you.

As time has passed, the speed gap between C++ and "higher-level"
languages has diminished. However, there's one thing where C++ still
excels compared to many other languages (although I can't say for sure
if compared to C#): It's possible to make extremely memory-efficient
programs with it (while still preserving a good level of abstraction,
which makes C++ better than C, IMO).
Jun 27 '08 #2
ave
But what I know about C# is two things: 1) managed code, and 2) garbage
collection. These are both deal breakers for execution speed, in my
opinion.
This is very wrong, C# is not as performant as C++ but these two points are
not related to the performance difference.

1) Managed Code
Managed code is compiled at execution time, okay there's some overhead there
as the JIT compiler processes the function. But it only performs the JIT
once. Because of the intermediate code and it's associated information used
to produce the native code, it is highly likely the JIT compiler has better
knowledge of what your code is doing than a C++ compiler. And it's entirely
possible the JIT compiler could produce better native code than a C++
compiler, leading to faster execution times.

2) Garbage Collection
Garbage collection is not a performance hindrance, it's just an environment
change. Typical game development practices attempt to reduce the number of
allocations\fre es during gameplay as much as possible. In a garbage
collected language like C# similar practices can mean no garbage is
collected, meaning no loss of performance. Of course, the language is
different and it means different rules need to be practiced during
development, but it's a different language + environment what do you expect?
:)

That being said, C++ is a preferable development language for games because:

1) Cross-platform, PC, PS3, X360, Wii, whatever, all have C++ compilers
maintained by their manufacturers. And whilst the quality of C++ compiler
can vary across platforms, they are (by and large) fairly language
compatible.
2) Inline assembly, when raw speed is necessary. The programmer can simply
drop to the machines level. Until such things as
vectors\matrice s\quaternions become intrinsic types of languages it's
unlikely C++ will be left.
3) Familiarity, just about every game developer is familiar with C++, evey
game company expects their engineers to understand C++.
4) It's unlikely every console manufacturer is going to agree on another
language all at once. Leaving C++ the only option currently.

ave
Jun 27 '08 #3
None wrote:
Just wondering...
Well, since you claim to be a game developer, how about trying out other
languages (with small demo programs that test issues you are interested
in, not full-blown games, of course) and report back your findings to
this group?
Jun 27 '08 #4
On Apr 22, 2:09 am, None <n...@none.none wrote:
Hi,

I am a game developer, sometimes "indy" and sometimes for a small-sized
company. I can't speak for all game developers, but everywhere I've ever
seen people working on games, execution speed has always been the most
important constraint in writing code. Writing readable and maintainable
code is important, but takes a back seat to execution speed.

I work with DirectX and/or OpenGL, always in C++. There are plenty of
things that I'd like to see improved in C++. But as far as I have seen,
C++ continues to be the workhorse of the gaming business. I've noticed, as
I was searching for examples of how to do some particular trick in D3D, a
few samples written in C#.

But what I know about C# is two things: 1) managed code, and 2) garbage
collection. These are both deal breakers for execution speed, in my
opinion. Trying to squeeze the maximum number of triangles and shaders
through the graphics pipe using code running on a virtual machine seems...
well, silly. And as for garbage collection, I've found that any serious 3D
code I've written has needed very explicit control over when things are
allocated and deleted. Rendering 3D invloves lots of very large buffers of
data, many of them changing drastically in size (meaning possible
reallocation) between every frame. Minimizing the expense of
allocation/deletion/reallocation through intelligent code is crucial.

Anyway, it just seems like C++ has been the "big hammer" for game
development for long enough that we've figured out what's good and what's
bad about it. I certainly have my own fairly long list of annoyances, but
I'm not really interested in opening that can of worms here, since it's
already been debated to death.

But I am interested in looking for alternatives. Am I wrong about C# -- is
it a viable alternative for serious programming, or is it a toy? How about
"D? "I've heard good things about it, but I don't know how widely
supported it is. Having well-supported tool chanins, libraries, IDEs,
documentation, and other resources is important.

Just wondering...
I am a hobbiest game developer as well. I do more scientific type apps
on the job. I am frustrated as heck myself. There is a feeling of
limbo right now as far as game development.

Here are my findings:

MS is doing its best to _force_ me to use C# for everything Windows
related
Almost all the new VS enhancements are centered around managed
code.
MSBuild does not work with native C++
Visual designers in VS do not work with native C++
MS's DB integration in VS is limited to managed code
Everytime I look something up in MSDN, I am plagued with
managed code examples instead of native C++
Activity on native C++ forums, for the language, for DirectX,
and otherwise has dropped substantially

I wouldn't mind switching to C# for game development, but fact is, it
is not possible right now.
The problem is that the _only_ library available for C# and DirectX is
XNA
MS admitted themselves XNA is a hobbiest tool in its current state,
has many shortcomings and is not feasable for commercial development.
Worse, MS is going down the path of charging fees for using it!
I started converting my engine to XNA and gave up as the low level
control that is needed for quality game development just isn't there
period.

I am left in Limbo. MS took out hardware excelerated OpenGL. MS's
documentation, IDE, tools, and APIs are all aimed at managed code more
so than native C++. Yet the only graphics API we are available is an
"Indie developer's toy"

So, while I would love to use C#, to make my resume look pretty, and
because development can be much more rapid, not to mention my opinion
that is forces more OO and has some features I like. I simply cannot
development any graphical app and expect any sort of quality.

I really wish MS would make an official statement on their intentions
for the future concerning game development.
I really wish MS would stop forcing things down my throat and give me
options.
I used to be one of those developers that was very pro MS, now they
are really irritating me.

My latest problem is embedding SQL Server Compact for one of my game
apps. Come to find out that if I want to use any of the tutorials or
documentation they have on it, I have to use IDE features in VS 2008,
forcing me to make a $800 upgrade! Could they just patch 2005,
nah....Try to install an old version of SQL Server? error: Your OS is
not supported.

*scream* *end rant*
Jun 27 '08 #5
Christopher wrote:
My latest problem is embedding SQL Server Compact for one of my game
apps. Come to find out that if I want to use any of the tutorials or
documentation they have on it, I have to use IDE features in VS 2008,
forcing me to make a $800 upgrade! Could they just patch 2005,
nah....Try to install an old version of SQL Server? error: Your OS is
not supported.
Have you looked at SQlite3? http://www.sqlite.org/
Jun 27 '08 #6
On Apr 22, 12:46 pm, Matthias Buelow <m...@incubus.d ewrote:
Christopher wrote:
My latest problem is embedding SQL Server Compact for one of my game
apps. Come to find out that if I want to use any of the tutorials or
documentation they have on it, I have to use IDE features in VS 2008,
forcing me to make a $800 upgrade! Could they just patch 2005,
nah....Try to install an old version of SQL Server? error: Your OS is
not supported.

Have you looked at SQlite3? http://www.sqlite.org/
Yes, its has limitation that won't work for the particular project.
Jun 27 '08 #7
Matthias Buelow <mk*@incubus.de wrote:
Well, since you claim to be a game developer, how about trying out other
languages (with small demo programs that test issues you are interested
in, not full-blown games, of course) and report back your findings to
this group?
I don't need to "claim to be a game developer" to do that. I don't even
need to write code. Just download the latest DirectX SDK. Most (or all?)
of the samples are offered in both C++ and C#. The samples provide a
decent coverage of the basic aspects of game development.

And there's already plenty of discussion of the perfomance of C++ versus
C#. Just a taste:

http://developers.slashdot.org/artic...3/04/28/163219
&mode=thread&ti d=126&tid=127
I think that my original post was worded poorly. Basically, I'm just
wondering what's next, after C++. I use C++, I love C++, I haven't used
anything that suits game development better. But it has its limitations
and its annoyances. Like I said initially, I don't care to enumerate and
debate them. So I just thought some of the comp.lang.c++ gurus might have
some insight on the next workhorse for high performance code... And I was
secertly hoping that the answer isn't C#. :)
Jun 27 '08 #8
Your Name wrote:
Basically, I'm just
wondering what's next, after C++.
I don't believe in a "now this, next that" approach to technology; use
whatever you like and is appropriate. C++ (and C) most likely have a
very long life still before them (hundreds of years?), probably Java
too, not so sure about C#. I would think that dynamic languages (new
dialects of Lisp, etc.) will see a renaissance in the medium-term
future, simply because hardware is now available to accomodate these
systems and languages like Java, Python are all moving in that direction
(especially when mixed with Javascript and XML to provide some poor
man's S-expressions), and more ambitious projects in dynamic modelling
and simulation can be attempted because of more powerful hardware and
better understood problem domains than 20 years ago. This doesn't mean
languages like C++ or C will be left out -- we will likely continue to
see a mix of languages, despite the hype gravel train that needs to move
on from station to station simply because it feeds a number of people. I
think mono-anything is always bad, and a diverse mix of languages and
methodologies is a good thing.
Jun 27 '08 #9
Matthias Buelow <mk*@incubus.de wrote:
I don't believe in a "now this, next that" approach to technology; use
whatever you like and is appropriate.
[...]
I think mono-anything is always bad, and a diverse mix of languages
and methodologies is a good thing.

I know that the "big hammer" approach is not appealing from an idealistic
point of view, but unfortunately, that's just the way it is in game
development. Things just move incredibly fast. There's a new high-end 3D
card every six months. Then there's bound to be a new version of DirectX
to take advantage of the new features of the hardware. Then there are
bound to be middleware companies scrambling to create the first game engine
to take advantage of the new API. There's so much radical overturn in the
industry that SOMETHING simply must become the de facto standard. You
can't just send everyone an e-mail suggesting that we all move to a more
balanced approach. And even if you want to be a lone daredevil and defy
convention by developing your game in some new language or combination of
languages, you run the risk of being a day late with your release, and
having reviewers look at your game and say "Ewwww, those graphics look like
a game from early 2007! What a joke!"

But, progress happens. John Carmack wrote Doom in C, and it was convincing
enough to get the gaming world to part ways with assembly language. If
someone today could offer something that was absolutely 100% backwards
compatible with C++ (meaning that you could just directly plug in existing
DLLs and LIBs), but IN ADDITION provided next-generation features, then we
might get somewhere. It just seems like it's overdue, at this point.
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
1954
by: Peter | last post by:
I really can't understand why you still use it or why you started using it in the first place.
8
3991
by: BadOmen | last post by:
I am using Win XP and when I exit my program by clicking the X it locks like it is closed but if I check the Activity Handler( I don't know the right English word for it) it is still there under program... Do I need to do anything in the code handle the shut down? Yours, Jonas
102
7544
by: RFox | last post by:
I date back to the early days of the web when HTML was limited but very managable, and have always maintained that hand-coding HTML gives you far better control and cleaner HTML markup than any WYSIWYG editor. But all the sites I created and manage are small sites (<50 pages). And I've been out of the loop in terms of what's new in methodology and with the specifications for the past couple of years.
1
3389
by: Marwan | last post by:
Hello I am using asynchronous delegates to make a call to a COM ActiveX object, but even though the call occurs on a separate thread, my UI is still blocking. If i put the thread to sleep in my delegate call, the application is well behaved (no UI freeze), but the call to the com object causes the UI to lock up Do I have to manage calls to an ActiveX object differently than using the BeginInvoke and a callback A sample of the code I...
6
1962
by: KathyK | last post by:
Hi and Thanks in advance! I am able to link to a MSAccess 2000 db that I secured. I have removed all permissions from the Admin user and actually the whole users group and admins group. I changed the database owner to a user I call owner. But, I can still link to this db from an unsecured database. Can you think of anything else to check? Thanks, Kathy
687
23270
by: cody | last post by:
no this is no trollposting and please don't get it wrong but iam very curious why people still use C instead of other languages especially C++. i heard people say C++ is slower than C but i can't believe that. in pieces of the application where speed really matters you can still use "normal" functions or even static methods which is basically the same. in C there arent the simplest things present like constants, each struct and enum...
1
1170
by: Marty | last post by:
Hi, I'm still playing with this managed/unmanaged code within my VC++ project. I'm sure it's gonna work, need just some tuning that you could help me to find out. Here is below the .h and .cpp I use. socketListener.cpp configuration properties: c/c++ - General : /clr
8
1995
by: Brad Simon | last post by:
I have written a shopping cart using ASP .NET (VB). It has been running quite successfully on a site for about a year or so. I use the SessionID as the key to hold information on the shopping cart. I have copy / pasted the code into a new site. Everything is working, EXCEPT for the shopping cart holding the SessionID. I have watched the variable, and each time I hit the 'Update' button in a datalist, the session ID changes. That is...
4
2927
by: Joe | last post by:
I'm hosting my web service on a Windows 2003 box which is remotely located. When trying to add a web reference to a C# project I get an error message 'There was an error downloading 'http://mydomain.com:port/webservice.asmx' The operation has timed-out (I've tried with and without using a separate port for the service) The weird thing is the page does show up on the left side of the screen listing the available methods but the Add...
7
4356
by: D. Patrick | last post by:
I need to connect to an Oracle database. I've never done it before. I see that with framework 1.1 you had to download ODP.NET from Oracle's site in order for the framework classes to even work. I tried that quickly, but the file is 400 MB, and the the installation asks for all kinds of things in order to install. Now I'm very confused. a) Do you still need ODP.NET with framework 2.0? b) Do you need to download and install other...
0
8145
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8095
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8588
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8556
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8236
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7030
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6068
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5526
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2541
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.