Skip to content

[WIP] Component Model + Mobs

Rob Nelson requested to merge pull/13866/component-mobs into Bleeding-Edge

Created by: N3X15

Executive Summary

This PR adds a framework for a generalized software component system.

Details

Many of us are familiar with the concept of Object-Oriented Programming (OOP). In short, it breaks a task up into interactions between entities (objects) and their relations. Space Station 13 already makes have use of this concept, but there's one problem: Many of the entities in SS13 can be enormous and complex, with human entities having a Life() process that encompasses a massive file of its own, and requires grey-beard levels of wizardry to work on it successfully.

There's a way to simplify OOP further: by using Components.

This PR adds a basic component model, which consists of a Container (/datum/component_container), which can hold one or more Components (/datum/component). This allows us to break a big, monolithic and complex process like Life() into smaller, more manageable chunks. More importantly, components can communicate with each other without direct references, allowing for highly flexible and adaptable systems.

As a demonstration, I have created a giant component spider mob which uses components for AI. These components communicate with a mob controller, but can also communicate with an object controller, making these components more reusable and adaptable than our existing mob framework.

Merge request reports