An Opinion on Unity 3D

When Microsoft pulled the plug on XNA (or rather, the moment Shawn Hargreaves left the team, but I have the suspicion that at least inside Microsoft, that’s more or less the same point in time ;)), I started looking for alternatives.

At first, I toyed around with Ogre3D and its C++/CLI-based .NET wrapper "Mogre", but the more I saw of Ogre’s internals, the less convinced I became, as it seemed to have entered that phase in an Open Source project were the community throws mediocre code at it and leadership lets it stick, unwilling to evolve the design and betting on the "version 2.0" fix.

Because I believe writing custom middleware is too big a task for a single developer (unless your goal is a 16 bit era game), I went engine shopping once again. My choice fell on Unity 3D.

Read the rest of this entry »


Using Wacom Touch Gestures in Unsupported Applications

I’ve recently made the decision to learn some drawing skills. Specifically, I wanted to start with a tablet right away so I could avoid having to re-teach myself to using a tablet instead of paper. However, I still consider it important to be able to shift and rotate the canvas with my hand, so I went for a Wacom tablet with touch.

Most artists I knew swear by Paint Tool SAI, but that just happens to be one of the applications not fully supported by Wacom’s drivers (pressure works fine, but touch is a no-go). Luckily, Wacom’s drivers are pretty flexible and you can easily modify them to support your favorite application.

Here’s a guide to enable pinch-zoom, panning and two-finger rotation in Paint Tool SAI and Manga Studio!

Read the rest of this entry »


Why you should Indent with Spaces

I avoid tabs in all code I write. That’s why you can read my code in your browser with the exact same formatting as it had in my IDE – no matter what browser or device you are using: Nuclex Framework sources in TRAC. Yet from time to time, I encounter people evangelizing tabs.

While I am fine with working on projects that use tab characters and I neither argue about the decision to use tabs nor intentionally divert from their style, I do have an opinion and it is that you should avoid tabs wherever you can.

Even the one, lonely, supposed advantage of tabs – users being able to choose their preferred indentation level – is a drawback in disguise because you no longer can set a safe limit for line lengths (see below).

Read the rest of this entry »


First SSD Killed. Yay.

At some point in 2009, I bought an Intel x25 Postville G2. Everyone was scared that SSDs would break down too quickly and I almost made the error of buying one of OCZ’s Vertex drives, but in the end I picked the more expensive Intel drive and it worked brilliantly.

This weekend, 3 years later, it did break down. It had no bad sectors and the SMART status showed only few internal reallocations due weak blocks. But from one reboot to the next, it prevented my BIOS screen from even showing up (and what options do you have left if, with the SSD plugged in, you can’t even turn on your PC…). In one word: bricked.

Of course, like any part of computer hardware, it failed at the most inappropriate moment. It stood by while I installed Windows 8. Kept working while I configured my email client and accounts, browser and bookmarks, VoIP connection and productivity apps. It endured while I installed and configured Visual Studio 2012, setting up all my preferences. And neither did it break when I installed my SSL certificates or began to organize my task bar and start screen.

No, the moment it failed was when I had set everything up to completion and rebooted with my Acronis TrueImage CD to make a backup of my system drive :)

Read the rest of this entry »


Spell and Grammar Checkers

I’m not a native English speaker, so given the task of writing something a bit more involved than just a blog post, I decided to seek out a spell checker which could also analyze my grammar (things such as punctuation rules, mixed up tense and so on come to mind).

The easiest route would probably have been to just install Word since it has both a spell checker and a grammar checker built-in, but I’m a bit allergic to having Office on my system, so I hesitated for a few days and looked at several other options. Which ended up motivating me to write this little rant…

Read the rest of this entry »


