Sim-eth-basic on android


#1

Hello,

Hope this is in the right category…

I’m trying to get Pspeeds super sim-eth-basic to working on Android :heart_eyes:

i’ve put the code on github: ( I’m running under Android Studio 3.1.4 )

It’s compiling and running on windows… server hosts and clients connect.

For the android side…
I’ve removed the glass-styles.groovy with Eric Bourque post to get Lemur working

There is really no other important differences between Paul’s version ( sim-eth-basic) and this one.

The issue is that no client can connect to the android server. ( including the local client )

  • The server starts to host ( looks ok )
  • push the “join game” on android and it sits at “Connecting…”

Using the android debugger… A thread dump below.

Any help much appreciated :slightly_smiling_face:

cheers


#2

Just to be clear… are you trying to run the game server on the android device?


#3

hmm yes… sounds silly… just for testing…
I should test the other way with a windows server and android client… pretty sure i had issues this way too… i’ll
check again.


#4

thank you for reply. tested with windows as server this time.

  • Windows Server host on port 4000
  • My android app has no soft KB, so hard coded:
    connectHost=props.addChild(new TextField(“192.168.1.114”),1);
  • application.log shows:
    20:28:35,319 DEBUG [AccountHostedService] startHostingOnConnection(Connection[ id=0, reliable=NioEndpoint[1, java.nio.channels.SocketChannel[connected local=/192.168.1.114:4000 remote=/192.168.1.117:51705]], fast=UdpEndpoint[1, /192.168.1.117:34702] ])
    20:30:12,105 WARN [ZoneManager] zone update underflow FPS:59
    20:32:00,203 WARN [ZoneManager] zone update underflow FPS:58
    20:33:36,300 WARN [ZoneManager] zone update underflow FPS:59
    20:33:45,319 WARN [ZoneManager] zone update underflow FPS:58

The server shows “Connections: 1” with the android client

On the android client
Error message is:
Connection Error
RuntimeException Error deserializing object, class ID:-48

press “ok” drops the server connection back to 0

not sure how to find the source of this.


#5

But with your setup it otherwise works desktop to desktop?


#6

Yes, perfectly


#7

It might be interesting to see the logging on the server that shows what classes were registered with what IDs.


#8

ok, will try to collect the server side Logs.

Logs ( when client connection button pressed ) on the android side:

D/com.jme3.network.base.DefaultClient: FINE Adding standard services...
D/com.jme3.network.service.ServiceManager: FINE addService(com.jme3.network.service.serializer.ClientSerializerRegistrationsService[serviceManager.class=])
                                           FINE Initializing service:com.jme3.network.service.serializer.ClientSerializerRegistrationsService[serviceManager.class=]
D/com.jme3.opencl.OpenCLObjectManager: FINE no active natives
D/com.jme3.network.serializing.Serializer: FINE Registered class[-42]:class com.jme3.network.message.DisconnectMessage to:com.jme3.network.message.DisconnectMessage$DisconnectSerializer@ca6264e
D/com.jme3.network.serializing.Serializer: FINE Registered class[-44]:class com.jme3.network.message.ClientRegistrationMessage to:com.jme3.network.message.ClientRegistrationMessage$ClientRegistrationSerializer@68b87c
                                           FINE Registered class[-2]:boolean to:com.jme3.network.serializing.serializers.BooleanSerializer@b48505
                                           FINE Registered class[-3]:byte to:com.jme3.network.serializing.serializers.ByteSerializer@442595a
D/com.jme3.network.serializing.Serializer: FINE Registered class[-4]:char to:com.jme3.network.serializing.serializers.CharSerializer@d15a78b
                                           FINE Registered class[-5]:short to:com.jme3.network.serializing.serializers.ShortSerializer@bc6e068
                                           FINE Registered class[-6]:int to:com.jme3.network.serializing.serializers.IntSerializer@47d6c81
D/com.jme3.network.serializing.Serializer: FINE Registered class[-7]:long to:com.jme3.network.serializing.serializers.LongSerializer@d3cb126
                                           FINE Registered class[-8]:float to:com.jme3.network.serializing.serializers.FloatSerializer@a353167
                                           FINE Registered class[-9]:double to:com.jme3.network.serializing.serializers.DoubleSerializer@a5d9b14
                                           FINE Registered class[-10]:class java.lang.Boolean to:com.jme3.network.serializing.serializers.BooleanSerializer@1d97d03
                                           FINE Registered class[-11]:class java.lang.Byte to:com.jme3.network.serializing.serializers.ByteSerializer@80ebefe
