By using this site, you agree to our Privacy Policy and our Terms of Use. Close
HappySqurriel said:
zarx said:
HappySqurriel said:

On the topic of CPU emulation ...

In the not too distant future I expect to see console manufacturers move towards having developers target a "virtual machine" rather than develop for the hardware directly. With how good JIT compilers are getting, you can still get a highly optimized program without being directly tied to specific hardware. If this was done well the vast majority of games would be "forward compatible" without losing a significant percentage of their performance.


doing that would lose all the advantages of running on dedicated hardware and the optimisations that makes possible. You would basically be making a PC game at that point (they can be optimised but they will never be able to get the level of optimisation of games designed "direct to the metal) but with slightly higher overheads (and you know how much devs complain about API overheads on PC) you won't see it next gen I don't think we will be at the point where hardware far outstrips the games capability to utilize it which is where you need to be for virtual machines to make sense, that or a totally hardware agnostic future where you can buy one game for all platforms (which I don't think the hardware manufacturers want as that would mean they couldn't charge as much royalties). Virtual mchine bassed games could make sense on PC tho as it would prevent issues with conflicts but even there the extra overheads (no matter how slight) make that prohibitive for AAA games. But for lower end games that want to be platform agnostic Java/HTML5 virtual machine makes a lot of sense as you can make one game that will run on anything, even in a browser like Bastion etc.

/Nerd rant

The primary considerations for producing high performance code is using the correct data-structures and algorithms, not on hand-optimization of byte-code that is better handled by a compiler. Even then, the 0.1% of code that you would (potentially) want to write in assembly to increase performance can be (mostly) written by the console manufacturer and provided as library to your VM.

Beyond this, people have been benchmarking C++ vs Java for nearly a decade with results that demonstrate that JIT compilation of Java byte code into machine-code produces similar (overall) results to compiling C++ code into machine-code; with each language having its own advantages in a handful of areas.

Google has already taken this approach with Android, and I don't think many people would say there has been noticeable performance problems on those devices because their games are java based ...

 

With that said, I'm not saying that this upcomming generation will move towards a virtual machine approach but I'm certain the following generation will ...

Google went that route as apps have to be as hardware agnostic as possible as there is a wide veriaty of hardware that it has to run on, running in a virtual machine helps make apps more portable and less prone to conflicts. But they will always incur a performance penalty vs native even the best virtual machines today have a 4-6% CPU performance penalty under ideal situations and in the real world it can be up to a 40% penalty so there is no way consoles will use them unless they literally have performance to burn, or developers for whatever reason need their console games to run on diverse hardware which means you lose the advantage of optomising for a single hardware set and running it direct to metal or at least to very low level APIs (which doesn't require hand optomised code BTW console manufacturers supply specialized compilers).

 

Oh and high performance apps on Android like games actually run native (or at least parts of them that require high performance) as the virtual machine is far to slow.

Here is a benchmark of Dalvik vs native on android 



@TheVoxelman on twitter

Check out my hype threads: Cyberpunk, and The Witcher 3!