Moondust-Project icon indicating copy to clipboard operation
Moondust-Project copied to clipboard

[Engine] Make `screen-width`, `screen-height`, and `screen-type` to define the in-game resolution

Open Wohlstand opened this issue 5 years ago • 11 comments

The engine.ini has screen-width, screen-height and screen-type options are unused yet internally. Make the sure there are will change in-game screen resolution when launching the game engine with choosing the config pack.

  • [x] screen-width/height to be able define the in-game resolution
  • [ ] screen-type to switch the resolution mode between fixed or dynamical. In a case of dynamical, the renderable picture will never be scaled, but the in-game resolution will be equal to the in-window resolution.

Wohlstand avatar Sep 08 '18 22:09 Wohlstand

engine.ini's Screen-type = dynamic / resizable, doesn't work either.

Windblade-GR01 avatar Sep 08 '18 23:09 Windblade-GR01

Yeah, the sense of screen-type is choosing the type of in-game scene: let it be fixed-size like it does now, or will be scalable in a dependence on a window size. The second case will don't scale textures and drawing objects, but will allow to change of camera size that will see same square (in pixels^2) as the physical square of the window. (For High-DPI mode, I'll scale the stuff to avoid the crap that PGE Engine had some times ago on macOS).

Wohlstand avatar Sep 08 '18 23:09 Wohlstand

You would also need to modify the editor to make the minimum (And default) section size the same as screen-height and screen-width.

Not sure how this would work under Screen-type = dynamic / resizable.

Windblade-GR01 avatar Sep 08 '18 23:09 Windblade-GR01

Not sure how this would work under Screen-type = dynamic / resizable. The windows could scale up to 3840 x 2160 (4K resolution) in some user monitors. For now the only option looks to have the ability to limit the maximum dynamic resolution. Even 2d sandbox games have this problem.

This forum link have images of starbound (A game like terraria) with absurd levels of zoom https://community.playstarbound.com/threads/guide-how-to-zoom-out-more-than-game-settings-allow.43009/

It uses a dynamic resolution like you plan with Moondust but you can adjust zoom and you can see at 1x zoom on ultra high resolutions it breaks.

They fixed it by allowing the user selecting zoom levels. But Moondust have the problem that the sectors are finite and at low zoom the camera would going out of boundaries.

If you limit the maximum resolution to the section size and/or a max-height and max-width options you could prevent the problem showed you adobe (The links).

The minimum resolution would be screen-height and screen-width and the sector size couldn't be smaller than the minimum resolution.

If the window resolution is bigger than the minimum resolution but smaller than the maximum resolution and the sector size is bigger than the window resolution.

It would be useful (But not necessary) to allow the user to select a zoom level like starbound, but with the limits described adobe.

It would be easier for now to just implement screen-width and screen-height, for now and implement Screen-type latter.

PD: More images of how it looks. https://imgur.com/a/44QS5 In the second screenshot you could see how it breaks http://i.imgur.com/mNWTF15.jpg

Edit: A 4k 1x screenshot of starbound Starbound in 4k with 1x zoom probably unplayable.

Windblade-GR01 avatar Sep 08 '18 23:09 Windblade-GR01

TL;DR: To make Screen-type = dynamic / resizable playable at high resolutions the Moondust team needs to limit the scaling to not exceed a maximum resolution setting (This varies per game) and to stay in the room margins.

Example

Maximum resolution = 960 x 540
Section size = 480 x 270 
Resolution = 480 x 270 scaled to 960 x 540

Example 2

Maximum resolution = 960 x 540
Section size = 4200 x 8500
Resolution = 960 x 540

This has to be DPI independent. It would be easier for now to just implement screen-width and screen-height for the time being.

Windblade-GR01 avatar Sep 09 '18 00:09 Windblade-GR01

You can don't worry to the room size limit as I have made the black zone and alignment to center that will allow to have rooms smaller than screen size, already :wink: The only a limit is minimal screen size to don't squash the thing into too small thing.

Wohlstand avatar Sep 09 '18 06:09 Wohlstand

On a quick hand, I have added the support for screen-width and screen-height values, and they are now working. It's the test I have ran with 1920x1080 in-game resolution (my screen size is two monitors of 1280x1024, therefore image is squashed): 2018-11-10 02-24-00

And the 256x224 doubled into 2 to make the resolution be like one of SNES's: 2018-11-10 02-27-46 2018-11-10 02-27-53 2018-11-10 02-28-42

The dynamical resolutions didn't implemented yet, the statical only.

Wohlstand avatar Nov 09 '18 23:11 Wohlstand

But, be careful! Without of changing of world map setup, the view will suck on a non-standard resolution. So, it's suggested to take world map area in a full screen view and align HUD at top (most of those setup also can be done through engine.ini).

Wohlstand avatar Nov 09 '18 23:11 Wohlstand

wait does this unload/reset enemies outside of the screen boundaries? also would lunalua be able to support this?

Shadowblitz16 avatar May 18 '19 02:05 Shadowblitz16

wait does this unload/reset enemies outside of the screen boundaries?

NPCs are activating once they are appearing on the visible area. Once this visible area was increased, there are more NPCs will appear on the screen and will be activated, or the opposite: when you decreased the size of screen, less NPCs will be activated.

Wohlstand avatar May 18 '19 09:05 Wohlstand

also would lunalua be able to support this?

In Discord that was discussed and LunaLua can't yet.

Wohlstand avatar May 18 '19 09:05 Wohlstand