D/com.jme3.network.serializing.Serializer: FINE Registered class[-12]:class java.lang.Character to:com.jme3.network.serializing.serializers.CharSerializer@fb9b975
                                           FINE Registered class[-13]:class java.lang.Short to:com.jme3.network.serializing.serializers.ShortSerializer@7a73398
                                           FINE Registered class[-14]:class java.lang.Integer to:com.jme3.network.serializing.serializers.IntSerializer@37977f1
                                           FINE Registered class[-15]:class java.lang.Long to:com.jme3.network.serializing.serializers.LongSerializer@2a9afd6
                                           FINE Registered class[-16]:class java.lang.Float to:com.jme3.network.serializing.serializers.FloatSerializer@b574257
D/com.jme3.network.serializing.Serializer: FINE Registered class[-17]:class java.lang.Double to:com.jme3.network.serializing.serializers.DoubleSerializer@a7f144
                                           FINE Registered class[-18]:class java.lang.String to:com.jme3.network.serializing.serializers.StringSerializer@19ca22d
                                           FINE Registered class[-19]:class com.jme3.math.Vector3f to:com.jme3.network.serializing.serializers.Vector3Serializer@4e8f362
D/com.jme3.network.serializing.Serializer: FINE Registered class[-20]:class java.util.Date to:com.jme3.network.serializing.serializers.DateSerializer@1d4ddb0
                                           FINE Registered class[-21]:class java.util.AbstractCollection to:com.jme3.network.serializing.serializers.CollectionSerializer@442254f
                                           FINE Registered class[-22]:class java.util.AbstractList to:com.jme3.network.serializing.serializers.CollectionSerializer@4c18cba
                                           FINE Registered class[-23]:class java.util.AbstractSet to:com.jme3.network.serializing.serializers.CollectionSerializer@e073f61
D/com.jme3.opencl.OpenCLObjectManager: FINE no active natives
D/com.jme3.network.serializing.Serializer: FINE Registered class[-24]:class java.util.ArrayList to:com.jme3.network.serializing.serializers.CollectionSerializer@46bba86
                                           FINE Registered class[-25]:class java.util.HashSet to:com.jme3.network.serializing.serializers.CollectionSerializer@70c3374
                                           FINE Registered class[-26]:class java.util.LinkedHashSet to:com.jme3.network.serializing.serializers.CollectionSerializer@811b8e3
                                           FINE Registered class[-27]:class java.util.LinkedList to:com.jme3.network.serializing.serializers.CollectionSerializer@87312e0
                                           FINE Registered class[-28]:class java.util.TreeSet to:com.jme3.network.serializing.serializers.CollectionSerializer@99d003f
                                           FINE Registered class[-29]:class java.util.Vector to:com.jme3.network.serializing.serializers.CollectionSerializer@da67d0c
D/com.jme3.network.serializing.Serializer: FINE Registered class[-30]:class java.util.AbstractMap to:com.jme3.network.serializing.serializers.MapSerializer@6b615b
                                           FINE Registered class[-31]:class java.util.jar.Attributes to:com.jme3.network.serializing.serializers.MapSerializer@a0dc2d1
D/com.jme3.network.serializing.Serializer: FINE Registered class[-32]:class java.util.HashMap to:com.jme3.network.serializing.serializers.MapSerializer@4f4b837
                                           FINE Registered class[-33]:class java.util.Hashtable to:com.jme3.network.serializing.serializers.MapSerializer@22dcac2
                                           FINE Registered class[-34]:class java.util.IdentityHashMap to:com.jme3.network.serializing.serializers.MapSerializer@304fb09
                                           FINE Registered class[-35]:class java.util.TreeMap to:com.jme3.network.serializing.serializers.MapSerializer@549413c
                                           FINE Registered class[-36]:class java.util.WeakHashMap to:com.jme3.network.serializing.serializers.MapSerializer@1df01a
