Thomas Sampson


Leave a comment

Success @ Games Republic 2012

Today’s Games Republic 2012 event, held at the University of Bradford, was incredibly rewarding for our team. The day was spent exhibiting our PSP Minis title BounceBack (along with our SteelEngine PSP game engine) to both students and industry professionals, and of course, the judges! We received some excellent feedback and were very humbled to be awarded the following three prizes…

 1st Prize – Best Team – Awarded by Rockstar Leeds
1st Prize – Best Game Technology – Awarded by Four Door Lemon
1st Prize – Best Game Design – Awarded by Sumo Digital

Many Photos were also taken at the event. BounceBack will be available for download on the Playstation Store for both PSP and Playstation 3, Summer 2012.


Leave a comment

Finding variable assignments

When searching through an entire codebase for a variable it is often useful to limit the search results to those instances where the variables is assigned a new value (or perhaps when the variable is used IN an assignment). This can be achieved with the following regular expressions…

Find assignments

MyVariableName[ \t\r\n\v\f]*=[^=][/code]

Find usage in an assignment

=[^=][ \t\r\n\v\f]*MyVariableName


Leave a comment

Working with LESS

What?

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


Leave a 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

Source: http://askubuntu.com/questions/451805/screen-resolution-problem-with-ubuntu-14-04-and-virtualbox


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
{
public:
	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);
	}

	~ProcessInstance()
	{
		if(m_hProcessInstanceLock)
		{
			::ReleaseMutex(m_hProcessInstanceLock);
		}
	}

	bool IsAlreadyRunning() const
	{
		return m_bIsAlreadyRunning;
	}

private:
	bool m_bIsAlreadyRunning;
	HANDLE m_hProcessInstanceLock;
};

Usage

ProcessInstance gProcess("my_process_guid_here");
int main(int argc, char* argv[])
{
	if(gProcess.IsAlreadyRunning())
	{
		return 0;
	}
}
Follow

Get every new post delivered to your Inbox.

Join 91 other followers