Good coding guidelines / February 26, 2014

Boolean Function Parameters

Consider the following code, which might be part of a custom Font class to draw fancy text. Looks good, right? Parameters are clear, order makes sense, and it’s easy to understand what the code does when you find it invoked: No need to go searching for the function implementation, or hovering over using the IDE

Read More
Code / February 7, 2014

Sleep vs WaitMessage vs MsgWaitForMultipleObjects

This topic seems to come up quite a lot, and yet the majority of the time, there’s no clear answer. Take the scenario: you have a game or an application, and there’s some downtime. You’ve noticed in task manager that your apps remains at a high CPU Usage% even while it’s not doing anything, and

Read More
Code / February 4, 2014

Playing video in FPC

A short and simple post for today. Playing a video file in Freepascal, without using Lazarus. I honestly couldn’t find any examples on the internet of how to do this, so I made one. The DirectX9SDK has examples of how to use DirectShow/ActiveMovie to play back video files in C++, however, the common version of

Read More
Code / February 1, 2014

Direct3D – Optimizing for different hardware

When your project is nearing completion, it’s time to look at optimization. For Direct3D, this typically means grouping and reordering of things to make the hardware work as efficiently as possible. For Direct3D 9, Microsoft have published a handy guide of things to look at optimizing here. But it’s interesting to look at the difference these

Read More
Good coding guidelines / March 7, 2010

3rd Party Code

As a general rule, I like to write all of the code used by my games/programs myself. Not because I think I am the best programmer in the world, but because – for me – one of the main reasons I program is to learn more about how software functions on the very lowest levels,

Read More
Code / November 21, 2009

Icefall UI Evolution

Taking a break from coding topics, today’s post explores how Icefall’s dialog User Interface (UI) has evolved over the course of it’s development. My automatic-backup tool keeps every version of Icefall available, so I fired up a few old versions and took some screenshots to illustrate the process. Original Design This screenshot is actually from the

Read More
Good coding guidelines / November 18, 2009

More Textures than Memory

Icefall uses literally dozens of textures… (and it will probably be ‘hundreds’ by the time the game is completed). Textures are used for everything, from the mouse cursor, menus, fonts, buttons, to the game world itself, spells/action icons, monsters, equipment… everything. Although my own main PC has 512MB of video (texture) RAM, not everyone does!

Read More
Code / November 16, 2009

Scary Windows development stories

I’m currently reading a book about the evolution of Windows. One of the most interesting things I keep finding is how stupid some 3rd party application developers must have been…. for example, it seems to have been common practice that if you wanted your app to grab a particular Windows setting (let’s say the Fonts

Read More
Code / November 12, 2009

Game Golden Rule #1: Support Windowed-mode

I thought I’d cover this rule first, because I listed it as number one and also because it’s probably one of the most controversial. Let’s begin: a simple Why/Why Not argument should suffice for this one: Why Allow Windowed-mode: It’s more convenient for your users. Some users multitask (gasp!), even while playing games. This is

Read More
Code / November 11, 2009

Paying your Windows Taxes

In Windows (like every operating system), when you’re writing an application or game there are certain things that your application is responsible for handling: some of them are easy, some of them take a little bit more effort. On his excellent blog, Microsoft’s Raymond Chen calls these responsibilities “Taxes”, and there are good reasons why

Read More