Down again…

Downloads for source and demos will be down again for a short while as I’m having to deal with another node migration because of my cheap VPS.

I’ll post again as soon as this is sorted -_-.

Of Video Editting and Modules Past

In the first year of my degree at the University of Derby we studied a module named Ludology, which was all about the theory of games and game design. The final assignment for the module was to create a clone of an 8/16-bit era game using Game Maker (urgh) and pitch it to two of our lecturers, who were posing as 80s publishers. Despite having to make the game in Game Maker, choosing a challenging target, and being stubborn enough to use only blocks for the game logic, what I created for this assignment was actually an incredibly faithful recreation of the first level of Sunsoft’s Gremlins 2: The New Batch for NES, including all game mechanics seen in the first level, except for money.

Why do I bring this module up now, a year and a half after the fact? Well, Gremlins 2 is a gem from my past, a huge part of my childhood as a NES gamer (yes I know I’m too young to have been brought up on an NES, but being poor had its advantages I guess), and a game I still enjoy to this day. I’ve played it to death, and previously even uploaded a video of me playing one of its hardest levels without taking a single hit (see below). I distinctly remember other students last year telling me how closely my clone resembled the original game, and having recently come across its exe, I couldn’t help but be proud of how authentic it felt, even if it was made with something so childish.

 

This brings me neatly on to two issues:
The first is simply the heritage of Game Maker, it’s flaws, misuse, potential, and the fact that it actually is possible to make good, respectable games in Game Maker – people just don’t. I’d like to make a post about this subject later, but in case I don’t get chance, I want you to check out two people: MESSHOF and Remar. In particular I want you to download and play Remar’s games Hyper Princess Pitch, and Hero Core. They’re free, and if you truly have an interest in gaming, you will thank me.

The second is the one I want to discuss now: Video editing. I’ve always found this to be a tricky subject. My experience with the various free software solutions has been poor (no decent export settings, formats, unstable, lost work, poor interface, unintuitive, poor video/audio synchronization), and I have never been able to justify splashing out on something more professional. Add to that I’ve always found it quite difficult to find information on how people managed to capture and compress high quality gameplay videos so effectively, and you’ll begin to see why the video before the previous paragraph is so poor, with the audio gradually drifting out of sync as it runs.

Since making that video, I have discovered VirtualDub. VirtualDub is a simple, linear video editor which is perfect if all you want to achieve is some simple cropping, resizing, dubbing, appending and recompression, however, it does not provide the slick GUI or advanced non-linear features that other editors do. After a little bit of poking around and following a lovely video tutorial for high quality, small file size exports on YouTube, VirtualDub allowed me to create reasonably sharp videos for my recent projects, Battenberg and Pastry3D. However, I ran into a brick wall when I set about my latest video editing endeavours.

 

Back in January I recorded the two playthroughs seen above, of Gremlins 2, level 1. One of these is running on an NES emulator, while the other is my Game Maker clone, and the point of the video was to position the two side by side so their resemblance was truly put to the test. But the playthroughs were recorded separately, so how would I go about merging them in this manner? VirtualDub is too linear for this – it does not provide functions to merge videos in such complex ways.

The answer, as it turned out after three to four hours of research and work, was to download Avisynth and VirtualDubMod. Avisynth, as best it’s creators describe it, “is a powerful tool for video post-production”. As far as I’m concerned though, it just provides a scripting language which can be used to manipulate videos in a non-linear fashion by utilizing a number of simple functions, such as StackHorizontal, which fitted my purposes to a tee. Again, as far as I’m concerned, VirtualDubMod is simply VirtualDub with added functionality, and integration for Avisynth, including syntax highlighting.

The short story is, the solution to the problem was simple, but the information I needed was so buried, and so tricky to put to use that it took a considerable amount of effort to achieve my end goal. Still, it was interesting to see how programmatic a solution to a problem such as video editing could be (seems obvious now I write it down), and I’m considering laying down a nice tutorial if I find the time – though a tutorial on merging videos like this may be too specific, and I’m no general master of the tools involved.

Three Weeks Freedom

Lectures an tutorials are of course important, but it has to be said that the journey to and from the university, and their inflexible schedules are rarely convenient things. More and more of late I’m finding I’d rather be off investigating things for myself than being forced down particular avenues. I’d love, for instance, to be looking into WebGL and x86 assembly right now, having greatly enjoyed the time I spent with MIPS last semester. Meanwhile, I feel that modules like Team Software Development have long since served their purpose in teaching me in the value of effective teamwork strategies, and now now do nothing but eat into my time. It was with great relief last weekend that I entered the start of a three-week break from such activities.

