Category Archive: Programming

Musings about programming, mainly covering C# and C++, sometimes related to game development, sometimes not.

Oct
19
2013

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 …

Continue reading »

Feb
27
2013

Why you should Indent with Spaces

Tabs for Indentation, Spaces for Alignment? No thanks.
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 …

Continue reading »

Jul
24
2012

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 …

Continue reading »

Jun
23
2012

Thread-Safe Random Access to Zip Archives

UML diagram showing the design of my file system abstraction layer
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 …

Continue reading »

Jun
18
2012

Ogre 1.8.0 for WinRT/Metro

Screenshot of Ogre 1.8.0 on Windows 8 Release Preview running as a Metro app
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, …

Continue reading »

Jun
15
2012

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 …

Continue reading »

Jun
12
2012

How to Delete Directories Recursively with Win32

Well, while I’m at it, here’s the counterpart to the recursive directory creation function from my last post, a function that recursively deletes a directory and all its contents. Ordinarily, you could just use the shell API to achieve this on classic Win32: /// <summary>Deletes a directory and everything in it</summary> /// <param name=”path”>Path of …

Continue reading »

Jun
12
2012

How to Create Directories Recursively with Win32

As I just found out, the CreateDirectory function on Win32 can only create one directory at a time. If one, for example, specifies C:\Users\All Users\FirstNew\SecondNew as the directory to create, and both FirstNew and SecondNew do not exist, then CreateDirectory() fails. That’s less than ideal for some cases. Recently, for example, I wanted my game …

Continue reading »

Jun
04
2012

Visual Studio 2012 Express – Metro Only?

Screenshot of the Eclipse IDE compiling a C++ project using MingW
This post’s title says it all. I’ve just installed the Windows 8 Release Preview with Visual Studio 2012 RC. Just like in the previous release, Visual Studio 11 Beta, the Express edition does not contain any plain Win32 project templates, only ones for Microsoft’s new Metro UI. This is a pretty scary situation for me: …

Continue reading »

Apr
07
2012

Perfectly Accurate Game Timing

Illustration of a timer running with compensation ticks
These days, I designed a timing system for my game. Doesn’t really sound impressive, eh? The problem with accurate timing, apart from hardware faults making timers change speed or jump back, is to resample a high-frequency clock running at 3+ MHz to the update rate your game is running with. The naive approach would be …

Continue reading »

Older posts «

Social Widgets powered by AB-WebLog.com.