Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace game scaling in gfx renderers with resolution & destination per scene node #980

Open
ghost opened this issue Oct 26, 2019 · 5 comments
Labels
context: code fixing/improving existing code: refactor, optimise, tidy... context: graphics res: in consideration type: enhancement a suggestion or necessity to have something improved

Comments

@ghost
Copy link

ghost commented Oct 26, 2019

Currently IGraphicsDriver interface has a strict game scaling setup where you have to set "native game size" and "render frame size" to achieve game scaling. After this renderer expects everything drawn in the native game resolution and scales up or down to match the render frame.
This is simple, but may be too restrictive for future needs.

See: IGraphicsDriver declaration:

  // Set the size of the native image size
  virtual bool SetNativeSize(const Size &src_size) = 0;
  virtual bool IsNativeSizeValid() const = 0;
  // Set game render frame and translation
  virtual bool SetRenderFrame(const Rect &dst_rect) = 0;
  virtual bool IsRenderFrameValid() const = 0;

The proposal is to completely get rid of strict "native size"/"render frame" setup in the renderer interface, and instead allow to define Native Resolution and Target Destination (sample names) per each scene node/spritebatch.

Examples of why this will be useful:

  1. Change game's aspect ratio by rearranging room viewport(s) and GUI depending on final resolution's ratio.
  2. Render text in higher resolution (this could allow to have low-res pixely game with vector fonts that scale conveniently depending on final display resolution).
  3. Debug overlay could use whole final resolution and not follow same scaling rules as the game.

Some thought should be put into deciding how it would be better to organize this data and its assignment so that game drawing functions would not be overloaded with unnecessary concepts, like image destination on final surface, etc.

Also must take the "Render sprites in screen resolution" option into consideration.

See Also: #967 , #969

@ivan-mogilko ivan-mogilko added type: enhancement a suggestion or necessity to have something improved context: graphics context: code fixing/improving existing code: refactor, optimise, tidy... res: in consideration labels Oct 26, 2019
@AlanDrake
Copy link
Contributor

The ability to specify a resolution for each camera would be helpful and make it possible to resize the viewport to different screens. We could remove the max round multiplier from setting and leave it to the game developer.
There should still be a target minimum resolution setting, at which point the whole screen is either scaled/stretch down or prevented from being resized.
"Render sprites in screen resolution" would become unnecessary if there's both a scale and a resolution as separate properties.
Rooms smaller than camera should be centered in the middle with a user definable color for filling borders.
Ideally, we would first implement a scale property for every graphical entity, though. This is something I wanted to do on AGS4 to replace the old low/high-res system.

@ghost
Copy link
Author

ghost commented Oct 26, 2019

Rooms smaller than camera should be centered in the middle with a user definable color for filling borders.

Currently cameras are not allowed to be larger than room, because it's not defined what lies behind the room in current game logic.

I think some of the things you put there are better moved to their respective tickets, as they are not directly related to my proposal (such as scaling for every graphical entity).
UPD well, maybe you could say they are. Also related to #969

@ghost
Copy link
Author

ghost commented Oct 26, 2019

Unfortunately I do not clearly understand following two paragraphs. Could you elaborate on each point?

The ability to specify a resolution for each camera would be helpful and make it possible to resize the viewport to different screens. We could remove the max round multiplier from setting and leave it to the game developer.
There should still be a target minimum resolution setting, at which point the whole screen is either scaled/stretch down or prevented from being resized.

@AlanDrake
Copy link
Contributor

AlanDrake commented Oct 26, 2019

I meant that once a camera viewport can individually set its own resolution and zoom then there's little stopping them from making the game fully adjustable at runtime, so it would be possible to set the proper ratio for 6:9, 6:10, 4:3 and resize the GUIs to the screen. As long as the game developer feels like it,

In that case though, think of a resizable window, a target minimum resolution will prevent results that deviate from the game developer's expectations which may make the game unplayable.

@ghost
Copy link
Author

ghost commented Oct 26, 2019

Oh right, adjusting viewport's/game's aspect ratio was another request that fits here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
context: code fixing/improving existing code: refactor, optimise, tidy... context: graphics res: in consideration type: enhancement a suggestion or necessity to have something improved
Projects
None yet
Development

No branches or pull requests

2 participants