[Help!] Reduce Lag
[Help!] Reduce Lag
I need to reduce the lag for my project, it is not the server, it is the .fla file; each time that the user moves 1 tile 20 variables are sent and updated, making you see the others walk really really slow.. how can i reduce the lag?
its that all variables seem to be essencial.. i mean i do not know how to reduce them.. because these are the variables that are essencial:
py
px
movefeat
look
init
but they are updating to often, if i dont update them though.. it doesnt work well.. the user sees other users moving really slooww
is there a way like.. umm.. putting all the values in 1 variable and then exploding them?
example:
instead of:
py
px
movefeet
look
init
(5), only one.. like this
all = py+","+px+","+movefeet+","+"look";
would that work?
py
px
movefeat
look
init
but they are updating to often, if i dont update them though.. it doesnt work well.. the user sees other users moving really slooww
is there a way like.. umm.. putting all the values in 1 variable and then exploding them?
example:
instead of:
py
px
movefeet
look
init
(5), only one.. like this
all = py+","+px+","+movefeet+","+"look";
would that work?
Of course you can. You can either join your values into a single string using a delimiter (like a coma, but I prefer a pipe |, i.e. 14|56|4|19|1 ), or if you use standard lengths for your values, you can even put them as a a series of non delimited values (adding leading zeros to make them uniform i.e. 014056040191) and use substr or modulus to take the portion you need.
Use Array.join() and Array.split() for imploding/exploding (you're a php person eh?).
This will severely reduce the amount of traffic, HOWEVER you will add more calculations to the client which has to do the extra step of joining and splitting the values (which under normal circumstances is negligable).
Use Array.join() and Array.split() for imploding/exploding (you're a php person eh?).
This will severely reduce the amount of traffic, HOWEVER you will add more calculations to the client which has to do the extra step of joining and splitting the values (which under normal circumstances is negligable).
how do you know im a php person o.o wow.. haha.. well ill try although i dont know how to do the exploding in the AS.. will it be something like this?:
when sending
var allin:Number = movefeet+","+ etc...
smartfox.setUserVariables(allin);
when receiving
myarray = Array.split(userObj, ",");
user._movefeet = myarray[0]
.. idk..
when sending
var allin:Number = movefeet+","+ etc...
smartfox.setUserVariables(allin);
when receiving
myarray = Array.split(userObj, ",");
user._movefeet = myarray[0]
.. idk..