Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excalibur crashes when using tilemaps and actors together #1418

Closed
DaVince opened this issue Feb 9, 2020 · 5 comments · Fixed by #1491
Closed

Excalibur crashes when using tilemaps and actors together #1418

DaVince opened this issue Feb 9, 2020 · 5 comments · Fixed by #1491

Comments

@DaVince
Copy link
Contributor

DaVince commented Feb 9, 2020

Steps to Reproduce

import { Engine, Loader, Actor } from 'excalibur';
import { TiledResource } from '@excaliburjs/excalibur-tiled';

const game = new Engine();
const loader = new Loader();
const levelResource = new TiledResource('assets/map/single-layer.json');
loader.addResource(levelResource);

game.start(loader).then(() => {
  const tileMap = levelResource.getTileMap();
  game.addTileMap(tileMap);

  const actor = new Actor();
  game.add(actor); // Game crashes on this line
});

Expected Result

The map should display, along with any defined actors.

Actual Result

The entire browser tab freezes and needs to be force closed.

Environment

  • browsers and versions: Chromium 79.0.3945.130, Firefox 72.0.2
  • operating system: Ubuntu 19.10
  • Excalibur versions: 0.23.0

Notes

  • UIActors are fine; the problem specifically seems to happen when combining the Tiled TileMap and an Actor.
  • import * as ex from 'excalibur' instead of the above import style makes no difference.

Current Workaround

None.

@DaVince
Copy link
Contributor Author

DaVince commented Feb 9, 2020

I've slightly modified the CodeSandbox sample to demonstrate the crash: https://codesandbox.io/s/excalibur-tiled-example-ev0mt

@DaVince
Copy link
Contributor Author

DaVince commented Apr 12, 2020

I have done further testing by writing a map loader for an entirely unrelated map format (specifically, some entirely inconsequential DOS game which stores its maps as text files).

End result: the culprit does not seem to be the Tiled map loader, but possibly something in Excalibur's code itself that is causing the browser to lock up.

I'd like to try and contribute to the project and will be hunting down this issue in the Excalibur code. First, I'd like to retest this issue on the latest version; is there any sort of development branch or do I just check out master?

@DaVince DaVince changed the title Excalibur crashes when combining Tiled TileMap with Actors Excalibur crashes when using tilemaps and actors together Apr 12, 2020
@eonarheim
Copy link
Member

eonarheim commented Apr 12, 2020 via email

@DaVince
Copy link
Contributor Author

DaVince commented Apr 12, 2020

Found the method that caused the lockup: stub out method TileMapImpl.collides() and the browser doesn't freeze anymore.

Will attempt a fix and send a PR tomorrow.

eonarheim pushed a commit that referenced this issue Apr 15, 2020
…wn (#1491)

Closes #1418 

TileMapImpl.collides() got stuck infinitely on the `trace points for overlap` loop when the actor's size is zero.

## Changes:

- Check size of actor before deciding whether to run the collision logic
- Return null when actor width or height is 0

Co-authored-by: Vincent Beers <vincent.beers@sogeti.com>
@DaVince
Copy link
Contributor Author

DaVince commented Apr 15, 2020

excaliburjs/excalibur-tiled#87 is a duplicate of this and can also be closed :)

@jedeen jedeen added this to the 0.24.0 Release milestone Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants