Sign in to follow this  

new to game programming and have questions:

This topic is 4249 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

so over the weekend, my friend and I downloaded ogre3d and started going through the basic tutorials(creating cameras, loading different mesh files, changing scenes and lighting). we plan on creating our first game, pong, using this engine. i guess i am first trying to understand how times, graphics, and frames all relate to each other. for example for a smooth animation, ive read that 60 frames per second is good. now in the program, there are frame listeners. now when there is input from the user (like moving the paddle to the left), that action ( keyboard being pressed) is attached to the frame? so in the program, you look at the current frame and check to see if there was an action performed, according to that action, you program will update coordinates of the paddle, and the next frame, the paddle is now displayed in the new position? is this sort of correct? now displaying frames is also sometimes refered to as rendering? this frame rate of 60times per second, is this also saying that your function call to display the frame is being called 60 times a second?

Share this post


Link to post
Share on other sites
Baker,

I'll try and answer each component of your question individually. However, before I do I'd like to point you in this direction. There you'll find answers to your most common questions.

Quote:

i guess i am first trying to understand how times, graphics, and frames all relate to each other.

In a general sense, time, graphics, and frames are all inter-dependant upon each other. From the moment your game begins to execute, until the game terminates - time is elapsing. As time is elapsing, your game is going through what is referred to as the "main game loop." This is a tight inner loop generally executed from function 'main()' which cycles over the processing of a computer game. This includes: checking for keyboard input, handling AI logic, updating sound queues, updating transforms for skeletal animation, etc....and finally, drawing the sprites, models, etc...to the screen.

Each time your main loop goes through one iteration, that is generally considered 1 frame. So each frame you are processing the state of the world, and at the end of each frame you're drawing the scene to the screen. This drawing operation is referred to rendering or drawing the "graphics." Now, as I said, each time your game goes through 1 inner loop it is referred to as a "frame." The number of times your game is capable of iterating over the main loop per second is the frame-rate (frames per second).

Now, this is all well and good for you, and is an acceptable answer. Someone will likely point out that the above is an over simplification and that you can get multiple passes through the main loop for every 1 draw call, dont worry about it. For now, the above is perfectly fine.

Quote:

for example for a smooth animation, ive read that 60 frames per second is good. now in the program, there are frame listeners. now when there is input from the user (like moving the paddle to the left), that action ( keyboard being pressed) is attached to the frame?

I'm not quite sure if you're asking in general, or withy Ogre3D in specific. In general, 60 fps is pretty good. Each frame (pass through the main loop) you check to see if a keyboard or mouse button either IS pressed, or was pressed since the last time you came through the main loop. In this way, you catch any keyboard or mouse presses that occured during the last 60th of a second.

Now, with Ogre3D in specific. I believe they have "listeners" and "notifiers" which are functions which get called whenever something happens. You register with the Ogre3D engine to tell it which of your functions to call whenever it detects a mouse or keyboard event, and you tell it which function to call whenever its time to render the scene. In this way, the inner game loop is hidden from you and you must only concern yourself with what to do when a button is pressed, and what to do when its time to draw.

Quote:

so in the program, you look at the current frame and check to see if there was an action performed, according to that action, you program will update coordinates of the paddle, and the next frame, the paddle is now displayed in the new position? is this sort of correct?

Yeah. Pretty much exactly correct. You either check or get notified of a keyboard event...you then update the position of the paddle based on the key that was pressed, and the next time you clear the screen and re-draw the paddle it will be in its new position.

Quote:

now displaying frames is also sometimes refered to as rendering? this frame rate of 60times per second, is this also saying that your function call to display the frame is being called 60 times a second?

Yes! =) You're exactly correct. 60 FPS means that a frame of animation, that is - one draw call, is happening 60 times per second. But just calling the draw routine 60 times in a row wouldnt do you any good, because nothing will have changed in between those 60 calls. So more specifically, 60 fps means 60 times reading keyboard input, updating positions, and THEN drawing. =)

Cheers and good luck!

Share this post


Link to post
Share on other sites
hi thanks for the reply. your post made things a little more clearer. i guess to fully understand, i will just have to get crackin at development!


Share this post


Link to post
Share on other sites

This topic is 4249 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this