-
Notifications
You must be signed in to change notification settings - Fork 67
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
Rapt pygame program runs EXTREMELY slow. #80
Comments
Can you link to your code. Share an APK. Anything? "My code runs slow" is not helpful to anyone. |
Here is the apk: https://www.dropbox.com/s/0eta3pkv3hpd927/Jeweled-1.7-release.apk?dl=0. I removed many features to make it faster but it is still slow. Since I removed some features it is a little buggy so you might have to launch it several times to make it work. Here is the draw grid function. It draws lines and the background though I commented out the line. There is some leftover non-working code:
|
Draw gem function. Draws gems:
|
Gem fall function. The program is slow when the gems are falling:
|
Finally my main loop. Still a lot of commented, uncleaned code. If you need more, tell me. My game runs fine on windows, mac etc.:
|
Sorry it did not publish all of my code correctly. |
I get that you want to keep your code private, but it is extracted to /data. That's not accessable to a normal user, but someone that's rooted can just read the code. The game seems to run fine on my phone, I can't compare it to a computer though. In a few days I might get hold of a rooted phone though, so I'll have a better look then. |
Could you make a screenshot video of the program on your device because I can’t make a video at the moment?
I get that you want to keep your code private, but it is extracted to /data. That's not accessable to a normal user, but someone that's rooted can just read the code.
The game seems to run fine on my phone, I can't compare it to a computer though.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#80 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/Ad72x6v0LeGric4zBPs3VvaSvqB8JTv_ks5sjRtigaJpZM4PScC->.
|
By the way. The full program uses particle effects. If you want a version running at full effects, tell me.
I get that you want to keep your code private, but it is extracted to /data. That's not accessable to a normal user, but someone that's rooted can just read the code.
The game seems to run fine on my phone, I can't compare it to a computer though.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#80 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/Ad72x6v0LeGric4zBPs3VvaSvqB8JTv_ks5sjRtigaJpZM4PScC->.
|
Could I get the fullest, fanciest version please. |
Yes. I will send it really soon.
Could I get the fullest, fanciest version please.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#80 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/Ad72x2mAuYaKszQsyNJcL_TI7QsGMYaMks5sjUxDgaJpZM4PScC->.
|
Here's a recording. Don't judge, it needs practice. https://github.com/Connor124/Connor124.github.io/blob/master/TRIM_20170917_180731.mp4?raw=true. |
By the way, How could I encrypt my code? When your done, could you also delete the apk?
Here's a recording. Don't judge, it needs practice.
https://github.com/Connor124/Connor124.github.io/blob/master/TRIM_20170917_180731.mp4?raw=true.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#80 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/Ad72x-GawAo0gqvYK8bop_Wh9Cd8w5uQks5sjVLegaJpZM4PScC->.
|
|
It should run at this speed
https://www.dropbox.com/s/vdypp04i73xltmc/Jeweled%209_17_2017%202_04_27%20PM.mp4?dl=0
|
I thought the slowness was a fancy animation. :) |
Do you have any ideas on how to make it run faster?
|
Any luck on finding out what is causing the 4FPS? 😊
|
@powewal this thread contains some insight: In general, pygame_sdl2 is slower with software rendering, like drawing lines and blitting surfaces. For a real improvement in speed, you should first create surfaces of each image graphic (the gems) (i can't tell if you do that or not....seems like they are drawn using the software draw API), then you need to cache other things like the background, lines, text, etc. These eventually need to be moved the the SDL2 render API. Basically, all the software/manual drawing is not optimised in SDL2, and you need to utilize the hardware GPU using the render API, and cache all your draws. This is typical of all modern games. |
Each gem is loaded with this
Gem = pygame.image.load(“assets/gem.png”).convert_alpha()
And then resized
resizedGem = pygame.transform.scale(Gem, gem_size)
|
Ok. Thanks. It is hard to read the code. In any case, the other points
still apply, that drawing should be cached, and eventually moved to the
render API. SDL2 (and to and extent pygame_sdl2) have removed optimization
for software rendering and you can expect lower performance until you use
the render API.
Beyond that, I can’t really read the code-in-comments for any more advise
for you.
…On Wed, Jan 10, 2018 at 9:37 AM powewal ***@***.***> wrote:
Each gem is loaded with this
Gem = pygame.image.load(“assets/gem.png”).convert_alpha()
And then resized
resizedGem = pygame.transform.scale(Gem, gem_size)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#80 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAh-pzREBhUy6aURa49ctKxda9BXLX_Hks5tJNkxgaJpZM4PScC->
.
|
How do you put those points into effect for andrioid?
|
Rewrite your code to cache drawing. Lock surfaces when doing many draw
operations, batch your blits into a single list instead of ad hoc. There
code be other opportunities, use cProfile and look for slow operations.
…On Wed, Jan 10, 2018 at 9:55 AM powewal ***@***.***> wrote:
How do you put those points into effect for andrioid?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#80 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAh-p4ch4xEoUYzRQh2hiJtf9Lk_HRAeks5tJN1ogaJpZM4PScC->
.
|
Thanks.
|
BTW what does it mean to cache drawing and lock surfaces? |
My program runs extremely slow
The text was updated successfully, but these errors were encountered: