Jump to content

Recommended Posts

Posted

I plan on creating a gui that houses a 2D entity. The 2D entity is gonna be constantly moving around, and my packet to sync the client would have at least 16 doubles.

 

Would it be safe and smooth if I synced the client every tick?

Kain

Posted

In multiplayer would all the players be able to see it, or only visible to one player (like a HUD or something)?  The reason I ask is that the data will have to be synced to all the clients so total bandwidth and processing would multiply up by the number of clients that might have the entity active in their client.

 

Would there ever be lots of them in the game at the same time?  This would also, of course, multiply up the amount of bandwidth and processing required.

 

For example, if you had four of these that were visible to four players then you'd have 4 * 4 * 8 = 256 bytes of payload that have to be transferred every tick.  However, I'm not really sure that that is that much of a problem with a modern computer but you can see how they could add up.

 

I do think that for smoothness you would want to update every tick or at least every other tick.  Every other tick would be a frame rate of 25 FPS which is pretty much considered low quality movement in modern gaming.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Only the player with the gui open would be seeing it. Also, for every player, there is 1 2D entity. With that in mind, yes, I could have over 10 players being synced up every tick.

 

 

Yes, the 2D entity is only in the gui and needs to be synced. The 2D entity will be controlled on the server, and will sync with the player so they can render it.

 

I'm attempting a sort of 2D game, and there will be a leaderboard in each world displaying the highest scores.

Kain

Posted

Okay, do you really have to send a packet every tick?  You said you want it to be smooth, so I'm assuming that means that fast action is required?  And would player input be continuous (like keyboard controlling fast movement) or would it be occasionally (like firing or hitting buttons?).  Because if it is more like a board game then you'd only have to send sync information when something changes or input is entered.

 

Anyway, I don't think 10 player's worth of packets should be too onerous.  It only gets bad when it multiplies up (like in my example where every player can see several entities).

 

If it does become a problem, you should also look at your payload carefully.  Do you really need to send 16 doubles every tick?  Can you come up with a pseudo compression scheme?  Or different packet types that handle the payload according to what is truly needed?

 

Alternatively, you can try to offload some processing onto the clients -- like "tweening" the animation.  For example, if the game allows for it the server can just say where something is moving to and then the client can process the steps in between.

 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.