Ashley and Scene 2D?

Anything libgdx related goes here!

Ashley and Scene 2D?

Postby javadocmd » Sat Aug 09, 2014 10:56 pm

The announcement of LibGDX's 1.3.0 release brought Ashley to my attention, and after a brief tour through the wiki and the example code, I got really excited about trying it.

I began to consider how I might integrate Ashley into some of the small, example games I've been working on, but I hit a bit of a roadblock when I thought about Scene 2D (which I tend to use a lot).

So my question is how do you see Ashley and Scene 2D fitting together? (Maybe the answer is "they don't".)

I really like Scene 2D as a tool to layout UI elements, handle messages in a hierarchical fashion, group actors to manipulate them as one, do simple animations and effects, and so on. So I'd hate to have to re-implement these things from scratch. But the advantages of Entity/Component systems are well-discussed, and I at least find them attractive.

It seems like the two systems come from diametrically opposed philosophies: the monolithic Actor object (in Scene 2D) vs. compartmentalized Components (in Ashley). And so I'm having a hard time imagining how I could marry the systems together and get the strengths of both. Any wisdom or speculation is appreciated. Thanks!
javadocmd
 
Posts: 31
Joined: Tue Jan 14, 2014 4:57 am

Re: Ashley and Scene 2D?

Postby evilentity » Sun Aug 10, 2014 1:34 am

You use scene 2D, actors and all that crap for UI, like God intended. Than use messages to communicate.
Looking for a freelancer? PM me!
evilentity
 
Posts: 4324
Joined: Wed Aug 24, 2011 11:37 am

Re: Ashley and Scene 2D?

Postby javadocmd » Sun Aug 10, 2014 6:19 pm

I'm unclear on your response. Your suggestion is don't use Ashley? Otherwise, what is its role?
javadocmd
 
Posts: 31
Joined: Tue Jan 14, 2014 4:57 am

Re: Ashley and Scene 2D?

Postby evilentity » Sun Aug 10, 2014 9:19 pm

Dont use it for the UI.
Looking for a freelancer? PM me!
evilentity
 
Posts: 4324
Joined: Wed Aug 24, 2011 11:37 am

Re: Ashley and Scene 2D?

Postby javadocmd » Sun Aug 10, 2014 10:24 pm

So what would you use it for? "UI" is kind of an overloaded term. Do you just mean menu buttons and things, or do you mean everything displayed on the screen -- player, enemies, bullets, etc.?
javadocmd
 
Posts: 31
Joined: Tue Jan 14, 2014 4:57 am

Re: Ashley and Scene 2D?

Postby evilentity » Sun Aug 10, 2014 11:40 pm

When I think UI, I think of Windows, buttons, labels and all that. But im just an idiot on the internet so who knows?
Looking for a freelancer? PM me!
evilentity
 
Posts: 4324
Joined: Wed Aug 24, 2011 11:37 am

Re: Ashley and Scene 2D?

Postby dashto » Mon Aug 11, 2014 4:18 am

A Scene2D node can be a Component in the ECS. Your Render System can contain another Stage used only for those Components (the UI or HUD should be outside of the entity system).

Source: I've shipped a game using Scene2D nodes as the "render component" in an ECS game. Might as well use an existing scene graph if you need it rather than rolling one from scratch.
dashto
 
Posts: 50
Joined: Thu Mar 06, 2014 1:15 am

Re: Ashley and Scene 2D?

Postby javadocmd » Tue Aug 12, 2014 7:49 am

Interesting thought. Thanks, dashto.
javadocmd
 
Posts: 31
Joined: Tue Jan 14, 2014 4:57 am

Re: Ashley and Scene 2D?

Postby javadocmd » Fri Sep 19, 2014 10:22 pm

This past Ludum Dare I actually got a chance to play with a different solution to this question. In essence I found a way to use Scene2D and Ashley side-by-side in what I think is a pretty nice way. I wrote a blog post about it with diagrams and everything (where you can also find a link to the Github repo with the functioning code).
javadocmd
 
Posts: 31
Joined: Tue Jan 14, 2014 4:57 am


Return to Libgdx

Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest