Search code examples
androidsocketsmultiplayer

What i the best way to do Multiplayer server?


I want to make a multi-player game on android,something small not too fancy,my thought on sending data to other players is sending the coordinates, and for instance only the players that will be close(depends on users screen size) will be updated,but still even only few coordinates to update every time that a player moves will be a lot,And i don't know what is the best way to save players that are currently Online (maybe by hash map)?


Solution

  • The best way should be to use some existing library.
    There are many multi-player game server libraries out there, but since you are asking for something small (and you would probably prefer it being free too), I'd suggest following choices. (All java)

    1. Netty - powerful low level, suitable for even high end purposes, but relatively difficult to start with.
    2. JWebSockets - All TCP, reliable connection, a great choice if played with for some time.
    3. Kryonet - Simple to use, lightweight, not cluttered with many features, might be sufficient for small games without much efforts.

    Hope this helps.