After discovering the potential of PlayerIO, I decided to work on a “simple” multiplayer game. Though, over the past 3 weeks I’ve learned that no multiplayer game is easy without planning.

monkeyScreenshot

Multiplayer Latency

I started off with a small project scope: Players spawn randomly and get bananas (points) depending on which side they stand on. More specifically, those on the side with lesser players get more bananas. Basically, a variant of the El Farol Bar Problem. Players would then advance to another room and encounter other game theory scenarios.

networkDiagram

Diagrams can help you visualize the lag time between players.

It sounded easy, but that was before I realized how difficult coding around latency was. Latency is the inevitable delay between users sending and receiving data. Simple interactions like player movement become way messier when lag is thrown into the mix. All input and calculations a player sees must be simulated on an almighty server. It’s essential to keep the player and the server in-synch for as long as possible to maintain the illusion of seamless play.

This can be achieved with the help of techniques from Bungie’s GDC talk, “I Shot you First”. Gamers who rage over lag may find it enlightening.

Starling Framework

particleEffects

Exploding monkeys.

I also tried adopting a graphics engine for this “simple” game. Starling is a graphics engine for Flash that taps into the power of Stage3D to boost performance. Almost all of my previous games used Flash’s built-in math-based rendering, which can easily kill the frame rate. As a vector artist and animator, it feels weird using sprite sheets. I’m not a fan of using hard coded tweens, but the smooth 60/60 fps makes it worth it. Plus, the particle effects are pretty slick. It took me a couple hours to figure out mouse input, but learning new systems always takes time. I’ve noticed that engines always seem to make easy tasks harder yet harder tasks easier.

The game is far from done, and I’m working to get the lag ironed out, but in the mean time you can play it here.

Thanks for reading!.

 

Leave a Reply