This is the second post of the Making a Browser Game series. Check out my last post here.
In this post, I'm going to discuss the basics of how a text-based browser game works.
As I've said in my first post, text-based browser games are a lot like web apps - only more fun. A web app can be a simple to-do list, or it can be a full-blown document editor like Google Docs. But they work inherently similar. They offer the user a means to log in, do something (like write a note, add an item to the shopping list), and they store the user's data somewhere on a server.
Crud! - Philip J. Fry
In a browser game you don't write notes, you write private messages to other players. The process is very similar though. It's Create, Read, Update, Delete (or CRUD for short). Let me give you an example of how this works for the radar in Directive Alpha.
- You start scanning a sector. That's the Create step (you create a scan object)
- You want to know where it's finished, so you go to the radar page. The game Reads from the database the current progress of the scan. It's not done yet.
- The game Updates the progress of the radar scan.
- After a while you come back to the radar. It has finished scanning. When you examine the results, the game Deletes the scan object, so you can start a new scan.
- The radar made some discoveries, the game Creates an Discovery object for each discovery.
- and so on...
These objects are stored in a persistent database which means that if you log out and come back a few hours later, the information about your account is still there. The keyword here is "persistent". That's why games like Directive Alpha are usually referred to as Persistent Browser Based Games (PBBG).
The main difference between a conventional web app and a browser game is that games usually involve some degree of randomness to simulate loot drop rates, decide on damage numbers and determine whether a hit has been blocked or not. A conventional web app should operate deterministically so it doesn't screw up your shopping list. In a future post, I want to elaborate on the effects and the need of randomness in a game.
If you haven't started playing yet, go to Directive Alpha and sign up now!