Scirra / Construct-bugs

Public bug report submissions for Construct 3 and Construct Animate. Please read the guidelines then click the 'Issues' tab to get started.
https://www.construct.net
107 stars 83 forks source link

Layout crash - Can't open certain layouts, array error related to tilemaps #8100

Closed AndreYin closed 1 month ago

AndreYin commented 1 month ago

While working on my project I got a weird crash, and clicked "restart". Then some layouts that had tilemaps edited after r398.2 stopped opening, resulting in a crash.

I'm pretty sure this was caused by pressing CTRL + Z then immediately trying to draw a tile, but I can't quite replicate it - it probably has to do with mirroring/flipping tiles still. I had it happen before but haven't saved the crash report right after it happening, the crash report listed here is for the crash when trying to load a layout.

https://1drv.ms/u/s!AuQM7MihYyx4tMMhsa0eX-OQk2wV1w?e=tdt5YE

I can't reproduce it properly.

  1. Open the project file
  2. Open layout Remedy 1
  3. C3 crashes

Observed result

Expected it to not crash

While searching for the issue in the project files, I noticed some tiles had the code "536870880hvd" associated with them. For instance, this is the data associated with one of the tilemap objects that are making C3 crash:

View details `"36x0,232,7x238,188x0,232,7x238,188x0,232,7x238,188x0,232,7x238,188x0,232,7x238,188x0,232,7x238,188x0,232,7x238,188x0,232,7x238,152x0,25x238,262h,10x0,232,7x238,152x0,8x238,17x235h,261h,10x0,231,245,259,5x238,152x0,7x238,263,28x0,204,206,6x238,152x0,7x238,263h,28x0,232,7x238,152x0,5x238,2x235h,261h,28x0,232,7x238,152x0,4x238,262h,10x0,233,235,261,18x0,234,2x236,252,4x238,152x0,4x238,263,10x0,232,238,263h,18x0,218,219,220,5x238,152x0,4x238,263h,10x0,249,238,263h,18x0,232,6x238,153x0,4x238,263h,10x0,246,274,238,11x235,261,6x0,246,260,274,4x238,153x0,5x238,2x235,261,7x0,232,3x238,10x235h,261h,6x0,246,274,5x238,153x0,7x238,263,7x0,232,2x238,263h,17x0,231,245,259,4x238,153x0,7x238,263h,7x0,232,2x238,263,17x0,204,206,5x238,153x0,7x238,263,7x0,232,2x238,263h,17x0,232,6x238,153x0,7x238,263h,7x0,232,2x238,263,17x0,232,6x238,153x0,7x238,262h,7x0,246,274,238,263h,17x0,234,2x236,252,3x238,153x0,6x238,235h,261h,7x0,232,2x238,263,17x0,218,219,220,4x238,153x0,5x238,263,9x0,232,2x238,263,7x0,266h,2x235,261,6x0,232,6x238,153x0,5x238,263h,9x0,234,252,238,261h,7x0,249,2x238,263h,6x0,246,260,274,4x238,153x0,5x238,263h,9x0,234,252,263,8x0,232,2x238,262,6x0,246,274,5x238,153x0,5x238,263,9x0,231,259,263h,5x0,266h,2x235,250,238,235h,261h,6x0,232,6x238,153x0,5x238,263h,9x0,232,238,263,5x0,231,245,259,238,262h,8x0,231,245,259,4x238,153x0,6x238,7x235,261,0,232,238,263,5x0,249,3x238,263h,8x0,204,206,5x238,153x0,6x238,7x235h,261h,0,232,238,263,5x0,232,3x238,263h,8x0,232,6x238,153x0,3x238,2x235h,261h,9x0,232,238,263h,5x0,266,235h,250h,238,262h,8x0,232,6x238,153x0,2x238,262h,12x0,234,252,238,261,6x0,232,238,263h,8x0,234,2x236,252,3x238,153x0,2x238,263,12x0,232,2x238,262h,6x0,249,2x238,235,261,6x0,218,219,220,4x238,153x0,2x238,263h,12x0,247,251,235h,261h,6x0,232,3x238,262h,6x0,232,6x238,153x0,2x238,262h,22x0,231,245,259,238,262h,6x0,246,260,274,4x238,153x0,2x238,263,22x0,249,3x238,263h,6x0,246,274,5x238,153x0,2x238,263h,22x0,232,3x238,262h,6x0,232,6x238,153x0,2x238,262h,22x0,232,3x238,263h,6x0,231,245,259,4x238,153x0,2x238,263,15x0,233,235,261,4x0,247,251,2x238,262h,6x0,204,206,5x238,153x0,2x238,263h,15x0,232,238,262,6x0,232,238,263h,6x0,232,6x238,153x0,2x238,262h,15x0,249,238,262h,6x0,218,250,263h,6x0,232,6x238,153x0,2x235h,261h,15x0,246,274,262h,6x0,232,238,262h,6x0,234,2x236,252,3x238,171x0,247,251,261h,6x0,247,251,261h,6x0,218,219,220,4x238,189x0,232,6x238,189x0,246,260,274,4x238,164x0,233,261,23x0,246,274,5x238,164x0,232,262,23x0,232,6x238,164x0,232,262h,23x0,232,6x238,153x0,167h,10x0,249,263,23x0,246,260,274,4x238,153x0,2x235,261,8x0,232,263h,23x0,246,274,5x238,153x0,2x238,263,8x0,232,262h,23x0,232,6x238,153x0,2x238,263h,8x0,232,262h,23x0,231,245,259,4x238,153x0,2x238,263,8x0,232,262h,9x0,233,235,261,11x0,204,206,5x238,153x0,2x238,263h,8x0,249,262h,9x0,232,238,263,11x0,232,6x238,153x0,2x238,263,8x0,232,263,9x0,246,274,263h,11x0,232,6x238,153x0,2x238,263h,8x0,232,263h,9x0,247,251,261h,8x0,266h,2x235,250,6x238,153x0,2x238,262h,8x0,232,262h,20x0,231,245,259,7x238,153x0,2x238,262h,8x0,249,263,20x0,249,9x238,153x0,2x235h,261h,8x0,232,263h,20x0,246,274,8x238,164x0,232,262h,20x0,266,235h,250h,7x238,164x0,249,263,11x0,233,235,261,8x0,232,7x238,3x536870880hvd,161x0,232,263h,11x0,232,238,262,8x0,249,7x238,3x536870880hvd,161x0,232,263,11x0,249,238,262h,8x0,266,3x235h,250h,3x238,2x536870880hvd,162x0,249,263h,11x0,247,251,261h,12x0,234,2x236,252,2x536870880hvd,162x0,232,262h,26x0,218,219,220,238,2x536870880hvd,162x0,233h,261h,26x0,232,3x238,2x536870880hvd,190x0,266,3x235h,2x536870880hvd,1343x0,233,235,261,193x0,246,274,262h,193x0,249,238,263,22x0,266h,235,2x536870880hvd,167x0,232,238,263h,22x0,234,236,2x536870880hvd,167x0,232,238,262h,22x0,218,219,2x536870880hvd,167x0,249,238,263,22x0,232,238,2x536870880hvd,167x0,246,274,263h,22x0,246,260,2x536870880hvd,167x0,232,238,262h,5x0,266h,261,6x0,266h,3x235,261,4x0,232,238,536870880hvd,166x0,247h,251h,2x238,263,5x0,249h,262h,6x0,234,2x236,252,262,4x0,232,238,536870880hvd,166x0,246,3x238,263h,5x0,232,262h,6x0,218,219,220,238,263,4x0,232,238,536870880hvd,166x0,232,3x238,262h,5x0,266,261h,6x0,232,3x238,263h,4x0,232,238,536870880hvd,166x0,232,3x238,262h,13x0,246,260,274,238,262,4x0,232,238,536870880hvd,166x0,232,3x238,263,13x0,246,274,2x238,263,4x0,232,238,536870880hvd,166x0,249,3x238,263h,13x0,232,3x238,263h,4x0,232,238,536870880hvd,166x0,246,274,2x238,262h,13x0,232,3x238,262,4x0,232,238,536870880hvd,166x0,232,3x238,263h,13x0,232,4x238,4x235,250,238,536870880hvd,166x0,232,4x238,13x235,250,10x238,536870880hvd,166x0,232,28x238,536870880hvd,166x0,232,28x238,167x0,232,28x238,167x0,232,28x238,167x0,232,28x238,167x0,29x238,167x0,29x238,176945x0"`

