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
Phaser.WEBGL doesn't move tilemap (CANVAS works,but slow) #1350
Comments
@KurtVanHal Which Phaser version is being used? And are the same issues present in the "dev" branch?
There was a WebGL issue for a spot - I can't remember which version(s) - where the texture were not updated correctly and so the map didn't scroll (affected WebGL only). There has also been recent work done to improve the tilemap scrolling performance, that can be found in "dev" as well. |
Hi pnstickne, First off, thx for the quick reply. Both examples work great. The version I'm using is Phaser v2.1.3. Thx in advance EDIT Thx to all |
@KurtVanHal I'm glad to hear that the future versions solve the problems! Right now "dev" is scheduled for the 2.2.0 release (it's RC stages!), but I'm not sure exactly when that will be. Obtaining a build is as simple as Right now the limitations with tilemap are .. uhm, "soft". The more on-screen tiles that need to be redrawn the slower it will run when scrolling - the new "dev" rendering greatly reduces the number of tiles that are redrawn, which is what results in the performance increase. Adding more visible tilemaps increases the number of tiles that need to be redrawn, so it's something you'll have to test! However, given a tilemap that is 32x32 when shown, I would expect the "dev" branch to be able to render 16+ tilemap layers when casually scrolled (and not invalidated) with the same performance as with a single layer previously. There is no optimization specifically for multiple layers, and each layer is rendered separately (this is cool in that layers can be stacked and moved independently, but it doesn't optimize for some common cases) - one drawback is that for 16 visible layers, there are 16 canvases created! Only the number of visible tiles should affect rendering performance, while off-screen tiles will only affect memory usage (but not performance unless available memory becomes a factor). Also, causing a tilemap to invalidate (ie. using |
@pnstickne Thx for the information. Let's get to work then ;) |
Has anything changed since the last post? I am experiencing the same problem. On computer the scrolling is not smooth but the game is playable. Unfortunately I can't say the same about phone experience. When the camera is not moving I get 60fps but at the moment the camera moves, the framerate drops to 4fps. |
The Tilemap updates talked about in this thread have been part of Phaser for over a year now, and haven't updated since then. |
Hi guys,
I'm having some difficulty getting my map working. When using the Phaser.CANVAS everything works, but when scrolling through the map there is a lot of lag. When using the Phaser.WEBGL the map doesnt render when I move my player. Any thoughts...
This is the basic code (very simple). It uses 1 layer (30_25 (32_32 tile))
var game = new Phaser.Game(800, 600, Phaser.WEBGL, 'phaser-example', { preload: preload, create: create, update: update, render: render });
function preload() {
}
var map;
var layer;
var cursors;
var sprite;
function create() {
}
function update() {
}
function render() {
}
Thx in advance
The text was updated successfully, but these errors were encountered: