Ahhh….better
Posted by: whaledawg on
Sep 29th, 2008 |
Filed under: general
So last friday I was once again trying to psych myself up for a day of pouring over obscure file processing code when I realized something. This game engine could be broken down into the following parts:
- Core services(message routing, drawing, error handling)
- Utilities(3D math, actors)
- Networking
- Physics(collision detection, friction)
- Tools(for making an actual game)
- File IO
- User Interface(keyboard input, minimaps and the like)
Why am I killing myself doing the least fun all in one chunk? File IO is important but it doesn’t have to be finished before everthing else.
So I am taking a break from .OBJ files and I’m cracking the UI. And it’s the best decision ever, I’m actually having fun again. Imagine that.
The only problem with the UI is designing it showed me how weak my message routing scheme was. Basically I had a class that processed the windows messages with a giant switch statement(another obscenely over complex code leviathan I’m forced to deal with) and it called a series of pure virtual functions(OnCreate, OnDraw, OnMouseClick and the like).
The user was expected to extend this class and over ride those functions to do what he wanted. Which is great, if all of your game will fit in one class. If you want to have different classes handle different events though you were out of luck.
So I changed it to be more of a “message router” that various “message handlers” register with. Everyone who can handle a mouse event and tells the router that he wants to get them will recieve the proper notices. Yes, I copied Java. But if it ain’t broke…

Be the first!
Tags: