Introducing Weekend Warriors

This August I have been working on a new game: Weekend Warriors.

Weekend Warriors is a strategy text game of spell-casting and problem-solving. You play the part of a wizard protecting your kingdom from the endless hoards of computer generated enemy horror.

You have at your disposal over sixty unique spells from which you must choose those that will defend your kingdom. Some spells will summon creatures to do your bidding, whilst others represent magical objects, places and enchantments that will aid you in your quest.

At each turn you must defeat the hoards of your enemy by matching symbols on your enemy cards with powers generated by your own creatures.

Facing your first enemy: The Baby Giant Slug, adept at killing noob wizards, this monster requires 2 points of combat power and 1 point of defence power in order to be defeated, however there is a short cut - just one point of fire power will toast this slug to death.
Spells are cast by spending either gold (generated by defeating enemies) or mana points (one point is generated each turn).  The more powerful spells cost more to play, and sometimes they are delayed one or more turns, so you need to think about what you will need in advance.

Unlike many games of this genre, you have access to every spell in the game, which you can access at any point in the game by opening your spell book.  There are currently over sixty unique spells to choose from, with more coming soon.  It is recommended that you study each spell carefully and weigh-up their costs against what you require to win. Some spells reward you for having already cast other spells, for example, the spell Bloodlust gives you combat points equal to the number of warriors you have in your battlefield, so it would be a good strategy to spend precious resources building up your army of warriors.

The spell book showing some of the available spells.


Weekend Warriors allows you to play the game however you want, and you are rewarded for knowing the spell book inside out.

Each turn consists of two phases.  In the first phase you may look through your spell book and choose spells to cast. You may wish to examine the creatures and objects already on your battlefield for activated abilities or to 'rest' creatures you do not need.  In the second phase your creatures spend their 'stamina' points generating powers for you to use in defeating the computer-controlled enemies.  In this phase it is too late to rest your creatures, although you may still cast new spells and organise your armies.

Viewing an item in your battlefield.  Here is the battle axe, which is just waiting to be equipped to a suitable dwarf.

Weekend Warriors is ready to play in public beta form.  There are probably a few bugs still to iron- out, and undoubtedly the game-balance will need tweaking based on feedback.

All constructive feedback is welcome.

Further updates in the future are planned, with more spells and enemies to keep you going.  What is even more exciting is that there is planned original artwork for each spell and enemy in the game coming soon from the talented artist Pob, who worked with me on Spellunker. You can check out Pob's artwork for Spellunker here.

One of the creatures in the spell-book view, showing (from left to right) name; 'summoning' button; spell class and types; description; placeholder for artwork (coming soon); flavour text; casting costs; stamina; abilities; links to other spells that work well with this one.
To get you started with Weekend Warriors, I've created a short tutorial.  Just press the 'Help' button in-game and choose a help topic.

Weekend Warriors tutorial running on my Lumia 950.


If you have enjoyed this post, then you may like this post from last year's game Have Spell Will Travel.




Summer projects over the years

So, I haven't posted for a little while. I have been enjoying the hot weather and some time off work, however I have also been working on a new project (some teasers at the end of this post...)

Each summer I aim to complete a new project.  Listed here are some of the best projects I have attempted over the years....

...starting with...

2008 The Unofficial Talisman Computer Game




An electronic implementation of Talisman - the Magic Quest Game.  I wrote this for fun and to develop my programming skills. It was in no way an attempt to undermine Games Workshop's intellectual property, however, GW did flex their legal muscles and I decided it best to remove this game from all sites that I control.  Nevertheless, it was tremendous fun to create, and it is still tremendous fun to play today.

2012 Star Funk

Here my mining vessel is under attack from a group of passing traders.

StarFunk is a game of Inter-Galactic trade, exploration, mining, piracy and combat for Windows.  If StarFunk is like any game, then think of Elite, but in 2D.  It is completely open, and although there are several missions to complete, how you play and what you do is entirely up to you - although getting on the wrong side of the space police is usually a fatal decision.

2013 Space Combat



I never quite finished this game, however I did distribute the code for anyone who wants to finish it.  In Space Combat you must defeat wave after wave of enemy space craft by throwing dice to overcome their defences.  The executable version is playable, at least for the early levels.

2014 Spellunker


Spellunker is a spelling and adventure game for Windows. You follow the story of Wordsworth Spellunker in his quest to find the truth about his parents.  Along the way you must defeat the various, ever-more challenging levels by casting magic spells - literally spelling words from the assortment of letters you are provided with. The longer your word, the more points you accrue.


The artwork for Spellunker is provided by the lovely Pob, and some of the story-line was created with thanks to Ben.

2015 Have Spell Will Travel



Have Spell Will Travel is a web-based adventure game. You play the part of a hero, defending the town from dreaded kobold attacks. At every turn you will be asked to test one of your many abilities. You could choose your highest stat, but you never know how dangerous your enemy is. With a little luck and skill you may survive long enough to quest for the fabled Sword of Gygax, or even defeat the dread sorcerer, Warren Fogbender.

You can choose from one of over 168 different characters each with a unique set of abilities.  Want to be an Ogre-ninja?  How about a Fairy witch?  Well, with Have Spell Can Travel, you can!



2016 - New game coming soon.

Early version of Weekend Warriors being tested in the Edge browser.

I am currently working on a new game.  It is still in the early stages, however I can say that it is a strategy game in which you must balance your attack and defence powers to overcome various challenges thrown at you by the computer.

The working title is Weekend Warriors, so called because one of the characters in the game - The Weekend Warriors - are so tough you may only play them on a Saturday or Sunday.

That's all for now, but stay tuned to find out more.

Microbit virtual pet

I made a virtual pet for microbit.

The microbit is an ARM-based embedded computer system designed by the BBC for use in computer  science education. It comes packed with sensors and a 25-LED display.  The microbit website allows you to program the device and I first discussed it in this post over here.



Today I built a virtual pet. Grab the code here and run it on your microbit or in the simulator.

Microbit virtual pet when started. It is happy.

As with all virtual pets you get to look after and feed a creature within the device. You can feed the creature by holding the 'A' button, and clean up after its waste with the 'B' button.  Holding both buttons together will get the creature to talk to you - it will tell you what it needs.  The creature gets hungry after a certain period of time which can be changed in the 'hungerThreshold' variable.

This virtual pet always does a poo after you have fed it.

Currently that is all, but there is room to improve: The creature does not die from neglect; it always eats even when it is not hungry; it does not complain when you shake it.

Update - 2016-06-29 - The micorbit virtual pet now has a new name: Mike the Microbit, and he will die from neglect.


Improved SenseHat headlines ticker

Last time I introduced my SenseHat RSS feed display code. Today I have made some improvements to the script.

The Sense HAT provides an 8x8 LED maxtrix display, accelerometer, gyroscope, magnetometer, air pressure sensor, temperature sensor and air pressure sensor, as well as a small joystick.  Basically a bundle of sensors that plug in directly to the GPIO pins on your Raspberry Pi. They are well worth purchasing should you wish to upgrade your Pi.



First off, the list 'feedlink' can be populated with as many RSS feeds as you like.  Here I have three BBC feeds, but they could be substituted for any feed you like.  Currently the ticker loops through all of the articles in each feed. You could change it so that each feed is chained to the end of the previous one.  With this code you can switch the the start of the next feed by shaking the Raspberry Pi.  The shake is detected by a change in the 'pitch' of the SenseHat.  You can change the sensitivity of the shake with the THRESHOLD variable.  The new feed will be displayed after the previous article has finished.
The RSS feed ticker scrolling over the SenseHat, however my camera frame rate can't keep up.

I have added some exception handling to the showFeed routine to handle an index out of bounds error. I think this could occur with the previous code.



#Sense Hat RSS reader
#version 2
#For Python 2
from sense_hat import SenseHat
import feedparser
import time


def showFeed(d, n):
    """Shows feed (d) article (n)"""
    try:
        sense.show_message(d.entries[n].description,
                           back_colour=[255,0,0],
                           text_colour=[255,255,255],
                           scroll_speed=0.07)
    except IndexError as e:
        sense.show_message("ERROR")



        
sense = SenseHat()
sense.set_rotation(270)
sense.low_light = True

feed = []
feedlink = ['http://feeds.bbci.co.uk/news/rss.xml?edition=uk',
            'http://feeds.bbci.co.uk/news/technology/rss.xml',
            'http://feeds.bbci.co.uk/news/uk/rss.xml']

