Giter Site home page Giter Site logo

Comments (4)

gschup avatar gschup commented on August 17, 2024 1

Hi! thanks for looking into GGRS!

Inspired by GGPO, GGRS is intended to be used to synchronise state for short p2p sessions (think a single match of a fighting game) between a small amount of players (think 2-4). The use case is quite specific, but the strong assumptions allow for strong results (in this case, this is "playing online with no added input latency").

From the few pointers you have given me, it seems like you should probably look into other options, as well. I recommend a server/host-based architecture that allows both for flexible drop-in and -out of players and maybe an event-driven synchronisation of state to cater your inventory/crafting needs.

I'll answer each point separately, hope that will shed some light on your issue ;)

Inputs

how would a 3d game even represent mouse movement (or do we treat the view vector itself as an input?)

you could encode the mouse dx and dy with fixed precision into a u32 or similar.

what about games with complex context dependant ui (minecraft crafting table, lets say) . I can maybe imagine creating an input struct with all possible actions in the game a player can take. But this breaks alot of the modularity of ecs, is there a better way?

I think that games with menu and inventory are probably better off with event-based networking. Deriving the outcomes of menu interaction from dx/dy alone seems very unnecessary.

the input struct seems to require Pod, which I have a hard time wrapping my head around the implications of.

It's basically a more modular way of saying "this can be represented through a fixed-size sequence of bits"

Desync

Intuition warns me this might become unmanageable in a more complex game.

The assumption that all state can be derived from inputs alone is quite strong, but it leads to a very efficient networking model. Making sure the state is actually deterministic is quite hard in practice.

Ggrs has tools for desync detection, but none for recovery. I do not understand the model well enough to know whether an out of band system for resyncing is even possible (would ggrs play nice).

There currently is no way to sync state other than through inputs. Desync detection is intended for debugging only. A feature like this could potentially be added, but I am very unsure this is actually a good thing for the purposes of this library.

Drop-In players

how hard would it be to get ggrs to play nice with players that spawn in as they load.

currently not possible, but potentially doable (by adding the functionality to GGRS). In usecases like this, I usually suggest a server-based architecture to handle flexible drop-in and drop-out at any time.

how would a game using ggrs handle NPCs spawned via RNG

All RNG has to be fixed through seeding in order to assure that a pseudo-randomly generated number is exactly the same across all clients.

from bevy_ggrs.

clinuxrulz avatar clinuxrulz commented on August 17, 2024 1

There is a gotcha too.

If you are using a SceneBundle (to use a gltf model for example), the SceneBundle will have child entities that get spawned automatically that will not be rolled back.

A workaround is to keep the player components simple, and have a separate non-rollback entity with the SceneBundle setting it's Transform to the same Transform as the player.

Rollbacks with parent/child entities leads to the Parent component and Children component pointing to entities that do not exist. So rollback of parent/child entity stuff needs to be either avoided, or the user need to reimplement their own parent/child stuff using Stable IDs rather than the Entity IDs to link them up.

Here is a little demo:

I use a FollowPlayer component to get the SceneBundle to follow the player on a separate entity.

from bevy_ggrs.

gschup avatar gschup commented on August 17, 2024

On the topic of a 3D example: I am sure we could enrich the repository by providing one. Thanks for the recommendation!

from bevy_ggrs.

gschup avatar gschup commented on August 17, 2024

closing this for now. feel free to reach out if further questions come up.

from bevy_ggrs.

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.