Project:Laser tag game

From London Hackspace Wiki
Revision as of 14:44, 3 June 2013 by Montyphy (talk | contribs) (Montyphy moved page Laser tag game to Project:Laser tag game)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Laser Tag Game
Created 02/06/2013
Members Paul Maidment
QR code


Project Information

Made by : Paul Maidment

See also : Not Just Arduino

Background

This is an attempt to create an open hardware version of the popular 'laser tag' game genre.

The basic premise of the game is to simulate a gun battle, similar to games such as paint-ball. Each player is given a 'pack' which they wear for the duration of the game. This pack typically consists of a body suit containing sensors and lights to cover various areas of the body. A toy gun is attached to the pack, the gun features a laser for special effect and also to assist with target designation. The actual targeting however is carried out using infra-red diodes (similar to the system used for changing channel on a television) as, in practice, using a laser for shot detection requires too much precision.

A typical game of laser tag is played in a custom built room known as an 'arena', generally this is a darkened room, utilising fluorescent paint, ultraviolet lighting and smoke generators. A maze is built inside the arena to provide opportunities for players to engage in tactics during the game. Arenas can be given various designs, including bases and locations where assets such as weapon refills can be gathered.

Smoke generators are often used during the game to enhance the visibility of the lasers (looks very cool.)

Game elements

Game hardware 'The Pack'

The game pack is a physical computing asset that enables the player to join the game, the game pack is made of a body vest, similar to an airsoft vest used in paint ball games.

Example: http://www.ebay.co.uk/itm/Stab-vest-cover-navy-police-medium-40-48-Metvest-heavy-duty-paintball-airsoft-/161025745493?pt=UK_Collectables_Militaria_LE&hash=item257de1e255

The vest would be embellished with infra red sensors and LED's, the sensors, to detect 'hits' to various body areas and the LED's to indicate various things such as the player being hit, their team colours or just to generally make them more visible during the game.

At this stage of development, I expect that the pack systems (and possibly) other in game assets will be based on the Atmel Atmega328 microcontroller as there is a lot of 'Arduino' code available for this.

Game server

There will be a central server, for the purpose of entering player data, coordination of the game, display of live game data, communication with the packs and running reports at the end of the game so that the player can review scores etc. This computer does not need to be powerful. I expect that this will be based on the Raspberry Pi.

The arena

The arena can be built in various ways,

Classic arena design follows these rules.

  • It should be a darkened room to lower the chances of light interference on the IR sensors.
  • Paint should be matte black to prevent reflection during the game.
  • Fluorescent paint may be used to provide 'landmarks' in the game and to make it easier to see the arena
  • Ultraviolet light will help to illuminate the paint.

An outdoor arena (at night) may be possible. This is subject to testing. Should be interesting to try!

The arena aspect of the project is low on the list of priorities at this time.

Experiments, Research and Code

Targeting mechanism

To summarise, I have simplified the description of the IR messaging for brevity.

A series of encoded pulses are sent from an IR LED to an IR Receiver. Each sequence of pulses is interpreted as a different message. For example, on a typical remote control, the code for "power off", may translate to a hexidecimal code such as '0xA90' (0xA90 is actually the ON/OFF code for a number of Sony Televisions.) The laser tag system uses a library that makes it easy to encode and decode these signals using cheap hardware.

The library used can be found here.

https://github.com/shirriff/Arduino-IRremote

The following is a test sketch to receive an IR code and illuminate an LED when the desired remote control code is received. This is for the purpose of range and target testing. I use this in conjunction with an IR transmit demo sketch (transmitting the code 0xA90 constantly) This is then placed into a battery powered device to perform the testing.

#include <IRremote.h>

int RECV_PIN = 8;
int irCode = 0;
int timeout = 0;

int PIN_R = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  pinMode(PIN_R,OUTPUT);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
 if (irrecv.decode(&results)) {   
   Serial.println(results.value, HEX);
   irCode = results.value;
   timeout = 0;
   irrecv.resume(); // Receive the next value
   
 } 
 
 timeout++;
 
 if(irCode==0xA90){
   digitalWrite(PIN_R,HIGH);
   irCode=0;
 } 
 
 if(timeout>10000){
   digitalWrite(PIN_R,LOW);
   timeout = 0;
  }
}