Skip to main content
gamedev.net
🔒 Locked

file sharing - client server

Started by phear 4 replies 400+ views
Original Post
phear
phear
Hi all. Here''s the deal. I developped 2 applications for a network game : one client and one server. The server is a standard TCP/IP Socket Server and the clients send commands through socket to communicate with the server. Each client can customise his skin and chooses a file (avatar) to represent himself. But the other clients will only be able to see this skin if they download the file. So i started by saying that the file would be sent to the server and the server would then broadcast this file to the other clients, but i am afraid that this might be too heavy for network or internet and i don''t have an idea how to organise all this... I am looking for an algorithm or a plan or something like that which would optimise the data exchange through the network and help me see clear. I started to code this method but it seems to not be a good solution : for exemple every time a client connects and sends his skin to the server, the server will have to send the file to all the clients ??? Thanx for ideas. pHeAr http://phear.fr.st
pHeArhttp://phear.fr.st
Cyberdrek
Cyberdrek
quote:
Original post by phear
Hi all.
Here''s the deal. I developped 2 applications for a network game : one client and one server. The server is a standard TCP/IP Socket Server and the clients send commands through socket to communicate with the server.

Each client can customise his skin and chooses a file (avatar) to represent himself. But the other clients will only be able to see this skin if they download the file.
So i started by saying that the file would be sent to the server and the server would then broadcast this file to the other clients, but i am afraid that this might be too heavy for network or internet and i don''t have an idea how to organise all this... I am looking for an algorithm or a plan or something like that which would optimise the data exchange through the network and help me see clear. I started to code this method but it seems to not be a good solution : for exemple every time a client connects and sends his skin to the server, the server will have to send the file to all the clients ???

Thanx for ideas.


pHeAr
http://phear.fr.st




The way I see it, all clients should have the files( images ) of all the avatars possible stored in a folder and the client would just send the number of the avatar to the server which in turn would send that number to all the clients connected... That would ease the load of bandwith for the internet or network.


"DaHjajmajQa''jajHeghmeH!"

Cyberdrek
danielc@iquebec.com
Founder
Laval Linux

/(bb|[^b]{2})/ that is the Question -- ThinkGeek.com
Hash Bang Slash bin Slash Bash -- #!/bin/bash
[Cyberdrek | ]
phear
phear
Not that simple : the problem is that the clients want to personalise there avatars and post new images to the server.

pHeAr
http://phear.fr.st
pHeArhttp://phear.fr.st
JonStelly
JonStelly
Here''s what I would try...

When a client connects, the client program gets the filename of the skin that user is using. It also computes some sort of CRC value for that file (for versioning).

The client then sends the filename and the CRC to the server.

The server sends a broadcast to all other clients, asking them if they already have that file with that CRC.

If all of the clients already have it, there''s no need to even send it to the server.




That''ll keep often used skins from being sent to the server and to the clients every time a new client connects. You could also give an option in the client that lets the user say "Don''t download custom skins" in which case that user has to either download any custom skins they want to see manually, or they just end up seeing a standard skin(assuming your game has some standard skins).
wrathgame
wrathgame
you could also.. (building on the post above)

have the server store each image it was sent. That way the client would only ever need send it once and whenever a client needed the image they would download it and store it. It would be best to also store something like a last used DateTime on each of these images.. that way if one wasnt used for like a month or 2 weeks or whatever then you could delete it to free some space (client could always re send it if they ever did show up again)

or if you have a very limited server and want to pass the buck, you could do a P2P type thing for the images where when a client logs in it sends the CRC etc to the server which sends it + your IP to all clients. if a client doesnt have your image then they connect to the client and DL it.. saving the server DLing it and then distributing it. of course this would put a lot of load on the client if there were a lot of players or if the image was large

~Wrathgame
~ Tim
phear
phear
Thanx for the CRC thing idea, i think that''s where i''ll look.
pHeArhttp://phear.fr.st

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.