Re: [pygame] time progression independent of game "ticks"

2007-07-20 Thread Greg Ewing
Michael George wrote: Having recently taught a data structures course I'm forced to point out that for some number of fish, inserting into the queue will become a bottleneck, Actually, it's not the number of fish that determines when this will become a bottleneck, but the typical number of eve

Re: [pygame] time progression independent of game "ticks"

2007-07-20 Thread Patrick Mullen
Yeah, a time queue is the way to go, don't bother with threads. On each update, you can get the current time (pygame.time, or pygame.clock), and pass that into your time queue. The time queue, will look something like this: [(5.0,eat,fish1),(6.5,eat,fish2)] At each iteration, you continue to p

Re: [pygame] time progression independent of game "ticks"

2007-07-20 Thread Michael George
Having recently taught a data structures course I'm forced to point out that for some number of fish, inserting into the queue will become a bottleneck, and you're better off using a priority queue (heap). --Mike Laura Creighton wrote: The first time I did something like that I made a fish cl

Re: [pygame] time progression independent of game "ticks"

2007-07-20 Thread Dave LeCompte (really)
"Simon Wittber" <[EMAIL PROTECTED]> > On 7/20/07, Daniel Nixon <[EMAIL PROTECTED]> wrote: >> What is the best way to go about such a thing? Use MVC and run the >> model in its own thread? If that is the case what is the best way to >> keep track of the passage of actual time within the model? > > T

RE: [pygame] time progression independent of game "ticks"

2007-07-20 Thread Chris Ashurst
[mailto:[EMAIL PROTECTED] Behalf Of Daniel Nixon Sent: Friday, July 20, 2007 00:20 To: pygame-users@seul.org Subject: [pygame] time progression independent of game "ticks" Hi list, I'm working on a game in which the player looks after a fishtank full of fish. Each fish ages, gestates

Re: [pygame] time progression independent of game "ticks"

2007-07-20 Thread Laura Creighton
The first time I did something like that I made a fish class which did things like get-hungry. Each fish stored its time of creation and time of last feeding, mating, egg-laying etc. Then I kept doing: for every fish: check the time of day, and update the fishes' state

Re: [pygame] time progression independent of game "ticks"

2007-07-20 Thread Simon Wittber
On 7/20/07, Daniel Nixon <[EMAIL PROTECTED]> wrote: What is the best way to go about such a thing? Use MVC and run the model in its own thread? If that is the case what is the best way to keep track of the passage of actual time within the model? This may or may not help: http://entitycrisis.b

Re: [pygame] time progression independent of game "ticks"

2007-07-19 Thread Dave LeCompte (really)
"Daniel Nixon" <[EMAIL PROTECTED]> wrote: > What advantage does calling pygame.time.wait() have over simply > lowering the frame rate passed to .tick()? I should really leave this one for folks who have been deeper into the SDL C code, but my understanding is that (at least until recently) for sma

Re: [pygame] time progression independent of game "ticks"

2007-07-19 Thread Daniel Nixon
I've been using something like myClock.tick(60), but that's for no other reason than 60 seems to be popular in most of the examples I've read. I doubt my game will require such a high frame rate. Aiming for 60fps seems to cause the game to take an entire core for itself, but using your wait time

Re: [pygame] time progression independent of game "ticks"

2007-07-19 Thread Dave LeCompte (really)
"Daniel Nixon" <[EMAIL PROTECTED]> wrote: > Thanks Ian, Dave. Passing down the milliseconds sounds like the way to > go. Thanks for the great advice. :) Actually, let me refine my suggestion. Back a month or more ago, I kicked off the whole "a CPU is not a saw" thread with a discussion very simil

Re: [pygame] time progression independent of game "ticks"

2007-07-19 Thread Ian Mallett
OK, I agree, it is probably not the most accurate way to do it, I'm assuming that the problem is that the game won't run basically the same speed and cumulative errors aren't relevant (ex: the speed the fish swims won't be exactly the same but close enough). Ian

Re: [pygame] time progression independent of game "ticks"

2007-07-19 Thread Daniel Nixon
Thanks Ian, Dave. Passing down the milliseconds sounds like the way to go. Thanks for the great advice. :) On 7/20/07, Dave LeCompte (really) <[EMAIL PROTECTED]> wrote: "Ian Mallett" <[EMAIL PROTECTED]> wrote: > You could try: > "http://www.pygame.org/docs/ref/time.html#pygame.time.Clock"; > wit

Re: [pygame] time progression independent of game "ticks"

2007-07-19 Thread Dave LeCompte (really)
"Ian Mallett" <[EMAIL PROTECTED]> wrote: > You could try: > "http://www.pygame.org/docs/ref/time.html#pygame.time.Clock"; > with Clock.tick(framerate) which would normalize the speed of the program > on any computer. I wouldn't go about it that way - tick(framerate) tries to achieve the framerate,

Re: [pygame] time progression independent of game "ticks"

2007-07-19 Thread Ian Mallett
You could try: "http://www.pygame.org/docs/ref/time.html#pygame.time.Clock"; with Clock.tick(framerate) which would normalize the speed of the program on any computer. Then you wouldn't have to deal with any of the annoying stuff. Of course this means that cutting edge computers would have no fa

[pygame] time progression independent of game "ticks"

2007-07-19 Thread Daniel Nixon
Hi list, I'm working on a game in which the player looks after a fishtank full of fish. Each fish ages, gestates while pregnant, grows hungrier, etc. For arguments sake lets say 15 minutes = 1 fish year. I want this passage of time to be independent of frame rate and iterations through the main g