Thomas Sampson

Leave a comment

Working with LESS


After having around 20 minutes exposure to LESS (CSS pre-processor) I’ve picked up the following quick tips:

How it works

LESS is a language/syntax for writing CSS which grants you more freedom and less repetition when defining and organising CSS styles with features such as variables, imports and loops. To be of any use, LESS files are translated into vanilla CSS for consumption in the browser (this can be done client-side at runtime, or baked out offline).

Writing LESS

Looks fairly simple, the LESS file I worked with (albeit for 5 minutes) bared a close resemblance to regular CSS, with some syntactic sugar sprinked here and there for good measure. Full specification can be found here:

Using LESS

Although it appears that some nifty javascript can be used to translate your LESS code to CSS at runtime (probably preferable to reduce turnaround times during development), in my scenario I needed to bake out minified css files offline. This can be achieved as follows:

  1. Install Node.JS
  2. Open a Node.JS command shell
  3. Install the less nodejs package:
    npm install -g less
  4. Compile your LESS file, redirecting output to destination .css file:
    lessc styles.less -x > styles.css
  5. The -x flag can be removed if you do not require the CSS output to be minified

1 Comment

Fixing Ubuntu/Xubuntu 14.04 screen resolution in VirtualBox

After recently installing Ubuntu 14.04 inside VirtualBox and installing the guest editions, I was stuck with a very small screen resolution. Apparently this is a bug with VirtualBox and until a fix is applied to the VirtualBox guest additions package, the following command should be used to fix this issue:

sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11


Leave a comment

Installing .deb packages without Ubuntu Software Centre

If like me, you attempt to avoid Ubuntu Software Centre at all costs (due to it’s often slow and clunky nature) you can easily install a downloaded Debian package from the terminal as follows:

sudo dpkg -i mypackage.deb

Packages can also be removed in a similar fashion if you know the package name:

sudo dpkg -r mypackage

Leave a comment

Preventing Multiple Process Instances In C++

Here is a quick C++ class I knocked up earlier this week which can be used to ensure that only a single instance of your application is running at any given time, using a system-wide mutex object along with a unique process identifier to prevent concurrent execution. The implementation provided is Windows only but could easily be adapted for other platforms using pthread_mutex_trylock.

ProcessInstance Class

#include <windows.h>
#include <string>

class ProcessInstance
	ProcessInstance(const std::string& processIdentifier)
		: m_bIsAlreadyRunning(false), m_hProcessInstanceLock(0)
		m_hProcessInstanceLock = ::CreateMutex(0, true, processIdentifier.c_str());
		m_bIsAlreadyRunning = (::GetLastError() == ERROR_ALREADY_EXISTS);


	bool IsAlreadyRunning() const
		return m_bIsAlreadyRunning;

	bool m_bIsAlreadyRunning;
	HANDLE m_hProcessInstanceLock;


ProcessInstance gProcess("my_process_guid_here");
int main(int argc, char* argv[])
		return 0;

Leave a comment

Games Britannia 2013

This year my friend and colleague Griffin Warner and I were asked to prepare and present game development workshops at Games Britannia Festival 2013. Games Britannia is a fantastic event which aims to bring together school children, educators, parents and industry professionals to discuss, practice and celebrate video game development and talent in the local region.

After attending Games Britannia 2012 to showcase BounceBack, I was excited to be invited back to carry out workshops and make a more substantial contribution to the event which had proven so successful the previous year. We were given the brief of putting together a two hour workshop, aimed at secondary school students of all ages, many of which with little/no prior games development knowledge or experience. At this point Griff and I had no previous experience teaching or delivering workshops, and found that planning the content and pacing of the workshops was particularly challenging.

After some deliberation we came up with the concept of a small RPG game named “Outbreak” which we would develop ourselves ahead of the workshops, which would intentionally have key components and section of logic missing from the game. The purpose of the workshops would then be to flesh out the game by discussing and implementing the missing components via a series of lecture slides and hands-on sessions. We chose to use Game Maker to develop the workshop resources, which proved highly beneficial as it allowed us to easily prototype the game in a matter of weeks. Choosing Game Maker also provided a simple graphical interface which was used during the workshop to demonstrate and implement the missing functionality, without having the students write a single line of code (although we did make sure to discuss the limitations of this approach and stress the importance of traditional programming techniques!).

We both worked hard preparing the workshop material in the weeks prior to the event. I implemented the basic skeleton for the game and implemented all of the core functionality, whilst Griff put together some excellent artwork and animation sequences for the game world and characters, which was later added to the skeleton to form the final workshop resource. At this point we were very privileged to be invited to Meadowhead  School in Sheffield to trial the workshop during an after school class, with a bunch of students who had kindly volunteered their time to act as guinea pigs for the Games Britannia sessions. After a few technical setbacks the workshop trial went surprisingly well and gave us the opportunity to tweak the difficulty levels and timings, and also address some of the feedback we received from the students.

The same week we were informed that our workshops had sold out and that we were lucky enough to have been sponsored by YoYo Games who agreed to provide free Game Maker Studio licenses for the event. With access to Game Maker Studio in mind, and particularly it’s ability to export to other platforms, we added a section to the end of the workshop which would allow the students to run their game on the Android tablets provided, at the flick of a switch!

Ultimately the workshops held at Games Britannia appeared well received by the students and there was definitely a sense of excitement and creativity during the sessions. Delivering the workshops (especially multiple times back-to-back over the course of two days) was harder work than anticipated but became easier and felt more natural as each session went by. The Android play-testing went down a storm, and many students were desperate to get a copy of the game to take home and install on their own devices. Personally I found it very rewarding getting the chance to speak with the kids who took part and particularly the select few who showed a great passion and enthusiasm towards game development and programming at such a young age, many of which reminded me of myself when I was in school. It was great having the opportunity to give advice I was never given, on how best to get into games development, the skills required, and the importance of communication skills and an autonomous approach towards learning new skills.

On behalf of Griff and myself I would like to thank everyone involved in Games Britannia 2013, particularly Jacob Habgood for inviting us to take part, Joanne Hewitt from Meadowhead school for allowing us to visit and trial our session, and YoYo Games for sponsoring the festival! Below are some photos taken from the event;