ARTICLE_LIMIT = 20
THRESHOLD = 15 # threshold for tilt (changes feed)

print "Running on SenseHat:"
while True:
    #read the feeds in
    for thisFeed in range(len(feedlink)):
        feed.append(feedparser.parse(feedlink[thisFeed]))

    i = 0 #article pointer
    f = 0 #feed pointer
    
    while i < ARTICLE_LIMIT:
        orientation1 = sense.get_orientation_degrees()
        time.sleep(0.5)
        print 'feed ',f,'article',i
        showFeed(feed[f],i)
        orientation2 = sense.get_orientation_degrees()
        #check for shake
        print 'shake detected ',abs(orientation2['pitch'] - orientation1['pitch'])
        if (abs(orientation2['pitch'] - orientation1['pitch'])> THRESHOLD):
            f += 1 #change feed
            i = 0 # return to start of feed
            if (f == len(feed)):
                f = 0
        else:
            i += 1
    time.sleep(2.5)

RSS feed for Raspberry Pi SenseHat

I have written a short script for running a news feed on a Raspberry Pi SenseHat.  The Sense HAT provides an 8x8 LED maxtrix display, accelerometer, gyroscope, magnetometer, air pressure sensor, temperature sensor and air pressure sensor, as well as a small joystick.  Basically a bundle of sensors that plug in directly to the GPIO pins on your Raspberry Pi. They are well worth purchasing should you wish to upgrade your Pi.



The feed picks up the headlines from the BBC news service and then runs continuously on the SenseHat display. Any other valid newsfeed could be substituted for the BBC feed.

RSS feed running on the Raspberry Pi with SenseHat.  I couldn't get a much better photo then this.

Step 1

I used feedparser for the RSS feeds.  This can be installed on your Pi using the following command:

sudo pip install feedparser

Step 2

The following Python 2 code runs an infinite loop which loads the first twenty articles from the BBC website and displays them continuously on the SenseHat display.

#Sense Hat RSS reader
#For Python 2
from sense_hat import SenseHat
import feedparser
import time

sense = SenseHat()
sense.set_rotation(270)
ARTICLE_LIMIT = 20

print "Ticker running on SenseHat"
while True:
    for i in range(ARTICLE_LIMIT):
        time.sleep(0.5)
        d = feedparser.parse('http://feeds.bbci.co.uk/news/rss.xml?edition=uk')
        sense.show_message(d.entries[i].description,
                           back_colour=[255,0,0],
                           text_colour=[255,255,255],
                           scroll_speed=0.07)
        
    time.sleep(2.5)

If you liked this article, then you might like my other SenseHat posts, or my other Raspberry Pi posts.

RetroClinic Datacentre for BBC Micro

The post was going to be called: 'You need to hear about my 1MB RAM disk', or 'Not even the US military have this hardware in their nuclear defence system'.

Yesterday the datacentre arrived for my BBC Master 128.

The datacentre is available from retroclinic.com and is a modern hardware upgrade for your vintage BBC microcomputer.  Setting-up was easy as I chose the 'external' datacentre option which is virtually plug-and-play (although I did need to install the RFS ROM chip).

BBC Master running TimeTrek.  The Datacentre is the 3D-printed box with the red light sitting on top of the disk drive.

Datacentre provides you with a RAM filing system.  This means that you get four virtual floppy disks available to use straight away.  The computer treats these as it would any floppy disk with the advantage of being totally silent and noticeably faster.

You also get one Non-volatile 200K RAM disk.  This works in much the same way as the other four with the added advantage of not losing its contents when the power is switched off.  I am going to use this for commonly-used apps. You can also configure the master to boot into this disk which is very handy.

Probably the most compelling reason to upgrade your beeb with the datacentre is the fact that you can plug a USB flash drive into the USB 2 port.  Your computer sees this as another (sixth) disk drive which you can, if you like, use to store programs and files as with the other disks.  More compelling is that you can transfer any file from your PC onto the USB disk and have your BBC computer read these files.  Even more so is that you can dump BBC disk images - both single-sided and double-sided disks.  I have a 4GB flash disk containing over 600 disk images (and it is only 1% full).  I am reliable informed that people have plugged up to 2TB of solid state storage into their computer.  Enough room for every line of code every written for the beeb.

