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

Update physics #5

Merged
merged 9 commits into from
Aug 27, 2023
Merged

Update physics #5

merged 9 commits into from
Aug 27, 2023

Conversation

sparshg
Copy link
Contributor

@sparshg sparshg commented Jul 16, 2023

Closes #4

@flathubbot
Copy link

Started test build 53339

@flathubbot
Copy link

Build 53339 failed

@flathubbot
Copy link

Started test build 53340

@flathubbot
Copy link

Build 53340 successful
To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/35979/org.sugarlabs.Physics.flatpakref

@flathubbot
Copy link

Started test build 55779

@flathubbot
Copy link

Build 55779 successful
To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/38436/org.sugarlabs.Physics.flatpakref

@sparshg
Copy link
Contributor Author

sparshg commented Jul 30, 2023

Data checker on activity can be added after sugarlabs/physics#58

@flathubbot
Copy link

Started test build 58410

@sparshg sparshg marked this pull request as ready for review August 12, 2023 16:26
@sparshg
Copy link
Contributor Author

sparshg commented Aug 12, 2023

Added patch to fix samples, also re-added sample 1

@flathubbot
Copy link

Build 58410 successful
To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/41039/org.sugarlabs.Physics.flatpakref

Copy link
Collaborator

@tchx84 tchx84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work fine 👍 , but there's a few errors I noticed, e.g.

Traceback (most recent call last):
  File "/app/share/sugar/activities/Physics.activity/sugargame/event.py", line 150, in _keydown_cb
    return self._keyevent(widget, event, pygame.KEYDOWN)
  File "/app/share/sugar/activities/Physics.activity/sugargame/event.py", line 191, in _keyevent
    mod = self._keymods()
  File "/app/share/sugar/activities/Physics.activity/sugargame/event.py", line 167, in _keymods
    mod |= self.__keystate[key_val] and mod_val
IndexError: list index out of range

To reproduce:

  1. rm -rf /var/home/tchx84/.var/app/org.sugarlabs.Physics/
  2. flatpak run org.sugarlabs.Physics
  3. Close the shape-selection palette.

@sparshg
Copy link
Contributor Author

sparshg commented Aug 18, 2023

That is an issue regarding sugargame being outdated, you can press any key and it will show this error, because pygame 2 has updated the keycodes for those in mod_map in event.py, hence index out of range issue.

>>> pg.K_LALT
1073742050
>>> hex(pg.K_LALT)
'0x400000e2'

This should be fixed in the sugargame repo instead since its not blocking issue for physics? so that other activities can also include the fix for this.

@sparshg
Copy link
Contributor Author

sparshg commented Aug 18, 2023

Fixes have been merged in upstream, I will create data checker for activity once version is updated

@sparshg
Copy link
Contributor Author

sparshg commented Aug 18, 2023

Patched sugargame

@sparshg
Copy link
Contributor Author

sparshg commented Aug 18, 2023

Opened PR in sugargame upstream too, sugarlabs/sugargame#15

@flathubbot
Copy link

Started test build 59521

@flathubbot
Copy link

Build 59521 successful
To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/42162/org.sugarlabs.Physics.flatpakref

@sparshg
Copy link
Contributor Author

sparshg commented Aug 23, 2023

Opened PR in sugargame upstream too

This has been merged.

@flathubbot
Copy link

Started test build 60762

@flathubbot
Copy link

Build 60762 successful
To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/43395/org.sugarlabs.Physics.flatpakref

Copy link
Collaborator

@tchx84 tchx84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sparshg I have been testing this a bit more thoroughly, and notice the following:

  1. Open the Physics and reset the canvas, to start clean.
  2. Go to the "play" toolbar and stop all movement.
  3. Go to the "draw" toolbar, add a few floating shapes, and try the different "pins" on these shapes (for rotating it, etc)

I noticed this a couple times, but after the third or fourth shape with pins, the pygame canvas would start freezing, to the point where not even the cursor is moving.

@tchx84
Copy link
Collaborator

tchx84 commented Aug 24, 2023

@sparshg I have been testing this a bit more thoroughly, and notice the following:

  1. Open the Physics and reset the canvas, to start clean.
  2. Go to the "play" toolbar and stop all movement.
  3. Go to the "draw" toolbar, add a few floating shapes, and try the different "pins" on these shapes (for rotating it, etc)

