Coder Social home page Coder Social logo

Comments (4)

paked avatar paked commented on August 19, 2024

Most other engines implement this as a group.

However, I have no idea how this looks from an ECS standpoint. Perhaps things are just bound together because they are part of the same system?

from engo.

EtienneBruines avatar EtienneBruines commented on August 19, 2024

An Entity mainly being a []Component, a group would roughly be [][]Component.

I could imagine we add another Update function?

func (s *Systemer) Update(group *engi.Group, dt float32) {
    var (
        rcs []*RenderComponent
        spaces []*SpaceComponent
        ok bool
    )

    if rcs, ok = group.ComponentsFast(rcs).([]*RenderComponent); !ok {
        return
    }

    // ....
}

(Note that we probably cannot cast to []*RenderComponent, but for the sake of argument, let's say we could)

from engo.

paked avatar paked commented on August 19, 2024

@EtienneBruines I think the best way to do this would be with a group of Entitys, as opposed to [][]Component.

from engo.

EtienneBruines avatar EtienneBruines commented on August 19, 2024

According to the stuff I've read on Stackoverflow and forums of other engines, the solution they talk about, is to have the user/programmer implement some kind of ParetnComponent, or HealthBarEntityComponent, which holds a reference (pointer) to the linked Entity. This means that the HealthBar Entity doesn't have to be part of the System which manages the Health - but when the health-bar changes (when the HealthSystem has processed the playerEntity), the referenced HealthBar Entity will be changed (i.e. the RenderComponent).

Long story short: the user should implement this, preferably by creating custom Components which hold pointer references to those Entitys, and only add those Entitys to the Systems which actually process it.

from engo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.