Once you have a USB drive full of disk images, you can transfer them onto either a floppy disk to run on the computer, or simply copy the image onto one of the four volatile RAM disks.  I spent several hours yesterday reliving the BeeBug magazine disks. You can, of course, run these disk images in an emulator on your PC, but there is nothing like running old software on vintage hardware (and a 32 inch screen).

Copying from a disk image to the RAM filing system is a process that takes one OS command *import -02 <imagefilename> and takes about ten seconds to complete for a double-sided disk.

It is possible to export the contents of a RAM disk back to a disk image for the purposes of sharing your disks or keeping a back-up in the cloud.  In fact the process is so convenient that you play loose and easy with your disks.  No longer are you confined to careful archiving of physical disks; ensuring that the most data is packed onto your precious floppy disk.

Perpetual Calendar from BeeBug by P Brown.  Yay! It doesn't think that it is 1916.
The device also has a USB 'slave' port for direct communication with your PC.  I haven't had time to play with this much yet as I was too busy looking through old disk images.  The device is a fully functional USB 2.0 specification host, and as such, you can use virtually any USB device in it you like, including keyboards, mice, joysticks, etc, but that's a post for a different time.


It is possible to accidentally corrupt your nonvolatile RAM disk, so regular backups to the USB drive are strongly advised.  I managed to do this (with resulting data loss) but fortunately the system comes with a utility to restore the disk.

If you are thinking about purchasing a BBC microcomputer, then the Retroclinic datacentre is an absolute must-have addition, so contact Mark now.

#bbcmicro #bbcmaster #retroclinc #bbcbasic #computers #vintage #floppydisk #beebem

What happens when you let a computer compose music?

What happens when you let a computer compose music?

Well the results are pretty impressive with Jukedeck.  By combining computer science and music composition theory, you can create A.I. generated tracks at the push of a button.


Jukedeck allows you to create a new composition in a few seconds by selecting the genre and mood from a list.  Every track you make is unique so there is no danger of your music appearing elsewhere. It is ideal for the growing army of video bloggers who need some background music for their creations.

Tracks can be used royalty free for individuals and small businesses (fewer than 10 employees). Other licensing options exist, including the option to buy the copyright for your tune.

The free account limits you to five downloads per month, but you can get more for each friend you invite (so click that image now!).

+1 geek experience point for Ed Rex, Jukedeck's founder.

What happens when you let a computer compose art?  
Find out in Modern Art is rubbish.

Arduino Star Trek control panel and love-o-meter

I have continued to learn Arduino programming using the Arduino Starter Kit.


The next project in the book uses the Arduino to control three LEDs in what it imaginatively describes as a Star Trek style captain's control panel.  In this project you learn how to write code to test the status of a push switch and then, depending whether it is pushed or not, set the voltage on the LED circuits to high or low. It's another really simple project and is the first introduction to using the Arduino to control components rather than just supply power.

The project comes with a template to help you imagine that you really are Captain Kirk, if you needed help with this.

The next following project is an imaginatively titled love-o-meter.

It uses some code to get read a value from a linear temperature sensor.  Depending on the temperature your program reads the Arduino will set the voltage on up to three LED circuits. The temperature sensor is a rather small component and it actually took me a while to find it! This project also comes with a handy cardboard template - complete with lips - to help bring it to life.  Put your fingers over the temperature sensor and watch the LEDs light up one-by-one.  I understand that the Enterprise was fitted with something like this to help test the compatibility of Federation captains with alien women, only Captain Kirk often chose to ignore it.

The love-o-meter also introduces you to the serial monitor - a console for the output of text so you can see what's happening inside your Arduino.  This is useful as in this project it is unlikely that the ambient temperature is as high as 20 degrees.  I had to adjust my program and found better results when I looked at the serial monitor.



Join me soon as I continue to work my way through the brilliant Arduino starter kit.  Coming soon we will look at using the tri-colour LED and the servo motor!

As it is customary to end an Arduino post with a Douglas Adams quote, here goes:

“It is a mistake to think you can solve any major problems just with potatoes.”

Still here? Well, you might like this post about the FUZE Basic Robot Arm Kit, or some noteworthy note apps for Windows.

Arduino project 1

