Giter VIP home page Giter VIP logo

Comments (8)

cBournhonesque avatar cBournhonesque commented on June 7, 2024 1

Added a GlobalMetadata resource on both the client and server which will contain metadata about the connection.
Currently it only contains the client_id.

from lightyear.

cBournhonesque avatar cBournhonesque commented on June 7, 2024 1

I don't think so, the current way of doing things is more like an experiment, I'm not really satisfied with it.
Also:

  • the ControlledEntities component on the Client entity is not updated when an entity controlled by a client gets despawned (i'm waiting for observers for this)
  • the ControlledEntities component on the Client entity is not updated when the ControlledBy component is updated at runtime

I think it will be easier when we have relations in bevy

from lightyear.

Nul-led avatar Nul-led commented on June 7, 2024

Maybe this can be integrated with rooms?

from lightyear.

cBournhonesque avatar cBournhonesque commented on June 7, 2024

Yes, maybe lightyear could spawn one room per connected player

from lightyear.

cBournhonesque avatar cBournhonesque commented on June 7, 2024

I removed the GlobalMetadata resource as it was confusing; I think we should look at what other libraries (unity, unreal) do for this

from lightyear.

cBournhonesque avatar cBournhonesque commented on June 7, 2024

There would be a distinction between:

  1. Who is simulating the entity and sending replication updates?
    (in most cases it is the server, but in some client-to-server replication cases it could be a client. It's not enough to check who has the Replicate component, because the server will also have the Replicate component to propagate the updates to other clients)
    A client could be sending replication updates even for entities that they are not controlling/moving.

  2. Who is controlling the entity?
    This is basically: which peer is controlling/moving a given entity? Usually it's the client who added the InputLeafwing component on an entity. However the client adds the InputLeafwing on the Predicted entity, it could be useful to know on the server-side (i.e. Confirmed entity) who is the controller for a given entity.
    (Then, if the controller disconnects, that entity could also get despawned?)

  3. Who has authority?

Who is acting as server for the simulation? usually it's the actual server, but if we're running in HostServer mode it's one of the clients acting as server?
This concept is still not clear to me.


I feel like 1) and 2) could be useful if they were handled in lightyear.

  1. could be useful to handle transfering the 'replication ownership' of an entity
  2. could be useful for the server to keep track of who is the ClientId controlling an entity

from lightyear.

cBournhonesque avatar cBournhonesque commented on June 7, 2024

Other idea: we could create a dynamic component ControlledByClientX for each client.
On the server-side, we can add that component on each entity that is controlled by a given client, so that we can easily retrieve the entities that are controlled by a client.

from lightyear.

Nul-led avatar Nul-led commented on June 7, 2024

@cBournhonesque can this be closed then?

from lightyear.

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.