TheAssemblyArmada / Thyme

An open source re-implementation of Generals : Zero Hour written in C++.
GNU General Public License v2.0
578 stars 56 forks source link

Dynamically Scaling Command Bar #33

Open tomsons26 opened 6 years ago

tomsons26 commented 6 years ago

Now that i got your attention let's break this down.

The SAGE engine uses Westwood's WND UI system, the system is bound to a prefixed aspect ratio the window was created with. The game scales the window to fit the aspect ratio its running at.

That in modder case would mean you would need to create a command bar WND for every aspect ratio. So what's the solution to avoid having to replace the files on every different aspect ratio? It's simple really, well on paper, instead of scaling the command bar we give things fixed locations. These are effectively the components cmdbarcomponents Broken down into components it would be like this, we also need a tileable texture for filling in the command bar cmdbarcomponents2

All comes together like that. (Scaling the ui will still happen but in fixed aspect ratio so there would be no distortions, just for making it easier for me i didn't scale the command bar in those mockups)

If you are wondering where this incredibly unique idea came from, well this is exactly how everyone else deals with this problem Here's a StarCraft 2 screenshot that is pushed to so wide screen it exposes this method even scshot

OmniBlade commented 6 years ago

From a practical point of view, how many aspects do we realistically need to support? I'd say only really 4:3 which we already have and 16:9. I was thinking more along the lines of how languages are handled where an optional additional path is searched first for appropriate assets, falling back to some default when not found. That way vanilla is unaffected, but the engine will load widescreen assets if a big file is loaded contained them in the appropriate path.

Invictaz commented 5 years ago

Might do aso 21:9 for widescreen gamers. And 16:10 for 1920x1200

Qibbi commented 5 years ago

Instead of having different wnds for different aspect ratios you could also check how the sub windows are aligned. If they are centered, and aren't buttons or something you can stretch them, otherwise you can calculate offset positions based on the wnd aspect ratio and desired aspect ratio. From tomsons screenshot one can see that the command bar background, power meter, and cash display are the only 3 centered items, which can all be tiled. In ZH as there are 7 buttons per row iirc there will be one button in the middle but because it is of type push button it should only be repositioned but not stretched.

xezon commented 3 years ago

Accounting for center section tiles will indeed make the control bar scalable. Will be nice if we can tackle this feature once WND is implemented.

ElTioRata commented 7 months ago

Another approach I found it's fixing and unstretching all of the command bar to the bottom-center like this mod does. It requires a few issues to be fixed afterwards (like re-art the command bar edges and remove or cover those black rectangles). Both the tiling approach and this one I just suggested aren't exclusive from each other, tiling may be uncomfortable in wider proportions than 16:9 since you'd have to turn your head to look for the radar for example, an option to limit command bar tiling to a certain width would be nice.

xezon commented 7 months ago

The "destretch" approach is a good idea too. I am copying the image here for safe-keeping

screen

Other than that, since a few years we also have a "Control Bar Pro" and variants of it specifically designed for 16:9 that replace the original Control Bar experience. Many pro players and streamers do use that already.

ControlBarPro_01

ElTioRata commented 7 months ago

I found the same mod but for vanilla Zero Hour (just in case y'all wondered how it looks).

screen