Yesterday I showed you the Arduino starter kit.  Today I started to try the first project from the book.



After a short primer in the physics of electrical circuits, the book guides you gently into the first project, which is to create a push-button controlled LED light on the breadboad.

The project doesn't actually use the Arduino except to draw power; its just to get you familiar with the breadboard.  Once I had created the first LED in series with a push switch I added a second LED in parallel with the original circuit as shown below, and hey presto, two robot eyes (well, OK, two red LEDs).

It's not the most impressive project in the book, but at least I have got to grips with the components now.
Things I have discovered that it would be useful to have but I don't currently own:
  • a good light source (to see the colours of the resistor bands);
  • magnifying glass (to see any of the components at all - my eyesight is deteriorating);
  • digital multimeter (not essential, but should be in the toolbox of any electrician);
  • component box (there are a lot of small components).
It is time to stop there and attempt a more challenging project another day. Come back soon.

And since it is customary to end an Arduino post with a Douglas Adams quote - here goes:

A learning experience is one of those things that says, 'You know that thing you just did? Don't do that.’


Still here? Dang! Well, you might like to look at this LEGO TARDIS kit, or maybe you want to solve some puzzles.

My first Arduino

I've bought an Arduino UNO so I can learn about microcontrollers and hopefully build some interesting projects.  In this post I shall briefly show what you get with the kit and then end with some advice from Douglas Adams.

I chose the Arduino original starter kit available to buy here:



What is Arduino UNO?

The Arduino is a microcontroller board intended for novices to create their own devices.  The Arduino UNO board processes various inputs that can then trigger actuators. In other words you can build a device where when this thing happens then that thing happens.


What's in the box?

A very generous selection of bits and bobs.  You get the Arduino UNO microcontroller intself plus a breadboard and wooden base (this is easy to assembly, however if you follow the instructions that come with it, you might end up assembling back-to-front as I did. This is easy to fix).

The kit also contains various components including DC motor, LED display, servo motor, potentiometer, temperature sensor, and a very generous length of USB power cable; in addition to various diodes, resistors, filters, LED etc. You also get some cool stickers to promote your love of Arduino and open source.

Bits and pieces.  I suggest that you invest in a component box for these.
What's in the book?

The starter kit comes with a projects book.  This contains the set-up instructions; how to install the software and connect to your Arduino; a primer in electronics and fifteen projects to try.  The projects include a light theremin, digital hourglass, Arduino clock, Zoetrope, secret knock detector and more.

The book is well-written, clearly set-out and easy to follow instructions.

I am looking forward to learning how to build my own projects by trying some of these out first.

The excellent Arduino project book which comes with your kit.

First steps.

The very first project is to make sure your system works by compiling a 'blink' program onto the device. All this does is to make the on board LED blink on and off at a rate you specify. This is to get you used to the software and make sure that all is in working order.

Next steps.

The next steps are to make something interesting.  I am not sure where I am going with this, but I do know that it is for another day.

Anything else?

I also bought the book Arduino Projects for Dummies by B Craft.



This book contains some more 'out there' projects, including automated gardens; RFID detectors; GPS dataloggers and much more.  How about a project where everytime your cat leaves you house it updates its Twitter profile?  Well that is covered in this book.  It is almost worth getting a cat for.  If you need some advice from Douglas Adams, remember: if you try and take a cat apart to see how it works, the first thing you have on your hands is a non-working cat.

The opposite is true of Arduino projects.


Come back for more geeky stuff soon...

Still with us?  Still awake? Then you might like my post on the micro:bit moisture sensor, or a whole load of posts about the Raspberry Pi.

Micro:bit moisture detector

Admit it.

You've let a house plant die through neglect before. Probably not even just the once. Multiple times over. You are a bad house plant parent, but things could change around if you had one of these.

My micro:bit water sensor showing animated "don't water me".


The micro:bit water sensor connects to your micro:bit through the pins provided at the bottom of your device. Black to ground; red to 3V and the blue to whichever pin (0-2) you wish to read.



My first project is a simple soil-moisture detector for a houseplant.  When the moisture level is okay for the plant then the micro:bit displays an animated cross ("do not water"); when the soil is dry then the micro:bit displays animated drops of rain ("water me").

Very simple.

Feel free to get my code.

