When a client connects to my game server, the server sends textures and then the world information.
The problem is that the texture information may come after the world information and so the client errors out because it has no texture to give the models.

How would I combat this?

  • 1
    \$\begingroup\$ First of all, what does it mean that you send textures? Textures should be stored on the client and you should send only the information: 'use texture number 1, 5, 12'. If you use a TCP protocol for sending data - packet order delivery is kept which means that if you send packets in this order: 5,6,7, the client will receive them in the same. Information like this should always be sent with TCP. \$\endgroup\$ – Jacob Jan 16 '17 at 10:16
  • \$\begingroup\$ I first send the width and height then send each pixel color. The game is low-res so this wouldn't be as bad as it would be with high-res games. \$\endgroup\$ – mid Jan 16 '17 at 10:25
  • 1
    \$\begingroup\$ Why not just display a loading screen until the texture info arrives? \$\endgroup\$ – benh Jan 16 '17 at 10:34
  • 1
    \$\begingroup\$ Don't send anything graphical over the net to other clients unless absolutely necessary. The clients should know themselves what texture to use. \$\endgroup\$ – Charanor Jan 16 '17 at 10:36
  • 2
    \$\begingroup\$ I do not understand why this question gets downvoted. I find the answers interesting which means the question may prove useful for future visitors \$\endgroup\$ – realUser404 Jan 16 '17 at 13:22

Don't send asset data during game-play sessions.

Either use a launcher to make sure that the game assets are up to date with what's on the server before the game starts, or do the download process in a loading screen.

In both cases, I suggest you use two different servers: one from which the game clients will download the assets, and one that will be used to process the actual game-play.

Otherwise, I suggest you re-think your game design: make the image not mandatory to continue the game-play, like a player guild icon, or a decorative hat.

Textures are generally much bigger to send over the network than your usual game packets. So it would be easy for a small group of players who know when the assets are sent in game to create a situation where too many assets are sent at once to the clients, and make your server slow down to a crawl because it's busy sending images to 50% of your players, not having time to process the actual game, and send actual game packets. Like a DDOS attack. (This has happened before.)


That's what a loading screen is for, to buy you time until you have the assets in place for rendering, also you can probably use placeholder assets or lower detail assets (that will download faster) for a lot of the assets you are dynamically downloading this way.

However you shouldn't make the game server send the textures instead have a load balanced asset server cluster.

That way when the game server sends "you need asset pack 5" and the client can then check its own cache and if it's not there go to the asset server and say "give me asset pack 5" and start downloading it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.