The Forester

Its got something to do with the nbm bundle, gonna re-create it.

yes it adds the source as separate .zip file now. Iā€™m assuming thatā€™s their own convoluted way of distributing it.



hope it works now. sorry for this.

I get this one, when trying to use it after a few seconds.

Code:
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main] java.lang.NullPointerException at paging.geometry.AbstractGeometryPage.setFade(AbstractGeometryPage.java:106) at paging.geometry.GeometryPagingEngine2D.processPage(GeometryPagingEngine2D.java:163) at paging.geometry.GeometryPagingEngine2D.processPage(GeometryPagingEngine2D.java:86) at paging.AbstractPagingEngine.update(AbstractPagingEngine.java:170) at forester.grass.AbstractGrassLoader.update(AbstractGrassLoader.java:147) at online.newhorizons.client.entity.terrain.Tile.update(Tile.java:113) at online.newhorizons.client.entity.terrain.CTerrain.update(CTerrain.java:80) at online.newhorizons.client.scenemanager.scenes.IngameScene.updateAlways(IngameScene.java:124) at online.newhorizons.client.scenemanager.SceneSwitch.update(SceneSwitch.java:37) at online.newhorizons.client.system.ClientApplication.update(ClientApplication.java:323) at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:149) at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185) at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:223) at java.lang.Thread.run(Thread.java:722)

Great! Can wait to try it out! :slight_smile:

1 Like

@EmpirePhoenix

It is probably page-loading related, and may be caused by the terrain.



How is the terrain loaded? If the grassloader is trying to access a terrain object that is not already loaded, or in the process of loading, that could cause an error like this.

1 Like

Itā€™s just a Node with a Mesh, taht is extended to implement terrain.

ā†’ and implement the getHeight(Vector2f)

Hiā€¦



I get this error, after setting up the materials:



[java]2011-12-03T01:03:28.401+0100 SEVERE Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

com.jme3.asset.AssetNotFoundException: Grass.vert

at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:268)

at com.jme3.asset.DesktopAssetManager.loadShader(DesktopAssetManager.java:395)

at com.jme3.material.Technique.loadShader(Technique.java:229)

at com.jme3.material.Technique.makeCurrent(Technique.java:214)

at com.jme3.material.Material.selectTechnique(Material.java:890)

at com.jme3.material.Material.autoSelectTechnique(Material.java:904)

at com.jme3.material.Material.render(Material.java:974)

at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:657)

at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:299)

at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:357)

at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:913)

at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:850)

at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1126)

at com.jme3.water.WaterFilter.preFrame(WaterFilter.java:195)

at com.jme3.post.FilterPostProcessor.preFrame(FilterPostProcessor.java:328)

at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1100)

at com.jme3.renderer.RenderManager.render(RenderManager.java:1168)

at RPG3dEngine.GameApplication.update(GameApplication.java:280)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:149)

at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:223)

at java.lang.Thread.run(Thread.java:662)[/java]



I wonder why, it involves the WaterFilter??

1 Like

@empirephoenix

Ah ok, it depends on how the method is implemented then.



Do you see any grass at all before the exception, and if so, does it seem to be loaded at the correct height?



Again, this may not be the problem but (if you care to bother) Iā€™d like to see this through. It is a general issue with paged terrains. Like with terrainquad, if the getHeight method is called to get the height value from a terrain-patch that is not yet loaded, it would return NaN. This would cause the same error.



If the getHeight method causes a null-pointer exception in some way, or does not return a proper float (like NaN), it would not manifest itself until the setFade method is called. The reason is that the fading/visibility calculation is the ā€œfirst contactā€ between the grass-node and the LWJGL thread.



The only ā€œnon-foresterā€ object being accessed from the loading thread is the terrain.

1 Like

@staugaard

No its because it canā€™t find the grass vertex shader, for some reason. And I think I know why, sec.



EDIT: Yes. I am fixing it good sir. Iā€™ll update right away and post when its done. It seems the matdefs wants the full path of the shaders even if they are in the same folder. Doh.

