ASGAlex / flame_tiled_utils

A set of useful utils to extend tiled functionality
MIT License
8 stars 3 forks source link

Error when loading tilemaps in Chrome browser on mobile devices #6

Closed xjyribro closed 5 months ago

xjyribro commented 6 months ago

Hi team, I used your package to render and large tilemap with animated sprites in Flame and it works well on desktop! However, there is an issue when loading on a mobile device.

Here is the the stacktrack:

at Object.throw_ [as throw] (errors.dart:297:3)
at _engine.SurfaceCanvas.__.drawAtlas (canvas.dart:451:5)
at sprite_batch.SpriteBatch.new.render (sprite_batch.dart:378:13)
at orthogonal_tile_layer.OrthogonalTileLayer.new.render (tile_layer.dart:145:16)
at renderable_tile_map.RenderableTiledMap.new.render (renderable_tile_map.dart:414:12)
at image_batch_compiler.ImageBatchCompiler.new.compileMapLayer (image_batch_compiler.dart:29:12)

error_tiled_utils

xjyribro commented 6 months ago

There is also an inconsistent crash on Chrome in profile mode.

Error: TypeError: null: type 'Null' is not a subtype of type 'NativeUint8List'
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 297:3  throw_
dart-sdk/lib/_internal/js_shared/lib/rti.dart 1385:3                         _failedAsCheck
dart-sdk/lib/_internal/js_shared/lib/rti.dart 1363:3                         _generalAsCheckImplementation
dart-sdk/lib/_internal/js_shared/lib/js_util_patch.dart 110:3                callMethod$
lib/_engine/engine/canvaskit/canvaskit_api.dart 1175:7                       SkImageExtension.readPixels
lib/_engine/engine/canvaskit/picture.dart 108:38                             toImageSync
packages/flame_tiled_utils/src/image_batch_compiler.dart 39:26               compileMapLayer
ASGAlex commented 5 months ago

There is nothing special in library's code to work with web inspector or in profile mode. Example application runs fine:

s2c0zmWEZR

Same for profile mode...

I just upgraded library to support latest Flame version - try to check if the bug still exists.