nape icon indicating copy to clipboard operation
nape copied to clipboard

Uncaught exception when running with OpenFL Neko

Open bartvanheukelom opened this issue 11 years ago • 14 comments

It appears something in Nape causes an error when running an OpenFL game with Neko.

Demo code:

class Main extends flash.display.Sprite {

 public function new () { 
 super();

 var tf = new flash.text.TextField();
 tf.text = "Hi There";
 addChild(tf);


 //var space = new nape.space.Space();
 }

}

This works fine. However, if you uncomment the var space line, the output is as follows:

$ openfl test neko
Uncaught exception - std@module_read

Am I doing something wrong or is this a Nape thing. If the latter, is it a bug or is Neko deliberately unsupported? Will it be fixed/added in the future? Thanks

bartvanheukelom avatar Dec 30 '13 16:12 bartvanheukelom

I'd be tempted to log this to openfl instead... I cannot reproduce it in a non-openfl project with just neko + nape

class Main
{
    static function main() {
        var space = new nape.space.Space(nape.geom.Vec2.weak(0, 10));
        var b = new nape.phys.Body();
        b.shapes.add(new nape.shape.Circle(10));
        b.space = space;
        space.step(1/60);
        trace(b.position.y);
    }
}

haxe -x Main -lib nape

deltaluca avatar Dec 30 '13 17:12 deltaluca

As you can see I've reported the issue with OpenFL. I'll soon test your code to see if the error is gone then on my machine as well.

bartvanheukelom avatar Dec 30 '13 23:12 bartvanheukelom

Yes, your sample works here too.

bartvanheukelom avatar Jan 01 '14 17:01 bartvanheukelom

I get this error when trying to run with Neko target:

AL lib: (EE) alc_cleanup: 1 device not closed
Called from zpp_nape/callbacks/CbType.hx line 348
Called from nape/callbacks/CbType.hx line 179
Called from nape/callbacks/CbType.hx line 198
Called from zpp_nape/callbacks/CbType.hx line 174
Called from zpp_nape/callbacks/CbType.hx line 353
Called from zpp_nape/ID.hx line 186
Uncaught exception - Invalid operation (+)

I put these two defines in my project.xml:

<haxedef name="NAPE_RELEASE_BUILD" />
<haxedef name="NAPE_NO_INLINE" if="neko"/>

gamedevsam avatar Feb 09 '14 15:02 gamedevsam

Could you reproduce that without using openfl and it's build tools? This seems to stem from the ID.hx file which is basicly just a bunch of 'static var X_ID = 0;' lines not ending up in the compiled code, and with the integers initialised to null (hence the invalid operationr + error).

deltaluca avatar Feb 09 '14 20:02 deltaluca

Well, here's a test project that initializes nape without openfl, it seems to work... but I need openfl and its build tools to make my games that use of Nape. So I'm still kinda sad, because Neko compiles much faster than cpp.

gamedevsam avatar Feb 14 '14 04:02 gamedevsam

It might be a neko issue https://github.com/HaxeFoundation/neko/pull/14

mrcdk avatar Feb 14 '14 08:02 mrcdk

It works. hehe..

<haxeflag name="-dce full" />

<!-- Optional -->
<haxedef name="NAPE_RELEASE_BUILD" />
haxe [3.1.3]
lime [0.9.7]
openfl-native [1.4.0]
nape [2.0.16]

R32 avatar Jun 01 '14 14:06 R32

As I mentioned in openfl/openfl#158, that flag doesn't resolve the issue for me, using all the same versions.

@deltaluca do you know why the static variables in ID.hx are included in the compiled code for all other targets, but not Neko? Can you think of why OpenFL would cause this to happen?

galundin avatar Jun 02 '14 17:06 galundin

There's no point investigating any further unless you build the latest neko with the lifted opcode limit as that is the reason for this problem. (OpenFL + Nape triggers it by being so damn huge paired together)

deltaluca avatar Jun 02 '14 20:06 deltaluca

It doesn't work for me:

haxe [3.1.0]
lime [2.0.0]
open-fl [2.1.6]
nape [2.0.16]

I'm in the middle of a coding jam so I will do it with flash and loose all the neko debugging facility...

MartinDelille avatar Nov 23 '14 10:11 MartinDelille

Just pointing out that I compile Neko from the GIT source and this does fix it for the example in the first post, however testing it on my game, the same error still occured.

Here my build of neko: http://test.failsafevault.com/files/neko-2.0.1-win.zip don't forget to replace the neko.dll in the bin folder

starburst997 avatar Jan 28 '15 16:01 starburst997

@starburst997, raise it with haxe/neko, if it's the exact same issue it may still be something on the lines of not having a large enough opcode size since presumably your game is more than a few lines of code ^^

deltaluca avatar Jan 28 '15 16:01 deltaluca

Thanks, I'll try tweaking the values to allow more size

starburst997 avatar Jan 28 '15 16:01 starburst997