Design patterns for effects between actors and technology
Posted
by
changelog
on Game Development
See other posts from Game Development
or by changelog
Published on 2012-07-02T20:05:49Z
Indexed on
2012/07/02
21:24 UTC
Read the original article
Hit count: 287
I'm working on my first game, and taking the opportunity to brush up my C++ (I want to make as much of it as portable as I can.)
Whilst working on the technology tree and how it affects actors (spaceships, planets, crew, buildings, etc) I can't find a pattern that decouples these entities enough to feel like a clean approach.
Just as an idea, here's the type of effects these actors can have on one another (and techs too)
- An engineer inside a spaceship boosts its shield
- A hero in a spaceship in a fleet increases morale
- A technology improves spaceships' travel distance
- A building in a planet improves its production
The best I can come up with is the Observer pattern, and basically manage it more or less manually (when a crew member enters a spaceship, fire the event; when a new building is built in a planet, fire the event, etc etc.) but it seems to be too tightly coupled to me.
I would love to get some ideas about how to approach this better.
© Game Development or respective owner