Node serialization

Hello, is there away for me to send nodes with spidermonkey. I would be doing this to send the map from the server to the client when the client connects.



The special thingy is that I’m using jme2 with latest spidermonkey from jme3.



Currently problem is that when I send a message with a node information in it the server goes into a infinite loop, or at least it seems infinite :S



This is the stacktrace

[java]java.lang.ArrayIndexOutOfBoundsException: -3

at com.jme.util.export.binary.BinaryExporter.fixClassAlias(BinaryExporter.java:316)

at com.jme.util.export.binary.BinaryExporter.save(BinaryExporter.java:199)

at com.jme3.network.serializing.serializers.SavableSerializer.writeObject(SavableSerializer.java:115)

at com.jme3.network.serializing.Serializer.writeClassAndObject(Serializer.java:303)

at com.jme3.network.serializing.serializers.FieldSerializer.writeObject(FieldSerializer.java:137)

at com.jme3.network.serializing.Serializer.writeClassAndObject(Serializer.java:303)

at com.jme3.network.serializing.serializers.GZIPSerializer.writeObject(GZIPSerializer.java:85)

at com.jme3.network.serializing.Serializer.writeClassAndObject(Serializer.java:303)

at com.jme3.network.connection.TCPConnection.write(TCPConnection.java:345)

at com.jme3.network.connection.Connection.run(Connection.java:131)

at com.jme3.network.connection.ConnectionRunnable.run(ConnectionRunnable.java:85)

at java.lang.Thread.run(Thread.java:662)

Feb 6, 2011 10:42:24 PM com.jme3.network.serializing.serializers.FieldSerializer writeObject

WARNING: [FieldSerializer][???] Exception occurred on writing. Maybe you’ve forgotten to register a class, or maybe a class member does not have a serializer.[/java]

Wouldn’t it be simpler to send the client a message telling it which map to activate?

Well the server generates the map randomly based on multiple different variables that can be changed on the server side which aren’t included in just one file. Even though one possibility would be to make it send these so that the client could generate the same map for himself. I though it would be much easier if I could just send the map from the server to the client it would much easier.

I believe it’s better to send these variables instead of the full node indeed. Saves some network traffic too and if you just keep the same generator on both server and client sides, they should produce the exact same map anyway.

I think baalgarnaal is right as well.



Also, it hardens security

I guess I’ll do it that way then