I am creating simple 100x100 tilemap using Tiled
and Phaser
, nothing more, but when I move the camero around, the "map scrolling animation" is not smooth, and there are noise/breaks/shakes of the map. I have no idea what is going on, specially this is only game showing the map. I found somewhere that it can be Chrome issue bug regarding animation frame, but it is the same on Firefox.
Can you advise?
Code example: https://github.com/Lazarencjusz/phaser-tilemap-shakes
I am using Tiled
to create json
of the map, then loading it into my app.
Key code is:
Camera creation:
const cursors = this.input.keyboard.createCursorKeys();
const controlConfig = {
camera: this.cameras.main,
left: cursors.left,
right: cursors.right,
up: cursors.up,
down: cursors.down,
acceleration: 0.3,
drag: 0.0017,
maxSpeed: 0.75,
};
this.#cameraControls = new Phaser.Cameras.Controls.SmoothedKeyControl(
controlConfig,
);
Map is created like:
this.#map = this.scene.make.tilemap({ key: AssetTilemapKey.testMap1 })
this.#tileset1 = this.#map.addTilesetImage(
TiledTileset.grassRoad,
AsseTilesetImageKey.grassRoad,
);
this.#map.createLayer(
TiledLayers.ground,
this.#tileset1,
)
-
\$\begingroup\$ Stepping frame by frame through your video, it looks like about one frame in four there's a larger lurch in motion than the previous three, giving that juddering shaky appearance. A couple possibilities I can think of are missing/incorrect delta time correction in the movement, a "beat frequency" misalignment between your logical update step and the rendering framerate, or an error in some code that's trying to adjust the map by full-tile increments. \$\endgroup\$DMGregory– DMGregory ♦2023年08月11日 16:02:44 +00:00Commented Aug 11, 2023 at 16:02
-
\$\begingroup\$ Just want to link this question, with your question on SO. If you do find a soultion, would be great if you could share. Thanks in advance \$\endgroup\$winner_joiner– winner_joiner2023年08月17日 07:36:21 +00:00Commented Aug 17, 2023 at 7:36
-
\$\begingroup\$ I found this one: dynetisgames.com/2018/02/24/manage-big-maps-phaser-3 but didn't have any time to test it yet \$\endgroup\$Michał Wojas– Michał Wojas2023年08月24日 19:01:23 +00:00Commented Aug 24, 2023 at 19:01