Giter Club home page Giter Club logo

Comments (2)

Earthmark avatar Earthmark commented on May 28, 2024

I tried to replicate this locally, here's my findings!

@cuppachino , where is the LogicStep type from?

And I'm curious, is your bug report that the timer in the LogicStep type advanced more quickly than you intended, or that when a window is unfocused the update rate has different characteristics?

Experiment Setup

The example program I used

[package]
name = "time_test"
version = "0.1.0"
edition = "2021"

[dependencies]
bevy="*"
bevy-inspector-egui = "*"

[profile.dev]
opt-level = 1

[profile.dev.package."*"]
opt-level = 3
use bevy::{input::common_conditions::input_toggle_active, prelude::*};

fn main() {
    App::new()
        .add_plugins(DefaultPlugins.set(WindowPlugin {
            primary_window: Some(Window {
                //present_mode: bevy::window::PresentMode::Immediate,
                ..default()
            }),
            ..default()
        }))
        .add_plugins(
            bevy_inspector_egui::quick::WorldInspectorPlugin::default()
                .run_if(input_toggle_active(true, KeyCode::Escape)),
        )
        .run();
}

My findings

Virtual Time (TLDR: Appears WAI on my machine)

I did find Virtual and Real time elapsed at slightly different rates, but it was minimally different, less than a second over a hundred seconds.

Virtual time seems consistent based on the elapsed time of the previous update tick, and adapted based on the update loop time. For me it seems it advances roughly close to real time, besides jump discontinuities when I drag the window where real time advances, but virtual time is paused during the drag.

Fixed time (TLDR: Appears WAI on my machine)

I adjusted my Fixed timestep to step to 0.5 seconds, and it advanced at a consistent rate (although jumping every 0.5 seconds) focused or unfocused, relative to Virtual time. It appears at least on my machine to be fairly consistent.

LogicStep time (The problem banana that I can not find)

I do not see this type in Bevy's libraries, but this appears to be the type that is having the rate issue.

Was this a name of a previously removed type?

from bevy.

cuppachino avatar cuppachino commented on May 28, 2024

@Earthmark LogicStep is essentially a duplicate of Fixed. My mistake was running the modified run_fixed_main_schedule in FixedMain.

Very sorry for wasting your time, but thank you for the detailed analysis! I thought it was a problem with the Virtual time affecting other timers, but that's probably because I was updating the virtual timer outside of the RunFixedMainLoop.

app.init_schedule(LogicUpdate)
  .add_systems(
-      FixedMain,
+      bevy::app::RunFixedMainLoop,
      run_fixed_main_schedule
);

The issue can probably be closed.

from bevy.

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.