6 Development

6.1 General Engine Design

The engine is completely self developed and written in C++. It uses the following libraries
  1. OpenGL 1.4 or OpenGL 2.0 with GLSL (depending on whether you choose high end or low end rendering)
  2. OpenAL for the Audio
  3. AssImp for Model Import
  4. libogg for longer Audio files. For short audio files the engine can directly load wav-files
  5. SDL for Game Window, Input, OpenGL initialisation. We use version 2.0 on all platforms except MacOS. There we use the old version 1.2
  6. Bullet Physic Engine for our physic engine. We use version 2.82 but we plan to update it soon.
  7. FreeImage for the loading of jpg's, png's, ...
  8. zlib for the compression of our files.
  9. libsigc++ for signals in C++
  10. tinyxml as XML parser. But we also developed our own binary XML variant (.xuti files)
  11. GLEW gives us access to all available OpenGL extensions.
  12. FreeType are used to render TrueType fonts
  13. WIN32 for threads under Windows and other Windows related stuff
  14. PThreads for threads under Linux and MacOSX
  15. LUA is compiled into the source code but not used.
  16. SWIG is used to connect Java with C++. With this library it is possible to call C++ methods from Java (and also Java from C++).
  17. Java as Environment for Modifications.
As a compile we use MinGW on Windows, GCC on Linux and Clang on MacOSX.
So you need to write your modifications in Java. Our first idea was to use C++ for Mods but this would not be platform independent. Through using Java it is possible to develop a MOD on Linux and it will work without modification on Windows, MacOSX.
The modifications are placed into the game directory under
mods/
usually there is only the 'firstmod' in this directory installed. You need to create your own mod directory. In your mod directory you will need a XML file with the name modinfo.xml with the following content:
<?xml version="1.0" encoding=ÜTF-8" standalone="yes"?>


The modinfo node has the following attributes:
  1. name - Name of the mod
  2. version - Version of the mod
  3. library - Important! This is the jar file which contains all your code. Here it is in the bin subdirectory of the mod.
  4. initclass - This is the name of the main class in your jar file. This class will be called by the game in order to initialise your modification.
In its most basic form the initclass has the following design:
package uti;
import com.staudsoft.syntheticworld.*;

public class FirstMod {
public static void init(int version)
{
System.out.println("Hello Java.test: "+version);
System.out.println("Engineversion: "+Engine.getEngineVersion());
System.out.println(Äfter Engineversion");
Engine.setModInterface(new MyModInterface());
}
}
The game will call the static (!) init method. In this you can initialise your interface. The mod interface is derivered from CModInterface. The basic structures is then:
package uti;

import com.staudsoft.syntheticworld.CClientAccess;
import com.staudsoft.syntheticworld.CModClient;
import com.staudsoft.syntheticworld.CModInterface;
import com.staudsoft.syntheticworld.CModServer;
import com.staudsoft.syntheticworld.CServerAccess;
import com.staudsoft.syntheticworld.ReferenceADR;

public class MyModInterface extends CModInterface {
@Override
public CModClient createClient(CClientAccess arg0, ReferenceADR arg1) {

System.out.println("JAVA:Created Client");
return new MyClient(arg0);
}
@Override
public CModServer createServer(CServerAccess arg0, ReferenceADR arg1) {
return super.createServer(arg0, arg1);
}
}
Todo: Describe the methods
After the mod is installed it can be loaded with the -/-mod parameter:
synworldloader.exe -/-mod firstmod
will load the "firstmod" modification.