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

[Draft] Task settings #135

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

[Draft] Task settings #135

wants to merge 2 commits into from

Conversation

royfalk
Copy link
Contributor

@royfalk royfalk commented Nov 24, 2024

Provide an alternative to vegasettings

This is a draft PR.
Currently, used only for testing on various systems.

@royfalk royfalk requested a review from evertvorster November 24, 2024 08:42
@royfalk royfalk self-assigned this Nov 24, 2024
@royfalk
Copy link
Contributor Author

royfalk commented Nov 24, 2024

@evertvorster , please try and run this (python3 python/randr.py)

Result should be something like:

Number of monitors: 1
Screen #0
['3840', '2160']
['4096', '2160']
['1920', '1200']
['1920', '1080']
['1600', '1200']
['1680', '1050']
['1600', '900']
['1280', '1024']
['1440', '900']
['1280', '960']
['1360', '768']
['1280', '800']
['1280', '720']
['1024', '768']
['800', '600']
['720', '480']
['640', '480']

@evertvorster
Copy link
Contributor

Hi there!

Thanks for looking into this. I think there is a bug in the script, as it detects only one monitor:

[evert@Evert vegastrike-git]$ python /usr/share/vegastrike/python/randr.py 
Number of monitors: 1
Screen #0
['2048', '1152']
['1440', '1080']
['1400', '1050']
['1280', '1024']
['1280', '960']
['1152', '864']
['1024', '768']
['800', '600']
['640', '480']
['320', '240']
['1680', '1050']
['1440', '900']
['1280', '800']
['1152', '720']
['960', '600']
['928', '580']
['800', '500']
['768', '480']
['720', '480']
['640', '400']
['320', '200']
['1920', '1080']
['1600', '900']
['1368', '768']
['1280', '720']
['1024', '576']
['864', '486']
['720', '400']
['640', '350']
['3200', '1800']
['2048', '1536']
['1920', '1440']
['1600', '1200']
['1440', '1080']
['1400', '1050']
['1280', '1024']
['1280', '960']
['1152', '864']
['1024', '768']
['800', '600']
['640', '480']
['320', '240']
['2560', '1600']
['1920', '1200']
['1680', '1050']
['1440', '900']
['1280', '800']
['1152', '720']
['960', '600']
['928', '580']
['800', '500']
['768', '480']
['720', '480']
['640', '400']
['320', '200']
['2880', '1620']
['2560', '1440']
['2048', '1152']
['1920', '1080']
['1600', '900']
['1368', '768']
['1280', '720']
['1024', '576']
['864', '486']
['720', '400']
['640', '350']


For comparison, here is the output of xrandr:

[evert@Evert vegastrike-git]$ xrandr 
Screen 0: minimum 16 x 16, current 5248 x 1800, maximum 32767 x 32767
eDP-1 connected 2048x1152+0+648 (normal left inverted right x axis y axis) 381mm x 214mm
   2048x1152    239.87*+
   1440x1080    239.87  
   1400x1050    239.76  
   1280x1024    239.78  
   1280x960     239.80  
   1152x864     239.87  
   1024x768     239.74  
   800x600      239.81  
   640x480      239.72  
   320x240      238.24  
   1680x1050    239.81  
   1440x900     239.80  
   1280x800     239.70  
   1152x720     239.91  
   960x600      239.72  
   928x580      239.78  
   800x500      239.72  
   768x480      239.72  
   720x480      239.35  
   640x400      239.49  
   320x200      238.84  
   1920x1080    239.88  
   1600x900     239.83  
   1368x768     239.74  
   1280x720     239.96  
   1024x576     239.43  
   864x486      239.60  
   720x400      239.62  
   640x350      239.59  
