Laser Tag C13 – Clone Signal

Love Jesus, Love Code

This tutorial should take approximately 30 minutes to complete.

The ability to receive a clone signal was introduced in the IR tutorial – https://crosscode.club/2025/03/24/laser-tag-c11-ir/. However, this feature is not particularly useful unless you can also send the signal. In this tutorial, we will create a toggle switch on the Milestag webpage that will switch the tagger into “clone” mode. This will allow the settings from one tagger to be distributed to other taggers.

When a clone signal is received by a tagger or a series of taggers, all affected taggers will have their game settings modified simultaneously. This provides a quick and efficient way to change settings, especially when a different style of game is required. The clone signal is 43 bits long, which is sufficiently lengthy that the IRremoteESP8266 library must handle it in raw format for both sending and receiving.

Byte NumberItemValueDescription
0Identifier0x87 Must be this value
1Identifier0xD4 Must be this value
2Identifier0xE8Must be this value
3RESERVED
4Volume0-50 = Loudest, 5 = quietest
5Field ID0-10x00 = A, 0x01 = B
6RESERVED
7RESERVED
8Kill LED0-60Kill LED timeout in seconds (0-60)
9Sound Set0-2Sound Set, 0=Military, 1 = Sci-Fi, 2 = Silenced
10SRK Damage0-255Mapped
11SRK Range0-255Mapped
12Flag0-161=Flag view enable, 2=Flag Repeat enable, 8=Team display Military, 16= Main Display Player
13My Gun Damage0-255Mapped
14Mag Size0-255Raw Value
15Magazines0-202Raw Value
16Fire Select0-20=semi-auto, 1=Burst, 2=Full Auto
17Burst Size0-255
18Rounds Min0-120=250, 1= 300, 2=350 ,.., 12=800
19Reload Delay0-255default=3
20IR Power Mode0-10=indoor, 1=outdoor
21Range0-66=max range
22Muzzle Flash0-1616=on, 8 = hit Flash, 2 = short range kill??
23Respawn Health0-72mapped, 36=100, 72=999
24Body Armour Min1-100Minimum damage to penetrate armour
25RESERVED
26Body Armour Max0-255
27Game Mode 10-255Game Mode 1: Zombie Mode ENABLE (+2) Friendly Fire ENABLE (+4) Unlimited Ammo ENABLE (+8) Respawn Flash ENABLE (+16) Flag Flash ENABLE (+32) Game Box RoR ENABLE (+64) Game Box Stay ENABLE (+128)
28Game Mode 20-255Game Mode 2: Body Armour ENABLE (+2) Zombie Flash ENABLE (+4) Near Miss ENABLE (+16) Flag End ENABLE (+32) Ammo RoR ENABLE (+64)
29Hit Delay0-255Seconds
30Start Delay0-255respawn delay
31Bleed Out0-255
After being tagged out [killed] you can still be healed during this time
32Game Length0-120Game time in minutes, 0=No Time Limit
33RESERVED
34Zombie Life1-72(Mapped) 36=100, 58 = 300, 72=999
35Zombie Damage0-16(Mapped) 0=1, 13=50, 16=100
36Body Armour Heal0-100points/second
37Medic Box Health0-100Raw value
38Ammo Box Clips0-30Raw value
39Armour Box Points0-100Raw value
40Weapon0-255RoR ENABLE = 0x08, Zombie Sounds = 0x40, Dual Muzzle ENABLE = 0x80
41RESERVED
42ChecksumChecksum calculated for bytes 0-41

New Feature

Save the project as LaserTag_C13_Clone

Variables

Add the following variables in the main tab

Edit Game tab

In this tab, the clone tagger operates as its own game state. During this state, the game should be paused, and a signal should be sent when the fire button is pressed. This action triggers the function cloneSendonShoot();, which is about to be created.

New Function – CloneSendonShoot() – Triggers Tab

At the end of the file, add the following code. This will send the clone signal when the button is pressed by calling the function sendCloneSignal();

New Function – sendCloneSignal() – IR Tab

At the end of the IR tab file, we will include the code for the function sendCloneSignal() along with its dependent function, sendSonyRaw().

void sendCloneSignal(){
  milesTagSettingsToArray();
  sendSonyRaw(milesTagSetting, sizeof(milesTagSetting) / sizeof(milesTagSetting[0]));
}

void sendSonyRaw(uint8_t* byteArray, size_t arrayLength) {
  const uint8_t numBits = 8; // Number of bits in a byte.
  const uint16_t startPulse[] = {2400, 600}; // Start Pulse ON & OFF durations.

  // Calculate size of rawData: start pulse + (2 durations per bit * numBits * bytes).
  uint16_t rawData[2 + (arrayLength * numBits * 2)];

  // Add the start pulse.
  rawData[0] = startPulse[0]; // ON duration.
  rawData[1] = startPulse[1]; // OFF duration.

  // Convert byte array to raw data.
  uint16_t index = 2; // Start after the start pulse.
  for (size_t byteIndex = 0; byteIndex < arrayLength; byteIndex++) {
    uint8_t byte = byteArray[byteIndex];
    for (uint8_t bitIndex = 0; bitIndex < numBits; bitIndex++) {
      if (byte & (1 << bitIndex)) { // Bit is 1.
        rawData[index++] = 1200; // ON duration.
        rawData[index++] = 600;  // OFF duration.
      } else { // Bit is 0.
        rawData[index++] = 600;  // ON duration.
        rawData[index++] = 600;  // OFF duration.
      }
    }
  }
    // data to be sent
    Serial.print("Data Sent: ");
    for (int i = 0; i < arrayLength*8; i++) {
        Serial.print(rawData[i]); // Print each element
        Serial.print(" "); // Print a space after each element
    }
    Serial.println();
  // Send the raw data once.
  irsend.sendRaw(rawData, index, 40); // 40 kHz frequency.
}

Add Toggle Button

The button should toggle the variable cloneTagger between false and true. When in tagger mode, the button will turn green. Modifications are required in both the MilesTagPage.h and the webActions tab.

<h1>Clone Mode</h1>
<button id="toggleButton" onclick="toggle()">Toggle</button>
  <p id="status">State: Loading...</p>
  <script>
    // Fetch the current cloneTagger state and toggle it on button press
    async function toggle() {
      const res = await fetch('/toggleAndState');
      const state = await res.text();
      document.getElementById('status').innerText = "State: " + state;
      const button = document.getElementById('toggleButton');
      if (state === "true") {
        button.style.backgroundColor = "green"; // Change to green
      } else {
        button.style.backgroundColor = "grey"; // Default color
      }
    }
    // Fetch the current cloneTagger state when the page loads
    async function loadState() {
      const res = await fetch('/toggleAndState?fetch=true');
      const state = await res.text();
      document.getElementById('status').innerText = "State: " + state;
      const button = document.getElementById('toggleButton');
      if (state === "true") {
        button.style.backgroundColor = "green"; // Change to green
      } else {
        button.style.backgroundColor = "grey"; // Default color
      }
    }
    // Call the loadState function when the page loads
    window.onload = loadState;
  </script>

Test Code

You should now see a small button at the bottom of the “/milestag” webpage

Christian Content

In the precise world of laser tag, the clone signal represents absolute alignment. With one command, Every device instantly adjusts—recalibrating settings, realigning parameters, and synchronising completely. Each tagger becomes perfectly tuned, eliminating any deviation or individual variation in the game settings. However, the clone signal does not change the tagger’s individual identity, such as its name or team; it only alters attributes related to gameplay.

Just as a clone signal transforms scattered devices into a unified system, God seeks to align our hearts with His perfect purpose. Similar to the clone signal, this alignment is not about losing individual identity but about becoming perfectly synchronised with divine intention.

The Bible offers powerful guidance on conforming to God’s will:

Romans 12:2 (NIV)
2 Do not conform to the pattern of this world, but be transformed by the renewing of your mind. Then you will be able to test and approve what God’s will is—his good, pleasing and perfect will.

Romans 8:29 (NIV)
29 For those God foreknew he also predestined to be conformed to the image of his Son, that he might be the firstborn among many brothers and sisters.

As Christians, God is conforming us to be like His Son, Jesus, in order to elevate us to our highest potential. This is a restoration of our lives, freeing us from sin’s distortion and helping us to reflect the perfect love that comes from Him. Just as a laser tag clone signal brings perfect alignment to every device, Christ’s transformative power brings perfect restoration to every human heart.

Leave a Reply