[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Problem clock.tick() and Threads
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Problem clock.tick() and Threads
- From: Juju Cece <jujucece@xxxxxxxxx>
- Date: Mon, 24 Oct 2005 11:45:02 +0200
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Mon, 24 Oct 2005 05:45:15 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=OxNHrmLii6o1FX2QeqVwoXQtAcD0dfv1DVVlnIf8Eupqd/MgM+d+angvsksMRAjMXtQ1uxo+n1gQI2qeUSyfLAX+l1VRkDLplMoQ2RhGhmyUkGYFxIlEi/Zc3hhdcC7+SLDx5hJ+1yOs5WSr9hEYpig62/zUhS1bCd9LqWVJVDA=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Hi,
I'm developping a Racing Top View Game (pyRacerz) and I want to add a
Network Game Feature.
To do that, I've created 2 Threads: 1 to receive datas and 1 to send.
On my main Loop I use:
clock.tick(100)
To limit the FPS (but I update the Frame 1 time on 2)
The problem is, when I use "clock.tick(100)", the Threads don't run,
because I think, there's not enough CPU.
If I substitute "clock.tick(100)" by "pygame.time.wait(10)", the
Threads work well...
But I want a precise FPS to have a smooth and playable game.
The problem comes, I think, from the pygame.time.delay" function which
is surely used by the clock.tick(100), and which consumes a high
amount of CPU.
Do you have an idea on how I can solve my problem ?
(Perhaps twisted will solve the problem, but I don't wanttoo much dependencies)
Thanks in advance,
Jujucece