Possible to animate node?

Hello JME. In my game I’ve got a .blend file containing a variety of player components (arms, legs, hands, torso, head, and equipment)
I am loading all of the components once at startup and then letting player’s generate their own unique appearance in-game. A player’s character components are attached to an “appearance” Node inside of a Player class… This looks and works great.
I can animate each component (spatial) separately BUT is it efficient having 5+ animation controllers per entity, if there are let’s say, 500 players online at once?

I’ve tried to attach an animation controller to the “appearance” Node itself but that doesn’t work, it doesn’t magically find the component/child animations :stuck_out_tongue: … Basically I’m unsure of how efficient it would be having 5+ anim controllers per character in a multiplayer game; hoping a jme developer can tell me, or give me some direction for a cleaner/efficient design if there is one. Thanks for reading.

Personally I would try it out and see, I mean just some sort of a prototype to see if 500 animated player will cause issues… This is by far the most secure way to know it and also have that prototype and to try out possible enhancements. On the other hand I think you never or pretty rarely will have all chars at once in the same room/scene?!

1 Like

What version of JME are you using? In 3.2 you can have one controller for multiple spatials that are in the subgraph of the Node the controller is attached to.

2 Likes

Always using the latest stable release.

Then you need to post some code, because this

is supposed to work

I didn’t know about the subgraph thing I’ll have to look it up. Here’s the code anyways:

    // Find the base character:
    appearance = new Node("Appearance");

    // find the components from the .blend file:
    this.head = findNode(dotBlendFile, "Head-0"); // component is a spatial
    this.torso = findNode(dotBlendFile, "Torso-0"); // component is a spatial
    this.hands = findNode(dotBlendFile, "Hand-0"); // component is a spatial
    this.legs = findNode(dotBlendFile, "Leg-3"); // component is a spatial
    this.feet = findNode(dotBlendFile, "Feet-3"); // component is a spatial
    appearance.attachChild(head);
    appearance.attachChild(torso);
    appearance.attachChild(hands);
    appearance.attachChild(legs);
    appearance.attachChild(feet);

    // attach the player's appearance node to the program's rootNode so we can see it
    rootNode.attachChild(appearance);

    // attach the animation controller to the appearance node
    control = appearance.getControl(AnimControl.class);
    channel = control.createChannel(); // <-- java.lang.NullPointerException
    System.out.print("Found .blend animation(s): ");
    for (String name : control.getAnimationNames()) {
        System.out.print(name + ", ");
    }
    System.out.println();
    channel.setAnim("Idle");

Deleted last post. Using 5 animation controls instead of 1… Not really resolved though.

Update: Its October 7, 2019 and I’ve had no performance issues using 5 anime controllers PER ENTITY in a multiplayer game with 100+ active entities.

well, im using one control, and just re-attach elements of character, like head, hair, eyes, clothes, etc.

and there is no problem at all. In Blender different material = new geometry in JME.

also if you want customize it better, i suggest using Shape keys (since jme 3.3).

but its fine if you say 5 controls make no difference. (it might just be a RAM usage difference i assume - because each might hold copy of animation samples)

Anyway a lot of problem for me was to get rid of “seams between parts like hand<->arm” but i succeed and now it looks perfect.

1 Like