Three weeks to get well ahead with my assignments, three weeks to get some more job applications off, three weeks to resume my studies of the Korean language, three weeks to look into WebGL or x86 assembly, three weeks to properly maintain my online presence or pursue my artistic interests. So many choices.

One week of that time has already elapsed, and I elected to spend it in the labs, where the PSP dev kits are, working on an optimized, billboarded, particle system for our Console Development 2 assignment. This is the module I’ve enjoyed the most this semester, and the module within which I feel that I have learned the most. Which of these is resultant of the other? Well, personally I think that it’s reciprocal. I’ve not only learned about PSP specific programming and optimization, but also finally found the opportunity to gain an understanding of threading – it’s a lot simpler than it seems on the surface – and undertake a complicated project in straight C. I’ll explain more about this assignment when it’s all tied up.

Speaking of threading, this has also been a feature of my Operating Systems and Mobile Development modules. My OS assignment is pretty much complete, and of little interest – it’s a simple benchmark of communications between processes and threads using the Windows API, and I plan to clear up the written part in the coming week. As soon as my PSP work is done I’ll sort out the write up for that too, leaving me only three modules to worry about when I go back for the last three weeks of the semester.

My Mobile Development project is a 2D game for Android. I’ll make another post about this in the coming weeks, but for now know that it’s a simple points-orientated game about drilling, I’m using the incredible libGDX framework, and the game may someday see itself published if my friends at Pillowdrift decide to take it on once I’m gone.

By gone I mean off on placement at whatever company wants me. I’m still looking, and I’m not worried about the time yet – the deadline is the end of summer and I’m sure I’ll find something excellent. If you’ve found your way here via my CV, a belated welcome to you! I hope you’ll take a quick look at my work under the Projects tab. Anyhow, my housemates and another friend are setting up shop as an indie company next year, and while I wish them the best of luck, I’d rather siphon the experience of industry veterans and prove myself in the real working world. I’ve told them they can have my Mobile Development project, polish and publish it if they wish, so I’m trying to keep the project as tidy and flexible as possible.

Seems there’s only one module I’ve yet to talk about, and this one comes with pictures! No really, I’d happily put up pictures of my other projects but I don’t have access to everything since I’m at my parents’ place right now. Interactive 3D Graphics Programming has taken me through the pains and pleasures of shaders lately, including a brief expedition into PIX to determine the root of some HLSL failures. As best I can tell I now have per-pixel diffuse and specular ambient, directional, point and spot lights working, and a system in place for managing them, attaching them to nodes in a scene graph for transformation. I recently added a similar method for attaching cameras to nodes and now need to re-implement my controllable camera nodes. By re-implement, I mean replace with controllable transformation nodes and attach cameras to those. Specular lighting looks fantastic on my terrain, though the terrain itself is a little bumpy, and I probably should decrease it’s shininess value. The one thing that’s been bugging me with my framework for this project is my use of DirectX constant buffers. Currently I only allow for a single constant buffer per shader set, and all of it’s data is copied across every time something draws. A better, more efficient, more flexible system would be to have multiple constant buffers updated hierarchically in my scene graph. In this way lighting data and other items would only be copied across when they are actually changed, saving a significant amount of time. Implementation of this system is of course dependent on the impending deadline, and seems unlikely, as I also need to implement render targets, collisions, player physics, and a demo. Still, you don’t learn the pitfalls until you try things, and I’ll remember this for future projects.

Let’s wrap this up with some screenshots from my DirectX engine, DacquoiseX. The model of Princess Peach is an adaptation of retrotails‘s over on Google 3D Warehouse, and I intend to use it for my current PSP project, recreating a scene from the ice levels from Super Mario Brothers 2 in 3D, with peach standing on the back of a black whale, spurting watery-foamy-particle-goodness from it’s spout-hole. The demo for this project? Well, that’s gonna be a bit stranger…

MIPS code, 저는 너무 바빠요!

I’m so busy this semester. Five modules at once, lots of assignments, and we’re already so far into the second semester. I want to post a few updates on what I’m up to, I just need to tie up a few loose ends before I have anything decent to show to…whoever is reading this.

