This post was originally published on Tim's blog.
OpenSAGE is an open-source re-implementation of the SAGE game engine. SAGE was the game engine used in C&C Generals, C&C Generals Zero Hour, Battle for Middle-earth and its sequels, C&C 3 and its sequel, and Red Alert 3 and its sequel. I've been working on OpenSAGE for 6 months, and made some good progress, so I've started this series of blog posts to talk about what is happening in the project each week. You can also star or watch the OpenSAGE GitHub repo for a more real-time view of things.
Following on from last week's post, here is what's been happening this week in OpenSAGE.
Progress this week
This week in OpenSAGE:
-
I've worked on UI rendering, in particular the main menu. The main menu now responds to mouse input, and you can click buttons. C&C Generals
.wnd
files use a callback system, and those callbacks are implemented in engine code, so I'm having to guess at their implementations just from observing behaviour in the running game. For example, when you first see the main menu, only the logo is visible, but then after any mouse (or keyboard) input, the border and buttons animate in. As far as I can tell that is done in theMainMenuInput
callback. Every UI element (or "window" as they're called in.wnd
files) has an input callback and a system callback. If it's not specified in the.wnd
file, then the engine appears to use default callbacks based on window type (button, textbox, etc.). The input callback receives mouse and keyboard messages, and turns them into "system" messages like "the skirmish button was pressed", and these system messages are passed to the system callback. One of the system callbacks isPassMessagesToParentSystem
, which passes any messages to the system callback of the parent window. In most.wnd
files I've looked at so far, eventually at the top level, the.wnd
defines a system callback that actually does something. The design seems heavily inspired by win32 window messages, but it's not the same. -
Stephan Vedder submitted another great pull request, this time adding initial support for the
.apt
format, used to define UI screens in Battle for Middle-earth (BFME) and later SAGE games.
Just a short update this week. Until next time!