If I use Notepad++ and replace all instances of "536870880hvd" to "0", the layout loads properly.

Affected browsers/platforms:

First affected release: r198.2

System details

View details Error report information Type: unhandled exception File: https://editor.construct.net/r398-2/main.js, line 1079, col 505 Message: Uncaught RangeError: Invalid array length Stack: RangeError: Invalid array length at Array.push () at np.EVb (https://editor.construct.net/r398-2/main.js:1079:505) at np.Cqb (https://editor.construct.net/r398-2/main.js:1080:86) at VUb (https://editor.construct.net/r398-2/plugins/allEditorPlugins.js:48:65) at https://editor.construct.net/r398-2/plugins/allEditorPlugins.js:357:443 at mw.op.I7c (https://editor.construct.net/r398-2/projectResources.js:950:76) at e1b.Instance.Cg (https://editor.construct.net/r398-2/plugins/allEditorPlugins.js:357:236) at d.Cg (https://editor.construct.net/r398-2/projectResources.js:894:373) at d.Cg (https://editor.construct.net/r398-2/projectResources.js:1461:315) at d.Cg (https://editor.construct.net/r398-2/projectResources.js:1416:3) Construct version: r398.2 URL: https://editor.construct.net/r398-2/ Date: Fri Jul 05 2024 10:46:08 GMT-0300 (Brasilia Standard Time) Uptime: 125.4 s Platform information Product: Construct 3 r398.2 (beta) Browser: Edge 126.0.2592.87 Browser engine: Chromium Context: webapp Operating system: Windows 11 Device type: desktop Device pixel ratio: 1 Logical CPU cores: 16 Approx. device memory: 8 GB User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0 Language setting: en-US WebGL information Version string: WebGL 2.0 (OpenGL ES 3.0 Chromium) Numeric version: 2 Supports NPOT textures: yes Supports GPU profiling: no Supports highp precision: yes Vendor: Google Inc. (NVIDIA) Renderer: ANGLE (NVIDIA, NVIDIA GeForce RTX 2060 (0x00001F08) Direct3D11 vs_5_0 ps_5_0, D3D11) Major performance caveat: no Maximum texture size: 16384 Point size range: 1 to 1024 Extensions: EXT_clip_control, EXT_color_buffer_float, EXT_color_buffer_half_float, EXT_conservative_depth, EXT_depth_clamp, EXT_disjoint_timer_query_webgl2, EXT_float_blend, EXT_polygon_offset_clamp, EXT_render_snorm, EXT_texture_compression_bptc, EXT_texture_compression_rgtc, EXT_texture_filter_anisotropic, EXT_texture_mirror_clamp_to_edge, EXT_texture_norm16, KHR_parallel_shader_compile, NV_shader_noperspective_interpolation, OES_draw_buffers_indexed, OES_sample_variables, OES_shader_multisample_interpolation, OES_texture_float_linear, OVR_multiview2, WEBGL_blend_func_extended, WEBGL_clip_cull_distance, WEBGL_compressed_texture_s3tc, WEBGL_compressed_texture_s3tc_srgb, WEBGL_debug_renderer_info, WEBGL_debug_shaders, WEBGL_lose_context, WEBGL_multi_draw, WEBGL_polygon_mode, WEBGL_provoking_vertex, WEBGL_stencil_texturing
AshleyScirra commented 1 month ago

