Guad / GTACoop

An online co-op modification for GTA5
GNU General Public License v3.0
82 stars 70 forks source link

Optimize network usage #14

Open uPrizZ opened 8 years ago

uPrizZ commented 8 years ago

As of one of the latest updates (most probably the one with sync improvements) my network usage has drastically increased, now always causing me to have timeouts after about a minute on a server. This is most likely caused by the synchronization taking up too much bandwidth usage.

This might be unnoticable for most players, because they have good internet nowadays, but keep in mind there are still people with bad internet connections who want to play online. So I hope the network usage is getting some optimization in the future, giving me the chance to play online again :+1:

BTW: Some might say "get better internet" now, but where I live this is sadly impossible. However I can play online games such as SA-MP, MTA, Battlefield 3/4 Multiplayers, Star Wars Battlefront and so on. So it must be possible to reduce network usage without the loss if sync quality.

Guad commented 8 years ago

You are absolutely right, I have not touched the network & server performance yet since I wanted basic sync first, but this is the next step. One thing is separating the huge vehicle mods & ped clothes dictionaries from the tick packets into their own, unifying the VehiclePosition and on foot position, etc

MaZyGer commented 8 years ago

I made few network games which was unfinished but it was just for learning. I also worked with lidgren but not much as I did with unity engine with different things like Unity Networking, Unity UNet, Photon Networking and Lidgren (intigrated to unity). Here you can see an example almost lagfree game where you drive hover vehicle which connects with my dedicated server http://bit.ly/1mkOSxh (it uses UNet, Its webplayer needs UnityPlayer installed and chrome does not support it). Its also an authorative server which means the inputs are send to server and from server to other clients to avoid cheating. Since gtacoop is local controlling it cannot be done like I did.

I could give a try and look what I can create for it. I already checked the code and it seems like there is some improvement needed but SyncPed looks like huge part of all other scripts.

I was thinking about new BaseClass which is called SyncObjects. There will be basics things and later we can expand it to SyncPed, SyncVehicle.