Horde3D

Next-Generation Graphics Engine
It is currently 09.11.2024, 01:13

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: 18.09.2012, 11:23 
Offline

Joined: 23.07.2009, 21:03
Posts: 51
Location: Germany
Since there sadly is no GameEngine specific subforum I'll post this topic here in the "General Discussion" forum:

Over the last couple of weeks implementing new components I started to realize I really should separate my render() and my GameUpdate().

The current GameEngine::Update() works like this (please correct me if I'm wrong!):

Update the GameEngine timer:

Update the component managers, which triggers
  1. the render() function in the scenegraph manager, which calls the h3drender using the active camera, and "Reset OpenGL camera so other components can render their content too"
  2. Then the run() methods of all components get called (using OpenMp)
  3. Then the update() gets called on every manager (using the order specified in the plugin.cfg)
  4. and at last we call render() on all components, excluding the scengraphcomponents.


The complete game loop in the demo apps is:

Every frame:
  • KeyStateHandler(); // handle keyboard input;
  • Update the GameEngine() // render + gameloop, as described above
  • glfwSwapBuffers(); // triggers glfwPollEvents -> getting keyboard/mouse/etc input

Now the way I see it, with the current way the GameEngine works, it is rather difficult to separate my GameLoop (handling user input, updating the game state, handling AI, playing sounds, etc) from my render loop.

What I want is a fixed time step implementation, updating my game about 30 times per second, and render it as often is I can (and in the process, remove unnecessary timers, since at the moment we have the Horde3D timer, the GameEngine timer, the GLFW timer, and the bullet physics timer being used).

Basically this: http://lspiroengine.com/?p=378

More detailed information is linked to in the post:

http://gafferongames.com/game-physics/f ... -timestep/
http://www.koonsolo.com/news/dewitters-gameloop/

To realize this, seperating the public GameEngine::Update() into
GameEngine::Update() //calling run() and update()
GameEngine::Render()
should work.

But now we have the problem of not having any interpolation regarding animation/transformation of entities.
Meaning if I update my game loop 30 times per second, and render at 120fps, particles, which get rendered by Horde3D, get updated every frame, but everything else would have the same position for 4 frames.

Hence I'd have to rewrite the scenegraph and animation component to support interpolation, and update those two components every frame as well, complicating the GameEngine::Update() function with "special cases".

So what I'm looking for from you guys is some input on whether my thought process is correct, what I missed, and ways to realize this.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group