Communication between Agent and JMonkey 3d model

Hello

I am developing a multi agent simulation using jMonkey to represent the 3d world and JADE for the agents.
I am a newbie for this type of development. I have created the 3d model (using jMonkey) and the agents (using JADE). I do not know now how to set up the communication between agent and the Model I have created using JMonkey.

Can you please help me with some example if possible.

Thank you

I’m not sure of what you want to achieve… however I’d start with having the agents print some output, just to make sure they are created and running. Then have an AbstractControl that is attached to a Spatial (what you call Model) that is driven by the agent.

One ideas is to use listeners(interfaces). My examples are a bit rough sketched but I hope it can be of help.

Create an interface in your agent library (or a separate one) that will contain one or more methods that you need to be executed.

public interface AgentListener{
   public void invoke(String[] params);
}

Then use that interface(not implementations yet) for your agents to invoke the method whenever you want in your AI code

if(agentListener != null){
   agentListener.invoke(params);
}

The advantage is that you can have any implementation, like a class that just writes on console… or your custom JME control

public class MyControl extends AbstractControl implements AgentListener{
   public MyControl(Agent agent){
       agent.setListener(this);
   }
   
   @override
   public void invoke(String[] params){
      //Do stuff here
   }
}

One advice is that do not use that method to move or transform spatials but to create private events that the control will use in controlUpdate to do that instead.

Edit: you can also implement this on an app state instead of a control, it depends on the project.

When you say JADE, do you mean Java Agent Development Framework - Wikipedia

Do you mean, how to get a reference from one to the other, for examples when there’s a collision between the models?

Hi @jakebriggs , yes that is what I mean

@bloodwalker Thank you for your response and truly appreciate, I am going to try to implement it and would let you know if it helped