Repository navigation
Getting started
[in progress]
-
the sources are at your disposal to develop your game / game engine, you just need to insert them into a project of your favorite Java IDE, while associating the libraries and native ones available from the "/toLaunch / inEclipse / Libraries" folder ( licenses, javadocs and sources are also there) or available for download at this link "https://www.lwjgl.org/customize.",
-
However, be aware that a project folder that can be used under eclipse is available in "toLaunch / inEclipse", you just have to move it to your working folder and move the different sources to the root of it. (I think it is better to avoid duplicating the source codes available at the root of this repository in the "toLaunch / inEclipse folder," thank you for your understanding and sorry for the inconvenience, despite everything if you consider that this is not a good thing, do not hesitate to let it know!),
-
to test the source code, it suffices for example to run the OpenGLTest test "main" class (core / fr.seynax.onsiea.OpenGLTest; https://github.com/seynax/Onsiea/blob/master/core/fr /seynax/onsiea/OpenGLTest.java),
-
Here is typically the launch code below which can be used in the main method of the main class with the following parameters in order: window width, height, framerate, vertical synchronization, sync number, instance of game logic,
try
{
final var gameEng = new GameEngine("Onsiea", 1280, 720, 60, true, 1, new DummyGame());
gameEng.start();
}
catch (final Exception exception)
{
exception.printStackTrace();
System.exit(-1);
}GameLogic is a class including game logics (until then it makes sense!). This class implement the IGameLogic structural interface with the following methods:
// Methods
void initialization (IWindow windowIn) throws Exception;
void input (IWindow windowIn);
void update (double intervalIn, IWindow windowIn);
void render (IWindow windowIn);
void cleanup ();These by means of these methods that the game will be able to be carried out in the desired way.
-
The initialization method is called once when starting the game, "input (IWindow windowIn)" is a method called directly after the test of the input / output devices to test them, for example to make the player move, Detect a window resizer, get the contents of the clipboard etc.
-
The void method "update (double intervalIn, IWindow windowIn)" is several times per second (for the moment defined on 60 times per second in the GameEngine class), this one allows to carry out various updates.
-
The "void render (IWindow windowIn)" method allows it to "draw" elements on the screen, to render via OpenGL or Vulkan. This method MAY be executed multiple times per second (up to the number of framerates specified in the window settings).
-
The difference between the method "update (double intervalIn, IWindow windowIn)" and "void render (IWindow windowIn)" from a point of view number of executions per second is important to understand, the render function MAY be executed from many times per second (depending on the settings) but the update function will be executed at any cost 60 times per second. If less iterations were done the second before it will be caught, if more iterations then it will be limited.
-
Why run the render method several times per second? The question here is simple to answer, we would hardly like to play a game where we have to wait 1 second to see the movement of our player ...
-
But in the case of the update method, why force the number of iterations? This makes it possible to synchronize the number of updates between players of a multiplayer server of the same game, this is very important, because without it, if one player has a better machine than another, he could run a lot. more update iteration per second and therefore for example move and tap faster (although the multiplayer network system is supposed to monitor and limit as much as it can this kind of situation, but it cannot work miracles!) . In addition, this makes it possible to avoid variable slowing down or acceleration making the game unstable, it also makes it possible to avoid depending strictly on the performance of the machine executing the game.
-
Example of GameLogic : https://github.com/seynax/Onsiea/blob/master/game/fr/seynax/onsiea/game/DummyGame.java
- You can also run the first OpenGLTest test (which doesn't do much for now, but new things will be coming soon)
12/11/2021 - Onsiea Engine - developed by Seynax