What have I been up to?

This week has been a bit slow, compared to the other weeks. It involved less writing code and more researching ways to do things.

So far, I’ve discovered a lot of things, a lot of which might not be relevant but I found out about them anyway.

Launching a new game

Whenever a new game is launched, a new GameManifest is created with game title, modules, and WorldInfo. After making the needed GameManifest object, the GameState is changed to StateLoading. In StateLoading there are multiple processes with are added in either initHost or initClient. Every process has a step function which performs the actual process and returns true once done. If the function fails to return true, it is called again after some time. There are many processes, I only investigated some which I thought were relevant to my work.


  • The WorldInfo which was added to the GameManifest while initialising the new game is now put to use. The WorldInfo is actually stored as a Map<String, WorldInfo> and this process simply gets the TerasologyConstants.MAIN_WORLD whose value is “main”. This made me understand that the world in which the player will spawn, it’s key should be “main” or TerasologyConstants.MAIN_WORLD.
  • The WorldGeneratorManager is fetched from the context, and a new generator is created, and seed is set for it.
  • A new StorageManager is instantiated to handle saving the game.
  • A LocalChunkProvider is instantiated which in turn creates ChunkGenerationPipeline where 8 threads are made for the loading of various chunks.


  • This process, as the name suggests initialises all entities with the BlockTypeComponent.
  • The entities are built in the generateBlockTypeEntity method of the BlockTypeEntityGenerator class. This method calls the build method of EntityBuilder class. In this method, the entity is assigned a pool using the assignToPool of PojoEntityManager, which maps entity ids to a PojoEntityPool object.


  • All the world properties like tree density are accessed here and added to the newly created worldEntity.
  • The worldEntity is created using a globalPool in the PojoEntityManager which I think is the only pool created and used throughout the game.
  • This entity is created in a different way but just like the BlockType entities towards the end, the same build method is called which allots it to a pool. This pool is the same as the globalPool used to create the entity initially.


  • A world generator is initialised and all the relevant entities associated with it are built and move them to the same pool being used till now. A large number of entities are built here.

The Chunk Generation Thread

  • The build method of EntityBuilder is now called by a large number of threads in completely random order creating chunks.


Apart from these processes, I’ve been looking at the way Sectors function as well. All the significant classes needed for the functioning are present in the engine but to put them in use, one needs to activate the TutorialSectors module.

The module makes use of the createSectorEntity method in the PojoEntityManager which in turn triggers the create method of the PojoSectorManager class. The PojoSectorManager creates a new pool in its constructor which is then used to build the sectors entity. The entity is also given the relevant components needed for simulation.