Code / October 30, 2009

OOP Part 3: Composition

Last time, we looked at the inheritance style of object-oriented programming in detail. Now let’s look at the alternative: composition. We’ll use another example from Icefall to illustrate the differences. Icefall has a central ‘world view’ that shows the player and their immediate surroundings (items, monsters, terrain, etc). The world view also shows animations (e.g.

Read More
Code / October 28, 2009

OOP Part 2: Inheritance

Last time, we talked about two different approaches to designing objects for a game or application: Inheritance and Composition. It’s time to look at the pros and cons in more detail. Let’s start with inheritance. Inheritance When learning OOP, inheritance is what you learn! Create a common, generic ancestor-type class, and create new classes for

Read More
Code / October 26, 2009

Object-oriented programming

Like almost everything else these days, Icefall is designed around object-oriented programming (OOP) principles. Specifically, Icefall uses Classes instead of objects, although the difference is not relevant for this discussion. At any given time, the game will be operating dozens of different classes and hundreds of instances of those classes, with the majority of them

Read More