Archive for March, 2010

8Mhz….

Wednesday, March 24th, 2010

Yesterday I made the switch to running the Picaxe chips at 8Mhz. Whilst the guns function fine at 4Mhz, they had problems registering all the hist from the Minigun as it shot faster than the guns could process the hits. Also as the code gains more features it will only get slower, I decided now was a good point in time to boost the speed.

Aside from some minor issues like reloading being two fast and all the sound statements being higher pitched the transition went quite smooth and the guns now pick up all the shots from the mini-gun. This leads to another problem that the mini-gun can kill players even quicker now!!!!

Admin Box

Sunday, March 14th, 2010

This weekend I have started work on the Admin Box, which when completed will allow me to start implementing persistent game data on the guns. So far I have only really got the physical construction of the box done and laid down the basic core code to write to the screen and read the position of the selector dial switch.

The Admin Box has 3 buttons, two on top which are used to increase or decrease the currently selected variable and one on the bottom which transmits the current variable. There is also a selector dial switch on the side, this swicthes between all the variables and also selects which commands to transmit.

The unit is using a shiny new 20×4 LCD screen I purchased with a funky blue backlight. Below are a couple of pictures to show the progress so far, expect updates to follow as the box becomes more functional.

Persistent Game State

Sunday, March 7th, 2010

One of the major flaws with the LibreTag system in its current state is that if the power is turned off mid game all the variables containing the players health and remaining ammo are lost. This can either be an annoyance or a way to cheat, either way it needed to be fixed.

I toyed with several ideas like saving all variables to the built in EEPROM every 10 seconds or so, but I was worried that after a while I may wear the EEPROM out. There is also the disadvantage that since the save is happening every 10 seconds people could still cheat in that time window. I finally came across the idea of getting the Picaxe chip to detect when the power is turned off and then save all the variables to EEPROM. By using a large capacitor (2000uf) on the 5v supply line, the Picaxe gets just under a second of runtime before the voltage drops too low.

I initially tried lower capacity capacitors but it was only at about 1500uf that the picaxe managed to stay on long enough to detect the power loss. I created a simple IF statement, once the input voltage dropped below about 5.5v (I’m using a 5v LDO regulator) it went into a loop sending a test character out the serial connection to the pc till the power completely dies. During testing what I saw was really strange since at 1000uf nothing was received, but when using a 1500uf capacitor,  about 20 characters were received. I would have expected that when using a 1000uf to at least get a couple of characters received, I am guessing this is to do with the logarithmic nature of a capacitor.

Anyway like I said with a 2000uf capacitor the Picaxe stays on for long enough to save the health, ammo and number of remaining clips to EEPROM. With a few more modifications to the code, the gun now reads these values back out at power on and hence the game state is preserved. The only thing now is that I have to re-flash the gun once the health or ammo is depleted, which means I better get working on the Admin box to remotely configure the guns…..