Jump to content
  • Advertisement
Sign in to follow this  
Si Hao

[java] Objects over sockets

This topic is 4265 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

I created a new thread since I do not want to hijack the other thread about java sockets. Some of the posts in that thread mentioned that sending objects over sockets are expensive. Currently I am using a simple event based client/server engine. For example, player moves 2 hexes to right, client will create an event object containing neccesary data in a hashmap (probably containing the destination hex number as well as player name that moved) and send it over to the server. Once it reaches the server, server will process the event according to the type of event object received. Now I have a question, is this method expensive? Currently everything is running smoothly, though there is not much content yet.

Share this post


Link to post
Share on other sites
Advertisement
Hi,

I agree with Captain here. It is expensive, yes, but for most (simple) games it is by far Ok. There are plenty of optimizations you can do to squeeze even more performance out of it, if you so want. You should be fine with it on simple games.

The reason we advice against using it is for 1) Prevent people from having the bright idea of sending complex, heavyweight game objects and states over the network, and 2) Allow for easier scalability on the server side - using NIO, you can easily increase your scalability.

Rodrigo

Share this post


Link to post
Share on other sites
Thanks for the replies I will just use my current engine for my current game and probably make a new engine for my next one.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!