Console Ports :-(

Decided to buy the game “I am Alive” from Steam today because it was only $15 and the setting sounded interesting: a psychological survival horror adventure taking place after some unnamed apocalypse.

The first thing that greeted me was this:

Screenshot of an error message from the game "I am Alive"

The moment I see such 1990s-typical “System Check” idiocy I’m already appalled by its developers. You can’t check anything useful that way and it will only serve to break your game in the future. Like those 1990s games complaining about not enough RAM when they check 16 GB as a 32 bit integer, this one complained about Windows 8 being an unsupported operating system – unthinkable that future OSes might run the game.

Read the rest of this entry »


Simple Main Window Class

Here’s another fairly trivial code snippet. I’ve stumbled across some borked attempts at initializing and maintaining rendering windows for games lately. Most failed to properly respond to window messages, either ignoring WM_CLOSE outright or letting DefWindowProc() call DestroyWindow() when WM_CLOSE was received, thereby not giving the rest of the game’s code any time to cleanly shut down before the window handle becomes invalid.

So I’ll provide a clean and well-behaved window class here. It doesn’t use any global variables – in fact, you could create any number of windows from any number of threads. WM_CLOSE simply causes the class’ WasCloseRequested() method to return true, so by polling this method you can first shut down graphics and input devices and then destroy the window in an orderly fashion.

For your convenience I also added some helper methods: one resizes the window in a way that ensures the client area will actually end up with the exact pixel size requested. Another will center the window on the screen without messing up if the user has extended his desktop over multiple monitors.

Read the rest of this entry »


Thread-Safe Random Access to Zip Archives

Many games choose to store their resources in packages instead of shipping the potentially thousands of individual files directly. This is sometimes an attempt at tamper-proofing, but mostly it is about performance. Try copying a thousand 1 KiB files from one drive to another, then copy a single 1 MiB file on the same way – the former operation will take many times longer.

A good choice for a package format is the well known .zip archive. It’s not necessarily well-designed, but it decompresses fast and you definitely won’t have any problems finding tools to create, modify and extract .zip archives. Thus, when I started work on a file system abstraction layer for my future games, seamless .zip support was one of my main goals (I may also add 7-Zip at a later time just for fun).

Here is the design I came up with after exploring the file system APIs available on Windows, WinRT and Linux:

UML diagram showing the design of my file system abstraction layer

You may notice some rather radical design choices in my File class: there are no Open() or Close() methods and there is no Seek() method, either – each read or write specifies the absolute position without requiring the file to be opened.

Read the rest of this entry »


Ogre 1.8.0 for WinRT/Metro

Ogre 3D Logo

In March I provided some binaries of Ogre 1.8.0 RC1 that were based on Eugene’s Metro port of Ogre, allowing Ogre to run as a native Metro App, using the Direct3D 11 renderer and RTShaderSystem for dynamic shader generation.

Those binaries no longer work with the Windows 8 Release Preview and Visual Studio 2012 RC, so I thought I’d provide an updated package!

Screenshot of Ogre 1.8.0 on Windows 8 Release Preview running as a Metro app

This time I went a bit further: while the last package was compiled with multithreading disabled, I have in the meantime ported Boost 1.50.0 to compile on WinRT (using a slightly modified version of Shawn Hargreaves’ WinRT CreateThread emulation code. Thus, this Ogre build has full support for multithreading and includes Boost!

Read the rest of this entry »


Code Better: Headers without Hidden Dependencies

When you work on a larger project, you cannot easily keep track of which header depends on which other header. You can (and should) do your best to keep the number of other headers referenced inside your headers low (to speed up compilation) and move as many header dependencies as you can into your source files, but this still doesn’t prevent you from building headers that implicitly depend on another header being included before them.

Take this example:

#ifndef MAP_H
#define MAP_H

/// <summary>Stores the tiles of a 2D map<summary>
struct Map {};

#endif // MAP_H
#ifndef WORLD_H
#define WORLD_H

#include "Actor.h"
#include <vector>
// Oops, forgot Map.h, but won't notice since World.cpp includes Map.h before World.h

/// <summary>Maintains the state of the entire world<summary>
struct World {
  /// <summary>Stores the map as a grid of 2D tiles</summary>
  public: Map Map;
  /// <summary>Actors (player, monsters, etc.) currently active in the world</summary>
  public: std::vector<Actor *> Actors;

#endif // WORLD_H

Throughout your project, map.h might always end up being included before world.h and you might never notice that if someone included world.h on its own, a nasty compilation error would be the result.

So what can you do ensure this situation never happens?

Read the rest of this entry »

Older posts «

Social Widgets powered by AB-WebLog.com.