D
D
durnevdanya2017-07-28 00:32:08
Java
durnevdanya, 2017-07-28 00:32:08

Why is C++ better for a game engine than Java?

Hello. I have seen discussions on this topic for a long time. There is lwjgl (light weight java game library), it gives access to OpenGL, it has a couple of engines and games. But many say that the best choice for writing an engine is C++. Why? Java generally for these purposes is not suitable? Or how :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Roo, 2017-07-28
@durnevdanya

A programming language is a tool for solving problems.
Java, C, Js, Python.... they are all tools.
And just as a hammer is good for hammering nails, and a screwdriver is good for driving screws, Java is good for writing applications with powerful logic, and Js, for example, for funny pages on the Internet.
It is possible to “tighten” screws with a hammer and hammer nails with a screwdriver, but it is much more efficient to use tools for their intended purpose.
Holivars are meaningless and useless here - you should not compare Java and C ++. Nobody argues about hammers versus screwdrivers (everyone understands that a hammer is faster)). In some tasks, it is more appropriate to use Java, in some - pluses.

X
xmoonlight, 2017-07-28
@xmoonlight

Java code runs inside the Java virtual machine.
C++ code is compiled into bytecode for direct execution by the processor.

The specifications of the bytecode and the virtual machines that execute it can vary greatly from language to language: bytecode often consists of instructions for a stack virtual machine, but register machines can also be used. However, most bytecode instructions are usually equivalent to one or more assembler instructions.
----------
Source: Wikipedia
Bottom line: an extra layer slows down the execution of logic in a Java application compared to C ++, but a finished Java application can be run on most devices and operating systems without additional recompilation and optimization for a specific platform.
About Java (off site)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question