“An example is not proof” – Old Jewish Proverb.
My biggest gripe with unit tests is that non-trival bugs almost never occur at the ‘unit’ or logic level. The real issues bubble to the surface only when you actually run your application.
However, if I want to write bug free software – Then I need to find the bugs before they occur in production.
I think that for the uninitiated the mere existence of unit tests can provide a potential form of delusion, to either one’s self, “Look I’ve got unit tests, I’m following best practises, yay me!” Or one’s manager “Our developers will produce software on time and on budget because they follow a best-practise test-driven agile methodology.” Or any other potential stakeholders. However, you actually have lots of very big bugs in your system and the schedule will slip. You just don’t know about it yet.
My reasoning behind this is that unit tests run out-of-band. i.e. They don’t always run under the same context as your production system. Heck you’re even supposed to mock out things like database connections or fileIO. And then when you encounter real-world scenarios such as time-outs, file handle locks, running out of memory, running out of diskspace, not reusing database pools. *Those* are the things that cause 99% of the headaches.
Quick example of a bug I had the other day:
So I’m writing a video game and I have a two monitor setup. When I dragged the game from one window to the other the mini-map disappeared from the screen. Kinda odd bug, Turns out that the video card lost the texture’s context (It was a render to texture, rather than a texture obtained from a file) when dragging from one monitor to the next.
The solution was to check if the context was lost and then re-allocate the texture. Creating a successful unit test to a) Find that bug in the first place and b) ensure that that bug remains fixed is just not worth the amount of effort it would take.
Unit-tests have a place, but don’t be fooled. If you want to write robust software, you need some kind of diagnostics tool that actually runs in-band.
TL; DR: I am not saying unit tests are bad. I am saying that they are not the silver bullet we would all like them to be.
You can get the game from the Global Game Jam Site - You can also check out the source if you’re curious. But don’t judge me too much! 48 hours doesn’t give you much time to think about code quality
I’m still pretty tired as I write this…
Once again I took part in the Global Game Jam. This was the forth time I’ve taken part, including the inaugural event back in 2008. This time was probably my best experience so far. Only one other member of our team had not done the jam before and our team worked together really well!
Last year I made a simple speech recognition insult game with no graphics and this year Gerard pitched a beat box game called “HeartBEATBox” (The theme from this year was a sound effect of a beating heart. Teams were free to interpret the theme as they saw fit.) Knowing that we could (kinda – more on that later.) do some kind of speech recognition our team became Lianne Booton (art) Gerard Paapu (writing/rapping/art) Sergio Cornaga (Jack of all trades) and myself (Programming). We had heaps of fun and laughed a lot. I feel kinda sorry for the team that was sitting in the same room as us. Protip: Try not to share a room with anyone making a music game!
This is roughly the sequence of events that took place.
By the first evening a backstory was written and gameplay storyboarded. I mentioned that speech detection was a bit dodgy and it might not work and proposed an alternative rhythm game. It didn’t really seem to catch on with the others, so we decided to shoot for a speech detection game even if we failed to pull it off.
I went home Friday and couldn’t sleep, so I got up about 3am and started working till around 6am sketching out the game screens with programmer art. Then I slept for about 2 hours and recorded a test rap and wrote the first version of the speech detection / rap battle loop and made sure the start screens, menu screens and win screens were all in as well as the intro and outro video sequences. (The test rap was ‘little miss muffit’ btw and the test videos were the ‘wildlife’ video that comes with windows7) – So an early version of the game was actually playable and winnable at this time.
By now I think it was around 12-1pm on Saturday and I caught the bus back to the venue. We were all a bit tired I think, but by around 9 or so that evening we had many of my place holder assets replaced with first versions of the actual assets – Around this time I can’t remember the order we started to do things in, but I do remember going home that Saturday pleased with what we had achieved and it meant that all Sunday was left for polishing.
I came in about 9 or 10am Sunday having got around 7 hours sleep. There were a couple of memory issues with the speech detection that I had to fix and a few more art assets to get in. Being the only programmer on the team was in some ways a little stressful because it meant I had to put together the whole game, but on the other hand it meant that I didn’t have to spend a lot of time communicating with another programmer or merging source code changes.
At this point I don’t remember what we worked on, but I do remember trying to get the score counter in at the last minute and working right up till the 3.00pm deadline.
Then came the presentations – And halfway through…
Turns out that there was a bug which we only later discovered the solution for, if your speech recognition was set to English-UK and your region was set to anything other than English-UK it would crash. So we went from it literally working on my laptop an hour before the presentation to it crashing without us knowing why. We managed to work around this issue and present the rest of the game when I took a couple moments out to produce a hack fix.
Achievement Unlocked: Game Jam Complete!
The day after the Game Jam I checked out any issues that people were having on twitter and discovered some low-end Intel cards only support a max texture resolution of 2048×2048 which I managed to fix by changing to a reach profile, rather than a hi-def profile and splitting up one of our larger spritesheets. I sent a few builds back and forth between Sergio and myself and he has now updated the Game Jam Site with the latest, more stable build.
- I had a great team to work with, I really like how we put a lot of effort into our animations and little details, which possibly detracted from the amount of game play we ended up producing. But it was all the kind of stuff you rarely see in Game Jam games. Many teams completely omit SFX / music / animation or menus – Let alone try to do FMV. I laughed especially hard when I realised I was in a team of 4 who all liked really terrible b-grade stuff.
- Probably a third of all the teams had trouble demonstrating the game. Including us! It’s one thing to make a game in 48 hours and it’s another thing completely to try get it to run on different hardware configurations. We were lucky to have a few people try out the game and report errors to us.
- Getting a rough outline of the entire game upfront and early was really helpful when it came time to integrate the final game assets.
- The game was written in C# with XNA and used System.Speech for the speech detection (Which is built into windows) – The movies were made in Gamemaker and captured with a screen capture tool. Which were then converted to WMVs – The way video is rendered in XNA is interesting as it involves playing a video in the background and then grabbing a frame from the video in the update loop as a texture and then displaying it. Which means you can then use that texture as you would any other texture, including rendering it onto a surface, or using post-effects or shaders. It kinda makes me want to do more with Video in the future.
- NZ accents are really terrible for speech recognition. I added some phonetic variants for words to the grammar to help with this. Eg. “Done” = “Don”, “Dun”, “Dunn”, “Doon”
- I think there were less artists this year, many teams could have done with an extra one or two. And only two(?) Females taking part. We definitely need to improve this next year!
- I recommend all game developers have a go at the Global Game Jam. You’ll probably meet people/have fun/learn something/make something/go crazy.
You can download it here Windows only for now…
Might require some kind of .net 4.0 / XNA runtime.
- Arrow Keys to move.
- Up Key to Jump.
- Down to activate switch
- You can double jump and climb up walls!
I decided to release an early version, even if it isn’t finished. With a bit of polish and help from an artist this could be quite a fun little game.
This game is largely inspired by Kyntt I like the idea of screen by screen platformers as there’s a certain something about the way exploration feels when you can only see one screen at a time.
The thing that’s most cool about this is that I build the levels from one giant paint.net file. (Infact if you open level.pdn in the leveldata folder, draw some stuff and then run buildlevels.bat you should see your changes in the game) The collision data is also obtained via one of the layers. White or Black means impassable and red means a corner vertex. You need these red vertices to give hints to the processor when it converts the bitmap information into vectors otherwise it gets into a bit of trouble. Finally blue means place one of the diamond collectables that you need to get. – Oh and gray means death and orange means lava… (Which also means death)
Currently the objects (moving platforms and switches) are hard coded. I think I’ll move them out into a .json file
This is the first time I’ve made a 2D platformer – I’m still not entirely happy with the collision and I think there’s a lot more to be done. But I’m happy to show it off as a proof of concept for now.
Also needs music and sound effects.
This year I will
- Take part in the One Game a Month Challenge. That’s right 12 games in 2013
- Finish the RPG engine I am working on.
- Upgrade my pixel art skills to at least make some decent 16×16 tilesets. (I want to be good enough to at least create some decent ‘placeholder’ artwork or artwork good enough to use in game jams)
- Obtain some 3D modeling skills. (Blender)
- Learn more about Graphics Programming – Particularly Shaders.
- Continue to exercise.
- Release something as open source.
My plan for the One Game a Month challenge is to make 6 games in 6 months and then spend 3 months on two games. Which leaves 4 games over, which I will probably use to collaborate with others. I mostly plan on doing 2D games. But I kinda want to have a go at doing a semi-old school First Person Shooter. We’ll see if I have the time to do that one!
I spent a couple of evenings and a couple of days having a go at making a short interactive fiction title.
Even though the game is only text and the programming is not particularly difficult you still have to write the game, including dialogue and descriptions of objects as well as design puzzles and wrestle with creating a parser that is intuitive for your players* – This is still hard. I set myself a limit of 4 rooms. (I only ended up using 3) In the interest of not spending heaps of time on it in order to throw it out there as an idea. I might expand the game in the future, or possibly write more Interactive Fiction.
*Because the game runs it a browser you can always log what people are typing back to a database in order to improve the game over time and see where people get stuck or where descriptions might be lacking on your part.
** I’ve already patched the game twice from players reporting bugs. But because all I have to do is copy some text files to deploy a new version the turn around time for patching is very quick.
Now that National Make a Game Month is over I’ve been thinking on what to work on next. The game is obviously still in development. But there are several sub-projects that need to be worked on.
- Animation and Events Manager: I need a tool to deal with importing all the animations from individual sheets and assign timings and events (such as sfx and vfx like particles) on a per frame basis. It also needs to save/load the animations database for the game and produce texture sheets.
- DitherMe : I’ve been wanting a texture clean up tool for a while, and I was going to implement a noise/colour reduction tool as a paint.net plug in. Partially to process photos to textures, and also to clean up some scanned in pencil work. However, many dither algorithms are purely non-parallel, which paint.net assumes is available. So implementations of Floyd-Stienberg Dithering tend to produce graphical artifacts.
- 3D Editor Tool: Of all the projects in the list this one is the most crazy. I’m thinking about building a 3D modelling tool, with the main intention of producing environments for the dungeon sections of the game. I find MilkShape3D a little hard to use and 3D Max or Maya is a little on the expensive side. This wouldn’t be a short project, so I should try to defer the idea as much as possible…
- New Website / CMS: I’m learning some ASP.NET MVC as well as jquery and I wouldn’t mind looking into MongoDB as a backing store.
- XNA / C# Profiler: Been working on this a little while, did the first version earlier in the year, would be nice to finish it and release the code.
So that’s it – Each item is a project in it’s own, is it any wonder why games take so long to make?
So it’s actually the 1st here in New Zealand. But a friend of mine just dropped off some WIP animation work. So here it is…
NaGaDeMo may be over, but I have a lot more work to do…
Also, as a side note I’ve been dabbling with Asp.net MVC and learning me some CSS and JQuery so I might be coding up a new site soon…
Not going to get finished for the end of the month, but want to have something cool to show. I’m starting to add comments to the code such as //Hack //Fixme and //Suboptimal
I’ve kinda sorta got some gameplay now – There can be multiple enemies and they each take turns. I thought that just attacking on 4 directions was a bit limiting for both gameplay and strategy so I’ve also started to code some ‘targeting’ for spells and ranged attacks – Even though there are currently no spells or ranged attacks. You can see the targets in the screenshot, yes I know they look like lollipops but it’s all I need for now.
Mouse clicking into 3D space has been the bane of my existence ever since I started coding video games, but at least XNA has a Viewport.Project() method for turning 3d co-ordinates into 2d screen space. You still have to be careful with any scaling you might have.
Mostly been under to hood updates the last couple of days. The enemies can now animate, there is a state machine for menus and things, the UI classes have been fleshed out a little more, I also darkened the edges of the viewport (I was somewhat inspired by the instagram filters, they have a tendancy to make things look creepy – It needs a real artist to work on, but the concept is neat.)
There still is no gameplay, got to add the ability for the player to die and get the enemies moving around.