D/com.jme3.network.serializing.Serializer: FINE Registered class[-37]:class java.lang.Enum to:com.jme3.network.serializing.serializers.EnumSerializer@5340241
                                           FINE Registered class[-38]:class com.jme3.network.message.GZIPCompressedMessage to:com.jme3.network.serializing.serializers.GZIPSerializer@eae1d27
D/com.jme3.network.serializing.Serializer: FINE Registered class[-39]:class com.jme3.network.message.ZIPCompressedMessage to:com.jme3.network.serializing.serializers.ZIPSerializer@77d817d
D/com.jme3.network.serializing.Serializer: FINE Registered class[-41]:class com.jme3.network.serializing.serializers.FieldSerializer to:com.jme3.network.serializing.serializers.FieldSerializer@7e5b879
                                           FINE Registered class[-40]:class com.jme3.network.message.ChannelInfoMessage to:com.jme3.network.serializing.serializers.FieldSerializer@7e5b879
D/com.jme3.network.serializing.Serializer: FINE Registered class[-43]:class [I to:com.jme3.network.serializing.serializers.ArraySerializer@9f8a1f
                                           FINE Registered class[-45]:class com.jme3.network.message.SerializerRegistrationsMessage to:com.jme3.network.serializing.serializers.FieldSerializer@7e5b879
D/com.jme3.network.serializing.Serializer: FINE Registered class[-46]:class [Lcom.jme3.network.message.SerializerRegistrationsMessage$Registration; to:com.jme3.network.serializing.serializers.ArraySerializer@9f8a1f
                                           FINE Registered class[-47]:class com.jme3.network.message.SerializerRegistrationsMessage$Registration to:com.jme3.network.serializing.serializers.FieldSerializer@7e5b879
D/com.jme3.opencl.OpenCLObjectManager: FINE no active natives
I/System.out: Bit size:48  mask:ffffffffffff
D/com.jme3.network.service.ServiceManager: FINE addService(com.jme3.network.service.rpc.RpcClientService[serviceManager.class=])
                                           FINE Initializing service:com.jme3.network.service.rpc.RpcClientService[serviceManager.class=]
D/com.jme3.network.util.AbstractMessageDelegator: FINEST map(null)
D/com.jme3.network.util.AbstractMessageDelegator: FINEST Checking method:public java.lang.Object com.jme3.network.service.rpc.RpcConnection.callAndWait(byte,short,short,java.lang.Object[])
                                                  FINEST isValidMethod(public java.lang.Object com.jme3.network.service.rpc.RpcConnection.callAndWait(byte,short,short,java.lang.Object[]), null)
                                                  FINEST Parameter count is not 1 or 2
                                                  FINEST Checking method:public void com.jme3.network.service.rpc.RpcConnection.callAsync(byte,short,short,java.lang.Object[])
                                                  FINEST isValidMethod(public void com.jme3.network.service.rpc.RpcConnection.callAsync(byte,short,short,java.lang.Object[]), null)
                                                  FINEST Parameter count is not 1 or 2
                                                  FINEST Checking method:public void com.jme3.network.service.rpc.RpcConnection.close()
D/com.jme3.network.util.AbstractMessageDelegator: FINEST isValidMethod(public void com.jme3.network.service.rpc.RpcConnection.close(), null)
                                                  FINEST Parameter count is not 1 or 2
                                                  FINEST Checking method:public void com.jme3.network.service.rpc.RpcConnection.handleMessage(com.jme3.network.service.rpc.msg.RpcCallMessage)
                                                  FINEST isValidMethod(public void com.jme3.network.service.rpc.RpcConnection.handleMessage(com.jme3.network.service.rpc.msg.RpcCallMessage), null)
                                                  FINEST Adding method mapping:class com.jme3.network.service.rpc.msg.RpcCallMessage = public void com.jme3.network.service.rpc.RpcConnection.handleMessage(com.jme3.network.service.rpc.msg.RpcCallMessage)
                                                  FINEST Checking method:public void com.jme3.network.service.rpc.RpcConnection.handleMessage(com.jme3.network.service.rpc.msg.RpcResponseMessage)
                                                  FINEST isValidMethod(public void com.jme3.network.service.rpc.RpcConnection.handleMessage(com.jme3.network.service.rpc.msg.RpcResponseMessage), null)
D/com.jme3.network.util.AbstractMessageDelegator: FINEST Adding method mapping:class com.jme3.network.service.rpc.msg.RpcResponseMessage = public void com.jme3.network.service.rpc.RpcConnection.handleMessage(com.jme3.network.service.rpc.msg.RpcResponseMessage)
                                                  FINEST Checking method:public void com.jme3.network.service.rpc.RpcConnection.registerHandler(short,com.jme3.network.service.rpc.RpcHandler)
D/com.jme3.opencl.OpenCLObjectManager: FINE no active natives
D/com.jme3.network.util.AbstractMessageDelegator: FINEST isValidMethod(public void com.jme3.network.service.rpc.RpcConnection.registerHandler(short,com.jme3.network.service.rpc.RpcHandler), null)
                                                  FINEST First paramter is not a MessageConnection or subclass.
                                                  FINEST Checking method:public void com.jme3.network.service.rpc.RpcConnection.removeHandler(short,com.jme3.network.service.rpc.RpcHandler)
                                                  FINEST isValidMethod(public void com.jme3.network.service.rpc.RpcConnection.removeHandler(short,com.jme3.network.service.rpc.RpcHandler), null)
                                                  FINEST First paramter is not a MessageConnection or subclass.
                                                  FINEST Checking method:protected void com.jme3.network.service.rpc.RpcConnection.send(byte,com.jme3.network.service.rpc.msg.RpcResponseMessage)
D/com.jme3.network.util.AbstractMessageDelegator: FINEST isValidMethod(protected void com.jme3.network.service.rpc.RpcConnection.send(byte,com.jme3.network.service.rpc.msg.RpcResponseMessage), null)
                                                  FINEST First paramter is not a MessageConnection or subclass.
D/com.jme3.network.service.ServiceManager: FINE addService(com.jme3.network.service.rmi.RmiClientService[serviceManager.class=])
                                           FINE Initializing service:com.jme3.network.service.rmi.RmiClientService[serviceManager.class=]
D/com.jme3.network.service.ServiceManager: FINE addService(example.net.client.AccountClientService[serviceManager.class=])
                                           FINE Initializing service:example.net.client.AccountClientService[serviceManager.class=]
                                           FINE addService(example.net.client.GameSessionClientService[serviceManager.class=])
                                           FINE Initializing service:example.net.client.GameSessionClientService[serviceManager.class=]
D/com.jme3.network.service.ServiceManager: FINE addService(example.net.chat.client.ChatClientService[serviceManager.class=])
                                           FINE Initializing service:example.net.chat.client.ChatClientService[serviceManager.class=]
                                           FINE addService(com.simsilica.ethereal.EtherealClient[serviceManager.class=])
                                           FINE Initializing service:com.simsilica.ethereal.EtherealClient[serviceManager.class=]
D/com.jme3.network.util.AbstractMessageDelegator: FINEST map(null)
                                                  FINEST Checking method:protected com.simsilica.ethereal.net.SentState com.simsilica.ethereal.net.StateReceiver.ackReceivedState(int)
                                                  FINEST isValidMethod(protected com.simsilica.ethereal.net.SentState com.simsilica.ethereal.net.StateReceiver.ackReceivedState(int), null)
                                                  FINEST Second paramter is not a Message or subclass.
                                                  FINEST Checking method:public com.simsilica.ethereal.net.RemoteTimeSource com.simsilica.ethereal.net.StateReceiver.getTimeSource()
                                                  FINEST isValidMethod(public com.simsilica.ethereal.net.RemoteTimeSource com.simsilica.ethereal.net.StateReceiver.getTimeSource(), null)
                                                  FINEST Parameter count is not 1 or 2
                                                  FINEST Checking method:public void com.simsilica.ethereal.net.StateReceiver.handleMessage(com.simsilica.ethereal.net.ObjectStateMessage)
                                                  FINEST isValidMethod(public void com.simsilica.ethereal.net.StateReceiver.handleMessage(com.simsilica.ethereal.net.ObjectStateMessage), null)
D/com.jme3.network.util.AbstractMessageDelegator: FINEST Adding method mapping:class com.simsilica.ethereal.net.ObjectStateMessage = public void com.simsilica.ethereal.net.StateReceiver.handleMessage(com.simsilica.ethereal.net.ObjectStateMessage)
                                                  FINEST Checking method:protected void com.simsilica.ethereal.net.StateReceiver.processAcks(com.simsilica.mathd.util.IntRange[])
                                                  FINEST isValidMethod(protected void com.simsilica.ethereal.net.StateReceiver.processAcks(com.simsilica.mathd.util.IntRange[]), null)
                                                  FINEST Second paramter is not a Message or subclass.
D/com.jme3.network.serializing.Serializer: FINER writing class:class com.jme3.network.message.ClientRegistrationMessage with ID:-44
D/com.jme3.network.serializing.Serializer: FINER writing class:class com.jme3.network.message.ClientRegistrationMessage with ID:-44
I/System.out: sys Client started 
D/com.jme3.opencl.OpenCLObjectManager: FINE no active natives
D/com.jme3.network.serializing.serializers.FieldSerializer: FINER Reading field:private long com.jme3.network.message.ChannelInfoMessage.id using serializer:com.jme3.network.serializing.serializers.LongSerializer@d3cb126
D/com.jme3.network.serializing.serializers.FieldSerializer: FINER Reading field:private int[] com.jme3.network.message.ChannelInfoMessage.ports using serializer:com.jme3.network.serializing.serializers.ArraySerializer@9f8a1f
D/com.jme3.network.base.DefaultClient: FINER com.jme3.network.base.DefaultClient@756c3ed received:ChannelInfoMessage[515007270853558, [[I@5f1d222]]
D/com.jme3.opencl.OpenCLObjectManager: FINE no active natives
D/com.jme3.network.serializing.Serializer: FINER writing class:class com.jme3.network.message.ClientRegistrationMessage with ID:-44
D/com.jme3.opencl.OpenCLObjectManager: FINE no active natives
D/com.jme3.network.base.DefaultClient: FINER com.jme3.network.base.DefaultClient@756c3ed received:com.jme3.network.message.ClientRegistrationMessage[id=1, gameName=null, version=0]
D/com.jme3.network.base.DefaultClient: FINE Connection established, id:1.

#9

I might be wrong but java RMI from what I read and testing is not compatible with Android… So the first thing back in the time was to replace the callbacks with socket channels api of JME for my game. Also running the server part on Android does not make sense to me and even if you achieve that probably you will need to keep the device constantly plugged in charger :smiley: .


#10

Afaik, JME RMI layer is not the same Java RMI.


#11

the client log is hard to read… https://imgur.com/ZkaNqqB

The error is deserializing object -48 which the client didn’t get ( or shouldn’t get )

ps need to charge my phone again after all this testing :blush:


#13

HINT: GameLoop

/**
     *  Sets the period of time in milliseconds that the update loop will
     *  wait between time interval checks.  This defaults to 0 because on
     *  Windows the default 60 FPS update rate will cause frame drops for
     *  a idle sleep time of 1 or more.  However, 0 causes the loop to consume
     *  a noticable amount of CPU.  For lower framerates, 1 is recommended
     *  and will be set automically based on the current frame rate interval
     *  if null is specified.
     */
    public final void setIdleSleepTime( Long millis ) {
        if( millis == null ) {
            // Configure a reasonable default
            if( updateRate > FPS_60 ) {
                // Can probably get away with more sleep
                this.idleSleepTime = 1;
            } else {
                // Else on Windows, sleep > 0 will take almost as long as
                // a frame
                this.idleSleepTime = 0;
            }
        } else {
            this.idleSleepTime = millis;
        }
}

#14

I don’t see this error message in the log you provided.


#15

after android “join game” it appears… i haven’t tracked down the source of it.
Imgur


#16

thank you kaloyan, maybe its timing related…


#17

Lemur popup does not display the full stack trace,
It comes from this line.

Full stack trace should be logged somewhere in android device.
If you can not find it, an easy way is to add this after line 293:

throw new RuntimeException(t);


#18

I edited your post to make the log more readable.


#19

At quick glance, I’m not sure what is happening. -48 seems not to be registered to anything… but then it’s still strange that it’s specifically sent.

Are you registering classes after the server has been started or after the client connects?

By the way, I’m more interested in that list on the server… though the client one is useful too as it turns out.


#20

thank you all! all most 4 am here… will pickup soon


#21

Also there is this problem… Happens more on Linux than Windows on my experience. Android is basically Linux so… You could try adding a delay, see SimEthereal Questions