You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
eonarheim opened this issue
Jun 15, 2019
· 1 comment
· Fixed by #2122
Assignees
Labels
core teamThis issue should be done by an Excalibur core memberfeatureLabel applied to new feature requestsstaleThis issue or PR has not had any activity recently
Currently it can be difficult to debug complex interactions in Excalibur, some guess work and experience is required. It can also be difficult to simulate issues that only occur at high speed.
Proposal
Add a new frame stepping API on the ex.Engine.debug component. This can be accomplished by providing new implementations of the frameStep() and now() which is currently provided by window.requestAnimationFrame and Date.now.
Something like this
// Drops the engine into frame step modeengine.debug.toggleFrameStep();// number of frames and the fps to simulate// Will step the engine 10 frames, at simulated 60fpsengine.debug.frameStep(10,60);
The text was updated successfully, but these errors were encountered:
Closes: #1170Closes: #577
This PR implements a new Clock api to manage the core main loop. Clocks hide the implementation detail of how the mainloop runs, users just knows that it ticks somehow. Clocks additionally encapsulate any related browser timing, like `performance.now()`
1. `StandardClock` encapsulates the existing `requestAnimationFrame` api logic
2. `TestClock` allows a user to manually step the mainloop, this can be useful for frame by frame debugging #1170
3. The base abstract clock implements the specifics of elapsed time
* The new `maxFps` option is added to the engine constructor options. This is achieved by exiting the mainloop early in clock if the current elapsed time does not match the desired fps. This can be useful when you want to deliver a consistent experience across devices.
## Some fixed bugs that were illuminated as part of this
- Excalibur's initialize flow was flawed, this PR refactors the start() to mean "ready for game code to run", before it actually meant resources loaded and player clicked play
- Play button wasn't positioned until first update, now positioned on init
- Systems were not initialized until first update, now initialized with the scene
## Current game start flow
### After this PR (consolidate init before start resolves)
1. game.start(loader)
2. clock started
3. load resources
4. compute resolution
5. run engine/scene/ecs system initialize
6. emit ready
7. start the game
### Before
1. game.start(loader);
2. mainloop raf started
3. load resources
4. run some initialize logic
5. compute resolution
4. start game
5. run initialize logic
## Changes:
- New Clock API for managing the mainloop
- Added `maxFps` engine option to constrain to a maximum fps
- Updated fps sampling to be more useful
- Updates the tests to use the new TestClock (fun side-effect tests are ~20 seconds faster in CI!)
- Some small bug fixes that are related to clock timings
core teamThis issue should be done by an Excalibur core memberfeatureLabel applied to new feature requestsstaleThis issue or PR has not had any activity recently
Context
Currently it can be difficult to debug complex interactions in Excalibur, some guess work and experience is required. It can also be difficult to simulate issues that only occur at high speed.
Proposal
Add a new frame stepping API on the
ex.Engine.debug
component. This can be accomplished by providing new implementations of theframeStep()
andnow()
which is currently provided bywindow.requestAnimationFrame
andDate.now
.Something like this
The text was updated successfully, but these errors were encountered: