Greetings,
I got a wierd problem that I seem to fail to solve myself or find any info about this particular one on the net (jmonkey forum included but please feel free to ‘let me google it for you’).
I have got a HashMap in a message. Tested it and confurmed that it is being populated correctly with the data I need to send over. PlayerDef and PlanetDef are simple structures that are marked with “@Serializable” and registered accordingly.
[java]
@Serializable
public class SceneGraphUpdate extends AbstractMessage {
public final HashMap<PlayerDef, ArrayList> content;
public SceneGraphUpdate() {
this.content = new HashMap<PlayerDef, ArrayList<PlanetDef>>();
}
public SceneGraphUpdate(PlayersNode players) {
this.content = new HashMap<PlayerDef, ArrayList<PlanetDef>>();
this.construct(players); // <--- this.content is populated with data found in players node here
}
[/java]
[java]
@Serializable
public static class PlayerDef {
public String name;
public ColorRGBA color;
public PlayerDef() {
name = "";
color = null;
}
public PlayerDef(String name, ColorRGBA color) {
this.name = name;
this.color = color;
}
}
[/java]
Everything works fine so far, server sends the message and it is received by client.
[java]
@Override
public void processMessageQueue(HostedConnection app, Message msg) {
if (msg instanceof SceneGraphUpdate) {
SceneGraphUpdate m =
new SceneGraphUpdate(this.getApp().getWorld().getPlayersNode()); // <— tested PlayersNode does have data for the SceneGraphUpdate to work with
this.getApp().getNetwork().broadcast(m);
}
}[/java]
BUT here is the problem… HashMap that was full of data before server broadcasted it now holds and empty HashMap.
[java]
@Override
public void processMessageQueue(Client app, Message msg) {
if (msg instanceof SceneGraphUpdate) {
SceneGraphUpdate m = (SceneGraphUpdate) msg;
WorldSynchronizer.sync(this.getApp(), m.content); // <— m.content is now empty
this.getApp().getWorld().startSimulation();
}
}
[/java]
Same thing happens when I tried sending a mock ArrayList, simple array though arrives with the data it stored before the transmission. At the moment it seems that I have looked everywhere I can imagine and absolutely lost. Any info would be much appreaciated at this stage (just a little over a week left for the assignment due date and still plenty of work to complete).
Thank you for all your help.