Anyhow, I thought it was about time I uploaded the MIPS assembly code for the first console development assignment from last semester, so I’ll be dropping in a link below and amending this page with one too.

Check out that page if you want any information about the project, or click here to see the assembly code. If you have MARS then you’ll be able to run the demo, unlike my snake game which crashed unless you could be bothered to look up the threading issue in the Keyboard and Display Simulator included with MARS, and fix it, like me and my friend did one fateful night.

While the demo may not be too impressive, and there aren’t many drawing functions, writing PrimLib was great challenge. I really enjoyed my time spent with assembly programming – optimizing things at such a low level is surprisingly compelling, implementation of the logic forces concentration, and I generally found the whole experience quite relaxing (except for the debugging – that was horrifying, but still kind of fun).

The greatest thing about my work in MIPS was that it was directly relevant to my work in Introduction to 3D Graphics at the time, where I also had to write Cohen-Sutherland line clipping and Bresenham’s algorithms in C++. It may surprise you to know that I wrote the Cohen Sutherland algorithm in MIPS first, then converted it to C++. Honestly, I might not mind working in assembly professionally if the opportunity ever arose, and my desire to throw down some 6502 for the NES is still as strong as ever.

[Assembly Code]

Enough about that though. I want to give a quick shout out to one of my current time-holes and then head back to more important matters.

Ever heard of Lang-8? If you’re learning a language at an intermediate or advanced level, Lang-8 could be an incredible way to boost your motivation, confidence, and get accurate corrections for real, native speakers. The site is free to use, and relies solely on the kindness of others. Simply put, you make an account, tell it what language you speak, and what you’re learning, then post entries about whatever you like in the language you’re learning. Random strangers from around the globe (preferably native speakers) then post corrections and comments on your entry, and the site even attempts to match you with your language counterparts and suggest friends.

I’ve been using Lang-8 to practice my Korean, even though I’m at a very basic level. There are a lot of Korean people on there learning English and, it seems, not many the other way round, so I’ve been inundated with friend requests. Although I’ve only found time and energy to post three entries of my own, I’ve found crawling and correcting other people’s entries to be almost as addictive as crawling YouTube – albeit in a more altruistic way…

Stale Battenberg and Powdery Snow

It’s snowing today. Me and my friend just went to Sainsburys and back and still it shows no sign of letting up. Gradually its covering the roads and paths – even those outside my window which are very busy. It’s late, and I’ve still a lot of things to get done, but then I got up late too, so I still have plenty of waking hours left.

That said, I thought I’d spend some time writing about a another pet project of mine – you know, the ones there’s rarely time for amongst your real work these days and you just keep putting off as they pile higher and higher like the snow outside.

Battenberg
The first iteration of Battenberg was a little application I threw together in a single day back when I was investigating OpenGL last summer (2011). I was tired of the constant step by step progression through the stages of learning OpenGL, so I thought I’d take a day out to program something more personal.

What
Battenberg is a name I gave this project very recently; it seemed appropriate given the application’s goal. The idea is to take a small image (preferably a very small pixel art sprite), or series of small images, and transform every pixel with a non-zero alpha value into a cube. The original program simply looped through each pixel in turn and added another cube to a buffer for each opaque pixel, then rendered this buffer in a OpenGL application with an fps style camera. That was nice, and I had a lot of fun loading old sprites from games I’d made and watching them march on the spot in glorious (blocky) 3D.

However, this christmas I was once again stuck for a less-mundane source of constructive-amusement when perusing DirectX tutorials. With 3D rendering on the brain my thoughts quickly went back to what I now refer to as Battenberg. What would I have to do if I actually wanted to use those 3D sprites as assets in a game? Preferably I’d be able to export them to a common model format so that conversion did not have to occur every time the game loaded resources. Boring. Too easy. Then I thought of something I had considered before – how could I make these assets more efficient?

For a start you didn’t need all those faces inside of the model resulting from forming it out of lots of cubes  – that would be easily done. But what about all those tiny triangles? Maybe I could get an outline of the shape and triangle tesselate it for better results? I’ve done triangle tessellation pretty recently as part of the XNA framework I was building with my friends at home, so that wouldn’t be too hard, surely…

Actually I’d never gone as far as to do tessellation of polygons with holes in them, and first I needed to identify polygons from the pixel data supplied. Slowly it dawned on me that this had become rather complicated; there were some pretty non-trivial algorithms to write if I wanted it tow work, and even my precious triangle tessellation algorithm needed expanding.

