4 ms·
Hey, so I had a question about http://docs.superpowers-html5.com/en/getting-started/scripted-behaviors http://docs.superpowers-html5.com/en/getting-started/scri
by seivan 11y ago
Hey, so I had a question about http://docs.superpowers-html5.com/en/getting-started/scripted-behaviors http://docs.superpowers-html5.com/en/getting-started/scripte...
How do you find this impact performance, especially when a behaviour might need to communicate with other behaviours, also how would that be done?
I've looked at several solutions, e.g Apple has a "BehaviourSystem" (called ComponentSystem) where you can fetch Behaviours (Components) per class from all other actors.
- elisee 11y agoBehaviors are simply added to a list of components on the actor (aka "game object") and once a tick, the whole actor tree is update()'d. There are probably optimizations to be done here, but we haven't hit the wall yet so we're trucking along on more urgent stuff :) Communicating with another behavior can be done like so: Sup.getActor("Some actor").getBehavior(BehaviorClass).someMethod(); If you use an actor or a behavior often, you'll want to cache it into a member variable so you don't look it up every frame. By the way, we have open sourced all the games we've made for Ludum Dare and the Global Game Jam over the last year, you might like checking them out: https://github.com/superpowers-extra https://github.com/superpowers-extra