UI System Quick Reference
This is the short version of the current client-side UI architecture.
System Overview
Mouse/keyboard
-> client input
-> games/warcraft-3/ui/ui_main.c
-> games/warcraft-3/ui/screens/*.c
-> games/warcraft-3/ui/ui_render.c
-> renderer API
The UI library parses Warcraft III FDF files client-side, owns the frame tree, and switches screens through menu commands. The server provides game data only, such as command buttons and inventory items.
Startup
CL_Init creates the renderer and UI function tables:
- Select renderer from
r_module. - Initialise the renderer.
- Initialise
UI_GetAPI. - Load theme and FDF assets.
- Execute
ui_start_command, defaultmenu_main.
Common commands:
| Command | Purpose |
|---|---|
menu_main |
Main menu |
menu_game |
Single-player menu |
menu_lan_refresh |
LAN game list |
menu_startserver |
Create LAN game |
Renderer Diagnostics
Use the stdout renderer before taking screenshots:
Equivalent:
build/bin/openwarcraft3 \
-data=data/Warcraft\ III \
-r_module=stdout \
-ui_start_command=menu_main \
-com_frame_limit=1
The output includes:
- loaded textures, models, and fonts
draw_portraitanddraw_spritedraw_imagewith screen rect, UV rect, blend mode, color, and texture namedraw_textwith text, font, rect, measured size, and colordraw_sys_textconsole overlay lines
This is useful for checking layout, anchors, backdrop pieces, button state art, translated strings, color codes, and screen composition without a window.
Unit Selection Flow
client/cl_input.c
CL_RequestUnitUI
-> clc_request_unit_ui
-> server/sv_unit_ui.c
-> games/warcraft-3/game/g_unit_ui.c
-> svc_unit_ui
-> client/cl_unit_ui.c
-> ui.UpdateUnitUI
-> games/warcraft-3/ui/screens/console_ui.c
The client caches returned unit data and renders it on subsequent UI frames.
Core Files
| File | Purpose |
|---|---|
client/ui.h |
Shared UI module API declaration |
games/warcraft-3/ui/ui_main.c |
UI entry point, lifecycle, startup command, screen selection |
games/warcraft-3/ui/ui_fdf.c |
FDF parsing and frame registry |
games/warcraft-3/ui/ui_render.c |
Layout solving and frame rendering |
games/warcraft-3/ui/ui_theme.c |
Warcraft UI theme resources |
games/warcraft-3/ui/screens/main_menu.c |
Main menu screen |
games/warcraft-3/ui/screens/console_ui.c |
In-game HUD screen |
client/cl_main.c |
Renderer/UI init and client frame loop |
client/cl_unit_ui.c |
svc_unit_ui parser |
server/sv_unit_ui.c |
Unit UI data request handler |
games/warcraft-3/game/g_unit_ui.c |
Game-side unit UI data provider |
renderer/r_stdout.c |
Text renderer backend |
Runtime Cvars
| cvar | Purpose |
|---|---|
r_module |
renderer for OpenGL, stdout for text output |
ui_module |
UI module name |
g_module |
Game module name |
ui_start_command |
Initial UI command |
com_frame_limit |
Exit after N frames |
See Runtime Modules and Cvars for the full config reference.
Debug Checklist
- Use
mdxtool --infoto verify model assets and sequence names. - Use
make run-ui-textto inspect draw calls. - Check
draw_image screen={...}for layout and anchors. - Check
draw_image uv={...}for tiling and atlas issues. - Check
draw_text text="..."for translated strings and Warcraft color codes. - Use screenshots only after the draw-call transcript looks sane.