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

Is it such possible to create fast games without using C/C++ ?

51 posts in this topic

1. Investment. A lot of time has gone into writing C++ code, so it has inertia. The same thing held true of C in years past, and assembly in the era before that.
C and Assembly are still around and are still as strong as ever. These types of languages don't disappear or get swayed by trends.
2. Vendor lock. Most platforms for games only support C/C++ and maybe a couple other languages peripherally.
In practice it is the other way. Everyone makes libraries in C/C++ so they can be consumed by C# or Java developers. Whereas it simply cannot work the other way. Standard Java cannot use C# libraries. Standard C# cannot use Java libraries. And yet they can all use C/C++ libraries. Standard C++ (because of it's powerful low level functionality) can just about use C# libraries if you embed a mono runtime in it.. but not many people are going to do that.

Also, which Vendor is it that is trying to lock you in with C++? It is perhaps an example of one of the few languages which dont have a single company governing it's standard. Unlike Java or C#.
C++ is not a good language. It isn't even a decent language, for the most part. It's old, crufty, ugly, broken, and woefully behind the times (although C++11 is a good forward step). It is absolutely not succeeding on its inherent merits these days.
It has a lot of legacy cruft, I agree (like OpenGL I guess) but when a successful language has been around as long as C++, it can't be helped. The biggest thing for me though is RAII. It is simply missing in all other languages but Ada and is crucial if we have exceptions. C# stuff like LINQ.. I simply couldnt care less about for gamesdev.
More people are leaving C++ for game development, and with good reason.
Not really. Admittedly Gamedev.net does has a large presence of managed language fans, and there are reasons for this but as you know, in the commercial world (no indie crap or vendor lockin to products such as XNA and Unity) C++ is the only language quite frankly.
As for Android and iOS... It is simple, all the commercial games (especially ports) from AAA studios use C++ (with small Java/Obj-C shims) and all the hobby / indie developers use MonoTouch or the specific platform's lockin languages.
All the wishy-washy nonsense about performance and low-level access and blah blah blah
I agree. Especially since this isn't so much about the language but the platform. DotGNU (native C#) would beat C++.NET hands down in speed.
0

Share this post


Link to post
Share on other sites
C and Assembly are still around and are still as strong as ever. These types of languages don't disappear or get swayed by trends.
 
This is totally untrue.
 
I was programming games 15 years ago. C and assembly were far more pervasive then than now. I haven't written any heavy-duty ASM in years but it used to be a regular part of rolling any major game product out the door.
 
Yes, they are "around" but "strong as ever" is patently false.
 
In practice it is the other way. Everyone makes libraries in C/C++ so they can be consumed by C# or Java developers. Whereas it simply cannot work the other way. Standard Java cannot use C# libraries. Standard C# cannot use Java libraries. And yet they can all use C/C++ libraries. Standard C++ (because of it's powerful low level functionality) can just about use C# libraries if you embed a mono runtime in it.. but not many people are going to do that.

Also, which Vendor is it that is trying to lock you in with C++? It is perhaps an example of one of the few languages which dont have a single company governing it's standard. Unlike Java or C#.

You've never shipped a console game, have you? ;-)

It has a lot of legacy cruft, I agree (like OpenGL I guess) but when a successful language has been around as long as C++, it can't be helped. The biggest thing for me though is RAII. It is simply missing in all other languages but Ada and is crucial if we have exceptions. C# stuff like LINQ.. I simply couldnt care less about for gamesdev.

RAII is far from "crucial" in managed languages, because of garbage collection and other lifetime management schemes. But it somewhat exists in C# (IDisposable and using clauses come to mind).

Not really. Admittedly Gamedev.net does has a large presence of managed language fans, and there are reasons for this but as you know, in the commercial world (no indie crap or vendor lockin to products such as XNA and Unity) C++ is the only language quite frankly.

Where are you getting your "data" here? I go to GDC every year, I talk to dozens of professional game developers from several different studios, and I follow the trends in language adoption for personal reasons quite closely. C++ is losing ground and fast. Hell, most games ship a C++ core and a heavily non-C++ implementation of all their peripheral logic. People are dying to put a bullet in the head of that language.

