Skip to main content
gamedev.net
🔒 Locked

Attaching effects to game objects

Started by wild_pointer Oct 12, 2008 at 1:05 PM 0 replies 700+ views
Original Post
wild_pointer
wild_pointer
This is more of a responsibilty/organizational question. Say I have a ship and I'd like to have the engine light up and leave some kind of trail when it's accelerating. Should the ship own the effect totally? Do I create some kind of generic rigging system and attach the effect to the "engine" point? Who would then turn the effect on and off when needed? Does the effect listen to an event or does the ship know about the effect?
[size=2]
swiftcoder
swiftcoder
Quote:
Original post by wild_pointer
This is more of a responsibilty/organizational question. Say I have a ship and I'd like to have the engine light up and leave some kind of trail when it's accelerating.
In an ideal system, the effect would be driven entirely by events (i.e. Ship.Accelerate, Ship.CeaseAcceleration), though it could also be reasonably implemented by watching a variable (i.e. Ship.IsAccelerating).

As to your other question, in the same ideal system, the ship knows absolutely nothing about the graphical representation of itself or its engine - but this level of de-coupling is not always feasible in practice, especially if you are adapting an existing codebase.
Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.