RTS4 UI

Its been a while since my last post! I’ve been working on my study, but have recently had some time to work on this project and make some more progress. I’ve started to build some classes to load the AOM UI files. These files are XML-based with a hierarchy of “gadgets” used to display textures, text, buttons, etc.

Some things to note while writing a UI parser:
– Many hidden elements contain invalid data, resources from elements should be lazy bound, to avoid reading from data that does not exist
– UI resources should be looked up in textures2.bar, then in textures.bar
– Element bounds are always in screen-space, they are not transformed or offset by their parents rectangle
– The UI appears to be highly coupled to the engine – pressing the menu button calls “showGameMenu”, which then must unhide an element inside the same UI file, looked up by its name. These may be defined in an external xscript file that I have not yet found
– Similar to the last point, the contents of many elements seems to be driven by the engine, looking up that element by name and setting the appropriate data (ie. chat lines), other parts follow a data binding model (ie. resources)
– To load the correct image, you need to look for a [image name]_def.xmb file, check if a civilization specialization exists to be used instead, and then add .ddt to the end of the image path.

If I’m wrong on any of these points, please tell me!

Screenshot of the in-game UI displayed in XNA:
rts4ui

Screenshot with all elements visible:
ui_all

I’m too lazy to create file locating stuff, so you’ll need to update the list of install directories before running it:
Download source and binaries (170KB)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s