Thursday, September 3, 2015

Marble GP - multiplayer game prototype + source code

Playing with Android, I recently completed a prototype of a simple game involving multiplayer mechanisms.

But before diving into technical details, I suggest you to watch a short demo:

Written in Java using the Android SDK, Marble GP  features:
- physics managed by JBox2D
- a home-made simple 2D Open GL ES 2.0 renderer
- a home-made TCP socket multiplayer system
- a home-made parser for levels importing in SVG format

The Open GL renderer is a direct port of the C++ Open GL ES 2.0 renderer Toto2DEngine I have written for the Raspberry PI. It is primarily a sprite batch renderer working with an atlas texture. It is quite simple to use and you could even build your own high-level graphical 2D API from it.

The client-server system is quite original because the socket server is designed to be run directly by one the devices involved in the game. So the game is self-reliant  in the sense that it doesn't need a central big and expensive distant game server. In other words, the game is local wifi multiplayer.

Finally, I was looking for a very simple way to biuld levels. I didn't want to hardcode my levels by hand, because it is tedious and it rarely gives interesting results. But because it is a prototype, I didn't have the time to code a level builder tool. So I choosed to write a simple SVG parser, generating Box2D primitives from SVG XML files. Always in the way to keep things simple, I have drawn my levels with SVG-edit.


If you are curious, you can find the sources of my 2D Open GL renderer as well as my core client-server socket classes. They are part of a my new framework Simple-Android.

1 comment: