Any tips to make things a little faster?

KanaedaKanaeda

很久以前 | 帖子#1
This is my situation: I'm making a multiplayer game that involves four people going head to head, like shooting at eachother from a top down view. The gameplay needs to be fast.

I 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 :-)

TobyToby

很久以前 | 帖子#2
A 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.

KanaedaKanaeda

很久以前 | 帖子#3
But 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?

TobyToby

很久以前 | 帖子#4
Their 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.

ChrisChris

很久以前 | 帖子#5
Specifically 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.

回复主题

现在就注册以回复主题

5dyouxi

5dyouxi.com是一个独立的游戏网站,在这里你将可以免费玩到各种好玩的单人和多人游戏。

开发者工具

如果你是一位flash游戏开发者,我们有一些非常强大的工具来帮助你开发更加优秀的游戏。

经典游戏

为什么不试试我们这里的一些最为优秀的在线flash游戏呢?这可是完全免费的!

Copyright ©2007-2012 5dyouxi™ - All rights reserved.31.2001ms on SERVER34096
注册 或者