The project appears to specify a tilemap with a size of about half a billion tiles. Unfortunately as the project already specifies an apparently invalid value and the steps do not include a reliable way to reproduce this happening in the first place, it is unlikely we can do anything about it. Assigning @DiegoScirra in case he can divine anything.

AshleyScirra commented 1 month ago

Note issue #8103 may be related, but also lacks reliable reproduction steps.

AndreYin commented 1 month ago

I tried my best replicating it in a new project, but could only find other tilemap bar bugs in the process (which I'm about to report). It's only a guess, but maybe could it be that the more you work on a tilemap, the more it corrupts? I never specified such a huge tilemap in the first place, and I have over 30 layouts in my project, they all worked just fine. Then after updating to r398.2 (to fix the previous bug from stable where I couldn't flip/mirror tiles sometimes), it started crashing the more I drew.

Pigpud commented 1 month ago

I had the layout editor crash when undoing a tilemap change in r399. I got the same error message listed above. After closing the project and opening it again I opened and closed the tilemap editor (without doing anything!) and all the tiles were misplaced. I was not able to replicate the issue in the latest stable r397.

https://github.com/user-attachments/assets/a72a4507-fe9f-4a15-942e-8fb8bbe40fa7

DiegoScirra commented 1 month ago

A problem was introduced when trying to fix #8065, both issues should be resolved on the next beta.

I haven't been able to reproduce the original issue, but I have a feeling that incorrectly transforming the indexes of the tile map to adjust for changes in size of the source image might have something to do with it.