gdx-ai icon indicating copy to clipboard operation
gdx-ai copied to clipboard

gdx-ai prevents GWT SuperDevMode

Open MrStahlfelge opened this issue 8 years ago • 14 comments
trafficstars

Issue details

html:superDev and html:dist works, but when you try to activate superDevMode with the compile button within the web browser, recompiling fails: [ERROR] Errors in 'com/badlogic/gdx/ai/StandaloneFileSystem.java' [ERROR] Line 65: Property 'user.home' is not defined.

Debugging is not possible without superdevmode activated.

Version of gdx-ai and/or relevant dependencies

1.8.1, line 65 is concerned.

MrStahlfelge avatar Aug 12 '17 18:08 MrStahlfelge

I have the same issue and can't compile in superDev mode, making debugging impossible 😢 . It seems the issue comes up when I use the MessageManager class.

Steps to reproduce the issue

Set up a fresh project with the gdx-ai extension. Instantiante a new MessageManager, or use MessageManager.getInstance(). Build the project with html:superDev, and try to compile with the refresh button.

alxthm avatar Nov 26 '17 13:11 alxthm

@MrStahlfelge Did you find some way to debug your application without superdevmode?

alxthm avatar Dec 10 '17 15:12 alxthm

No, unfortunately not.

MrStahlfelge avatar Dec 10 '17 21:12 MrStahlfelge

Unfortunately, I won't have the time to investigate in the short run, sorry. PR welcome :)

davebaol avatar Dec 11 '17 12:12 davebaol

@garbadrom did you call MessageManager class before LibGDX was properly initialized (in your game constructor or in the HTML launcher class) ?

mgsx-dev avatar Dec 11 '17 15:12 mgsx-dev

@mgsx-dev No, if I call MessageManager.getInstance() in the renderloop, the bug still comes up.

alxthm avatar Dec 11 '17 15:12 alxthm

@garbadrom and when you're removing this call all is OK ?

mgsx-dev avatar Dec 11 '17 15:12 mgsx-dev

Yes. The same issue comes up if I call System.getProperty("user.home") in the render loop, even without using the MessageManager class.

alxthm avatar Dec 11 '17 15:12 alxthm

System.getProperty("user.home") is not expected to work on HTML.

The root cause is that StandaloneFileSystem should not be accessed when you're using libgdx. It could happen when you're accessing (directly or indirectly) GdxAI class before LibGDX is properly initialized (calling from game constructor or from HTML launcher ...) see here : https://github.com/libgdx/gdx-ai/blob/master/gdx-ai/src/com/badlogic/gdx/ai/GdxAI.java#L48

I can't reproduce this issue with my setup. Maybe more information on your current setup could help : version of gdx-ai, libgdx, gwt ...

mgsx-dev avatar Dec 11 '17 16:12 mgsx-dev

Yes, I see ! However I believe the issue comes from the html:superDev compilation, as the issue still comes up even if I call MessageManager.getInstance() in a method that is never called.

I'm using : gwtVersion='2.8.0' gdxVersion = '1.9.7' aiVersion = '1.8.1' The issue is still here with gdxVersion = 1.9.8.

I've created a repository with a setup that reproduces the issue : https://github.com/garbadrom/GdxAiAndGwtTest.

alxthm avatar Dec 11 '17 18:12 alxthm

I had a similar issue with the same exception, but for compiling with dist instead of superdev. It was specifically linked to Behaviourtrees - there, the StandaloneFileSystem was (incorrectly) used. I didn't explicitly call anything ai related before everything was ready. But i found out, that reflection plays a role here. It was quite fragile, but i was able to isolate classes considered for reflection, finally being able to compile and not fail at runtime (due to class not found, because of missing reflection setting). I was only able to solve it by copying the whole btree source into my project, as using the com.badlogic.gdx.btree package for reflection was necessary for runtime, but fails at compilation. Only after splitting it into a different packaging, it worked for me.

So, the gist of it: The thing being active before Libgdx is properly initialized is reflection, at least in my case. This provoked the exception.

ReneHabermann avatar Aug 12 '18 11:08 ReneHabermann

Yes, i got this error too [ERROR] Errors in 'com/badlogic/gdx/ai/StandaloneFileSystem.java' [ERROR] Line 65: Property 'user.home' is not defined. My env gwtVersion='2.8.0' gdxVersion = '1.9.9' roboVMVersion = '2.3.6' box2DLightsVersion = '1.4' ashleyVersion = '1.7.0' aiVersion = '1.8.0'

So i cant use gdx-ai for html version ^( And if you run example @alexandrethm, you get error too.

petrov-pro avatar May 06 '19 16:05 petrov-pro

Exact same error.

[ERROR] Errors in 'com/badlogic/gdx/ai/StandaloneFileSystem.java'
[ERROR] Line 65: Property 'user.home' is not defined.
    version = '1.0'
    ext {
        appName = "AriseDeeper"
        gdxVersion = '1.9.10'
        roboVMVersion = '2.3.7'
        box2DLightsVersion = '1.4'
        ashleyVersion = '1.7.0'
        aiVersion = '1.8.2'
    }

I only use IndexedAStar for pathfinding.

payne911 avatar Sep 20 '19 04:09 payne911

I figured out a solution; it may not work for every project but it works here: https://github.com/payne911/Arise_Deeper/pull/1 . I use GWT's super-source mechanism (see core/src/AriseDeeper.gwt.xml, there's a line for super-source) to substitute the GdxFileSystem implementation in place of StandaloneFileSystem (which can't be loaded at all due to the system property access). core/src/emu/ has the super-sourced file. In the GdxDefinition.gwt.xml file, I inherit the game and its super-source after I inherit gdx-ai; I don't know if this matters. I hope this helps someone who finds this issue later...

tommyettinger avatar Sep 20 '19 05:09 tommyettinger