legorovers / pirover_simulator

A python based simulator for the 4tronix Inition and Pi2Go robots.
GNU General Public License v3.0
8 stars 39 forks source link

WINDOWS Background loading error #14

Open VladBagat opened 2 months ago

VladBagat commented 2 months ago

All background images (and probably other assets) are not loaded properly. Instead black screen window is returned.

My assumption is that Python Package Manager is not working properly (as it never does)

I might be wrong with the assumption...

louiseadennis commented 2 months ago

Good idea - would you like to be assigned this issue?

VladBagat commented 2 months ago

Yes! I am already trying bits

VladBagat commented 2 months ago

UPD:

  1. It is not a Package Manager error.
  2. It is not an obvious OpenGL error (verified with dedicated pyglet debugging tool)
  3. All loaded sprites have "unmappable" features (from pyglet grpahics batch logging)
  4. Issue is persistent on local Ubuntu 24.04 distro
louiseadennis commented 2 months ago

Hmm... I wonder if Windows and Ubuntu 24.04 are using different versions of pyglet and we're running into some issue with the pyglet update. I wonder what would happen if we replaced one of the button or background images with something that didn't have unmappable features. If that fixed the problem then we'd know what to do with the other images.

VladBagat commented 2 months ago

I tried to load an image object just before its conversion to the sprite. Background is now visible, but is connected to the Rover and is reduced to a size of a rover sprite? For some (unknown) reason, it behaves exactly like rover. (Follows rover while it being drag and droped) image_2024-09-24_190631198

louiseadennis commented 2 months ago

My intuition here is that however you've done this, its uploading the background in a different place/way to how it was previously - I mean it's possible that this is some weird new version of pyglet issue, but this feels more like the main code is treating the background like the robot.

However it is positive that we can now see the background (even if at the wrong size and in the wrong place). If this is something to do with pyglet (or possibly python) versions (and the simulator definitely works on Ubuntu 20.04 and before the pandemic also worked on Windows) then I wonder if Stack Overflow has anything relevant on it (you may already have looked, but this feels to me like a problem other people should have run into since it clearly has something to with versions of the underlying language or libraries.

VladBagat commented 2 months ago

My intuition here is that however you've done this, its uploading the background in a different place/way to how it was previously - I mean it's possible that this is some weird new version of pyglet issue, but this feels more like the main code is treating the background like the robot.

You are right, Louise! I have downgraded pyglet to 2.0.2 (which is a December 2022 version) and all buttons and maps now work correctly!

Do you want me to keep on fixing the existing error or should I update our requirements.txt file, so it will force new users to install archaic version of pyglet (either 2.0.2 or the closest working one I will be able to find)

UPD: 2.0.9 is the latest version when background and other buttons are displayed. 2.0.10 already has a black screen instead

louiseadennis commented 2 months ago

I'm happy for you to keep working on this - we can certainly add a pyglet version requirement to requirements.txt (when we get it!) but at some point we'll need to update and so fixing this before then would be good.

At least since we know this is to do with pyglet versions, it's possible we can find other people who've encountered the problem and possible have a fix.