Jump to content
  • Advertisement
Sign in to follow this  
EternityZA

Java Serialization

This topic is 2559 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi.

I’m currently creating an online multiplayer FPS. I have a working client and server and 12 people can play together on a LAN with no lag. The client and the server is written in java. I’ve created my own crude binary protocol for communication between the clients and the server. I’ve taken care to make sure nothing gets send that isn’t necessary. The player position update frequency is 20 Hz.

I’ve been looking at java serialization to make my life a little easier when it comes to sending/receiving game data but I don’t know what the overhead is for using it. Also I fear that if I use java serialization it might complicate things if I later want to swap to using UDP. I get the feeling java serialization is more aimed at enterprise java but I hope I'm wrong.

I have no problem continuing without serialization if there’s any disadvantage to using it for a multiplayer FPS. I would just like to know.

Thnx in Advance!

Share this post


Link to post
Share on other sites
Advertisement
Java serialisation was not design for low latency scenarios like an FPS over the internet. I would expect it to perform poorly compared to your own binary protocol. I believe the overhead is high enough. If you are not careful you can end up serialising an entire object graph, which is obviously expensive.

If you had not already implemented your own protocol, you could have used it as a placeholder implementation to get you up and running quickly.

You will probably need to switch to UDP if you want to support an action game over the internet. On a LAN there is likely no packet loss, but if you encounter packet loss with TCP it can introduce a lot of artificial latency. For completeness, I will say that you can use Java serialisation with UDP. You can tell it to output to something like a ByteArrayOutputStream and then turn that into a UDP packet.

Share this post


Link to post
Share on other sites
Thnx! thats what i wanted to know. Il just continue with what i have wich works fine.

I am planning on switching to UDP I was just using TCP to get started.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!