A question for the people who entered the LOTR contest...
I have a question for those people who did entries for the Lord of the Rings contest...
How exaclty do you time your scenes? How did you go about displaying a scene for a set amount of time, then switch to the next scene? Did you use WM_TIMER messages set to really large intervals like 30 seconds or so? Did you just time the scene based on the movement of objects, as in waiting to change the scene when a certain object moves past a certain point?
Moe''s site
preformance timer. and kept all logic code running through 100 times second... with a ''step'' counter.. so when step==100, thats 1 second in. etc.
http://www.riptorn.8m.com
http://www.riptorn.8m.com
Check my entry, there is script file of the form:
/until runscene
10 scene1
20 scene2
30 scene3
I load this into an array when I init, setup an index to the 1st entry, and run its scene (scene1). I use glut timer to check every frame if timeSeconds>timeInCurrentIndex (10 in the 1st case), when that happens, I bump up the index and run index 2''s scene (scene2), etc.
To do an interscene dim, I trigger dimming a certain amount of time before the next switch time, i.e. if I program a 2 second dim (none to black to none) I trigger the dim 1 second before the current index time, or 9 seconds for the 1st index, so from 9-11 I am dimming, 10 is the darkest point, and that is when the scene switches (bump "effectn" var which is used in a switch statement to run the nth scene).
zin
zintel.com - 3d graphics & more or less
/until runscene
10 scene1
20 scene2
30 scene3
I load this into an array when I init, setup an index to the 1st entry, and run its scene (scene1). I use glut timer to check every frame if timeSeconds>timeInCurrentIndex (10 in the 1st case), when that happens, I bump up the index and run index 2''s scene (scene2), etc.
To do an interscene dim, I trigger dimming a certain amount of time before the next switch time, i.e. if I program a 2 second dim (none to black to none) I trigger the dim 1 second before the current index time, or 9 seconds for the 1st index, so from 9-11 I am dimming, 10 is the darkest point, and that is when the scene switches (bump "effectn" var which is used in a switch statement to run the nth scene).
zin
zintel.com - 3d graphics & more or less
zintel.com - 3d graphics & more or less
Code copied directly from mine:
Basically, an array of structs that holds the scenes draw function and its start time (in seconds). Once its start time is reached, it is run, and only 1 scene is run at a time.
-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
typedef struct{ float time; void (*function)(void);} scene_t;#define SCENE_COUNT 6scene_t scenes[] = { 0, Scene1_DrawFrame, 23, Scene2_DrawFrame, 44, Scene3_DrawFrame, 65, Scene4_DrawFrame, 75, Scene5_DrawFrame, 99, Scene6_DrawFrame, 130, NULL};void GL_BeginFrame(){ if (gametime < scenes[scene+1].time) scenes[scene].function(); else { scene++; if (scene == SCENE_COUNT) quit=true; }}
Basically, an array of structs that holds the scenes draw function and its start time (in seconds). Once its start time is reached, it is run, and only 1 scene is run at a time.
-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
-----------------------"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else's drivers, I assume it is their fault" - John Carmack
Just check timer.h in mine. (baldur karlsson)
------------------------------
Baldur K
"Hey! I hate these Microsoft guys! What a rotten compiler! It only accepts 16,384 local variables in a function!"
------------------------------
Baldur K
"Hey! I hate these Microsoft guys! What a rotten compiler! It only accepts 16,384 local variables in a function!"
Mine is the worst. This is what you must never try to do:
I used a bunch of if statements like this
So. When I want to change the duration of the first scene I also have to change all the others.
I wanted to make a new timing system but I thought there wasn't enough time. But I was wrong since I lost more just by calculating the values of my IFs.
[edited by - __ALex_J_ on May 8, 2002 8:24:23 PM]
I used a bunch of if statements like this
if (time_elapsed>=0 && time_elapsed<1200) ...if (time_elapsed>=1200 && time_elapsed<2000) ......
So. When I want to change the duration of the first scene I also have to change all the others.
I wanted to make a new timing system but I thought there wasn't enough time. But I was wrong since I lost more just by calculating the values of my IFs.
[edited by - __ALex_J_ on May 8, 2002 8:24:23 PM]
Ah, thanks for the replies guys!
Its interesting to see how someone else does thier timing. Right now I don''t have any specific timing code for scenes other than my standard timer that checks for 1/30th of a second. I use it to time all my input to make sure my program isn''t getting input at the same rate as my frames per second. For example, if the user hits the escape key, I don''t want my program (in the future) to jump from the in game menu to the exit game confirmation, just because the user kept his/her finger on the escape key for 1/10th of a second.
I also wrote a one second timer (it still needs to be tested). So every 1 second, the timer fires. Along with this is my variable interval timer that fires when the specific interval of time has passed. I still need to work a little on this one.
Its always interesting to see how someone else does a similar functioning piece of code. Its interesting to see how different people accomplish the same thing with different implementations.
Moe''s site
Its interesting to see how someone else does thier timing. Right now I don''t have any specific timing code for scenes other than my standard timer that checks for 1/30th of a second. I use it to time all my input to make sure my program isn''t getting input at the same rate as my frames per second. For example, if the user hits the escape key, I don''t want my program (in the future) to jump from the in game menu to the exit game confirmation, just because the user kept his/her finger on the escape key for 1/10th of a second.
I also wrote a one second timer (it still needs to be tested). So every 1 second, the timer fires. Along with this is my variable interval timer that fires when the specific interval of time has passed. I still need to work a little on this one.
Its always interesting to see how someone else does a similar functioning piece of code. Its interesting to see how different people accomplish the same thing with different implementations.
Moe''s site
This is very helpful, this is what I have found the hardest part of OpenGL. Using timers and putting it all into something that works!
Wow... I tought gettickcount was the only way... well I''m using it right now and it works pretty good.
Alex :: I did a nice way to outcome your problem. I use a START_DIPS variable. each time a scene finishes it fills START_DISP with GetTickCount. so when the next scene starts STAT_DISP - GetTickCount = time elapsed for that scene only.
This should work on common machines.
Alex :: I did a nice way to outcome your problem. I use a START_DIPS variable. each time a scene finishes it fills START_DISP with GetTickCount. so when the next scene starts STAT_DISP - GetTickCount = time elapsed for that scene only.
This should work on common machines.
Help me with my Isometric OpenGL engine.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement