I'm working on a 2D game. There are two players (in multiplayer) and about 350 entities (mobs and other).To synchronize mobs i used a random with the same seed on both devices.But to move the player and to fire, i send the commands to the other player through TCP.It works fine but sometimes there are delays.

Is it the way I would organize things? Not really. But it does work I suppose. There's all kinds of reasons things could hitch up, from gc thrashing to oversynchronization to network lag, but a half dozen LOC doesn't really say much. I can't tell how expensive your command constructors are, or what collection implementation you're using, and so on.

Performance troubleshooting is tricky enough, intermittent performance problems are maddening. If you can find out what changes in the program or the environment cause the intermittent problem to get worse or more frequent, you're more than halfway to figuring out the cause.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org