See also Go and Rust. There is major investment from major commercial entities on killing C++. C++ is used for the two reasons I provided in the AAA space, and nothing else.
As for Android and iOS... It is simple, all the commercial games (especially ports) from AAA studios use C++ (with small Java/Obj-C shims) and all the hobby / indie developers use MonoTouch or the specific platform's lockin languages.

Not true. Go do your homework on what languages are used in most games. C++ is the shim language more often than not.
1

Share this post


Link to post
Share on other sites

I will only use compiled languages for games, I dont want to have to install an RTE just to run my program. 

0

Share this post


Link to post
Share on other sites
I will only use compiled languages for games, I dont want to have to install an RTE just to run my program. 

C++ has a runtime library. It may or may not be linked statically to your program, so you might be reliant on more of a runtime than you think.


In general, avoiding runtimes is probably the least reasonable excuse for using C++ IMHO, because the good ones are either trivial to install or ubiquitous already anyways.
2

Share this post


Link to post
Share on other sites
Though in some of the later specs of OpenGL, apparently you can use compiled (native) code rather than compiling it up from source at runtime.

Basically, if the shaders were JIT compiled as they were being used rather than being compiled natively up front. It is highly likely you would get worse performance. This is exactly the same with .NET.

Shaders are the perfect analogy here -- they're some of the most performance critical code in a modern game, and yet are written in a "JIT" language that follows the same pattern as C# code.

 

 

In GL, you can't pre-compile them (except for the newest GL spec, which allows you to cache the intermediate version for the current GPU only, so you still need to distribute the GLSL source to each user and parse it at least once for their GPU/driver combo), and in D3D you can precompile them to an intermediate assembly format. C#/Java/Python/etc are also pre-compiled to an intermediate assembly format! This pre-compilation step can perform optimisations and greatly reduce the workload on the JIT compiler.

At runtime, this intermediate (shader/C#/Java) assembly code is then JITed to real machine code on demand.

 

However, this JITing can cause spikes in your frame-times, so you need to be able to control when it happens. With shaders that's pretty straightforward (in D3D you tell the runtime to compile it, and in GL you do the same but also draw an off-screen triangle using the shader to force it to actually do what you asked...), but I'm not sure if it's controllable in C#/Java, so that would be my only concern (not the final speed of the JITed code).

Edited by Hodgman
1

Share this post


Link to post
Share on other sites
You haven't learned programming until you are at the hardware level C/C++ allows you to be at.

 

What on earth makes you think working with C++ places you at the hardware level?

2

Share this post


Link to post
Share on other sites

Yes, you can write a game faster without c++. ;)

Did not notice anyone mentioning it and the riming with the last post just begged for it. In short, getting stuff done in a reasonable time-frame is worth to be considered. The extra time might allow you to try other - better - algorithms also, which is where most of the performance improvements lie.

Edited by tanzanite7
1

Share this post


Link to post
Share on other sites

[quote name='ApochPiQ' timestamp='1357780770' post='5019718']
C++ has a runtime library. It may or may not be linked statically to your program, so you might be reliant on more of a runtime than you think.

In general, avoiding runtimes is probably the least reasonable excuse for using C++ IMHO, because the good ones are either trivial to install or ubiquitous already anyways.
[/quote]

You are overestimating what the usual computer user can or cannot do.

If you expect the latest Java RTE to be available, well don't expect many to be able run your software without any problems. Problems you might have to fix which can cost a company money, technical support doesn't come free.

 

Besides there are also thoose that can install runtime X but aren't motivated. For example I do rarely install any Java related updates, there is just no software that I do use regulary which requires it.

And whenever there is Java software that I would like to use I think twice, because there is probably some smaller tool that doesn't expect me to perform more than a copy&paste setup, so basically no reason for me to waste my time with it.

 

I do however have python, lua, tcl, javascript, c, c++, asm, ... development systems installed and thus the runtimes. Why because I do use them? I know they aren't just some crap wasting my hdd space. f you want to sell me something, you not only have to sell me your game, no, basically you do also have to sell me the huge dependency you are shipping with.

 

In C++ you can either add the runtime too your executable or don't link to it at all. So if you want something really small or really simple too install (copy&paste) it's probably one of the best choices.

0

Share this post


Link to post
Share on other sites

[quote name='shadowomf' timestamp='1357942757' post='5020488']
In C++ you can either add the runtime too your executable or don't link to it at all. So if you want something really small or really simple too install (copy&paste) it's probably one of the best choices.[/quote]

