MetalES / Project-Zelda

Project Zelda, made using Solarus
12 stars 1 forks source link

Change the internal resolution #62

Open MetalES opened 7 years ago

MetalES commented 7 years ago

Most of today's screen are 16:9 whereas the default resolution (320x240) is 4:3. I did though that we should try a 3ds port, and 3ds resolution is 400x240

I like the idea of a pseudo widescreen resolution, first, because it fill the entire screen when fullscreen and secondly the increased field of view.

This is how it looks in 400x240, of course, everythng need to be rebuild concerning the X axis and graphics.

There should be a way to place objects depending on the resolution, then, I would add multiple resolution to englobe both 4:3, 16:9 and 16:10 resolutions.

sans titre 6

sans titre 7

Some elements don't need to be touched, such as the dialog box, equipment submenu, option submenu, the rest need to be completely reworked

Need a global variable which will, store the current resolution and see how it is done in the equipment submenu and such.

EDIT: as set_quest_size will be a thing in Solarus 1.6, prepare the needed functions for modifying the screen format in game.

Something like this should be ok, on_resolution_changed will be used firstly by the HUD script, then, the Option submenu and the QSS (Quest Selection Screen), which are game related menues.

-- This would be available only in Solarus 1.6, then, changing a resolution from gameplay would be possible.
local set_quest_size = sol.video.set_quest_size
function sol.video.set_quest_size(width, height)
  set_quest_size(self, width, height)

  -- Register an event that will be called through game:register_event("on_resolution_changed")
  -- Use it on menues that need to be redrawn (ex: menues that set x or y axis to an object in on_started)
  local game = sol.main.game
  if game ~= nil then
    game:on_resolution_changed()
  end
end
MetalES commented 7 years ago

The other solution should be select a screen format, kinda like Mystery of Solarus' language selection at the start of the game, set the resolution automatically and then load all files with the proper resolution

Screen height will always be 240

MetalES commented 7 years ago

This is how it looks in 16:10 in the Field Test Room, this is fucking amazing, no more black borders ! Hooray sans titre 8

So, at least, these will be the resolutions

4:3 -> 320x240 16:9 -> 400x240 16:10 ->432x240

MetalES commented 7 years ago

Reminder: Movement in the pause menu need to be modified as well

MetalES commented 7 years ago

Okay, this is how it works

I decided that the resolution would be automatically set, and not toggled by the player, the reason is, the more higher the resolution is, the more the engine need to display, and in fullscreen this can be a mess.

When the player starts the game, he would face this screen, after the Solarus Logo, if the resolution is different than the choice, the code would copy, erase and replace quest.dat with the proper resolution and then it will say "Please restart the game".

sans titre 40

Then, at the next start, the new resolution will be applied, choosing the same screen format will pass this screen.

The limitation of resolution come here because some menus use specific size bitmaps, the file selection, the save menu background and the pause menu background (did used a trick with a png mask and a surface color though) and because as said above, it will be lagfest.

The height rest unchanged , it is still at 240, no matter the mode selected.

Tested on a 16:10 screen, perfect Tested on a 16;9 screen, perfect Tested in a 4:3 screen, perfect

https://www.youtube.com/watch?v=4617ygC6f88

christopho commented 7 years ago

What if the quest data is in an archive data.solarus? What if the quest is installed system-wide and the user only has read-only access?

quest.dat already supports multiple quest sizes. We could implement sol.video.set_quest_size() function if it helps.

MetalES commented 7 years ago

That could help indeed, I did not take these in consideration, set_quest_size could help

MetalES commented 7 years ago

Thank you for implementing such feature, I'm pretty sure that it would be useful for some of us.

I did already configure everything and tested, didn't know that we could resize surfaces just by recreating them ... Now aspect ratio can be changed during gameplay, all remain is set_quest_size.

Yet, I did some tests, and turns out it works quite well https://www.youtube.com/watch?v=jhtKKAWdc8c

sans titre 44