B4J Question Multiplayer game using a B4J server and WebSocketClient

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
I've been building a multiplayer game using b4j and WebSocketClient.
Maybe it's the simplest game in the world. Just move a player through a field.
The goal was only to learn WebSocketClient. Yes it works! It is very cool!.

Many questions about games on a server have been appearing and are about them that I would like to talk about.

In my "game" the tick on the server runs every 50 milliseconds and the positions are updated and the positions of all players are sent to all clients.


- In a good multiplayer game the logic is implemented only on the server?
- How to create a tick for the game on the server?
- How can a server manage thousands of players?

- If I create a simple game in b4j how many players at most do you think I could have?

Please talk about these issues and others you think is important about developing multiplayer games!

Thank you.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
In a good multiplayer game the logic is implemented only on the server?
I think that it depends on the game. If you are creating an online chess then it makes sense to implement all the logic on the server. For a real-time game you will need to implement some logic in the server and some in the client.
A real-time game must consider the network latency. It makes everything much more complicated.

You can use BackgroundWorker to implement the server loop.

B4J servers have very good performance. You can see some numbers here: https://www.b4x.com/android/forum/threads/37502/#content
 
Upvote 0
Top