Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Not Quite Pong  (Read 31622 times)

0 Members and 2 Guests are viewing this topic.

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Not Quite Pong
« Reply #15 on: July 26, 2008, 04:59:22 pm »
Quote from: "Daazku"
Look REALLY REALLY REALLY better with no v.sync.... Do you clear the scren with 0,0,0,255 ? Because i think that can be why the ball is not perfect.


obviously I have to clear the screen, how else would I do it? still very strange that you get better results without vsync, they're pretty much equal on my pc only that the no-vsync version consumes 98-99% cpu (on a dual core) and the vsync version only 14-20%

Quote
Ps: You reset the score at 100 that not cool !

No, I don't. Scores greater than 100 are merely not displayed correctly :-P (anyways, who plays pong up to a score of 100+??)

Daazku

  • Hero Member
  • *****
  • Posts: 896
    • View Profile
Not Quite Pong
« Reply #16 on: July 26, 2008, 06:48:15 pm »
Me?
Pensez à mettre le tag [Résolu] une fois la réponse à votre question trouvée.
Remember to add the tag [Solved] when you got an answer to your question.

Daazku

  • Hero Member
  • *****
  • Posts: 896
    • View Profile
Not Quite Pong
« Reply #17 on: July 26, 2008, 06:52:40 pm »
Quote from: "l0calh05t"
Quote from: "Daazku"
Look REALLY REALLY REALLY better with no v.sync.... Do you clear the scren with 0,0,0,255 ? Because i think that can be why the ball is not perfect.


obviously I have to clear the screen, how else would I do it? still very strange that you get better results without vsync, they're pretty much equal on my pc only that the no-vsync version consumes 98-99% cpu (on a dual core) and the vsync version only 14-20%

Quote
Ps: You reset the score at 100 that not cool !

No, I don't. Scores greater than 100 are merely not displayed correctly :-P (anyways, who plays pong up to a score of 100+??)


-No i know that. But in the case u didn't clear the screen with 100% that can be a problem.

-Me?

The game take 70% of my cpu.. Try to use the method SetFrameLimit() and use something lie 60.
Pensez à mettre le tag [Résolu] une fois la réponse à votre question trouvée.
Remember to add the tag [Solved] when you got an answer to your question.

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Not Quite Pong
« Reply #18 on: July 26, 2008, 08:36:19 pm »
Quote from: "Daazku"

-No i know that. But in the case u didn't clear the screen with 100% that can be a problem.


Uhmm.. no? I use glClear(GL_COLOR_BUFFER_BIT);, which clears 100% of the viewport. (no matter what alpha value is used)

Quote

-Me?


And if I support scores >99, where should I stop? 999? 9999? Or just keep on increasing the number of digits forever (possibly overwriting the score of the other player)?

Quote
The game take 70% of my cpu.. Try to use the method SetFrameLimit() and use something lie 60.

Are you suggesting to use SetFrameLimit instead of vsync? Doesn't seem to make much sense  :? (of course, i might just not know the reason)

EDIT:
I just tried to use SetFrameLimit(60) instead of UseVerticalSync(true) and the results are absolutely horrible. Tons of tearing, jittery framerate etc. Not very nice...

Daazku

  • Hero Member
  • *****
  • Posts: 896
    • View Profile
Not Quite Pong
« Reply #19 on: July 27, 2008, 07:23:28 am »
Not instead... but personally setFrameLimit work well....

Anyway if your game take all my cpu and the ball is not nicely rendered on my comp that not really my comp the problem.. It's a fucking pong man.. I tested some other project like: http://www.sfml-dev.org/forum-fr/viewtopic.php?t=1082 (WallBreaker)

It take 0% CPU and is WELL rendered.

And personally again... Using thread for your pong is a bad idea.. You don't need it...
Pensez à mettre le tag [Résolu] une fois la réponse à votre question trouvée.
Remember to add the tag [Solved] when you got an answer to your question.

Wizzard

  • Full Member
  • ***
  • Posts: 213
    • View Profile
Not Quite Pong
« Reply #20 on: July 27, 2008, 08:53:46 am »
This is why modern games come with many options. :wink:

In no way is any program guaranteed to run more efficient with or without multithreading and with or without vertical sync on any computer.

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Not Quite Pong
« Reply #21 on: July 27, 2008, 12:53:11 pm »
Quote from: "Daazku"
Not instead... but personally setFrameLimit work well....

Anyway if your game take all my cpu and the ball is not nicely rendered on my comp that not really my comp the problem.. It's a fucking pong man.. I tested some other project like: http://www.sfml-dev.org/forum-fr/viewtopic.php?t=1082 (WallBreaker)


