Updating my Kernel

Published May 10, 2007
Advertisement
I've got the unit tests of the signals running under both Windows XP and Mac OS X. I installed Code::Blocks on the MacBook Pro so that I'd be using the same IDE on both machines and the projects files are (mildly) compatible. I've still had to use separate project files for both systems as the directory locations of key libraries are different, and after a directory reorganisation both now cause Code::Blocks to whinge about malformed directory locations for some reason, but they compile and run without warnings which is the main thing. Stopping Code::Blocks throwing a hissy fit at run-time can wait.

For my next task I've decided to skip ahead a bit and design the kernel, otherwise known as the game loop. With the signal code in place this isn't that difficult to code; it really is just a loop that keeps sending signals until it gets told to quit. The main decision that needs to be made is how these modules will interface with each other using signals.

After sketching things out on paper, I can't help thinking that the best method for doing this is to define the signal interfaces outside of the class they "belong" to as signal objects out in global space. My initial thoughts on that proposal is my inbuilt reaction that globals are evil nasty things that should be avoided at all costs unless they are unavoidable. But all other solutions I can think of are either as convoluted as all hell or are globals in disguise (like singletons). The point is that with this architecture the signals are the main interface with core modules like the kernel and many different modules may need to connect up to it, and I might as well make the interface the signal itself rather than wrapping it up with pretty functions just to pretend it isn't global. Of course, all the signals will be contained within namespaces so it's not as if they'll be trampling all over the code base.

Now I just have to decide on a naming strategy for signals. I'm usually not a fan of code warts because I feel they make names harder for humans to parse, but in this case I might need something to signify that this is a signal. Maybe something like sig_KernelUpdate? Although I'm not sure about the "KernelUpdate" part...
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement