Jump to content

  • Log In with Google      Sign In   
  • Create Account

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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
52 replies to this topic

#41 ApochPiQ   Moderators   -  Reputation: 15765

Like
2Likes
Like

Posted 11 January 2013 - 05:40 PM

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.

Sponsor:

#42 Servant of the Lord   Crossbones+   -  Reputation: 19579

Like
1Likes
Like

Posted 11 January 2013 - 07:53 PM


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.
It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.
All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal

[Fly with me on Twitter] [Google+] [My broken website]

[Need web hosting? I personally like A Small Orange]


#43 SimonForsman   Crossbones+   -  Reputation: 6111

Like
2Likes
Like

Posted 11 January 2013 - 08:07 PM

<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, 11 January 2013 - 08:13 PM.

I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#44 Washu   Senior Moderators   -  Reputation: 5200

Like
1Likes
Like

Posted 12 January 2013 - 12:25 AM

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.


In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.
ScapeCode - Blog | SlimDX


#45 Aardvajk   Crossbones+   -  Reputation: 5982

Like
0Likes
Like

Posted 12 January 2013 - 08:18 AM

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.



#46 Servant of the Lord   Crossbones+   -  Reputation: 19579

Like
1Likes
Like

Posted 12 January 2013 - 10:39 AM

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


It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.
All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal

[Fly with me on Twitter] [Google+] [My broken website]

[Need web hosting? I personally like A Small Orange]


#47 iMalc   Crossbones+   -  Reputation: 2306

Like
0Likes
Like

Posted 12 January 2013 - 12:57 PM

Case in point - MineCraft (java)
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms

#48 Washu   Senior Moderators   -  Reputation: 5200

Like
1Likes
Like

Posted 12 January 2013 - 01:43 PM

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, 12 January 2013 - 01:45 PM.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.
ScapeCode - Blog | SlimDX


#49 ic0de   Members   -  Reputation: 844

Like
1Likes
Like

Posted 12 January 2013 - 03:27 PM

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.


you know you program too much when you start ending sentences with semicolons;


#50 SimonForsman   Crossbones+   -  Reputation: 6111

Like
1Likes
Like

Posted 13 January 2013 - 01:05 AM

<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 />
I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#51 Chad Smith   Members   -  Reputation: 1134

Like
0Likes
Like

Posted 13 January 2013 - 02:13 PM

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.

 

Those whose to say that the "performance" issues are not entirely Java?  Like Simon stated above me, I could see those "performance" issues coming from all the cubes/voxels it must always manage.



#52 dleskov   Members   -  Reputation: 107

Like
1Likes
Like

Posted 15 January 2013 - 04:09 AM

 

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

 

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.)

 

Speaking on behalf of Excelsior: We had an $10 charity deal in the end of 2012, have been extending discounts to indie developers and small companies for quite some time, and if your game is non-commercial, you may qualify for a totally free license, like the authors of Culrtis II, Rogue's Tale, etc.



#53 shadowomf   Members   -  Reputation: 315

Like
0Likes
Like

Posted 17 January 2013 - 04:10 PM

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.

For single player games not that big issue (though it is still an issue). However you can always provide a patch for your game (regular patches are a good idea anyway).

Two more things. Games have often a much shorter lifetime than other software, which reduces the chance that a huge bug is found in the msvcrt. And games get patched more often than other software. Sometime old versions of some office/commercial software is used for years without any updates (never change a running system).

Note microsoft is the exception here, since they have a unique distribution channel shipped with their os. For most other third party libraries you will probably be better of to ship a new version of the library by yourself using a patch/update/whatever since you can't expect the user to update them.

 

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

I would happily take the lazy route, adding another step where the msvc redist installer opens up and confuses the averange computer user isn't exactly great. Besides if you're doing a hobbist project (something for yourself and your friends), copy&paste install is much easier than building a installer and convincing people to run it.

Yes I know I'm really lazy and don't like to okay->agree->continue->browser->accept->done if a simple ctrl+c, ctrl+v can work too.

 

Case in point - MineCraft (java)

As mentioned before not something all would consider fast.

I don't think it sucks performance wise, but the gameplay in general is a bit more on the calm side.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS