LAN party place reservation

Tags:

Originally posted in my old blog at My Opera

Let's take a look at one of my biggest PHP projects so far: Reservinator 1.0, or in other words, a very advanced place reservation system for LAN parties. The page is in finnish, but the post is not, so read on!

If you've even been to a LAN party, you might've used something similar to this system. Amongst other features, Reservinator let's you view an overview map of the event location, choose your place by clicking the place you wish to reserve, and sign up for competitions.

It also has various admin tools, such as sending email to users, marking their reservations as paid based on the bill reference number, and biggest of all, building the overview map with a very easy to use drag and drop interface for placing rooms, tables and other things.

This is something I've developed during this year, beginning from April I think. I developed it for The Group, which is a finnish event organizer, specialized in LAN parties and gaming events, such as the City-Strike Counter-Strike tournament held this year in Helsinki. I've been a part of this organization, doing programming work, since 2004 or so.

During these years, I have developed several different reservation systems, so you could say that I'm an expert on LAN party reservation systems. Sounds nice eh? :D

Reservinator is to be the reservation system to end all reservation systems, the one-size-fits-all solution that can be easily re-used in future events too. This shows in the features and layout which is highly customizable.

Overview

The system runs on PHP5 and MySQL, based on Zend Framework, ADOdb and Smarty. It also uses a lot of JavaScript to improve the features in the admin panel, powered by Prototype and Scriptaculous.

Main “normal user” features:

    '' A screenshot of the top-down map of Solid Fireparty. The small boxes are places, red ones reserved, transparent ones free. The big box on top displays messages when the user hovers over places or rooms.

    This may seem difficult to do with HTML, but the solution is actually very simple: Each room is just a div which is positioned absolutely. Each table is also an absolutely positioned div, with smaller floated divs inside them which make up the places the users can click. This view is fully customizable from the admin panel with an easy drag-based interface.

    Main admin features:

      Technical aspects

      There are various things that are faced when developing something like this. First thing is obviously the size of the project; there is a lot of code involved. Others include things like how to structure the database and things like that. Another thing was the map editor, which is quite complex and was actually the original idea I started building the system around.

      As mentioned earlier, I used the Zend Framework in this project. This means it uses the MVC pattern, so even though the project got pretty big, it's quite easy to manage as the parts are properly separated.

      The database structure took a lot of thought, but now it seems quite simple. Basically, the system separates users, reserved places, invoices, places, rooms and tables in separate tables.
      When an user reserves a place, the place is put to the reserved places table along with an ID to a newly generated invoice. The invoice is placed to the invoice table, and linked to the user with the user's ID. When the invoice is marked paid by an admin, the system generates a claim code for each place and they are put to a table as well, with references to the place they claim.
      When the user claims a place, the place in reserved places table is marked as being claimed by the user.

      The map editor required quite much work. Firstly, it uses the drag and drop feature provided by scriptaculous to move the rooms and tables. Each room and table is also selectable by a click, which loads their settings which can then be changed. The settings are stored in the elements themselves as attributes. One somewhat difficult feature was the table angle: You can define an angle in degrees you want to rotate a table. This required a lot of thinking on how to get it display correctly, because HTML does not support rotating elements. It does some calculations on the fly to figure out how much each place needs to be moved so that the table appears to be in the correct angle.

      When the admin saves the layout, the JavaScript code collects all the data from each room and table and sends them to PHP for processing. There's a lot of things PHP has to do to the data before it can be submitted to the database.

      Each table must be inside a room, therefore PHP must first create a list of rooms and their dimensions. Then it must calculate where each table is, and if a table's dimensions are inside a room's dimensions, it means the table must be placed under that room in the database. PHP also has to calculate how to place the places in tables which have an angle set, but this only applies when the places are rendered: it's not sent to the DB. Place numbering is also calculated on the fly.

      Future developments

      This is an ongoing project for me. There have already been several missing features and things that could be improved on when we used Reservinator as the place reservation system for Solid Fireparty. Most of the things were admin-related, so from a normal user's point of view, the system has worked very well.

      We are also renting the system to other LAN party organizers. You can contact me for regarding the system and pricing at my nick at thegroup.fi. It's currently in finnish, but it can be easily translated to any other language.