Closed acbart closed 9 years ago
Hi, tested this on XO1.5 running OS based on OLPC OS 11.3 (Peru version). Also tested it in my sugar-build development environment. Pong example (once initialized and dependencies satisfied), starts fine BUT keyboard input doesn't reach it. I finished a little game and want to publish it on activities.sugarlabs.org, your help properly sugarizing it is most welcome.
I'll reproduce this and get back to you. Thanks for trying out Spyral!
Ah, wait, did you already submit a PR to fix this, and it was accepted by @rdeaton? I might be slightly out of the loop on this one :)
Yes I submitted a patch. Sorry, should've put a note here. Thanks!
El jue, 17 de abr 2014 a las 9:20 AM, Austin Cory Bart notifications@github.com escribió:
Ah, wait, did you already submit a PR to fix this, and it was accepted by @rdeaton? I might be slightly out of the loop on this one :)
— Reply to this email directly or view it on GitHub.
Excellent, super pleased to hear this! I'm frankly astounded that that was the only hiccup O.o
Yes actually I'm pretty excited about having found Spyral as I'm leading a "videogame craftsmanship workshop" with children 10-12 near Bogotá - Colombia.
I'd like to support Sugar even outside XO and that's why I filed https://github.com/platipy/Example.activity/issues/8.
Sugargame's example app manages this gracefully using the pygame.VIDEORESIZE event.
I'll continue testing with other XOs and OS versions and report back.
Regards and thanks for a nice lib and docs :-)
El jue, 17 de abr 2014 a las 11:20 AM, Austin Cory Bart notifications@github.com escribió:
Excellent, super pleased to hear this! I'm frankly astounded that that was the only hiccup O.o
— Reply to this email directly or view it on GitHub.
I've conducted some further testing. Heres my results:
That is all I have to report atm hopefully it's useful. Tested on XO1.5 and XO1.75
Definitely useful! And interesting to hear that it's slow on startup on the XO - that could potentially be a problem. We'll want to to do comparisons with traditional pygame games, and also do some cprofiling to find out what's causing the delay.
For the redraw, I think we just need to add a new event registration for Scenes to call their redraw event on the "system.video_expose" event https://github.com/platipy/spyral/blob/master/spyral/scene.py#L672
By the way, if you want to gather some profiling data, an easy way is to pass the "-p" option in to the dev_launcher when you run the game on the XO (from the command line, rather than from the wheel). This should hopefully put a .pstats file into your profiles folder (might need to create it first, our current version isn't always smart enough to create on write), and that can then be processed with Pstats. http://stackoverflow.com/questions/13532531/python-stats-how-do-i-write-it-to-a-human-readable-file
I tried this and it's freezing the application on quit, incontrollably saving tens of thousands of pstats files into profile/{date} dir.
I have 2 simple scenes. The transition between them is taking a long time as well, I thought it was the animation, but I disabled that.
I would really like to release the game soon. I'll put it up on git asap.
Regards, Sebastian
El vie, 18 de abr 2014 a las 1:50 PM, Austin Cory Bart notifications@github.com escribió:
By the way, if you want to gather some profiling data, an easy way is to pass the "-p" option in to the dev_launcher when you run the game on the XO (from the command line, rather than from the wheel). This should hopefully put a .pstats file into your profiles folder (might need to create it first, our current version isn't always smart enough to create on write), and that can then be processed with Pstats. http://stackoverflow.com/questions/13532531/python-stats-how-do-i-write-it-to-a-human-readable-file
— Reply to this email directly or view it on GitHub.
I've pushed an initial commit for our initial hangman implementation.
I've still to clean it up a bit, probably use custom events. Add some info on human rights...
Hopefully you will like it.
https://github.com/icarito/colgadito-spyral
Regards, Sebastian
El vie, 18 de abr 2014 a las 10:53 PM, Sebastian Silva sebastian@fuentelibre.org escribió:
I tried this and it's freezing the application on quit, incontrollably saving tens of thousands of pstats files into profile/{date} dir.
I have 2 simple scenes. The transition between them is taking a long time as well, I thought it was the animation, but I disabled that.
I would really like to release the game soon. I'll put it up on git asap.
Regards, Sebastian
El vie, 18 de abr 2014 a las 1:50 PM, Austin Cory Bart notifications@github.com escribió:
By the way, if you want to gather some profiling data, an easy way is to pass the "-p" option in to the dev_launcher when you run the game on the XO (from the command line, rather than from the wheel). This should hopefully put a .pstats file into your profiles folder (might need to create it first, our current version isn't always smart enough to create on write), and that can then be processed with Pstats. http://stackoverflow.com/questions/13532531/python-stats-how-do-i-write-it-to-a-human-readable-file
— Reply to this email directly or view it on GitHub.
El vie, 18 de abr 2014 a las 1:37 PM, Austin Cory Bart notifications@github.com escribió:
For the redraw, I think we just need to add a new event registration for Scenes to call their redraw event on the "system.video_expose" event https://github.com/platipy/spyral/blob/master/spyral/scene.py#L672
I just tried registering self.redraw() for events system.video_expose and system.video_resize and still the artifacts remain on the dirty pygame window.
Okay, I've finally got my XO laptop pulled out and ready for testing. I was able to reproduce the following glitches so far: 1) Terribly slow startup 2) Terribly slow scene transitions 3) Redrawing not happening
The weird thing is that when I run from the dev_launcher on the XO, these problems aren't happening. So there's some interaction here with Sugar that's making everything go crazy.
As for the profiling, it does indeed go berzerk on the XO and create thousands of pstats files.
In other words, I don't get my saturday off after all :)
Okay, even weirder; try running the XO bundled game a second time. I'm having better speed now on startup. There's still some unfortunate couple second slowdown between scenes, so I'll need to look into that. And of course, the redraw error.
Artifacts problem has been solved! You were using a different version of SugarGame. We use our own version that grabs more events (including window changes). https://github.com/platipy/sugargame2
After setting up the correct SugarGame2 and adding the event registrations, artifacts are successfully redrawn over.
I didn't mean to occupy your Saturday! Your support is greatly appreciated. As said, I'm thrilled about spyral and hoping to see the dawn of many many games built by children.
Back to the subject, I did try it several times on XO1.75 (ARM processor based) last night and didn't experience a speedup on repeated runs (I think). Also, running from dev_launcher seemed to be pretty much as slow.
I had noticed the sugargame2 but I had compared it with sugargame (gtk2 version at [1]) and I thought it was the same. My mistake, sorry.
[1] http://git.sugarlabs.org/sugargame/mainline/trees/8254afb5ed18706ffb90210747c6beac4d9cf98e
I will try to profile some more to try and help finding the problem.
Thanks a lot for your efforts and help.
Regards, Sebastian
El sáb, 19 de abr 2014 a las 10:10 AM, Austin Cory Bart notifications@github.com escribió:
Artifacts problem has been solved! You were using a different version of SugarGame. We use our own version that grabs more events (including window changes). https://github.com/platipy/sugargame2
After setting up the correct SugarGame2 and adding the event registrations, artifacts are successfully redrawn over.
— Reply to this email directly or view it on GitHub.
Haha not a problem. That's how open-source goes sometimes!
I've solved the berzerking profiling. It had to do with the way that Spyral quit; using sys.exit exited the profiling, but because the Scene Stack managed by the director was never emptied, it never exited the dev_launcher (and thought it was continually transitioning between scenes). I've made some changes to how spyral quits and it's better behaved now.
About to take a look at the profiling data now!
I'll also be hopping on to take a look shortly :)
Hi, Thanks for fixing the profiler. Now I could get interesting results. They are consistent both on my laptop and the XO.
I did the following. On our simple hangman game, I setup to switch scenes on the first key event. Then in the second scene, I call spyral.director.quit() on first key event.
I then proceeded to launch dev_launcher.py -p and wait one seccond to press a key.
This profiled the startup on Game-1.pstats, showing that parsley takes up a vast majority of the startup time. Finale-1.pstats is less clear but there are some suspicious large amounts of string methods rsplit and startswith going on.
Here's some output from the XO 1.75 (running OLPCOS 13.2):
Mon Apr 21 18:43:26 2014 Game-1.pstats
261691 function calls (248530 primitive calls) in 6.282 seconds
Ordered by: internal time
List reduced from 409 to 10 due to restriction <10>
ncalls tottime percall cumtime percall filename:lineno(function)
7856/1 0.521 0.000 4.616 4.616 /home/olpc/Activities/Colgadito_grafico.activity/libraries/parsley/ometa/runtime.py:461(_apply)
10300 0.440 0.000 0.440 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/parsley/ometa/runtime.py:30(mergeWith)
6465 0.329 0.000 0.953 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/parsley/ometa/runtime.py:509(exactly)
4076/10 0.326 0.000 4.614 0.461 /home/olpc/Activities/Colgadito_grafico.activity/libraries/parsley/ometa/runtime.py:573(_or)
10840 0.266 0.000 0.266 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/parsley/ometa/runtime.py:17(__init__)
85 0.265 0.003 0.265 0.003 {method 'blit' of 'pygame.Surface' objects}
16232 0.222 0.000 0.662 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/parsley/ometa/runtime.py:397(considerError)
4076 0.216 0.000 0.320 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/parsley/ometa/runtime.py:128(joinErrors)
172 0.151 0.001 0.384 0.002 /usr/lib/python2.7/inspect.py:472(getmodule)
8567 0.147 0.000 0.193 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/parsley/ometa/runtime.py:225(head)
Mon Apr 21 18:43:26 2014 Game-1.pstats
261691 function calls (248530 primitive calls) in 6.282 seconds
Ordered by: call count
List reduced from 409 to 10 due to restriction <10>
ncalls tottime percall cumtime percall filename:lineno(function)
21538 0.078 0.000 0.078 0.000 {len}
16232 0.222 0.000 0.662 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/parsley/ometa/runtime.py:397(considerError)
15379 0.092 0.000 0.092 0.000 {isinstance}
14320 0.053 0.000 0.053 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/parsley/ometa/runtime.py:407(_trace)
13889 0.053 0.000 0.053 0.000 {method 'get' of 'dict' objects}
12900 0.054 0.000 0.054 0.000 {method 'append' of 'list' objects}
11994 0.079 0.000 0.079 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/parsley/ometa/runtime.py:264(setMemo)
10840 0.266 0.000 0.266 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/parsley/ometa/runtime.py:17(__init__)
10300 0.440 0.000 0.440 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/parsley/ometa/runtime.py:30(mergeWith)
10089 0.098 0.000 0.152 0.000 /usr/lib/python2.7/inspect.py:51(ismodule)
Mon Apr 21 18:43:28 2014 Finale-1.pstats
23325 function calls (23321 primitive calls) in 1.928 seconds
Ordered by: internal time
List reduced from 118 to 10 due to restriction <10>
ncalls tottime percall cumtime percall filename:lineno(function)
50 0.984 0.020 0.984 0.020 {time.sleep}
101 0.188 0.002 0.188 0.002 {method 'blit' of 'pygame.Surface' objects}
1 0.157 0.157 0.157 0.157 {pygame.base.quit}
50 0.097 0.002 0.097 0.002 {pygame.display.update}
303 0.084 0.000 0.152 0.001 /home/olpc/Activities/Colgadito_grafico.activity/libraries/spyral/spyral/scene.py:187(_get_namespaces)
5252 0.040 0.000 0.040 0.000 {method 'rsplit' of 'str' objects}
5257 0.028 0.000 0.028 0.000 {method 'startswith' of 'str' objects}
202 0.024 0.000 0.049 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/spyral/spyral/rect.py:43(__init__)
303/302 0.022 0.000 0.577 0.002 /home/olpc/Activities/Colgadito_grafico.activity/libraries/spyral/spyral/scene.py:255(_handle_event)
50 0.018 0.000 0.310 0.006 /home/olpc/Activities/Colgadito_grafico.activity/libraries/spyral/spyral/scene.py:582(_draw)
Finale-1.pstats% sort calls
Finale-1.pstats% stats 10
Mon Apr 21 18:43:28 2014 Finale-1.pstats
23325 function calls (23321 primitive calls) in 1.928 seconds
Ordered by: call count
List reduced from 118 to 10 due to restriction <10>
ncalls tottime percall cumtime percall filename:lineno(function)
5257 0.028 0.000 0.028 0.000 {method 'startswith' of 'str' objects}
5252 0.040 0.000 0.040 0.000 {method 'rsplit' of 'str' objects}
1815 0.007 0.000 0.007 0.000 {len}
1158 0.012 0.000 0.012 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/spyral/spyral/vector.py:64(__getitem__)
808 0.015 0.000 0.015 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/spyral/spyral/rect.py:98(__setattr__)
553 0.011 0.000 0.015 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/spyral/spyral/vector.py:53(__init__)
405 0.003 0.000 0.003 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/spyral/spyral/scene.py:259(<genexpr>)
351 0.010 0.000 0.014 0.000 /home/olpc/Activities/Colgadito_grafico.activity/libraries/spyral/spyral/rect.py:56(__getattr__)
322 0.002 0.000 0.002 0.000 {time.time}
306 0.002 0.000 0.002 0.000 {isinstance}
Note: On my laptop the delay is consistent, barely noticeable
Thanks for your continued support. For the time being I'm exploring putting up a splash screen with GTK before launching spyral.
This seems to mesh with what we're finding with Parsely. @rdeaton is investigating how we can get over this bottleneck; it shouldn't be necessary to do all this parsing every time, so it's just matter of handling this on the spyral-developer side rather than the spyral-user side.
I've released an initial version on ASLO http://activities.sugarlabs.org/en-US/sugar/addon/4741
It implements a gtk.Image splash screen that starts in the first few seconds.
The spyral window, takes over 30 seconds to load on XO1.75. Hopefully this can be improved.
Regards, Sebastian
Hi @acbart I took your hint and commented out the styles functionality for our games (which we were'nt using anyhow). It did improve noticeably the load times. Maybe make this functionality optional? This is specially helpful for scene transitions, which were pretty useless before.
I'll make a general issue for Parsley and close this one.
We haven't tested Spyral on an XO recently.