Synchronization in multiplayer

Except when yours is already missing 90% of what it needs.

I already answered this. Binary.
Binary.
Binary.
Binary.
Binary.
Binary.
Binary.
Binary.

4 bytes of integer is always better than 9 characters of string… multiply times number of components * number of objects… it makes a huge difference.

Sim-ethereal already does this for standard things like position and provides the tools to do it efficiently for other things. That’s why I can fit a whole object position update in something like 22 bytes.

Which sim-ethereal already does. Plus you have tools for client-side interpolation.

Sim-ethereal already does this, too.

The “physical position” lives on the server. The client is only a view and it’s indexing into the interpolation of known good data.

Only because you didn’t read it.

Probably not… unless you want to slow things down further.

Most people who want to solve the same issues will use (at least as a starting place) the tools already provided.

4 Likes

Give me the link. thank’s

4 bytes of integer is always better than 9 characters of string… multiply times number of components * number of objects… it makes a huge difference.
9 characters of string = 18 bytes of UTF-8.

Algorithm? my code:

buffer = message.json.toJSONString().getBytes("utf-8");

When I decided to make a game, I first wrote the server and then I selected 3d engine.

By the way, many people think that both the client server and 3d work better on C ++

1 Like
  1. translate all variables into bytes along with the type
  2. Add a separator
  3. Forwarding to the server
  4. Restore from bytes to java variables
    ?
1 Like

Many people think the earth is flat. What’s your point?

3 Likes

Ok, I’ll play along… but this is getting ridiculous so this will be my last reply.

{
myPosition = {
x = “123.56”
y = “456.78”
z = “901.23”
}
}

Is always always always going to take WAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY more space than three floats stored as binary: 3 * 4 bytes.

Moreover, you can often pack those even smaller like Sim-etheral does and fit it all 5 or 6 bytes.

JSON/XML/etc. are nice when you must embed the structure in your data because you will be interoperating with 100 different types of clients and servers. But it’s SLOOOOOW. Dog slow. Butt slow. Snails are running circles around it.

If you control both ends of the channel then there is no reason to waste space and time with the structure. Both ends already know the structure.

Your entire server architecture is based on enterprise-style development practices that just don’t work for real time gaming.

You should read about GAME network synchronization and specifically “entity component systems” as a game architecture. If you want to scale up more than 1000 players at a time you are very much going to need something like an entity system.

That’s it. I’m out. It’s up to you to fail or succeed now. You’ve already got failure in the bag… so hopefully you can come to your senses soon.

2 Likes

My meaning in this topic is how to optimize the: client, server, data transfer, memory, variables, etc. fast light

Interestingly about interpolation

The meaning of making the game good at least technically.

about java and c++
https://www3.ntu.edu.sg/home/ehchua/programming/java/JavaNativeInterface.html
ps: (Many games assemblies work better (it depends only on the hands and head of the developer I think)

1 Like

but now not 1994 year. You propose a procedural approach?

My friends write a connection to the database in assembler.
(facebook and vk Broadcast to low-level C)

We came to the conclusion that it is not necessary to optimize until the problem has appeared.

Better:

  1. provide scaling
  2. Buy the best internet
  3. buy a better server

than:

  1. Debug the low-level code.
  2. Spending human time.

http://www.kriconf.ru/

PS: General findings of the developer community.

1 Like

You want to say:

  1. You make structure (or class).
  2. Translate to bytes.
  3. Send and receive
  4. make class (or structure) from bytes
  5. execute

?

This:

package com.example;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class Serializer {

    public static byte[] serialize(Object obj) throws IOException {
        try(ByteArrayOutputStream b = new ByteArrayOutputStream()){
            try(ObjectOutputStream o = new ObjectOutputStream(b)){
                o.writeObject(obj);
            }
            return b.toByteArray();
        }
    }

    public static Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException {
        try(ByteArrayInputStream b = new ByteArrayInputStream(bytes)){
            try(ObjectInputStream o = new ObjectInputStream(b)){
                return o.readObject();
            }
        }
    }

}
1 Like

@pspeed, why pointing to your libraries when he doesn’t give a shit on them anyway? In my opinion, he rather should learn the basics of the JME networking api first before going on with those advanced libs. :slight_smile:

However, I have the feeling that he is not really talking us seriously anyway…

4 Likes

Big idea:

I form the message on 3 packages - an example:
send_to_server : {
update player_id: 22 camDir -0.19635175 -0.02604162 -0.22531715,
update player_id: 22 camLeft -0.15078059 1.14738945E-7 0.13139714,
update player_id: 22 camDir -0.19635175 -0.02604162 -0.22531715,
}

This will reduce the number of tasks and messages 3 times

From server packet:
player_1:
{
update player_id: 22 camDir -0.19635175 -0.02604162 -0.22531715,
update player_id: 22 camLeft -0.15078059 1.14738945E-7 0.13139714,
update player_id: 22 camDir -0.19635175 -0.02604162 -0.22531715
}
player_2:
{
update player_id: 22 camDir -0.19635175 -0.02604162 -0.22531715,
update player_id: 22 camLeft -0.15078059 1.14738945E-7 0.13139714,
update player_id: 22 camDir -0.19635175 -0.02604162 -0.22531715
}

player_6:…

One big packet with 3 lats player packets:

On client:

  1. Set the coordinates in turn.

_____________________________________________-

  1. Reduce the number of messages to order 3 times
  2. Reducing the number of messages from the server 18 times.
  3. Failures in network operation will not affect the display of 3d
1 Like

Did you read last Paul’s post? he provide you a tool to solve your issue. do you really want to write your own?

and yes, this topic is useful. It provide a good understanding of synchronization in multiplayer, since experienced developers point to that so many times, that it is very hard to miss that.

1 Like