Note that there are some explanatory texts on larger screens.

plurals
  1. POIs it possible to do real time network games in Actionscript 3.0
    primarykey
    data
    text
    <p>Question: Is it possible to update 100+ objects in the Flash Player over Socket Connections? More details and my own try's below!</p> <p><strong>Details</strong></p> <p>For my internship I got the time to create a multiplayer physics game. I worked for a steady three months on it. My internship is coming to an end and I couldn't finish my game.</p> <p>My problem is that its hard to send multiple packets each time-step to the server and back. The packets I send are position updates of the objects and mouse of other clients.</p> <p>I will try to explain the network/game flow.</p> <ol> <li>Client connects to the server using the binary Socket class in AS3</li> <li>Server ask for verification and client sends name and thumbnail.</li> <li>Server waits until 4 clients are connected (Some matchmaking etc)</li> <li>Server picks 4 clients and makes them run on a separate Thread(Combined as a Team)</li> <li>Client sends his performance score to the server range 1-100.</li> <li>Server makes the best client the host machine for the physics and the other 3 slaves</li> <li>Host game sets up the level and makes around 1-100 shapes in the level(primary shapes and complex shapes like bridges, motors, springs)</li> <li>Every time-step the host gets all updated property's of the shapes and sends them to the clients (x, y, rotation, sleep)</li> <li>The client applys all the shape property's to the correct shapes</li> </ol> <p>I tried different time-steps and noticed that until a time-step of 1/15 second the client(slave) won't notice any lagging in the game. I also tried to pick a lower time-step and tween the movement of the shapes but that did give some strange movement on the client(slave) side.</p> <p>I will give an example of a single object update packet.</p> <pre><code>&lt;O|t=s:u|x=201|y=202|f=automaticoo&lt;/O &lt;O|t=m:p|x=100|y=345|f=automaticoo&lt;/O </code></pre> <p>I noticed that the Flash Player can stack a lot of packets in the buffer before sending. For example if I send a lot of packets at once it stacks them up and send them together to the server. With faster time-steps you don't get more updates on the client(slave) side but more updates in the same packet row.</p> <p><strong>Tries</strong></p> <ol> <li>Use the new RTMFP(udp &amp; p2p) protocol for updates. (little bit better in performance but less in reliability)</li> <li>Code my entire socket server in c++ instead of Air(with the ServerSocket) (better in performance but noticed the lagging part is not the server but the Flash Player)</li> <li>Use the ByteArray compress method and the AMF serialized format (performance about the same except the c++ server can't unserialize the messages)</li> </ol> <p>Do you guys think it is possible in the Flash Player too handle so many update request each time-step.</p> <p><strong>Discoveries</strong></p> <p>There is a stick arena game that is multiplayer in ActionScript 3.0. They used a lot of tricking and even then I get a ping of about 300ms and it only updates the players constantly (4 players in a lobby).</p> <p>Sorry for the long post.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload