question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Fluid] Convenient entity matching

See original GitHub issue

Quick notes. Sorry for mess!

(From a jam perspective) aspects are currently a quite laborious aspect of ODB. it’s a pain writing out the predicates for a system or queries to the subscription manager. There’s some areas we could improve things:

Query singletons

Believe there are opportunities to solve the following query in a more succinct manner.

E(world.getAspectSubscriptionManager().get(Aspect.all(BathroomLevel.class)).getEntities().get(0))

Don’t know about others but having to inspect or alter a singleton that falls outside the scope of my system aspects is a fairly common thing. Delegating to a specialized passive system might be the proper way to do it, but the verbosity of resolving the singleton remains.

Something like E(BathroomLevel.class) could do the trick.

Query + iterating lists

Same with this query:

        IntBag actives = world.getAspectSubscriptionManager().get(Aspect.all(Hammer.class)).getEntities();
        int[] ids = actives.getData();
        for (int i = 0, s = actives.size(); s > i; i++) {

We could follow a jQuery style batch-operations All(Hammer.class).visible(true).do(myOperation) or perhaps the more practical for(E e : All(Hammer)), can’t really weigh the performance costs of having an iterator. I guess a per-composition iterator wouldn’t be too costly or limiting?

Constructors Will not do. IntellIJ quick-creating a constructor forcefully maps the Aspect.Builder as a parameter.

public class MyExampleSystem extends BaseEntitySystem {
    public MyExampleSystem(Aspect.Builder aspect) {
        super(aspect);
    }
}

Bit of a hack but I’ve been using a no-arg constructor (with Aspect.all()) in the hierarchy to save time in this regard.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DaanVanYperencommented, Dec 26, 2017

To keep things extensible and easy to grok settled on:

Group

        for (E gun : E.withGroup("player-guns")) {
            gun.firing(true);
        }

If anyone has a better naming suggestion i’m all for it. was considering E.group(..), E.allWithGroup(..), perhaps E.entitiesWithGroup(..) since E tends to get statically imported.

Tag

       E player = E.withTag("player");

Subscription

 for ( E e : E.withAspect(Aspect.all(Pickup.class, Pos.class)) ) { .. }
 for ( E e : E.withComponent(Pickup.class) ) { .. }

edit 1&2: Added tag, subscription

0reactions
DaanVanYperencommented, Dec 20, 2017

High value ticket for me, I’d love a convenient and fast API to retrieve by tag/group/composition and operate on sets.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Available Liquid objects - Power Apps - Microsoft Learn
A entity object provides access to the attributes of a Power Apps table record. Attribute, Description. Id, The GUID ID of the table,...
Read more >
Deep Entity Matching with Pre-Trained Language Models - arXiv
We present Ditto, a novel entity matching system based on pre-trained Transformer-based language models. We fine-tune and cast EM as a sequence- ...
Read more >
Intelligent Liquid Integrated Functional Entity: A Basic Way to ...
This methodology with generalized purpose can be named Intelligent Liquid Integrated Functional Entity (I-LIFE).
Read more >
Fluid Replacement for Athletes - NATA |
113 However, many athletes are unable to maintain hydration, so hyperhydration may be beneficial in extreme conditions when fluid intake cannot match sweat...
Read more >
Quality or convenience: Pick one | MDedge Dermatology
A 35-year-old male with a 5-year-history of a changing mole on his back sends a picture of the lesion to a telemedicine website...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found