HDMI-A-1 connected primary 3200x1800+2048+0 (normal left inverted right x axis y axis) 708mm x 399mm
   3200x1800    119.81*+
   2048x1536    119.85  
   1920x1440    119.85  
   1600x1200    119.82  
   1440x1080    119.82  
   1400x1050    119.78  
   1280x1024    119.71  
   1280x960     119.86  
   1152x864     119.77  
   1024x768     119.59  
   800x600      119.49  
   640x480      119.52  
   320x240      117.34  
   2560x1600    119.81  
   1920x1200    119.85  
   1680x1050    119.80  
   1440x900     119.81  
   1280x800     119.68  
   1152x720     119.53  
   960x600      119.74  
   928x580      119.55  
   800x500      119.47  
   768x480      119.24  
   720x480      119.65  
   640x400      119.64  
   320x200      117.55  
   2880x1620    119.85  
   2560x1440    119.86  
   2048x1152    119.82  
   1920x1080    119.77  
   1600x900     119.83  
   1368x768     119.67  
   1280x720     119.67  
   1024x576     119.85  
   864x486      119.69  
   720x400      119.54  
   640x350      119.24  
[evert@Evert vegastrike-git]$

@evertvorster
Copy link
Contributor

I wonder if xrandr is the best way to interrogate for available monitors....
Is SDL2 queries not more portable?
I found a little tutorial video for SDL2 that looks interesting.
https://www.youtube.com/watch?v=WeNo2ARotmU

@evertvorster
Copy link
Contributor

Since this is a new venture in settings for Vega Strike, can we agree on a rough list of requirements for the configuration app?

Having the settings app separate from the main application is weird, and counter-intuitive.

Ideally, the game engine should call the settings app on startup.
The settings app should then check to see if there is a valid configuration file.
If there is, check to see that the requested resolution and screen in the configuration file is available.
If it is, and the settings app was just called to check that screen is available for the game to run on, pass that information back to the game engine, together with the requested screen information.

If the configuration file does not exist, or does not have a valid screen configuration anymore, give the user the choice of which screen and resolution to run on, and save that to the config file, then return that information back to the game engine.

Now, you should also be able to call the configuration app from the game menu. When you call it like this, then the configuration app should expose all the configuration options and at the end write that to the configuration file, and return back to the game.

It is my humble opinion that this should be in place before we start porting over each of the settings that is possible with the old settings app. We could then incrementally move over settings that makes sense. There are also quite a few settings in the original configuration file that is not settable in the app, and you needed to modify the configuration file directly. Stuff like assigning keys to buttons on the joystick, which axes does what and so on. That might be a good reach goal for sometime in the future.

@royfalk
Copy link
Contributor Author

royfalk commented Nov 24, 2024

I think there is a bug in the script, as it detects only one monitor

It's not yet ready. I'm in the data collecting stage and I have only one monitor so I literally needed your input to see the results are not what I expected.

I wonder if xrandr is the best way to interrogate for available monitors....
Is SDL2 queries not more portable?

This is my first attempt. I was sure python would do this easily and it turns out it ain't so. We'll probably need separate code for Windows or use some extra library like SDL.

@evertvorster
Copy link
Contributor

Thanks for the explanation. I am quite happy to run and test code. When I see the code doing something that is unexpected, I'll call it a bug and describe it as best as I can.

Yes, there will most probably be separate code for Windows and Linux.

I agree that the settings app should be in Assets. The argument for having it separate is also a good one. The game UI is very hardcoded and inflexible.

@BenjamenMeyer
Copy link
Member

or use some extra library like SDL.

We're already using SDL2 so let's see if we can get the information from it so we can have a single path for all platforms. Pretty sure SDL2 already has methods to query this stuff.

@royfalk
Copy link
Contributor Author

royfalk commented Dec 7, 2024

This was intended as a temporary measure until we move the settings app into the game itself. I am holding off on that until I can figure out how to pass the window handle from C++ to python.

This is not easy but it seems an elegant and challenging solution. However, I'm also working on other things, so it's slow going.

@royfalk
Copy link
Contributor Author

royfalk commented Dec 8, 2024

I found it !

It being the dark art of mixing SDL and TKinter.

As @BenjamenMeyer said, SDL2 is a far superior solution for implementing this. I'm keeping this PR open for now, but I hope that we'll have a working PoC in a month or so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants