Omnimaga

General Discussion => Technology and Development => Computer Programming => Topic started by: Sorunome on May 24, 2013, 10:01:55 pm

Title: Pong with pygame
Post by: Sorunome on May 24, 2013, 10:01:55 pm
Hey, i've been working on pong with pygame, and it is working! :D
The only question i have to you guys is - did i do something fundamentally wrong because on my raspberry pi it only runs with low fps and on my lappy it runs with 30, what takes it so much calculation power?
Title: Re: Pong with pygame
Post by: ElementCoder on May 25, 2013, 01:46:54 pm
Yay Python :D I haven't worked much with pygame yet, so I don't think I'll be able to help. When I run it however it goes fullscreen and crashes pretty much instantly.
Title: Re: Pong with pygame
Post by: Sorunome on May 25, 2013, 03:33:52 pm
wut, what does the terminal output you?
Title: Re: Pong with pygame
Post by: ElementCoder on May 26, 2013, 11:24:39 am
Atm on windows, the console didn't output anything but IDLE said:
Code: [Select]
Traceback (most recent call last):
  File "C:\Users\Gebruiker\Downloads\pong.py", line 189, in <module>
    main()
  File "C:\Users\Gebruiker\Downloads\pong.py", line 182, in main
    moveStuff()
  File "C:\Users\Gebruiker\Downloads\pong.py", line 148, in moveStuff
    ball.move()
  File "C:\Users\Gebruiker\Downloads\pong.py", line 76, in move
    quit()
  File "C:\Users\Gebruiker\Downloads\pong.py", line 11, in quit
    sys.exit()
SystemExit
I'll test at linux soon.
Title: Re: Pong with pygame
Post by: Sorunome on May 26, 2013, 03:10:58 pm
that is normal if you lose >.<
idk why but idle gives errors on sys.exit()
Title: Re: Pong with pygame
Post by: Vijfhoek on May 26, 2013, 03:29:42 pm
It is extremely laggy on my Linux system, runs at about 2fps. Might have to do with AMD's crappy 2D performance on Linux, but it can't be *that* extreme. Also, it spreads over my two screens which gives a funny effect.
Title: Re: Pong with pygame
Post by: Sorunome on May 26, 2013, 04:29:40 pm
lol, i just set it to fullscreen, maybe it is quicker if i enable hardware thingy for graphics?
Title: Re: Pong with pygame
Post by: Vijfhoek on May 26, 2013, 04:44:29 pm
I guess it is, especially for the Pi, which has a relatively powerful GPU compared to the CPU.

::EDIT:: When I changed it to HWSURFACE, it only slowed everything down even more :(
Title: Re: Pong with pygame
Post by: Sorunome on May 28, 2013, 11:25:32 pm
Hey, if i run it on my pi before startx it will only start x for pong and it runs on normal speed!
Hurray! :D
Title: Re: Pong with pygame
Post by: DJ Omnimaga on June 08, 2013, 12:11:52 am
What version of Python do I need to play the game?
Title: Re: Pong with pygame
Post by: Juju on June 08, 2013, 12:25:36 am
I assume it should run with Python 2.7 with the pygame library installed obviously. And it does. It doesn't run in Python 3 though.
Title: Re: Pong with pygame
Post by: DJ Omnimaga on June 08, 2013, 12:29:28 am
Ah ok. I think I have version 3 installed, since it just closes immediately after opening (I only get to see the command line thing)
Title: Re: Pong with pygame
Post by: Sorunome on June 08, 2013, 04:55:56 pm
I assume it should run with Python 2.7 with the pygame library installed obviously. And it does. It doesn't run in Python 3 though.
yes, 2.7

and I just noticed a misstake, for the fps instead of 1000/30 i put 30/1000, that would explain why it runs so slow on my pi >.>