StOneDOes Posted Sunday at 08:45 AM Share Posted Sunday at 08:45 AM I'm not sure I understand the documentation for this function World::Update(). The first param is: frequency number of updates per second I would have thought that this would not be necessary, rather you would just call this function on each game frame? Think of a game server where you are essentially simulating the world, and likely capping the FPS to a suitable amount - lets say 100 frames per second. Do I call world->Update( 100 ) in some arbitrary place, or do I just called world->Update() on each frame, which is already capped out at 100 frames per second by some thread sleeping code that already ran in the given iteration of the game loop? What happens if I call world->Update( 100 ) on each game loop iteration? Quote Link to comment Share on other sites More sharing options...
Dreikblack Posted Sunday at 09:02 AM Share Posted Sunday at 09:02 AM Game logic runs in own thread with 60 Hz by default. This param can change it. FPS can be way higher, but game logic would still run with this stable frequency. Most likely internally at the very end of what Update is doing sleep with left time till next game cycle iteration happens. 1 Quote Link to comment Share on other sites More sharing options...
StOneDOes Posted yesterday at 08:08 AM Author Share Posted yesterday at 08:08 AM Ok thanks for the repply, but how is it running in its own thread if I'm calling the Update() function? I guess this begs the question, of what happens if I do not call World::Update()? I'm not sure that this will be suitable for a game server, unless I don't understand correctly. I need to be able to simulate/update the world on command, and essentially pause simulation when I want, so that I can rewind play for things like lag compensation. If objects are still being moved around the world while I'm doing hit calculating then this would end badly. I hope I'm just misunderstanding here. Unless @Josh can you please provide a breakdown of how threads are handling things in the breakdown, thanks Quote Link to comment Share on other sites More sharing options...
Dreikblack Posted yesterday at 08:17 AM Share Posted yesterday at 08:17 AM From my understanding World::Update do update physics, calls components Update() methods, etc. There are undocumented methods Update() and Resume() for World, which probably is what you you need to be sure that nothing will happen even without calling Wolrd::Update(). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.