Question about Java, C and FPS performance

Hi, I have a few FPS issues in my game and I thought, before doing anything about it, maybe, switching to another engine might solve the problem. I learned that Java is slower as C but more portable, but then again I remember how norman wrote somewhere that open gl code runs native anyway and that it doesnt matter.

On the other hand, I remember writing a code to factor primes, and C was like 10x faster than java in doing this, so its hard to imagine that java can do anything as fast as C.

Lets say I have the same game code logic in Java on Jmonkey and on another game engine that runs on C++ will they have the same fps?

The language overhead is the smallest issue. How you create your scene and optimize the rendering is important, in any language or 3D library. And who is this Norman everybody seems to be talking about?

3 Likes
@normen said: And who is this Norman everybody seems to be talking about?

I dont know but this NormEn knows so much he must be a 300 year old wizard. :slight_smile:

So the question seems to be about implentation rather than what language to use?

I have a very large blockTerrain from the plugin Cubes that I want to implement efficently, Ive tried every combination of map sizes and chunks and there are some “fast” combinations but I seem to hit a limit pretty fast. A reason for this might be that I am viewing the game in Bird view", so there will be lot of stuff on the scene all the time. Ive limited the possible cam height and angle but I still see 3/4 of the Map in the worst case and my FPS drops from 4000 to 100.

I know about lod but I dont know how to implement it with cubes. What can I do to make my terrain faster?

@drollian said: I dont know but this NormEn knows so much he must be a 300 year old wizard. :)

So the question seems to be about implentation rather than what language to use?

I have a very large blockTerrain from the plugin Cubes that I want to implement efficently, Ive tried every combination of map sizes and chunks and there are some “fast” combinations but I seem to hit a limit pretty fast. A reason for this might be that I am viewing the game in Bird view", so there will be lot of stuff on the scene all the time. Ive limited the possible cam height and angle but I still see 3/4 of the Map in the worst case and my FPS drops from 4000 to 100.

I know about lod but I dont know how to implement it with cubes. What can I do to make my terrain faster?

I don’t know exactly how the Cubes library creates the mesh and textures / shaders but I guess by now there should be a lot of material on the web on how to optimize “block world” type renderings. Whats the problem with 100fps though? Mind you going from 4000->1000 fps is still less time lost than going from 60 to 50 frames. Anything in the thousands can’t be really regarded as “performance loss” but its easy to misinterpret the numbers because they are so large. Its about time in this case.

1 Like
@normen Whats the problem with 100fps though?

I have nothing on the scene except the Map and I want to add a LOT of stuff, my guess is that the fps will drop below a playable point when I start with 100fps.

Also I have a extremly good setup, I think taking my computer as reference is a littlebit too much.

@drollian said: I have nothing on the scene except the Map and I want to add a LOT of stuff, my guess is that the fps will drop below a playable point when I start with 100fps.

Also I have a extremly good setup, I think taking my computer as reference is a littlebit too much.

But when you see the whole map the individual objects are probably not much larger than a few pixels, giving you more options to optimize at such views (e.g. making them a single particle emitter or post effect that draws a few points or something like that).

1 Like
@drollian said: On the other hand, I remember writing a code to factor primes, and C was like 10x faster than java in doing this, so its hard to imagine that java can do anything as fast as C.

Remember that a lot of the rendering is done on the GPU rather than the CPU, in which case it doesn’t matter whether your code is in Java or C.

Minecraft is written in Java and Mythruna is even done using jMonkeyEngine.

Is Java ‘as fast’ as C? Arguable.
Is it capable? Definitely.

1 Like
@normen said: But when you see the whole map the individual objects are probably not much larger than a few pixels, giving you more options to optimize at such views (e.g. making them a single particle emitter or post effect that draws a few points or something like that).

I didnt thought about that, looks like a good solution thanks for the hint.

@rickard said: Is it capable? Definitely.
ok :)