2011-08-24

firebase

Firebase From Scratch: Introduction

In a series of posts we’ll do “Firebase From Scratch”, an introduction to Firebase and its concepts and ideas. Hopefully, reading this series will give you a firm grasp of what Firebase is and what it can do.

Firebase is a “game agnostic multi-player server”, but that might not be entirely easy to parse. So let’s go backwards: If you want to write a multi-player game, what are the big components you need to worry about before it is done? You need a game client obviously, then a game server, a protocol between the two, and probably a database to store data in. Firebase is here to help you with 2 of those 4 components.

And how, exactly?

  • Your game client, which can be written in almost any language you want, utilizes a Firebase Client API to send and receive messages from the game server. This way you don’t have to worry about the protocol for each game or player, or addressing in general: Firebase will handle that for you.
  • You don’t have to write a game server, you can use Firebase itself as a server, and all you have to do is to write the game. That is to say, you write the code that decides what to do when, for example, player “adam” sends a “bet” action. In other words, the logic and not the server.

Let’s look at the last bit again. A game server is a complicated beast, it should handle multi-threading, networking, be possible to extend easily, be fast as hell, and hopefully also be fairly simple to work with. And you can certainly write it all yourself, but why bother when Firebase will do it for you? If you write a game in Firebase, you can concentrate on what really matters: the game, not the crud surrounding it. Needless to say, you’ll be finished much faster that way!

You can write your game client in any language supported by the Firebase Client API. At the moment this means C/C++, C#, Flash/Flex and Java, but Objective-C is on the way. For the server side game your a bit more restricted and your main choice should be Java, but we’re also supporting a number of script languages such as JavaScript, Ruby or Groovy.

With me still? Fine, next we’ll look at what you actually need to do, a kind of head-first crash course if you like. Stay tuned!