Any tips to make things a little faster?
Toby说
很久以前 | 帖子#2A bullet's X and Y should never be constantly updated. You only need to broadcast the creation event. Send the X Y, Rotation and velocity and you shouldn't have to worry about it from there.
Kanaeda说
很久以前 | 帖子#3But these bullets bounce off walls... So their direction is not always a constant thing hey. The "physics" of the bullets, if you will, are determined on the players side and broadcasted out from there. See my conundrum?
Toby说
很久以前 | 帖子#4Their direction is not required to be sent across the server. So long as the walls are not being moved by the players the end result will appear the same on both clients. If the walls DO move then you can just broadcast the rebound and velocities as you did when it was fired initially.
Chris说
很久以前 | 帖子#5Specifically slow moving bullets are pretty easy to handle as they have predictable paths.
In a perfect world you would send over an initial x,y,angle and velocity combined with a time-stamp, then let the receiving client pop it in at the correct location and predict it from here.
There is a pretty good thread on the subject of synchronization here which even have examples.
In a perfect world you would send over an initial x,y,angle and velocity combined with a time-stamp, then let the receiving client pop it in at the correct location and predict it from here.
There is a pretty good thread on the subject of synchronization here which even have examples.
回复主题
现在就注册以回复主题
Kanaeda说
很久以前 | 帖子#1I have a these variables that need to be updated constantly:
Each players X,Y and angle.
Each player bullets X And Y (only two bullets can exist at one time)
Q1:
Is it better to broadcast that on an interval (like the other games work). I just worry about it looking choppy. Even if I use the lowest possible interval (The limit is 25ms, thats a frame in a 40fps swf,right?), there's a possiblity of you shooting at a player in one spot, who is actually in another spot before your visuals have updated. (that chance is very slim tho)
OR is it better to broadcast as the variables are updated, forgetting about intervals? I'm using this method and I think it's a little too much for it?
Q2:
What should I broadcast the variables as? Angles and x and y values often arent totally rounded off. Should I be broadcasting floats or just round them off and send them as Integers? Obviously you would lose the finer points of the thing tho, without the floats.
If you can give me tips, knowledge, secrets, biscuits... Anything would be greatly appreciated :-)