I noticed this a couple times, but after the third or fourth shape with pins, the pygame canvas would start freezing, to the point where not even the cursor is moving.

I also noticed some strange random behaviors, like sometimes the pins won't pin the object, and when movement is resumed these will simply fall down to the "ground", instead of being pinned and rotate.

@sparshg
Copy link
Contributor Author

sparshg commented Aug 24, 2023

This has been a known bug for a long time now: sugarlabs/physics#27

I had tried looking into the issue but couldn't find whats wrong, I will try to dig a bit more on this.

@tchx84
Copy link
Collaborator

tchx84 commented Aug 24, 2023

@sparshg I have been testing this a bit more thoroughly, and notice the following:

  1. Open the Physics and reset the canvas, to start clean.
  2. Go to the "play" toolbar and stop all movement.
  3. Go to the "draw" toolbar, add a few floating shapes, and try the different "pins" on these shapes (for rotating it, etc)

I noticed this a couple times, but after the third or fourth shape with pins, the pygame canvas would start freezing, to the point where not even the cursor is moving.

@sparshg this one seems more critical..

@sparshg
Copy link
Contributor Author

sparshg commented Aug 25, 2023

I tried this, the objects do fall to ground or glitch out and go crazy occasionally with pins, but I didn't experience any crashes. This is what I tried:

Untitled.mp4

I tried this on Ubuntu LTS 22.04, should I try to install it on some other distro?

@tchx84
Copy link
Collaborator

tchx84 commented Aug 25, 2023

@sparshg I have been testing this a bit more thoroughly, and notice the following:

  1. Open the Physics and reset the canvas, to start clean.
  2. Go to the "play" toolbar and stop all movement.
  3. Go to the "draw" toolbar, add a few floating shapes, and try the different "pins" on these shapes (for rotating it, etc)

I noticed this a couple times, but after the third or fourth shape with pins, the pygame canvas would start freezing, to the point where not even the cursor is moving.

What I am describing here is this:

Screencast.from.2023-08-25.16-25-23.webm

Note how when I am about to add "rotating motor" pin to the third shape, the whole canvas freezes. I can still interact with the GTK side of things, but the pygame side is completely frozen.

I get this error, which might or not be related

Traceback (most recent call last):
  File "/app/share/sugar/activities/Physics.activity/physics.py", line 155, in run
    self.currentTool.handleEvents(event)
  File "/app/share/sugar/activities/Physics.activity/tools.py", line 122, in handleEvents
    return self.handleToolEvent(event)
  File "/app/share/sugar/activities/Physics.activity/tools.py", line 811, in handleToolEvent
    self.constructor(self.jb1pos, self.palette_data['speed'])
  File "/app/share/sugar/activities/Physics.activity/tools.py", line 816, in constructor
    self.game.world.add.motor(body, pos, speed=speed)
  File "/app/share/sugar/activities/Physics.activity/myelements/add_objects.py", line 585, in motor
    self.parent.world.CreateJoint(jointDef)
  File "/app/lib/python3.10/site-packages/Box2D/Box2D.py", line 3354, in CreateJoint
    return self.__CreateJoint(defn)
AssertionError: def->bodyA != def->bodyB

@sparshg focus on this.

@sparshg
Copy link
Contributor Author

sparshg commented Aug 26, 2023

Yep, I am able to reproduce this issue now, working on it.

@flathubbot
Copy link

Started test build 61407

@flathubbot
Copy link

Build 61407 failed

@flathubbot
Copy link

Started test build 61408

@flathubbot
Copy link

Build 61408 failed

@sparshg
Copy link
Contributor Author

sparshg commented Aug 27, 2023

Upstream fix sugarlabs/physics#59
This also fixes the motor not getting pinned and objects glitching out, etc.

Deleted fix-load patch since the fix was merged in upstream

@flathubbot
Copy link

Started test build 61419

@flathubbot
Copy link

Build 61419 successful
To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/44060/org.sugarlabs.Physics.flatpakref

@tchx84
Copy link
Collaborator

tchx84 commented Aug 27, 2023

Upstream fix sugarlabs/physics#59 This also fixes the motor not getting pinned and objects glitching out, etc.

Deleted fix-load patch since the fix was merged in upstream

Excellent.

@tchx84 tchx84 merged commit bf12693 into flathub:master Aug 27, 2023
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.

Upstream doesn't support pygame 2
3 participants