How
Step 1: Load the Sprites
This is the definition of trivial. Dragging and dropping a bunch of files on to an exe will give me their paths as command line arguments and each can be easily separated and processed one by one. I can use DevIL to load a huge variety of image formats with little effort.

Step 2: Define the Polygons
The biggest roadblock: I need to identify the shapes that will make up the front and back faces of the model. This is tricky because I need to know about all of the shapes within the image, and all of the holes within each shape. I’m considering simply storing holes as a shape within a shape, and any shapes within holes as simply another unrelated shape. I hope to sort out all the shapes with a system of edge-walking and polygon fills (for pixel ownership) which I care not to make an arse out of myself by explaining without first trying out. I’m trying not to impose any limitations on the images that can be processed, so my job is made slightly more difficult by the fact that I can’t reliably identify a surrounding transparent zone at the beginning (e.g. I can’t assume the first pixel is transparent and go from there).

Step 3: Give it Sides
If we’re going to have some depth then we need sides. I’m going to generate these before step 4 because we only need sides for the edges we currently have defined. These can easily be formed from triangles and will already be in their optimal state.

Step 4: Triangle tessellation
Let’s take those ugly polygons and make them into triangles. By doing this you’re almost guaranteed to end up with less polygons than if you simply used two triangles for each pixel. Ear-clipping is fairly efficient and I’ve written it before using this fine article as a guide. I merely need to port what I wrote to C++ and expand it to deal with holes. This should be much easier than stage 2, but also quite fun to write.

Step 5: Copy Cat
Once the front face is done we can simply copy it, add a bit more Z, and call it the back face. No-one will be any the wiser.

Step 6: Output
Now I’ve never written to a model format before, but I’m sure it’s about as easy as reading from one. This should be a piece of cake. If all else fails the crappiest of image formats will do so long as you can convert it to another using a modelling tool or other program.

Notes:
It should be no problem to calculate normals and save these if this is necessary, especially given the cubular nature of our models.
Texture coordinates can easily be assigned as we loop through them in order to form our polygons in the first place. It might be wiser, however, to generate another texture containing only one instance of each colour used, and use this to assign texture coordinates.
It may be useful to also output a model which uses the old cube-per-pixel approach for use in pixel-explosion effects and such.

Why?
This is an interesting little project for me. It won’t take long to write once I nail down the algorithms and find a night or two to commit to it, and there’s the promise of pretty results to keep me motivated. I like the aesthetics of sprites processed in this way and I do want to use the application for a project sometime in the future.

http://osu.ppy.sh/

PSP Demo Video!

So I had a chat with one of the Techs from uni yesterday and managed to get a video capture of my PSP Demo from Console Development last semester. It’s not the greatest quality rip, but then the PSP’s screen is pretty crappy too. That said, it is much darker, grainier, and more contrasty than the demo appears when running on a PSP.

I overlaid the music from the closing titles on which the demo was based in VirtualDub while I was fixing the aspect ratio and tweaking the contrast, since I didn’t get time to actually figure out audio streaming on the PSP. Yes, the frame rate is poor because of the high-poly hummer model I used for See-Through, and a few bits of code which I’m going to look into optimising on monday, since this semester’s Console Development module is all about optimisation, and I get to play with the PSP tuner for monitoring the performance of my applications.

I’ll embed the video below and get back to work on the here and now. Maybe I’ll be back later to post about Battenberg. Maybe I won’t.

What’s to Come

Having dispensed with the first week of the second semester, I now have a decent idea what I’m going to be up to for the rest of the year. This semester is five modules instead of the previous three, so I’m doing my best to get ahead this week while I can, and think about what I’ll do for the assignments.

Oh, before I continue, I’ll track Wayne down this week and ask about getting videos of our PSP demos. I’m not sure he’s found out about that yet himself though, so I may have to try it out myself. Fingers crossed I can get a demo onto YouTube soon.

Interactive 3D Graphics Programming
We’re moving away from our own software renderers and into DirectX. We’ll be using DirectX 11 and working a lot with shaders. One of the assignments for this module is to create a simple 3D game engine using DirectX. We’ll probably have to make a small game to demonstrate this, and I’ve not a clue what I’m going to do for that yet. I do want to look into cel-shading though – I looked it up last semester but there was no way it would have worked in my software renderer. In shaders though, it should be no problem.

