Answer the question
In order to leave comments, you need to log in
How to make a game server in Java?
To begin with, the simplest thing is required from the server: to send data from one player to all the others. In total, 10 people are connected at the same time. The problem is that the game is in the arcade genre, and constant data exchange is needed. With the current implementation, periodically (~ once every 20 seconds) the server hangs for a second or a little less. This happens only if the client and server are on different machines. I don't know how to deal with it.
Can you recommend any articles/books on this topic? Preferably in Russian, because I'm not very friendly with English.
Or briefly describe the most correct architecture for such a server?
Answer the question
In order to leave comments, you need to log in
I think these links will come in handy to get you started (some have one article, some go to entire sections):
gamedev.9fog.com/tag/java-server
javatalks.ru/topics/24659?page=1#121338
https:// forum.zone-game.info/showthread.php?t=24211
habrahabr.ru/post/229045
habrahabr.ru/post/136765
Dig towards NIO. You can search here in Russian www.youtube.com/user/KharkovITCourses/videos
If it hangs every 20 seconds, then GC is most likely triggered. You can try adding the -Xmx 1G option when starting the JVM, thereby allocating 1G of RAM, then the GC will work less often.
You can also tweak the GC itself, google about GC CMS tuning or Java GC types to change the GC to some other one.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question