Author Topic: Pong with pygame  (Read 4698 times)

0 Members and 2 Guests are viewing this topic.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Pong with pygame
« 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?

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline ElementCoder

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 611
  • Rating: +42/-2
    • View Profile
Re: Pong with pygame
« Reply #1 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.

Some people need a high five in the face... with a chair.
~EC

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Pong with pygame
« Reply #2 on: May 25, 2013, 03:33:52 pm »
wut, what does the terminal output you?

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline ElementCoder

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 611
  • Rating: +42/-2
    • View Profile
Re: Pong with pygame
« Reply #3 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.

Some people need a high five in the face... with a chair.
~EC

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Pong with pygame
« Reply #4 on: May 26, 2013, 03:10:58 pm »
that is normal if you lose >.<
idk why but idle gives errors on sys.exit()

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Vijfhoek

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 120
  • Rating: +13/-1
    • View Profile
Re: Pong with pygame
« Reply #5 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.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Pong with pygame
« Reply #6 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?

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Vijfhoek

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 120
  • Rating: +13/-1
    • View Profile
Re: Pong with pygame
« Reply #7 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 :(
« Last Edit: May 26, 2013, 04:48:43 pm by Vijfhoek »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Pong with pygame
« Reply #8 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

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Pong with pygame
« Reply #9 on: June 08, 2013, 12:11:52 am »
What version of Python do I need to play the game?

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: Pong with pygame
« Reply #10 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.
« Last Edit: June 08, 2013, 12:26:41 am by Juju »

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Pong with pygame
« Reply #11 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)

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Pong with pygame
« Reply #12 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 >.>

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!