GithubHelp home page GithubHelp logo

Comments (4)

RJ avatar RJ commented on May 27, 2024 2

Could just document the workaround until bevy solves it for us 🤷‍♂️

from bevy_replicon.

RJ avatar RJ commented on May 27, 2024 1

Here's my workaround at the moment:

fn clear_events<T: Event>(mut events: ResMut<Events<T>>) {
    events.clear();
}

fn replicon_event_setup(app: &mut App) {
    // before replicon creates these with normal `add_event`, create them manually
    // so they will not be cleared before FixedUpdate can run
    // see: https://github.com/lifescapegame/bevy_replicon/pull/85
    #[cfg(feature = "is_client")]
    {
        app.init_resource::<Events<InitClientMessage>>();
        app.init_resource::<Events<PlayerInputsMessage>>();
        app.init_resource::<Events<TimingReportMessage>>();
        app.init_resource::<Events<EventMessages>>();
        // clear them at the end of fixedupdate:
        app.add_systems(
            FixedUpdate,
            (
                clear_events::<InitClientMessage>,
                clear_events::<PlayerInputsMessage>,
                clear_events::<TimingReportMessage>,
                clear_events::<EventMessages>,
            )
                .in_set(SpacepitSet::Last),
        );
    }
    // SERVER -> CLIENT EVENTS
    app.add_server_event::<InitClientMessage>(SendPolicy::Ordered);
    app.add_server_event::<PlayerInputsMessage>(SendPolicy::Unreliable);
    app.add_server_event::<TimingReportMessage>(SendPolicy::Unreliable);
    app.add_server_event::<EventMessages>(SendPolicy::Unreliable);
    // ...
}

from bevy_replicon.

UkoeHB avatar UkoeHB commented on May 27, 2024

For reference, this is fixed in this bevy PR.

from bevy_replicon.

Shatur avatar Shatur commented on May 27, 2024

Fixed in Bevy 0.12.1, closing.

from bevy_replicon.

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.