2 Likes

[java] @Override

public float getHeight(Vector2f xz) {

Ray ray = new Ray(new Vector3f(xz.x,1000,xz.y),new Vector3f(0,-1,0));

CollisionResults res = new CollisionResults();

this.curnode.collideWith(ray, res);

if(res.getClosestCollision() != null){

return res.getClosestCollision().getContactPoint().y+this.terrain.getLocalPosition().y;

}

return 0;

}[/java]



I canā€™t think of any reason it is invalid. I construct the terrain from the Update thread.



I see the grass for a few frames correctly (between a few sekonds to a few milliseconds), then it crashes.



Could it be a problem if i have multiple Foresters running? (like static fields or similar?)

@androlo said:
@staugaard
No its because it can't find the grass vertex shader, for some reason. And I think I know why, sec.

EDIT: Yes. I am fixing it good sir. I'll update right away and post when its done. It seems the matdefs wants the full path of the shaders even if they are in the same folder.

Great... *Sits back and waits eagerly*

@staugaard

could you check now? if this didnā€™t work i have to remove the library descriptor entirely, add it again and do another update, which would take a few mins.

@androlo said:
@staugaard
could you check now? if this didn't work i have to remove the library descriptor entirely, add it again and do another update, which would take a few mins.

I'll do it right away...

@androlo
EDIT: I updated (only one file updated: project.properties), and build the TheForester project again, added the new jar... And I still have the problem. (Hope i did it right, so I dont waste your time)... (And at the same time my daughter woke up...)

@empirephoenix

There shouldnā€™t be any problems like that. Of course it canā€™t be ruled out, but the problem is with the loading, and there are no static methods or variables in either the grass-loader or the grassgeometrygenerator. The generator method is synchronized as well.



Iā€™m still looking.

@staugaard

No I will have to resubmit the whole thing, but Iā€™ll do that right away. Thanks for helping out with info and stuff, its embarassing tbh, simple error I made.



You could check in later and I will have updated it with a brand new jar etc. Itā€™s just a distribution problem, doesnā€™t have anything to do with buggy code or so.



Iā€™ll edit this post when Iā€™m finished.



EDIT: Its updated now. Tho i did two updates, so check that you actually get the new file. The new jar contains updated matdef.



Iā€™m gonna track these issues in the OP.

1 Like
@androlo said:
@staugaard
No I will have to resubmit the whole thing, but I'll do that right away. Thanks for helping out with info and stuff, its embarassing tbh, simple error I made.

You could check in later and I will have updated it with a brand new jar etc. It's just a distribution problem, doesn't have anything to do with buggy code or so.

I'll edit this post when I'm finished.

Any time, and thanks for the great contribution! (I hope to see it in action soon) ;)
1 Like
@androlo said:
Procedural terrain-systems is a problem in general, being that the grass depends on terrain to work.

I dont use procedural terrain system, I use YOUR procedural approach. (and you misspelled my name i your "main" post in this thread) ;)

You should have both source and javadoc in the release/libs/ directory and then reference them in the library xml file so users of the IDE get the javadoc and sources too.

Edit: Hm, I saw they are referenced from the other folders as wellā€¦ Guess thats fine too.

1 Like

@EmpirePhoenix



Need more info to solve that null pointer exception thing. Gonna change the lib tomorrow to use executor.execute instead of submit for the runnables. Iā€™ll probably keep it that way for some time during the initial stages of the release; that way the loading exceptions wounā€™t be blocked.



There will be no questions then as to what causes it.

@androlo



I got it to work now, but I dont think you have fixed the issue.



I debugged it, and while all others verts and frags are placed in my asset (eg. Common/MatDef/ā€¦), the grass.vert and .frag are looked up in the root of the asset. Where ofc it cant be found.



If the vert and frag for Grass and GrassImpostor is placed in the root of the asset, it works. So thats my workaround, until its fixed.



Looks cool, nice work :slight_smile: