As part of my ongoing C++/OpenGL hobby project to develop a (free) game, engine and tools, I am beginning to develop the HUD (Heads Up Display) editing tool. Aside from delivering a game, one of my primary objectives is to encourage creativity by providing tools that allow gamers (i.e. non-programmers) to customise the game in numerous ways, from simply building new levels, all the way to modifying the game mechanics and importing their own assets (models, textures, sounds, etc.). A part of such customisation is allowing a user to design their own HUD.
Please bare in mind that I'm not creating a World of Warcraft HUD or anything complex like that; this is just a hobby project for arcade style games, so I'd like to keep things relatively simple..
So here's a summary of what the HUD editor will need to be capable of:
- WYSIWYG viewing and editing of the game's HUD layout.
- Adding components to the screen. There are several different types of HUD components, such as panels, icons, decorations, and values (such as scores, item counts, time remaining, etc.).
- Deleting components.
- Arranging the layout of components, such as moving and resizing components. It would be nice to have features to make such editing easier/quicker, e.g. grouping related components.
- Arranging the order of components from front to back.
- Specifying properties of each component (e.g. fonts, colours, value to show). I guess it also might be useful to be able to view and edit properties of the component layout directly too?
- Define how the layout reacts to different screen aspect ratios. I think this is the most tricky part. One of my goals is for the HUD to gracefully handle different aspect ratios like widescreen (TV/PC) and portrait (phone/tablet), so I think it would be nice if the user could a design HUD that could dynamically accommodate any arbitrary aspect ratio. So rather than say "if 16:9 use layout A, else if 9:16 use layout B", etc. or just stretching a layout to fit an unexpected aspect ratio (thus distorting text, images, dimensions, etc.), the HUD should look as nice as reasonably possible when a user decides to do something crazy like running the game in a 32:9 resolution.
Here are my design ideas so far:
- Viewing the HUD: The HUD is displayed at 100% by default. The HUD can be panned by left-click and dragging anywhere not on a component. The HUD can be zoomed in and out using the mouse wheel. Selecting "Reset View" from the "View" menu resets the view to the default.
- Adding components: There is an expandable panel showing the various component types that can be added. The user drags a component he wants to the screen. A new component of that type is created and placed on the screen.
- Selecting components: The user can click a component to select it. The selected component is highlighted. One thing that always annoys me in other apps is being unable to select a component that is behind another one. So I had the idea of holding Control while clicking to select the component that is behind the currently selected one (thus, you could do this multiple times to get to the component that is furthest back).
- Deleting components: Pressing the 'Delete' key deletes the selected component (alternative: Select "Delete" from "Edit" menu or right-click context menu).
- Moving components: The user can left click and drag to move a component. Movement snaps to a visible grid.
- Resizing components: Eight "Edit Handles" appear on a selected component as small squares. Edit Handles on the edge of a component can be dragged to resize the component in one direction. Edit Handles on the corner of a component can be dragged to resize the component in two directions.
- Ordering components: Like MS Office and other apps. Right-click, context menu, "Move Forward", "Move Backward", "Bring to Front", "Send to Back". Affects the selected component.
- Component properties: An expandable VB-style property panel shows properties of the selected component. Properties can be specified via usual means (e.g. text fields, number fields, check-boxes, drop-down lists, and so on). For resources like Fonts, Colours, Textures, Models, Values, etc.. the engine already has support for these things, so it should be easy to support them as properties in a generic way. I already started developing a property sheet for the game objects, so I think I will reuse that one for the HUD components too.
- Linking components to the screen: To accommodate changes in aspect ratio, rather than laying out the HUD entirely relative to the screen, I had the idea of supporting a mix of relative and absolute values. So for example, the user can place a square score icon in the top-left corner of the screen with an equal distance from the left and top. If the game is played on a different aspect ratio, the icon remains square (not stretched), and the distances between the left and top of the screen remain equal. For this, I thought of perhaps middle-click dragging a component to a screen edge or corner, but I'm not really sure if that's the best way to accomplish this, since I don't recall encountering middle-click drag in other apps before.
- Linking components to other components: Following the previous point, let's say you want to place the score component adjacent to the score icon. You could middle-click and drag your score component to the right edge of the score icon to attach it, like before with the screen. Then you just need to resize the width and perhaps offset the component slightly from the icon (in case you want a small gap between the two components). The trick here is that the offset and width are both absolute, so a change in aspect ratio won't throw the component out of whack.
- Copy and Paste Components: I think users will expect standard features like this to be supported. Standard procedure: "Edit" menu or context menu.
- Undo/Redo: Same again. I think users will reasonably expect all of the above actions to be undoable. Standard procedure again: "Edit" menu or context menu.
This is what I have so far. I'd be interested to hear from others who have tackled this problem and how they approached it, or just anyone who has any ideas on the subject. I'm especially interested in how to handle the problem of variable aspect ratios and screen resolutions, but any insights into designing an intuitive and efficient editor for video game HUD's would be great!
Cheers!