-
Notifications
You must be signed in to change notification settings - Fork 0
Buildings Functionality
Buildings are spawned as an Entity()
using the BuildingFactory
that creates a new entity and adds necessary components to it. See Entity Component System for how this component system works.
Why use a factory? The game engine already uses the Abstract Factory Pattern, a great way of creating similar objects without specifying a concrete class, so it made sense to conform. he
- A base building is created first by calling
createBaseBuilding()
which returns an entity with a PhysicsComponent and ColliderCompenet.
This is where to put non unique components (components that every building will possess)
- The specific components are then added for that specific building
e.g. the
TextureRenderComponent
which requires the path of the image asset to be constructed which differs for different buildings
- Some of these components are also configured using a configuration file
e.g.
townHall.addComponent(new CombatStatsComponent(config.health, config.baseAttack));
The rationale for using configs - Configuring Entities
The current Config Classes extend from the BaseEntityConfig
and adds support for a building level up system.
Visualisation of the BuildingFactory
using BuildingConfigs
in a class diagram:
The Building factory loads the configs and uses the fields in them to create and add components to the newly created building entity.
private static final BuildingConfigs configs = FileLoader.readClass(BuildingConfigs.class, "configs/buildings.json");
Map
City
Buildings
Unit Selections
Game User Testing: Theme of Unit Selection & Spell System
Health Bars
In Game menu
- Feature
- User Testing:In Game Menu
Landscape Tile Design Feedback