RPGWatch Forums - View Single Post - Metahuman facial animation
View Single Post

Default 

April 20th, 2021, 16:01
Originally Posted by Redglyph View Post
It's possible, and that's what I said, it's easy to abuse it (for the C# part). But it starts with disadvantages for the performances, being JIT-compiled and based on garbage collection.

C++ has its disadvantages too . . .
Hmmm, if you write high level game logic code and you have JIT-related performance bottlenecks. . . you are doing something very very wrong

Here's why: most game logics are relatively simple: they use (mostly) simple algorithms and data structures. Problem is, that simple stuff is very tempting to be written with brute force.

Here's a quick example:
You are writing a simple tile-based RPG, and your world is, say, 1000x1000 tiles.
This means you have to store 1000x1000=1million tiles.
Now, if you test your player whether he can move to North from the current tile. . .
. . . is it really efficient to sweep through 1million tiles to find the tile just North of you?
. . . is it really good to do this in every single frame when the player presses the Up button?
. . . is it really necessary to keep this much data in memory all the time?

This is the highly inefficient brute force approach, and believe me, it won't be any better in C++ or even assembly. The only way to make it efficient is to think about the problem and solve it by with effective algorithms and data structures.
If you have these at hand, you'll realize that c# is just as good as c++.

Mind you, theoretically, you are right: any JIT-based language is slower than a precompiled one. However, when you do high level coding and your algos and structs are okay, the speed difference is marginal.
duerer is offline

duerer

Keeper of the Watch

#10

Join Date: Mar 2008
Posts: 783
Mentioned: 8 Post(s)