methusalah / OpenRTS

Real-Time Strategy game 3D engine coded in pure java
MIT License
1.29k stars 151 forks source link

NPE at com.jme3.material.Material.<init> when running OpenRTS-example Game.java from eclipse #104

Open keer007 opened 8 years ago

keer007 commented 8 years ago

Hi, I have cloned the latest repository (as of an hour ago) and imported OpenRTS-core and OpenRTS-example as gradle projects in Eclipse. When trying to run Game.java (the main class in example), I run into the following exception - SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main] java.lang.NullPointerException at com.jme3.material.Material.(Material.java:120) at view.material.MaterialManager.getColor(MaterialManager.java:62) at view.MapView.createSky(MapView.java:89) at view.MapView.(MapView.java:55) at Game.simpleInitApp(Game.java:27) at app.OpenRTSApplication.initialize(OpenRTSApplication.java:156) at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130) at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207) at java.lang.Thread.run(Thread.java:745)

Running with JDK1.8 on Mac OS X and Eclipse Luna. Tried debugging and found that many .j3md definitions are loading properly and the exception is thrown when trying to load matdefs for a 'Unshaded.j3md'. I am totally newbie to jmonkey, so I am not really sure how jmonkey assets/resources are pulled into open-rts. Will keep checking the jmonkey jars pulled by Gradle to see if the above asset exists or not ...

Any tips to get the Game running from Eclipse or atleast start the Example Game from command line using Gradle?

methusalah commented 8 years ago

We have to fix it. In the meanwhile; you should run the core main class directly. It's in OpenRTS-Core.src.app.mainRTS

in that Main, F1, F2 and F3 allow you to toggle between editor, gameplay and firstperson view

keer007 commented 8 years ago

Thanks - core-app.mainRTS works fine.