Multiplayer Nutmeg Lab

Background
I recently decided to give Flash game development a try. Despite mostly limited to 2D and no luck on iOS devices it still have a massive reach compared to downloadable games. Found out soon that Flixel is a great retro looking library on top of Actionscript that will make creating flash games a breeze, sort of.

I have also been following @phtonstorm on Twitter for some time and his excellent Nutmeg tutorial was a great inspiration for taking on flixel development myself.

Now I have always been weak for online (speaking of client-server here not putting a swf file on a web server somewhere) development. Back in the days I tried writing a C++ MMO server but I have grown up a little since then. It is just a massive amount of work for one part time indie. Anyway a couple of months ago I discovered the Smartfoxserver platform. A short description from their own web site:

SmartFoxServer is a comprehensive platform for rapidly developing massive multi-user applications and games with Adobe Flash/Flex/Air, Java, Android, .Net, Unity3D, Silverlight, Apple iPhone etc...

The Lab
Now what if you could mix flash/flixel development and smartfoxserver!? It had to be done, so I give you here a modified Nutmeg with "multiplayer" feature. It is not really multiplayer as you would expect but at least you can see other players jumping around in your world. If there is nobody around you can try opening several browser windows to simulate multiple players of course.

All credits for the actual game goes to Richard "Photonstorm" Davey, pixel art by Ilija Melentijevic and music by Brendan Ratliff

Multi NutmegMulti Nutmeg

It has a very basic dead reckoning in place which looks a bit shabby but gets the job done. Every 200 ms your position, velocity, facing direction etc will be sent to the server and then broadcasted to all connected players. Since the elevators, stars and monsters are not synchronized it will look a little weird but this is more a Proof of concept. A true Nutmeg multiplayer would be a lot more work I think and perhaps not the best multiplayer type of game.

I also made a couple of small modifications to the game itself besides adding the network code:

  • Removed background music - Really annoying when having several instances running when testing
  • Disabled pause when losing focus - Also to help during testing in multiple instances

Conclusion
During this little lab I have learned a lot both on the Flash Development process (I'm using FlashDevelop btw), how Flixel works and how to write a Smartfox server extension in Java. I haven't written any piece of Java code the last 10 years so this was an experience in itself. I also discovered that Eclipse is REALLY slow on my computer.

I plan on posting the code here also if anyone is interested how it was done. Be warned though that my Actionscript and Java knowledge is poor, this was hacky!

Newsletter

Get the latest news, upgrades, tips and tricks by joining this FREE newsletter.
Make sure you don't miss out on anything! We keep your information confidential.

Your Email:

Hosting by YMLP.com