Here I am continually reading the analog pin (P2) and storing the value in a variable called 'water'. I found that a value less than 10 means 'bone dry'.

The micro:bit in the emulator showing the animated rain drops.
Future expansion of the project will be to connect the micro:bit to a water pump so that the system can automatically water the plant as well.  It might also be useful to store the time taken to dry up, or audible warnings if the soil is completely bone dry: Yes, you can get a headphones adapter for the micro:bit as well.

The water sensor is a fun addition to the micro:bit computer and there are clearly multiple fun projects to attempt. You can get your water sensor here.

BMI calculator in #python

Following a conversation with a student today, here is my version of a simple Python 3 script for calculating your body mass index index.



print("BMI Calculator")

while True:
    mass = float(input("\n\nEnter mass (kg): "))
    height = float(input("Enter height (m): "))
    bmi = mass / (height**2)
    underweight = 18.5 * (height**2)
    normal = 25 * (height**2)
    borderline = 30 * (height**2)
    
    print("Your bmi is : ", "%.1f" % bmi)

    if (bmi <= 18.5):
        print("'Underweight.'")
        print("To be 'normal' weight, your mass would need to be : ", "%.1f" % underweight, "-", "%.1f" % normal, "kg" )
        print("You are advised to gain ", "%.1f" % (mass - underweight), "kg") 
    elif (bmi < 25):
        print("Normal weight.")
    elif (bmi <30):
        print("Borderline high.")
        print("To be 'normal' weight, your mass would need to be : ", "%.1f" % underweight, "-", "%.1f" % normal, "kg" )
        print("You are advised to lose ", "%.1f" % (mass - normal), "kg")
    else:
        print("High")
        print("To be 'normal' weight, your mass would to be : ", "%.1f" % underweight, "-", "%.1f" % normal, "kg" )
        print("You are advised to lose ", "%.1f" % (mass - normal), "kg")
        print("To be 'borderline high', your mass would need to be : ", "%.1f" % borderline, "-", "%.1f" % normal, "kg" )
        print("You are advised to lose ", "%.1f" % (mass - borderline), "kg")
        
    
    
    

Microsoft have updated the Band 2

I just got back from a walk to discover that my Microsoft Band 2 wanted to update.  The new update includes a feature that I had previously voted on for development - walking as an activity.  I wish I had know this before I went for a walk.

Microsoft Health App on my awesome Lumia 950. When you are on the Internet nobody knows that you are a dog.

The 'walk' feature boasts the ability to track your distance, elevation change and to record points of interest on your map.  I am looking forward to trying it out soon.

The latest update also includes a universal Windows 10 version of the Microsoft Health app, so you can get the same functionality of the phone app on your desktop, although the web app is much more useful in terms of the information it provides (such as four week history and comparisons) but it is good to have the live tile spinning round with my info.

Not got a Band 2? I am really pleased with mine and I can highly recommend this product.
Microsoft Band 2 - Medium



You will need a Windows 10 phone to get the full functionality out of your band, however it works on Windows 8.1 phones as well, including several latest versions of Android phones.  It even works on those phones from that struggling fruit company - I can't remember the name of right now, but I know that the last good thing they developed was the Apple II.

History fans will be interested to know that the smart watch was not created by Apple.  I saw the following advert on the back of a copy of The Micro User magazine from about 1984 ish.


The Seiko-RC 1000.  It featured 2K of RAM and was the first watch to interface with a computer. I would certainly buy one of these for my BBC Micro if I could be certain that they still worked or had the correct cable.  You occasionally see them on eBay, however I've never seen one that isn't just sold for the packaging.  Functions included: scheduling, memos, world time and a four-function calculator app.  Cool, though.

Fun fact of the day: Queen Elizabeth I received a wrist watch as a gift from the Earl of Leicester in 1571, but she had to wait over four hundred years for a reliable app store.

Some of the best marble runs

In a tsunami of marbles watch this video of 11000 marbles. Yes, 11000, all at once. Enjoy!



If you can endure the cheesy Christmas muzak then here is a really good one from someone who seems to have no other use for their house than as a playground for marbles.


The little ball that could.


Place your bets!


This one went viral recently, and no surprise, one of the best marble runs you will find on the Interwebs today.



Feeling inspired by some of these videos, then you might need to do some shopping for marble run equipment.

Label