Neko overflow problem

  • hello everyone ..

    so I needed FlxNapeTileMap into my current project .. and mostly it worked prefectly (great thanks for those who worked on it :smiley: )

    but it seemed to crash on neko for certain maps in a very weird way althoug it will work nicely on linux cpp & flash. this crash only happens on certain layouts though . I tried to find a pattern to it but I couldn't. so whenever I faced it I kept changing different tiles until it worked again (which is not acceptable of course).

    here is the neko crash log ->

    Invalid field access : elem
    Called from zpp_nape/shape/Polygon.hx line 923
    Called from zpp_nape/shape/Polygon.hx line 1115
    Called from zpp_nape/space/Space.hx line 4944
    Called from zpp_nape/space/Space.hx line 2405
    Called from zpp_nape/space/Space.hx line 1821
    Called from nape/phys/BodyList.hx line 455
    Called from flixel/addons/nape/FlxNapeTilemap.hx line 256
    Called from flixel/addons/nape/FlxNapeTilemap.hx line 143
    Called from map/TiledLevel.hx line 106
    Called from a C function
    Called from map/TiledLevel.hx line 29
    Called from state/mode/collect/CollectCoinsSinglePlayerMode.hx line 30
    Called from flixel/FlxGame.hx line 623
    Called from flixel/FlxGame.hx line 713
    Called from flixel/FlxGame.hx line 663
    Called from flixel/FlxGame.hx line 530
    Called from openfl/_legacy/events/EventDispatcher.hx line 98
    Called from a C function
    Called from openfl/_legacy/display/DisplayObject.hx line 161
    Called from a C function
    Called from openfl/_legacy/display/DisplayObjectContainer.hx line 286
    Called from openfl/_legacy/display/Stage.hx line 1103
    Called from openfl/_legacy/display/Stage.hx line 351
    Called from openfl/_legacy/display/Stage.hx line 1084
    Called from openfl/_legacy/display/Stage.hx line 430

    so today I was planning to fix that problem .. I started to follow the call stack.
    and then three hours and 40 traces() later .. I found the line causing the problem.
    without going into much details this check should evaluate to true


    tracing both crs & config.epsilon results in 49152 and1e-08 respectively
    now you would think that the last condition would result in true easily, right ?

    WRONG because in neko -> 49152*49152 = -1879048192 ._.
    overflowing seems to be a know issue with Neko .. Ref

    so I was finally able to get it to work by just using crs for comparison instead of crc*crs
    but I would like to know better ways to do it. also I would like to know what should I do about that change .. should I push it somewhere for example ?

  • @Ali-Hassan I think one should use Int64 or Float (which is actually double in Haxe, thanks, didn't know it before your question :D).

  • for the sake of completeness i made a simple test class in Neko and here are the results

    class Test {
        static function main() {
            var x:Int        = 49152;
            var y:Float      = 49152;
            var z:haxe.Int32 = 49152;
            var w:haxe.Int64 = 49152;

    here is the logs :

    Test.hx:7: -1879048192
    Test.hx:8: -1879048192
    Test.hx:9: -1879048192
    Test.hx:10: 2415919104
    Test.hx:11: 2415919104
    Test.hx:12: -1879048192
    Test.hx:13: 2415919104
    Test.hx:14: 2415919104

Log in to reply

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.