Screen resolution bug when running the game
Hello @JonathanMurray. Hello everyone. Here I bring a temporary solution when running the game and shows screen resolution bug when running the game.
To reproduce this problem: Just start the game and some incompatibility with the screen resolution identification will appear. Causes a resolution bug, the game is immediately stopped.
Causes investigated: Relatively associated this error with incompatibility of the video driver with openGL applications. I still don't know which video cards can be affected, here I am using the VGA compatible controller for Intel Skylake GT2 [HD Graphics 520].
Temporary solution:
Disable the fullscreen at line 47 of the main.py file in the "/python-2d-game-3/pythongame" installation directory of the game.
Change self.fullscreen = True to self.fullscreen = False
So that it is:
class Main:
def __init__(self, map_file_name: Optional[str], chosen_hero_id: Optional[str], hero_start_level: Optional[int],
start_money: Optional[int]):
cmd_flags = CommandlineFlags(map_file_name, chosen_hero_id, hero_start_level, start_money)
pygame.init()
print("Available display modes: " + str(pygame.display.list_modes()))
self.fullscreen = False
self.pygame_screen = self.setup_screen()
Error message:
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 153 (XFree86-VidModeExtension)
Minor opcode of failed request: 10 (XF86VidModeSwitchToMode)
Value in failed request: 0x220000e
Serial number of failed request: 265
Current serial number in output stream: 268
Video card system registration and installed driver:
*-display
description: VGA compatible controller
product: Skylake GT2 [HD Graphics 520]
manufacturer: Intel Corporation
ID: 2
bus information: pci@0000:00:02.0
version: 07
width: 64 bits
clock: 33MHz
capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
configuration: driver=i915 latency=0
resources: irq:156 memória:a0000000-a0ffffff memória:90000000-9fffffff porta de E/S:4000(tamanho=64) memória:c0000-dffff
@lavinhatti Hello! Thanks for writing up the detailed issue!
Actually, it seems like I (accidently) checked in a change at 2020-01-26 where I disable fullscreen (line 97 in main.py), so in any version more recent than that I believe it should work for you by default without having to make any changes to the code (?)
However, I'm adding another fix now in the form of a commandline flag: https://github.com/JonathanMurray/python-2d-game/pull/36/files
Hello again. Okay, I appreciate the changes. I seeing more details of this bug. Check it abelow:
Available display modes: [(1366, 768), (1366, 768), (1366, 768), (1360, 768), (1280, 720), (1280, 720), (1280, 720), (1024, 768), (1024, 768), (1024, 576), (1024, 576), (960, 720), (960, 600), (960, 540), (960, 540), (928, 696), (896, 672), (864, 486), (840, 525), (840, 525), (800, 600), (800, 600), (800, 600), (800, 512), (800, 450), (720, 450), (720, 405), (720, 405), (700, 525), (700, 450), (684, 384), (680, 384), (640, 512), (640, 480), (640, 480), (640, 400), (640, 360), (640, 360), (576, 432), (512, 384), (512, 288), (480, 270), (432, 243), (400, 300), (400, 300), (360, 202), (360, 202), (320, 240), (320, 180), (320, 180)]
X Error of failed request: BadValue (integer parameter out of range for operation)
In addition to the supported resolution lists, the screen resolution is automatically changed to 800x600, but it still does not show in full screen under these conditions.
I used pygame.display.Info() to get the video information:
Display Info:<VideoInfo(hw = 0, wm = 1,video_mem = 0
blit_hw = 0, blit_hw_CC = 0, blit_hw_A = 0,
blit_sw = 0, blit_sw_CC = 0, blit_sw_A = 0,
bitsize = 32, bytesize = 4,
masks = (16711680, 65280, 255, 0),
shifts = (16, 8, 0, 0),
losses = (0, 0, 0, 8),
current_w = 1366, current_h = 768
>
Hi, I downloaded the zip file and when i open the run python folder, nothing happens. I don't know if I'm meant to do something else. Please help.
Hi @Letmein456
The recommended way to run the game is through a Python interpreter (that you must have installed beforehand), so it's not really "plug-n-play" unfortunately. This is described in some more detail here: https://github.com/JonathanMurray/python-2d-game#installation
# first make sure Python3 is installed. Then run the following in a terminal:
pip install -r requirements.txt
./run.py
If you have questions regarding running the game in general (and not specifically related to Screen resolution bug when running the game), I'd recommend creating a new GitHub issue where that discussion can take place.