Mobile Apps Development
Working with java we’re to develop an application for android that meets the specifications laid out in the assignment spec. Since a lot of the people on the course are games programmers can I see a lot of games coming from this module in the near future. I already have a concept in mind, and the module tuition seems to have set off at snail’s pace, so I plan to get a head start this weekend, and press on ahead.

Team Software Development
As far as we know we’ll be working in the same groups as last semester, but I wouldn’t put it past Dave playing some tricks on us. We’ve been told to either continue our original projects or start new ones, and my team has opted to start something new with the lessons learned from our difficulties in the first half of the module. We’re working in XNA, since that’s what most of the team feels most comfortable with, and drawing inspiration from classic arcade games. We’ve also been promised a bit more tuition over the chaos of last semester, where we were pretty much dropped into groups and left to do our own thing.

Operating Systems
This module is about looking at the theory of operating systems and how they work. We’ll be tasked to develop applications that make use of functionality provided by operating systems, and there’ll also be a test to make sure we’ve been listening throughout the lectures.

Console Development
Actually come to think of it, the first lecture in this was a brief recap of the first semester, so I’ve just taken a look at the module handbook. It seems we’ll be focussing more now on optimisation and performance analysis. We’ll be looking at hardware (probably of the PSP, like last semester) and how it affects the performance of our programs. The final objective will probably be to create a game or application of some sort that is tailored in some way to perform well on the PSP, and detail what we have done to achieve this.

PillowDrift
Despite the added pressure from university, me and my friends at home are still planning to continue our collaborative work – though we need to simplify our game idea significantly or it’ll just never be finished. During the first semester we more or less completed a framework/engine built around XNA and began developing a level editor for our ambitious current concept. We will not let that go to waste!

Actually, the others are considering setting up as a company for their placement year, as some students have had success doing in the past. While this would be fun, and no doubt a worthwhile experience, I’d still rather get a real placement and learn from the current masters. I’ll try to help them out anyway, but for me, getting a placement is still a high priority.

Pastry3D Video Uploaded

Back with my desktop now, I’ve finally been able to screen capture Pastry3D’s demo scene. It took some fiddling, but I was able to upload it to YouTube in 720p, even if YouTube compression has somewhat damaged the quality. The video can be found here, or embedded in this post, below:

I’ve also updated the Pastry3D page with this video.

If anybody knows of a good guide to capturing, editing, and exporting high-quality videos with a reasonable file size I’d love to see it. It’s something I’ve never been able to do and it’d be great to be able to put up more videos of my current projects or favourite games.

Fishy on a Dishy

I did indeed go out trawling during and after that last review I wrote. I’ve been around Terry Cavanagh’s blog and twitter, and around Souleye’s site, reading about games and music, and blasting the PPPPPPowerup! album of VVVVVV OST rearrangements into my ears. It’s probably beyond time I should be in bed by now, but I wanted to leave you this little (bloody long) gem I stumbled upon in my travels.

I was linked here from Terry Cavanagh’s twitter. Seems he’s playing Dark Souls currently, a game I’ve not had chance to play yet. Chris Dahlen has written an excellent article about the game which stands, imho, as a work of art in itself. It takes an approach to game journalism that I have seldom seen, and then only in the closing paragraphs of standard reviews. I see my own feelings for games past experience reflected so sharply in this article, and now long to tackle Dark Souls more than ever. Sadly, the new semester is soon to start and I think it wise not to start of something that sounds so all-consuming.

I’ll take the liberty of quoting a paragraph of the article here, one that really struck a chord with me. I hope Chris Dahlen won’t mind, especially since I’m referring you to the full thing – and I do heartily encourage you to read it, though the article itself is a challenge to approach.

When I caught sight of him I backed up and raised my shield: was he going to attack me? Then I noticed what he was doing: he was hard at work throwing boulders down a hole. I had seen the device that caught the boulders, the tracks they rolled down, the holes where they broke through the walls, the lizards they crushed. I knew that the tracks ran through the entire Fortress, and now I could see the giant creature that kept the boulders rolling, moving like clockwork: lift, turn, drop, lift, turn, drop. He’s the coldly beating heart of this puzzle box, the engine that drives the entire machine, the creature that just keeps dropping rocks on your head to see if you’ll quit. He’s the most obvious metaphor for a game designer you’ll ever find. Is he making your life miserable—or richer, and more exciting? That’s for you to decade.

Goodnight.