The World - AnderWoche/MoldiyECS GitHub Wiki
The world is the main class, it contains all managers to use it just write:
import de.moldiy.moldiyecs.World;
...
World w = new World();
https://github.com/AnderWoche/MoldiyECS/blob/master/src/main/java/de/moldiy/moldiyecs/World.java
In the world you can now insert as many systems as you want. for this you need a system and a group, every system must be in a group.
World w = new World();
w.getSystemManager().addSystem(new MySystem(), w.getSystemManager().getMainSystemGroup());
You can also use the frame work single threaded by putting each system in the main thread group. But then it would be better to use artemis-odb unless you want to use multi-threaded.
Each group represents one thread!
There are 2 types of groups The "normal" group SystemGroup and the ThreadedSystemGroup. The "Normal" group can only be accessed with w.getSystemManager().getMainSystemGroup(), ALL other groups you create are ThreadedSystemGroups.
World w = new World();
// Access to mainThreadGroup
SystemGroup mainGroup = w.getSystemManager().getMainSystemGroup();
w.getSystemManager().addSystem(new MySystem(), mainGroup);
//Access to another group
ThreadedSystemGroup myNewGroup = w.getSystemManager().createThreadedSystemGroup();
w.getSystemManager().addSystem(new MySystem2(), myNewGroup);
How often should the group be processed per second?
ThreadedSystemGroup myNewGroup = w.getSystemManager().createThreadedSystemGroup();
myNewGroup.setIterationPerSecond(120); //The Group iterate now 120 times per Second.
You can use setIterationPerSecond() to limit the iterations per second of the systems in the group to get your desired tick rate. If you do not call the method it is unlimited.
Start the World
World w = new World();
w.initializeAndStart();
Once you have entered all systems you only need to initialize and start systems, but note that after calling initializeAndStart(); you cannot add more systems.