Jump to content
  • Advertisement
  • entries
  • comments
  • views


Sign in to follow this  


Been making excellent progress building a reasonable game-based class library for Windows CE. Early on, I decided that MFC wouldn't help me much. The MFC classes that would be of use to me were fairly trivial, and the stuff I did need simply wasn't available. I figured I'd build a decent, yet not too thick layer on top of the SDK. Eventually it'll be a DLL, so I can write several games using the same library without a lot of bloat.

I've cloned the best features of my previous class library, StarView (AKA the best class library that you've never heard of and never will). I've been pretty judicious in my choosing, only making classes for stuff that's gonna get a lot of reuse. For example, I haven't made a lot of graphics-based classes (except for the sprite stuff), as there's not much reuse of the drawing code from game to game.

As for my test game, Voracity, it's starting to shape up. There's currently 270 lines of game-specific code, which makes me happy. It doesn't yet do all the stuff that the old Win95 version did, but once I get everything implemented it should have a lower count of per-game code.

One thing I did decide to dump is STL. While it is awfully elegant, most implementations implement it entirely out of inline functions, so it can bloat your app. This isn't a problem for most apps, but it is a problem if you're programming for a limited system like CE. Since I still like to use dynamic data, I decided to steal one of the best ideas from StarView. They had a single extremely good and flexible self-growing vector abstract class called container. It had gobs of functions and could pretty-much approximate most dynamic data structures you would need. They then then wrote macros (this is 1994, before templates) that added type-safety and exposed the functions that made sense for the structure. For example:

DECLARE_LIST(ListOfInt, int);

DECLARE_STACK(StackOfInt, int);

declared the classes ListOfInt and StackOfInt. A ListOfInt is a standard linked-list class, and a StackOfInt is a stack. The classes had the functions you would expect (insert, delete, push, pop, etc). The best thing is that the functions in the classes are simply one-liners that called the equivalent function in container, which existed entirely in a DLL. Because of this, you could declare lists, stacks, queues, etc. and call 'em as necessary. Declaring these structures doesn't appreciably increase the size of your code, because all the work's being done in the DLL. Since this is 1999, and I have templates, mine work like this:

ListOf IntList;

StackOf StackList;

It doesn't have all the cool iterator and allocator stuff that STL's got, but it does allow me to declare and use lightweight data structures.

FWIW, DeltaLogic has a tool called XTL that supposedly implements STL in a DLL. I imagine they're doing something similar to what I did. They just spent a little more time on it :)
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!