Need some help in creating the basics of a JavaFX game

New problem. I want to scroll the map like so:


Group:
                content: bind[
                    map
                    robot
                    bullet
                    gameObject
                ]
                translateX:bind -robot.translateX + centerPosX
                translateY:bind -robot.translateY + centerPosY
            }


But this causes major lag if its moving the map. The map itself is a Group that has cache on, so it should be just a big static image…
How else should I scroll a map?

How large is the map?

Currently 800x600(the size of the game window).

Later Ill have maps larger then that of course but I currently don’t sort out which nodes need to be removed from the map when not seen.

I have improved it a little bit by spliting the timeline like so:

    var windowMove = Timeline {
        repeatCount: Timeline.INDEFINITE
        keyFrames: KeyFrame {
            time: 10ms
            action: function() {
                canSkip:true;
                g.translateX = -robot.translateX + centerPosX;
                g.translateY = -robot.translateY + centerPosY;
            }
        }
    }

But still uses a heap of cpu. Don’t see it running on anything that’s not a new computer atm.
Increasing the time does lower the cpu but it just makes it look horrible.

Its also just using temp graphics which are just rectangles. I haven’t got my SVG art from my artist yet.

try using g.transforms = [translate(…)]

Thanks that improved it a little. But still doesn’t give me much room for bullets. I can only have 10 on screen.
Will the performance be improved in this area in the next update?

Also seems that insert is slow when working with a lot of nodes. But I don’t this I have this issue.
http://piliq.com/javafx/?p=864

What’s the best way to keep track of nodes(my tiles) to keep on screen?
It seems I’m unable to track them how I want. Which is have my whole map as nodes in a group and then make another group for viewing and share those nodes with that group that only needs to be seen. But seems you can’t share nodes with more then one group? This only will work if I duplicate the node. Which will just slows everything down.
So for now I have to add the whole map to the screen.

Wish there was a example somewhere to explain how do to this…

Create a sequence containing nodes that are [not] supposed to be seen - don’t create a Group - it’s a node in a scenegraph. A node can have only one parent.

Add or remove nodes into this sequence (you could do it though binding automatically, too). You could also add a trigger - if a node is added, it’s ‘visible’ automatically becomes false…

you could also bind a visibility of a node to its bounds intersecting the “game screen”, or any other condition (like it being present in certain sequence).

Oh I didn’t know about the 1 parent rule. Thanks, Ill try that out and see if that solves my problem.

I found adding/removing nodes from a scene slower then showing the whole map, so for now I have just set there visibility.

You said a node can’t have more then one parent. Then what’s the best way to add a second screen to view the same object? In my case a 2nd player.