[SOLVED] Jme-minimap

@jayfella not sure if there’s a specific thread for the jme-minimap you put on the store. Just wanted to see if you could help me out.

This works:
addChild(new MiniMapState(((SimpleApplication) getApplication()).getRootNode(), 64, 200));

This does not work:
addChild(new MiniMapState(new Node(), 64, 200));

Uncaught exception thrown in Thread[main,5,main]
IllegalStateException: Scene graph is not properly updated for rendering.
State was changed after rootNode.updateGeometricState() call.
Make sure you do not modify the scene from another thread!
Problem spatial name: null

I thought I could do new Node() to just get a blank scene for the minimap. What am I missing?

1 Like

Are you sure you’re not manipulating that node you passed from another thread? It will get attached on the initialisation phase of the AppState.

1 Like

In my test I don’t even keep a reference to the node I pass (hence the new Node()) - so I wouldnt know of any way to add anything to that Node

This is the stack

Thread [main] (Suspended (uncaught exception IllegalStateException))
Node(Spatial).checkCulling(Camera) line: 361
RenderManager.renderSubScene(Spatial, ViewPort) line: 717
RenderManager.renderScene(Spatial, ViewPort) line: 710
RenderManager.renderViewPort(ViewPort, float) line: 1096
RenderManager.render(float, boolean) line: 1158
Main(SimpleApplication).update() line: 272
LwjglDisplay(LwjglWindow).runLoop() line: 530
LwjglDisplay(LwjglWindow).run() line: 632
LwjglDisplay(LwjglWindow).create(boolean) line: 466
Main(LegacyApplication).start(JmeContext$Type, boolean) line: 463
Main(LegacyApplication).start() line: 424
Main(SimpleApplication).start() line: 127
Main.main(String…) line: 101

1 Like

If that node is not being managed and having its update methods called every frame then you will have this problem.

For the root node, this is done automatically.

1 Like

Is there anything in the wiki on how to do this ?

1 Like

Why do you have a node in a mini map that you aren’t doing anything with?

Anyway, if you search on the forum for “managing viewports” or “viewport app state”, I suspect you will find hits. It comes up from time to time.

…or you are 5 seconds away from the JME source code at any time and can just look at what the application class does with root node… calling updateLogicalState() and updateGeometricState() every frame.

1 Like

I’m trying to add a scene with a seperate rootnode, to act as the minimap scene, so that my entities can have different models in that scene (as opposed to what they look like in the main view).

Just gonna reference this oldt thread here: [Solved] Minimap, cloaking devices and stealth

1 Like

Just seems weird to shove a node in there and forget about it. Like, I wonder how you will do anything with a map at all.

1 Like

Oh, wait. Maybe I can just have a minimap rootnode and add that to the app-rootnode, because my normal models arent on the global rootnode, they have their own “root”

1 Like

This was just to test - getting a “blank” minimap

1 Like

Dude!

It’s literally as simple as calling node.updateLogicalState(tpf); node.updateGeometricState() every frame.

Which you could find in the source code. And in the forum.

To all JME users, if you are afraid to look in the JME source… quit now. Load up Unity or something. :wink:

Edit: keep life simple, man. This is the easy stuff. :slight_smile:

Edit 2: an example of managing a viewport: Lemur/ViewPortDemoState.java at master · jMonkeyEngine-Contributions/Lemur · GitHub

1 Like


thank you
:chimpanzee_cool:

2 Likes

Please note there are also JME Tests out there. The error you had @asser_fahrenholz is just about “hey! this node was in render process! we throw error to you so you dont have artifacts trying render it somewhere else while its in render process(not done)” .

Generally im not sure if there is a wiki about it somewhere.

You can make SDK → New project → JME Tests → search for render tests → multiple views.

look at:

Anyway i was again curious if Wiki have something about it, but i was unable to find.

there is:

but it only mention about:

that do not have own Node, but use rootNode.

@mitm could be worth add to wiki about “custom scene graph managing” - what is IllegalStateException and caused by what. Also mention that if someone make own use of this, he need "node.updateLogicalState(tpf); node.updateGeometricState() " like Paul said.

2 Likes

I can see how it would be worth adding another topic under the Multiple Camera Views wiki page.

The next questions going to be about filters and such with the minimap I am sure.

I wont be doing any wiki stuff for the rest of the year though (outside of versioning search) so if someone feels froggy, jump on in.

@pspeed minimap with lemur is dam good stuff and uses a technically more robust way of implementing a minimap than a generic viewport adaptation will give you.

There’s always the alternative of a forum search. It has all this info in it already and in more detail than a wiki page will ever have.

1 Like

It’s a bit of a catch 22. If you want to use anything available in the existing scene graph its update loop will already be managed. If not the user has to manage it.

But I can’t add a “rootNode” and manage it myself because you can only attach a scene to one node. If you attach a scene in the existing graph to mine it will detach it from the other.

In the end this is just an implementation of how to go about such a thing, and how to use a mask/overlay to style it. The code is licensed the same as the engine - and I encourage users to customise it to their needs if the situation arises.

2 Likes

Oh, you were referening to your store-plugin. Gotcha

1 Like

It’s in the code already. That’s what makes it circular with an image over the top.

The mask decides what part of the quad is drawn. The overlay is drawn on top.

In my example the mask is just a circle and the overlay is like a border around the circle.

You can change these. Maybe a square with rounded corners, anything.

https://github.com/jayfella/jme-minimap/tree/master/src/main/resources/Textures/MiniMap

2 Likes

Your plugin is really cool. I just had requirements to make it possible to hide some parts of the world and game on the minimap. So there’s nothing wrong with your plugin :slight_smile:

2 Likes