--
You received this message because you are subscribed to the Google
Groups "Robotlegs" group.
To post to this group, send email to robo...@googlegroups.com
To unsubscribe from this group, send email to
robotlegs+...@googlegroups.com
for support visit http://knowledge.robotlegs.org
I'd be interested in chatting about the potential a game engine based on RL could have. It would be interesting to see how one could split out the non-rendering/high-performance bits... This is the reason you don't see too many OOP based game engines. Trying to get them to perform at reasonable frame rates is... challenging.
But using RL/DI for the wiring bits of a component based engine is intriguing. I'd be interested in talking/thinking/brainstorming about it more...
j
Haha! By now, I'm entirely with you on this one. The only gripe I
still have is with making this change in behavior in a minor version.
This is mostly relevant for Robotlegs, as I'm fairly confident that
people using SwiftSuspenders on its own right now are bound to be
advanced developers who could deal with the change, if it's only
brought to their attention in a prominent way.
If you feel that we can take the risk for Robotlegs 1.1, by all means:
Let's go for it.
Note that I have a couple of other bugs still to fix (mainly that
child injectors should share the map of already instances that have
already been injected into). Will do that real soon now.
I created a component-based game engine called Mockingbird (http://
playmockingbird.com/). I've spent the last 3 years doing AS3 component-
based game engines (and spent the 5 years before that doing similar
engines for consoles). So I've got some experience with this! ;-)
Mockingbird is a bit different in that it's engine is designed for
runtime/real-time modification to the components and game entities.
So, in your example, we'd never have a PlayerEntity or EnemyEntity
class, everything is an entity and the components are assembled based
on data.
Now that I actually start to describe it, I'm not sure where
dependency injection would fit in at our component level! ;-) Since
it's data-driven at run-time, there's not much advantage (or is it
even possible?) of using Robotlegs/SwiftSuspenders to do injection
(because we don't have actual AS3 classes).
I do a somewhat hierarchical dependency injection on my components
(what we call Behaviors): when the individual behaviors are
instantiated I setup references to their owning entity, scene and
game, then call an initializer. This is similar to how Robotlegs sets
up it's mediators (though I don't do it automagically, I explicitly
construct all the entities and populate them).
I have been curious if Robotlegs could help me at this level, but now
that I actually talk it out in this posting, I'm not so sure.
I do love using Robotlegs at the application tier, though, where I
treat the game engine itself as one component in the larger app
(which, if you look at http://playmockingbird.com/ or http://mockingbirdgames.com/
you'll see is it a lot more than just a game engine).
Troy.
In Mockingbird as originally designed (and deployed on our site) we
don't need the strong typing because our behaviors (components) all
have to "just work" when mixed with any other component, so any common
dependencies are pushed into the entity class. This makes the
behaviors less like components (in the PBE-sense) and really just
behavioral (i.e. manipulators of the baseline entity's properties).
In most of the custom work we've done for clients, they've had pre-
designed combinations of behaviors and have not exposed that dynamic
system to the user. In those cases, the behavior system gets in the
way because all of the game object logic is built in code (like what
you're describing). I then end up doing lookup-by-strings and losing a
lot of type safety, and in fact usually end up creating monolithic
behaviors for each object type.
What I'm working on right now is a system that's the best of both
worlds. Given the dynamic nature of AS3, runtime reflection, and stuff
I'm learning from the DI crowd, I've got a few ideas bubbling for how
I can do it. Haven't had a test to implement and test them yet, so
it's still all just on paper.
> So im not sure if there is a good reason why you should still allow for
> dynamically adding components to entities. With your experience, can you
> think of a good example?
We implemented "power-ups" by essentially allowing one component
(which handled "collectable" logic) to assign a behavior to the object
that collected it. So, an invincibility power-up is a collectible that
when collected assigns the "invincible" behavior to the object that
collects it. So, that's one example for dynamic behaviors/components
at runtime.
And in general, if you have that flexibility, you'll find fantastic
ways to take advantage of it. Dynamic behavior systems are very
powerful for certain types of games. For others, they're easily more
trouble than they're worth. Depends on the design.
> Sometimes I like the "data-driven" aspect of PBE but at other times I really
> hate it. Working on this large Facebook game at the moment its a nightmare
> having most things declared in XML, any refactoring causes headaches galore,
> and the inheritance ability in the XML while cool looking at first causes
> innumerable problems.
I've gone back and forth on the XML-driven component definitions.
Mockingbird was originally all described in XML, with the actual
component classes being treated as "assets". For the second version we
stripped all of that out to make Mockingbird leaner and faster, but on
our current project I'm missing the flexibility of having non-
programmers make updates to certain things. So, for our next version
I'm playing with a hybrid model that's essentially a more powerful/
expressive version of the XML, borrowing some things from MXML. In
fact, I'm even looking at making the XML compatible with MXMLC such
that things could be dynamically loaded *or* precompiled.
> I think rather than calling this idea a "Component based Game Engine" it
> should be "Component based Game Framework".
This is an important distinction. As someone who's been selling and
building game tech for the last 10 years, it's critical to distinguish
between a framework for games (something like Flixel or PBE) and a
game engine (like Mockingbird). Frameworks are essentially SDKs for
programmers to use to build the final product. Engines, in my mind,
should be designed to be entirely data-driven (beyond plug-ins/
extensions) and should include some form of toolchain. At least, those
are my expectations in those terms.
> One thing I havent mentioned yet is Signals. I love this idea Robert Penner
> has done an incredible job with these things, totally turning on its head my
> idea about how events should work. I think they could be a great way to
> communicate between all levels of an app: the applicaiton tier, the entities
> and components. I just havent quite worked out yet how to take full
> advantage of these in a component based game framework.
Signals (as a pattern) is critical for games. The native Flash event
system is too heavy weight to use for inter-object communication. It's
the biggest bottleneck in the original Mockingbird (which uses native
events and the native display list extensively). The latest versions
of Mockingbird have dispensed with almost all events from within the
engine and instead use a custom Signals-like system. It was even more
of an issue with Mockingbird as the original version used Flex change
events for handling all of the dynamic updates, which caused a *huge*
amount of memory allocation for just events when a new game would be
loaded.
Troy.