Skip to content

ebiten: Update is called not often as expected when the app is minimized #3405

@hajimehoshi

Description

@hajimehoshi

Ebitengine Version

9b968a8

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • OpenBSD
  • Android
  • iOS
  • Nintendo Switch
  • PlayStation 5
  • Xbox
  • Web Browsers

Go Version (go version)

go version go1.26.0 darwin/arm64

What steps will reproduce the problem?

Run this program

package main

import (
	"github.com/hajimehoshi/ebiten/v2"
)

type Game struct{}

func (e *Game) Update() error {
	println(ebiten.Tick())
	return nil
}

func (e *Game) Draw(screen *ebiten.Image) {
}

func (e *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
	return 640, 480
}

func main() {
	_ = ebiten.RunGame(&Game{})
}

and minimize the app

What is the expected result?

Ticks are printed 60 times per second

What happens instead?

Ticks are printed but more slowly than 60 times per second

Anything else you feel useful to add?

The behavior is pretty flaky. For example, inserting a println in the Ebitengine itself changed the behavior.

Now Update is invoked based on the frames, we might have to call it in a separate goroutine.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions