Showcase using rules to play games inside Drupal 7

avinoama2's picture

I started off with a question about a year ago.
My question was "Can I use Drupal to create a game that is playable by players”?
To build it in Drupal I had to think differently from what i used to CMS or OOP.

My most basic idea was that I will define a set of Entities that acts as my “game”.
Game – is the static game that will hold a title, description and some preset fields that will by determine by game type.
Game type – is the bundle of game and allows it to be field able.
Running game – is a running instance of the game at hand.
Player – is a slim user that will not relate to Drupal users (you don’t have to Register in order to play a game).
My basic thought was that everyone can run it even in shared hosts so for my demo I won’t use open-socket or any other of complicated technologies.
I said let’s use Ajax called in small intervals just for demonstration reasons.
In order to relay messages to several clients in an unsynchronized matter I needed to add another entity
Command – Each command is a set of action to perform on each client.

From there I started programing my basic example...
My basic example was TIC TAC TOE...
I created an interface for that that can be played.

I used Rules module as a source of building games.
I have attached all my logic of TIC TAC TOE to the rules module in a way that I can allow a non-programmer to create or edit game logic.

Here’s the code it’s an alpha version so use it on your responsibility.

also got a demo site running
To play games no authntication needed.
You need to connect from 2 browsers to play.
TicTacToe or Chess

I would like to hear what you think about it ?

if you want to know how it works i still didnt make the specs for developers and for game editors. For now use the code or ask questions.

Game Entities (2).jpg31.78 KB
EDA Implemented on rules module (1).pdf26.82 KB
Chess Piece Move Condition.png43.4 KB


very cool.. making something

patoshi's picture

very cool.. making something like MUD or would actually be doable with just drupal.

Yes you can

avinoama2's picture

but you need a bit of coding...
Notice all game events are past via rules to the players.

add some more photos to show you what was implemented as a rule.


avinoama2's picture

To play games you donot need to be authnticated in my site.