Conditions and Expressions for Layer Names and Project Properties

Hello,

I’m wondering if it’d be possible to have some conditions and expressions added for the following items:
Conditions:

  • If layer name is (nameparameterhere) (May not be feasible)
  • If game resolution height is (heightparameterhere) (from game properties)
  • If game resolution width is (widthparameterhere) (from game properties)
  • If game scaling is set to (fit width/fit height/don’t adjust/etc)

Expressions:

  • Game Resolution Height
  • Game Resolution Width

Reasoning:

After some conversations on the discord, I’m trying to work through building an extension that will allow GD5 to have a fake “UI layer” or “GUI Scene” that matches functionality in other engines.

Many engines have a UI Layer that defines the game’s “Base” resolution, and so the UI stays not only static in position, but in size, even if your game’s assets and playable scenes are a much lower resolution. (e.g. GUI scenes in Defold)

For GD5’s purposes, my main goal would be to simplify the process of having a completely different asset/scene resolution vs the actual game resolution. As an example, even if the game (and UI) resolution is designed for 1920x1080, your game assets would actually be designed for 320x180 resolution (16x16 pixel assets). The game would zoom in all non-GUI layer cameras by 6x (320x180 is 1/6 of 1920x1080)

This accomplishes a few things:

  • For Pixel Art games, this allows you to keep your assets at their native resolution while using the IDE, but to the player they’re scaled to fit the proper resolution and appear as if the assets were scaled.
  • The UI itself is not scaled up from a much smaller size, eliminating some scaling artifacts that happen with text.
  • Asset size is drastically reduced for the game.

It’s very possible to accomplish this through events, but it’s a bit complex to maintain, and isn’t possible to make into an extension to simplify for other users, as it requires knowing both the desired resolution and all of the layer names, since these conditions don’t exist.

In a perfect world, we’d be able to either manually ID the UI layer in the IDE, and set 2 separate resolutions, but that may be too complex.

Since I don’t know that we want to modify the entier way that the game properties/Layer UI works, my other thought is to take these conditions and expressions to accommodate the following

  • Add an event that automatically calculates the needed scaling/zoom for the player (They input the “real” resolution of the game for their assets, and it calculates the scale multiplier by comparing it to the resolution set in game properties)
  • Apply camera zoom to a layer by name.
    • In a best case scenario, there’d be a way to apply this to every layer that matches a specific layer name, or each layer that doesn’t match a layer name. (basically “If layer name != “GUI Layer”” or “If Layer Name = “GUI Layer” (Inverted)” | Zoom Camera 6x (“Layernameexpressionhere”,)

as a note: there are screenwindowwidth/scenewindowwidth and similar expressions, but those equate to the window size, not the defined resolution, as far as I can tell.

Any/all help is appreciated, or info on why these wouldn’t be implemented.

4 Likes

I have tweaked this slightly as this has been coming up more on the discord, and we really need some expressions (and conditions) for all of the project properties.

The expressions are probably more important, as there is an increasing need to know what resolution the game is set at, what scale mode it is set at. This has other benefits though such as being able to pull the version number, author, etc.

The requests around layers still apply to the above, but I wanted to update this with the new relavent info from what I’m seeing people ask for.

2 Likes