It is rendered perfectly well on my pc (both with and without vsync), so it *does* depend on the computer. If you tell me what kind of configuration you have, maybe I could find out what causes the problem (can't guarantee that, though)

Quote
It take 0% CPU and is WELL rendered.

And personally again... Using thread for your pong is a bad idea.. You don't need it...


I know I don't, but this game is a bit of a platform for experimentation. Better try this kind of stuff in a simple game first, before applying it to more complex games.

EDIT:
New version uploaded with drastically reduced cpu usage (~5% on my pc while the cpu is speedstepped down to 780 MHz)

Daazku

  • Hero Member
  • *****
  • Posts: 896
    • View Profile
Not Quite Pong
« Reply #22 on: July 27, 2008, 05:03:12 pm »
Système d'exploitation   Microsoft Windows XP Professionnel
Type   X86-based PC
Processeur   x86 Family 15 Model 2 Stepping 9 GenuineIntel ~3042 Mhz
Mémoire physique totale   1 536,00 Mo
Mémoire virtuelle totale   2,00 Go
Mémoire virtuelle disponible   1,96 Go
Espace pour le fichier d'échange   1,36 Go

vsync = 50% processor and the ball teleport lag.
vsync = 99% (all) processor and the ball is nearly perfect. (Maybe its the hight contrast balck white...)
Pensez à mettre le tag [Résolu] une fois la réponse à votre question trouvée.
Remember to add the tag [Solved] when you got an answer to your question.

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Not Quite Pong
« Reply #23 on: July 27, 2008, 11:39:08 pm »
Quote from: "Daazku"

Processeur   x86 Family 15 Model 2 Stepping 9 GenuineIntel ~3042 Mhz


Is that a single-core P4? (I suspect using a single-core *could* cause problems if windows' scheduling is being really, really stupid... as it is quite often) With or without HT?

I tested it with cpu affinity set to only one core and cpu usage didn't increase, it actually dropped a little down to ~2%. (my cpu is a 2.2GHz Core 2 Duo mobile)

Quote

vsync = 50% processor and the ball teleport lag.
vsync = 99% (all) processor and the ball is nearly perfect. (Maybe its the hight contrast balck white...)


50% with the current version?? How can that be? It should be sleeping most of the time or waiting for vsync. vsync might be busy-waiting if the driver is badly written, which is the only way I could explain the discrepancy. have you got any way of profiling/testing the code, to help me find the problem? Anyways, thank you for the info.

PS: A slight "doubling" of the ball is also caused because of the high contrast but it isn't too bad on my laptop's screen.

Daazku

  • Hero Member
  • *****
  • Posts: 896
    • View Profile
Not Quite Pong
« Reply #24 on: July 27, 2008, 11:50:10 pm »
Quote from: "l0calh05t"
Quote from: "Daazku"

Processeur   x86 Family 15 Model 2 Stepping 9 GenuineIntel ~3042 Mhz


Is that a single-core P4? (I suspect using a single-core *could* cause problems if windows' scheduling is being really, really stupid... as it is quite often) With or without HT?

I tested it with cpu affinity set to only one core and cpu usage didn't increase, it actually dropped a little down to ~2%. (my cpu is a 2.2GHz Core 2 Duo mobile)

Quote

vsync = 50% processor and the ball teleport lag.
vsync = 99% (all) processor and the ball is nearly perfect. (Maybe its the hight contrast balck white...)


50% with the current version?? How can that be? It should be sleeping most of the time or waiting for vsync. vsync might be busy-waiting if the driver is badly written, which is the only way I could explain the discrepancy. have you got any way of profiling/testing the code, to help me find the problem? Anyways, thank you for the info.

PS: A slight "doubling" of the ball is also caused because of the high contrast but it isn't too bad on my laptop's screen.


Like i said it the with no vsync the game is okai and run well (with the problem of contrast XD) but it take all my cpu. (It's a game so it's not so bad but you should try to reduce that...)

Yes i have a single-core P4 cpu :D. (My pc is old.. 3 years old)
Pensez à mettre le tag [Résolu] une fois la réponse à votre question trouvée.
Remember to add the tag [Solved] when you got an answer to your question.

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Not Quite Pong
« Reply #25 on: July 28, 2008, 11:00:35 am »
Quote from: "Daazku"
Like i said it the with no vsync the game is okai and run well (with the problem of contrast XD) but it take all my cpu. (It's a game so it's not so bad but you should try to reduce that...)

Yes i have a single-core P4 cpu :D. (My pc is old.. 3 years old)


Since the vsync version uses way more CPU than it should and the non-vsync version works better, I suspect your problems are caused by your graphics card driver. Anyways, I just uploaded a version with framerate limit, so you can try that one if you wish. Looks absolutely horrible on my comp though...

EDIT: Also added a non-threaded version.

Daazku

  • Hero Member
  • *****
  • Posts: 896
    • View Profile
Not Quite Pong
« Reply #26 on: July 28, 2008, 02:24:43 pm »
I wanted to test all executable on a laptop but no one start XD.

This application has failed to start because the application configuration is incorrect XD.

Long life to VC++ :P.

Some dll are missing i think....

(On my comp i had vc++ with the .net package and i uninstalled it but i think some dll are remaining).
Pensez à mettre le tag [Résolu] une fois la réponse à votre question trouvée.
Remember to add the tag [Solved] when you got an answer to your question.

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Not Quite Pong
« Reply #27 on: July 28, 2008, 07:40:30 pm »
the dll's are all there afaik... there is only one correct solution to that problem... install the VC90 redistributable package. (Windows checks the C:\Windows\WinSxS directory, for these files if i'm not mistaken...)

http://www.microsoft.com/downloads/details.aspx?displaylang=fr&FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf

Daazku

  • Hero Member
  • *****
  • Posts: 896
    • View Profile
Not Quite Pong
« Reply #28 on: July 28, 2008, 07:47:32 pm »
Ya but that suck HARD and i will not reinstall this #%$#@$% XD.

Long life to VC++
Pensez à mettre le tag [Résolu] une fois la réponse à votre question trouvée.
Remember to add the tag [Solved] when you got an answer to your question.

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Not Quite Pong
« Reply #29 on: July 28, 2008, 08:00:07 pm »
it's not that bad imo. look at it this way: by having one system wide CRT, it can be shared by all apps built using that CRT (smaller exes, less waste of HD space). If you use mingw (or VC static CRT) you are always including parts of the CRT in your exes, which means that if you have many apps built that way, you'll have many copies of the CRT on your disc.

 

anything