Except that isn't really true in practice. How many games fail miserably if you don't have the right MSVC Redistributable package installed?

 

(Hint: quite a few. Although Steam/Origin seem to be fairly immune to this problem)

0

Share this post


Link to post
Share on other sites
But on the flip-side, huge games like EVE have their core written in C++ (for speed), with Python layered over it (for ease of coding and convenience).

Many games are actually written in two languages: C++ and a scripting language (often Lua or Javascript).

Its important to clarify this point...

 

Eve is not written in C++. It is written in PYTHON with some core components written in C++, either for speed or as an interface to the operating system (their IOCP module which exposes IOCP to stackless python). The core of the game is in Python, not the other way around.

 

That being said, most games that have a scripting language have the "core" of the game written in C++, and then a scripting language layered on top to provide some rapid iteration capabilities.

 

All that being said, there is no reason not to start with a language that is a lot simpler. Such as python with pygl/pygame (or whatever the current frameworks are), or C#/XNA... or any number of other platforms.

 

[quote name='swiftcoder' timestamp='1357943745' post='5020496']
(Hint: quite a few. Although Steam/Origin seem to be fairly immune to this problem)
[/quote]

That's more because they package it up with the distributable package that you download... as you can see everytime you run a new game and it installs a new MSVCRT package.

Edited by Washu
0

Share this post


Link to post
Share on other sites

C++ has a runtime library. It may or may not be linked statically to your program, so you might be reliant on more of a runtime than you think.

In general, avoiding runtimes is probably the least reasonable excuse for using C++ IMHO, because the good ones are either trivial to install or ubiquitous already anyways.


You are overestimating what the usual computer user can or cannot do.
If you expect the latest Java RTE to be available, well don't expect many to be able run your software without any problems. Problems you might have to fix which can cost a company money, technical support doesn't come free.


If you need the latest for your game to work you package that RTE with your installer and have your games installer install the RTE unless a newer version is allready installed. Today almost all AAA games do this for the c++ runtime libraries (Different libraries for each version of Visual Studio) and for DirectX. (Those who don't are doing it wrong) Java, .Net, are no different, If your application needs something then bundle something with your installer or add something as a dependency to your package if you're on Linux, then the system will download and install it automatically if necessary (Which i guess is how Steam handles things as well)

Edited by swiftcoder
0

Share this post


Link to post
Share on other sites
Comparing a C/C++ run-time to the Java/.NET framework dependency is a bit too much? The game I am working on has around 7 binary lib dependencies.. And they are all statically linked. The EXE has zero dependencies (other than standard Windows DLLs of course). Heck, it does not even need an installer. The only reason why most of the C++ games require MSVCR DLLs installed are because developers are lazy, don't want to build static libraries themselves for their compiler/MT/MD support and just link with the binary DLL packages they can find on the net. Edited by simast
-4

Share this post


Link to post
Share on other sites

[quote name='simast' timestamp='1357946644' post='5020520']

Comparing a C/C++ run-time to the Java/.NET framework dependency is a bit too much?[/quote]

It's not that different. You can always package the JRE into an executable, which achieves much the same end.

 

Excelsior produces a nifty-albeit-expensive AOT java compiler to simplify the process, or there are a variety of less-friendly-but-cheaper open-source options (GCJ, LLVM + VMKIT, etc.)

1

Share this post


Link to post
Share on other sites
Comparing a C/C++ run-time to the Java/.NET framework dependency is a bit too much? The game I am working on has around 7 binary lib dependencies.. And they are all statically linked. The EXE has zero dependencies (other than standard Windows DLLs of course). Heck, it does not even need an installer. The only reason why most of the C++ games require MSVCR DLLs installed are because developers are lazy, don't want to build static libraries themselves for their compiler/MT/MD support and just link with the binary DLL packages they can find on the net.


Don't be so hasty to accuse people of laziness just because you don't understand their reasons.
2

Share this post


Link to post
Share on other sites

But on the flip-side, huge games like EVE have their core written in C++ (for speed), with Python layered over it (for ease of coding and convenience).
Many games are actually written in two languages: C++ and a scripting language (often Lua or Javascript).

Its important to clarify this point...
 
Eve is not written in C++. It is written in PYTHON with some core components written in C++, either for speed or as an interface to the operating system (their IOCP module which exposes IOCP to stackless python). The core of the game is in Python, not the other way around.


My mistake, I thought I read that their graphics engine was written in C++ (which was a reasonable assumption). I assumed most the gameplay-related logic was handled by Python, but the graphics-related code was C++ since rendering and physics usually takes the vast majority of a frame. How their server is set up, I'm not sure - I know they use Python heavily there as well, but I don't know if they use C++ for some of the heavier computations their servers might be running.
All that being said, there is no reason not to start with a language that is a lot simpler. Such as python with pygl/pygame (or whatever the current frameworks are), or C#/XNA... or any number of other platforms.
Fully agree! Start with Python, and if you need your core graphics engine to run really fast... use the really fast graphic engines that are already made for Python.
1

Share this post


Link to post
Share on other sites
<blockquote class="ipsBlockquote" data-author="simast" data-cid="5020520"><p>Comparing a C/C++ run-time to the Java/.NET framework dependency is a bit too much? The game I am working on has around 7 binary lib dependencies.. And they are all statically linked. The EXE has zero dependencies (other than standard Windows DLLs of course). Heck, it does not even need an installer. The only reason why most of the C++ games require MSVCR DLLs installed are because developers are lazy, don't want to build static libraries themselves for their compiler/MT/MD support and just link with the binary DLL packages they can find on the net.</p></blockquote>

Why would you statically link third party libraries ?

If a statically linked library contains a security hole and you don't patch your software immediatly you expose your users to unnecessary risks, if a dynamically linked library contains a security hole the user will get an updated version of the library installed automatically by the OS(Atleast on those with a modern package management system, Windows still only sends out updates for Microsofts software, but the RTE for C++ on Windows is Microsoft software and it does get security fixes, some critical, through Windows Update) as soon as it is available.

Here is an example: http://technet.microsoft.com/en-us/security/bulletin/ms11-025
a bug in the Visual C++ 2008 and 2010 redistributables (MFC part of it) that allowed attackers to execute arbitrary code on machines running software using some of those functions.

Now what is best, that the end user gets the fix through windows update or that he has to find out about the security flaw and then manually install a custom patch for EACH application whos developer used the affected functions but was too lazy to make a proper installer for his software.

Static linking is the lazy route, making sure your application installs properly is the proper way to go. Edited by SimonForsman
2

Share this post


Link to post
Share on other sites

[quote name='Servant of the Lord' timestamp='1357955609' post='5020578']
My mistake, I thought I read that their graphics engine was written in C++ (which was a reasonable assumption). I assumed most the gameplay-related logic was handled by Python, but the graphics-related code was C++ since rendering and physics usually takes the vast majority of a frame. How their server is set up, I'm not sure - I know they use Python heavily there as well, but I don't know if they use C++ for some of the heavier computations their servers might be running.
[/quote]

Their graphical component IS written in C++.But, like most games, it is a very small part of the overall game, once you have the "engine" setup, the rest is just a matter of shoving data at the subsystem and letting it handle it. All that logic is done in python. Physics is handled on the server side and is actually mostly in Python, there are some pieces that are offloaded to C++ using low-overhead bridges, but most of it is python. The way they have designed their systems they can rip out a performance intensive component of a calculation (say computing the current position of an object A that is set to orbit another object B at a range of 5,000 kilometers while attempting to move at full speed AS the other object attempts to counter orbit the object A, which happens a great deal in small fleet combat) and move that into a C++ module, which integrates seamlessly into their stackless python architecture.

1

Share this post


Link to post
Share on other sites

Simast, you have it back to front.

 

I frequently statically link the runtime purely out of laziness because I can't be bothered to write an installer (for trivial, personal projects only of course). It is far, far more effort to link dynamically and also ensure that you provide the correct DLLs if they are not on the user's system and, obviously, best practice for the reasons SimonForsman outlines above.

0

Share this post


Link to post
Share on other sites

My mistake, I thought I read that their graphics engine was written in C++ (which was a reasonable assumption). I assumed most the gameplay-related logic was handled by Python, but the graphics-related code was C++ since rendering and physics usually takes the vast majority of a frame. How their server is set up, I'm not sure - I know they use Python heavily there as well, but I don't know if they use C++ for some of the heavier computations their servers might be running.

 

Their graphical component IS written in C++.But, like most games, it is a very small part of the overall game, once you have the "engine" setup, the rest is just a matter of shoving data at the subsystem and letting it handle it. All that logic is done in python. Physics is handled on the server side and is actually mostly in Python, there are some pieces that are offloaded to C++ using low-overhead bridges, but most of it is python. The way they have designed their systems they can rip out a performance intensive component of a calculation (say computing the current position of an object A that is set to orbit another object B at a range of 5,000 kilometers while attempting to move at full speed AS the other object attempts to counter orbit the object A, which happens a great deal in small fleet combat) and move that into a C++ module, which integrates seamlessly into their stackless python architecture.

 

So in answer to the question, "Is it possible to create fast games without using C++?", we hold up Eve online as an example that's written in Python, except that the fast parts (the rendering) are written in C++?

 

I love using Eve Online as an example of a game written in Python, and I'm not saying it isn't possible to write fast games without C++ (it is!), I'm just pointing out Eve isn't the best example to use in context to the question of this thread. Unless I'm completely misunderstanding what you meant, which is likely. laugh.png

1

Share this post


Link to post
Share on other sites
So in answer to the question, "Is it possible to create fast games without using C++?", we hold up Eve online as an example that's written in Python, except that the fast parts (the rendering) are written in C++?
Any particular game will have to interface with the operating system at some point. Chances are that interface will be written in... C++. That does not mean YOU have to write C++ to access it, as the interface may have been written for you. Python with PyGL or PyGame uses C++ (or C) at some level in order to access the underlying functions.

That being said, the majority of the C++ part of the eve graphical engine is mostly just wrapping up DX in a fashion to make it "usable" as a simple component of their core, python, engine (called Carbon).
I love using Eve Online as an example of a game written in Python, and I'm not saying it isn't possible to write fast games without C++ (it is!), I'm just pointing out Eve isn't the best example to use in context to the question of this thread. Unless I'm completely misunderstanding what you meant, which is likely. laugh.png
Eve certainly isn't the only game one can use as an example of a fast game that doesn't require C++. AI War, which is a .Net based game, used SlimDX as its core for rendering and input for a long while. It now uses unity as its core. Edited by Washu
1

Share this post


Link to post
Share on other sites
Case in point - MineCraft (java)

 

Minecraft isn't exactly "fast", In Minecraft I get 30-40 fps in most other games I get 60-75, In my game Engine I get 110-130 fps its written in C/C++ and looks a lot better than Minecraft. It all depends how fast you want to go. To write really really fast games you don't necessarily need C++ but you do need a compiled (or assembled) language. That said Minecraft is still fast enough to play and be amazingly fun (it used to have terrible performance back in alpha/beta) and alot of games written in other languages are fast enough. So unless you want your game to run really really fast you could use java or python or something.

1

Share this post


Link to post
Share on other sites
<blockquote class="ipsBlockquote" data-author="ic0de" data-cid="5020851"><p><br /></p><blockquote class="ipsBlockquote" data-author="iMalc" data-cid="5020797"><p>Case in point - MineCraft (java)</p></blockquote>&nbsp;<br />Minecraft isn't exactly "fast", In Minecraft I get 30-40 fps in most other games I get 60-75, In my game Engine I get 110-130 fps its written in C/C++ and looks a lot better than Minecraft. It all depends how fast you want to go. To write really really fast games you don't necessarily need C++ but you do need a compiled (or assembled)&nbsp;language. That said Minecraft is still fast enough to play and be amazingly fun (it used to have terrible performance back in alpha/beta) and alot of games written in other languages are fast enough. So unless you want your game to run really really fast you could use java or python or something.<br />&nbsp;<br /><p><br /></p></blockquote><br />I'd bet that a large part of Minecrafts performance problems come from managing all those cubes/voxels rather than from Java though, there are far better looking and better performing games written in Java out there. (Not to mention games like dwarf fortress which look far worse than minecraft, are written in C or C++ and perform horribly).<br /><br />In fact, the graphics is probably the area where compiler/VM/language choice has the least impact on performance. (Your language/vm/compiler choice only affects the time it takes to issue a drawcall to the graphics API, the actual rendering will perform identically regardless of what language you issued the drawcall from).<br /><br />
1

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