in game scheduler
Hello everybody,
Does somebody know where i can find some good resources about programming a scheduler for a game under win32. I want to create a more complex scheduler than a simple round robin.
Thanks in advance,
Plotark
More advanced in what way?
I think you should start out with an easy system, then just add the features you want, like extra data or something.
----------------------------------------------
Petter Nordlander
"There are only 10 kinds of people in the world. The who understand binary and those who don''t"
I think you should start out with an easy system, then just add the features you want, like extra data or something.
----------------------------------------------
Petter Nordlander
"There are only 10 kinds of people in the world. The who understand binary and those who don''t"
I have this approach: I give each subsystem a priority, and in the game loop, I run the highest priority tasks. If enough time is left to maintain a constant frame rate, then I run lower priority tasks. But if a certain amount of time has passed since a task has been last run, say 5 frames, then I temporarily increase the priority so that it definitely runs next frame.
Thanks for your answers.
In fact the thing i don''t know is how to schedule periodic events with my task
manager. For instance my manager is just programmed in a round robin way, it''s
just a loop like:
For each Task
Task->update
RenderTask->update
I want to perform the RenderTask->Update only every 33 ms in order to have a
constant frame rate and to use idle time. But i don''t how to schedule this event under win32.
Any idea?
Perhaps i can have another approach with this problem by using two threads and
the concept of producer and consummer. By using a blit queue like the one presented
by Robert Dunlop (http://www.mvps.org/directx/articles/using_a_blit_queue.htm).
In one thread i have my simple scheduler that update the game and post the
region to blit and in another thread there is a loop like this one:
while(Playing)
{
if(job)
DoBlt()
if(frameReady and (currentTime - lastTime)>33ms))
Flip() (I use DirectDraw)
}
Perhaps I''m still to young (in game programming) to know whether it''s a realistic approach or not.
Thanks in advance
Plotark
In fact the thing i don''t know is how to schedule periodic events with my task
manager. For instance my manager is just programmed in a round robin way, it''s
just a loop like:
For each Task
Task->update
RenderTask->update
I want to perform the RenderTask->Update only every 33 ms in order to have a
constant frame rate and to use idle time. But i don''t how to schedule this event under win32.
Any idea?
Perhaps i can have another approach with this problem by using two threads and
the concept of producer and consummer. By using a blit queue like the one presented
by Robert Dunlop (http://www.mvps.org/directx/articles/using_a_blit_queue.htm).
In one thread i have my simple scheduler that update the game and post the
region to blit and in another thread there is a loop like this one:
while(Playing)
{
if(job)
DoBlt()
if(frameReady and (currentTime - lastTime)>33ms))
Flip() (I use DirectDraw)
}
Perhaps I''m still to young (in game programming) to know whether it''s a realistic approach or not.
Thanks in advance
Plotark
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement