There have been a few requests and rumblings recently about using games as a way of presenting experiments. Last year, we developed a simple pairs matching game in PsychoPy, which played a standard game of pairs – but with reaction times and sequence of correct answers recorded in a separate data file.
One of our units within the School has expressed an interest in simple games for children, which record reaction times and correct responses. In most cases, the beauty of PsychoPy and being based in Python, is that we can make use of various game related libraries with the experimental API’s from PsychoPy.
Occasionally though, there may be a need to create a game which is either available to play on a mobile device or over the internet, so we decided to briefly investigate some game frameworks in our self development time, so that we are aware of the options if such a project comes up. Here are some that we looked at:
From last year’s PyCon, we took part in a 1 day event looking at a game framework called Myrmidon – which is Python based. All code has to be written in a text editor, with no GUI interface – and due to being in the early stages of development, working out how the system worked was done by looking at code examples and going through the main engine code itself. After not too long, we managed to get a basic Asteroids clone working, showing the potential of the framework. The experience was useful also in going through the process of creating a game, where you essentially start with a “loop” which goes round and round, runs a sequence of events and waits for user input. One of the benefits of the framework and using Python, is that it should be suitable to compile and run on a desktop PC, Mac, iPhone, Android if required – though the documentation at this early stage was lacking on how to achieve this properly.
Next up we looked at a full game development studio, in the shape of Gamemaker Studio – which has a free option that you can download to try out.
Like with PsychoPy, you can either develop via a graphical user interface, or via a code view if you want to jump straight in. The language is its own internal language, but the syntax is very similar to PHP and can be picked up quickly.
This time, the documentation and online support is a lot more vast, and there are many tutorials to get you started for creating your own game. Within an hour, we had a very simple game running where you had to click onto a clown object, which moved faster and faster each time.
With the fully paid option (which comes with a discount for educational institutions!), there are modules which you can purchase and install which allow easy export to different platforms – without really having to write any code or ensure libraries are correctly imported.
Then finally, to complete a range of different product types – there was some time spent looking at frameworks which were build specifically to develop HTML5 based games. The introduction of HTML5 and CSS3 has helped to push a new wave of online application/game development – thanks to the new HTML5 canvas tag.
Some companies are starting to lean more and more towards using the technology, as it enables software to be developed which will essentially run on most platforms – without custom deployments at a simple level. There were many frameworks out there to choose from, but we found Phaser (a JavaScript library), which had a lot of on-line support and tutorials.
Running through one of the tutorials had us set up with a quick and simple platform game, within only an hour or so. Phaser looks appealing in particular, due to its support of a useful layout/map tool called – Tiled, which outputs map definitions in a JSON format (which could be re-used in other libraries too).