[SOLVED BUG] Marching Squares

Hey there,
i’m doing a qix game.
The moment i set the marching squares at 1x1 px i got an error message.
I need 1x1 px cause i want the rectangle to be perfectly drawn.
I wonder if it’s a bug or not.
here ss.


I tried the marching square qix example project with the online version without making any changes. It worked for a little while then I got this error.

what i’m trying to do is increase precision to 1 px to get precise geometries…since it is a qix game. I guess that is the problem…but i could be wrong

I didn’t make any changes to the example. It still crashes. This is the full error that I get.

TypeError: Cannot read properties of undefined (reading '38')
    at GDJSInlineCode.ScalarField.extrapolate (https://game-previews.gdevelop.io/1713682366400-959083/gdjs-evtsext__marchingsquares__definescalarfieldpainterlibrary-func.js?gdCacheBurst=4286881865:328:53)
    at GDJSInlineCode.HeightMap.getHeight (https://game-previews.gdevelop.io/1713682366400-959083/gdjs-evtsext__marchingsquares__definescalarfieldpainterlibrary-func.js?gdCacheBurst=4286881865:920:37)
    at GDJSInlineCode.prototype.containsPoint (https://game-previews.gdevelop.io/1713682366400-959083/gdjs-evtsext__marchingsquares__marchingsquaresbehavior.js?gdCacheBurst=4286881865:215:41)
    at Object.GDJSInlineCode [as userFunc0x857928] (https://game-previews.gdevelop.io/1713682366400-959083/gdjs-evtsext__marchingsquares__marchingsquaresbehavior.js?gdCacheBurst=4286881865:4353:46)
    at gdjs.evtsExt__MarchingSquares__MarchingSquaresBehavior.MarchingSquaresBehavior.ContainsPointContext.eventsList0 (https://game-previews.gdevelop.io/1713682366400-959083/gdjs-evtsext__marchingsquares__marchingsquaresbehavior.js?gdCacheBurst=4286881865:4363:111)
    at gdjs.evtsExt__MarchingSquares__MarchingSquaresBehavior.MarchingSquaresBehavior.ContainsPoint (https://game-previews.gdevelop.io/1713682366400-959083/gdjs-evtsext__marchingsquares__marchingsquaresbehavior.js?gdCacheBurst=4286881865:4433:111)
    at gdjs.evtsExt__PathPainter__PathPainter.PathPainter.HasIntersectionWithBallContext.eventsList1 (https://game-previews.gdevelop.io/1713682366400-959083/gdjs-evtsext__pathpainter__pathpainter.js?gdCacheBurst=4286881865:1801:207)
    at gdjs.evtsExt__PathPainter__PathPainter.PathPainter.HasIntersectionWithBall (https://game-previews.gdevelop.io/1713682366400-959083/gdjs-evtsext__pathpainter__pathpainter.js?gdCacheBurst=4286881865:1894:93)
    at gdjs.GameCode.eventsList1 (https://game-previews.gdevelop.io/1713683865657-186871/code0.js?gdCacheBurst=4286881865:209:75)
    at gdjs.GameCode.eventsList10 (https://game-previews.gdevelop.io/1713683865657-186871/code0.js?gdCacheBurst=4286881865:941:15)

well…it looks like it’s gonna need a fix

The example uses MarchingSquare 0.5.0 when the lastest version is 0.5.7. I’ll update the example.
I wouldn’t recommend a cell size of 1x1 as it would completely defeat the purpose of the marching square algorithm. Indeed, tiles of 1 pixel make no sense.

2 Likes

I opened the example and updated the marching square extension and played it for awhile without any crashes. It seems good.

Ok, mind a question…
is It possible to draw a precise rectangle (sry, i dont mean tò draw rectangle, i mean to get a precise rectangle contour of field by additive formula) with marchin squares?
Cos everytime the rectangle get rounded on corners cos i guess it is how marching squares works.
But still i wonder if it is possible

Bump.
It was my 0.50 ver of marching squares acting strangely.
With 0.57 it’s working fine (not perfectly).
Thx Davy