Had a major revelation on how to structure your programs in an Entity-Component-System design! The problem I was running into was in implementing a "context-sensitive" interact button --- when the player is near an interactable thing and they press the action button, then the game should respond somehow, but how can we do it in a generic and extensible way?

Solution? add an ActiveInteraction component, and implement context-sensitive responses by means of dedicated systems that handle the corresponding interaction. (Initially, I was thinking of stuffing a lambda, or some defunctionalised deferred message into the system, but this would have been hairy).

Reply
R

Replies