README.md |
Laser Tag
This uses a programmer to setup the game. In addition is supports adding bases, health/ammo packs, etc.
Parts
Guns
- IR LED
- IR Receiver (multiple in thhe future to allow for being shot in multiple places)
- Microcontroller (Arduino Nano ~$5/each)
- Battery
- A few buttons for firing and reloading
- Optional: LCD screen for showing health, ammo, etc. (~$6/each)
Programmer
Either a wifi enabled microcontroller or any microcontroller with a USB connection and a computer.
Overview of gameplay
Use programmer to setup each gun. The programmer will send a IR signal containing the game variables to each of the guns.
Guns then send a IR signal to other guns to indicate shooting. Each guns stores its own health and ammo in addition to game constants (eg. Game Mode, Team, Auto reload, etc).
Each team can have a base which will be sending out a constant signal. Any player of the same team that is within range of the base will be able to respawn and/or heal.
Optional packs act similar to bases but are not team specific. They can be used to heal or reload ammo.
Signals
I'm thinking of using a 4 byte signal to send any data. The first byte will be the sender's ID, the second byte will be the command, and the last two bytes will be any other data.
Sender IDs
Reserved Sender | ID | Notes |
---|---|---|
Programmer | 0x00 | |
Team Base for respawns (2nd digit is team ID) | 0x10-1F | This allows for up to 16 teams |
Health/ammo packs (2nd digit is pack type) | 0x20-0x2F | This allows for up to 16 pack types |
Gun ID (can be the same for teams) | 0xE0-0xFF | Might need to allocate more if we want more than 32 players |
Commands that guns receive
Command | 1st byte | 2nd byte | 3rd byte | 4th byte |
---|---|---|---|---|
Set Gun option | Sender ID (should be programmer) | 0x00 | Option Type | Option Value |
Shot | Sender ID (gun or optionally other weapons such as grenades) | 0x10 | Damage | Gun type (for optional statuses) |
Respawn | Sender ID (should be team base) | 0x11 | Optional data such as delay | 0x00 |
Pack | Sender ID (should be pack) | 0x12 | Pack Type | Pack Value |
Commands that guns send
Command | 1st byte | 2nd byte | 3rd byte | 4th byte |
---|---|---|---|---|
Shot | Sender ID (gun) | 0x10 | Damage | Gun type (for optional statuses) |
Gun options
Option | ID | Values | Notes |
---|---|---|---|
ID | 0x00 | 0x00-0x1F | This corresponds to Gun IDs 0xE0-0xFF |
Ammo Capacity | 0x01 | 0x00-0xFF | |
Health Capacity | 0x02 | 0x00-0xFF | |
Auto Reload | 0x03 | 0x00-0x01 | |
Auto Respawn | 0x04 | 0x00-0x01 | |
Gun Type | 0x05 | 0x00-0xFF | This is used to identify the gun type for optional statuses |
Starting Health | 0x10 | 0x00-0xFF | To be used when the game starts or gun respawns |
Starting Ammo | 0x10 | 0x00-0xFF | As above |
Shooting
Before firing the shooter will check if it is still alive and has ammo. If it is it will decrement the ammo left before sending a Shot signal with the GUN ID, damage, and gun type. The gun will then check if it is on auto reload. If it is, it will check if the ammo is less than the max ammo. If it is, it will reload the ammo.
If the target is in line of sight they will receive the signal. The target will then check if the sender is a valid gun and if so, check if it is on the same team (using the sender ID). If it is not on the same team, it will take damage and check if it is dead.