Skip to content
This repository was archived by the owner on Oct 1, 2022. It is now read-only.

Implementation Concepts Important Notes for Developers

Andreas Eberle edited this page Jul 18, 2018 · 4 revisions

On this page, we want to document some important implementation concepts relevant to the game development. Please keep in mind that this is by far not a complete list but rather should grow over time.

Building Files

For JSettlers, building configurations are defined in xml files in jsettlers.common/src/main/resources/jsettlers/common/buildings. The files define:

  • blocked and protected positions
  • location and type of the building flag
  • location of the construction posts (buildmarks)
  • bricklayer positions during construction
  • image indexes
  • allowed ground types
  • worker type (if a worker is required)
  • offer and request stacks
  • the job of a worker (if a worker is working in this building)

Blocked and Protected Positions

A building has blocked and protected positions. Blocked positions are blocked for movables, meaning they cannot walk on these locations when the building construction by the bricklayers has begun. All positions covered by the building image should be marked as blocked so movables don't walk through buildings.

Protected positions can be walked on by pathing movables. However, if a movable has nothing to do, it will try to get away from protected positions to keep these areas free of movables. Furthermore, buildings and trees cannot be placed on protected positions, making sure that a protected position is always walkable.

Important: All buildings must have a full border of protected positions around their blocked positions. Furthermore all positions with a stack (over or request) of a building and all locations walked by a building worker must be marked protected. This ensures several aspects:

  • The protected positions will always be walkable => the building worker will always be able to do his job
  • Two buildings will always have two walkable positions in between them and there is always at least one walkable position between a building and the border or any other non-walkable obstacles. This ensures movables can always reach all non-blocked positions on the same "continent".

Stacks

There are three types of stacks:

  • Construction stacks: are used to define the materials needed to construct a building. Furthermore, they define the location where the materials should be delivered to.
  • Request stacks: are used to define where goods should be transported to and which goods are needed at that location (request stacks)
  • Offer stacks: must be placed at the location where the building worker drops the produced materials. These locations are solely used to check the available amount of materials to display that number in the UI.

Important: All stacks of buildings must be on a protected position of that building. This is required to ensure that the position is allways reachable (no tree or other building can be placed on top of it). Naturally, all stacks must be on non-blocked positions of the building.