YouGroove Posted February 1, 2015 Share Posted February 1, 2015 Hi, I download Rick's game : Bombkiller that is great base for making TPS games http://www.leadwerks.com/werkspace/page/games/_/bombkiller-r39 Like in the past , the character behaves very laggy and weird, but i found how to have it moving smooth. I just called the function dealing with movement inside of UpdateWorld instead of UpdatePhysics. self:Movement() The only physics the function calls is SetInput(..) So my question is why calling SetInput in UpateWorld behaves very smoothly, while it is very laggy and weird if we call it in UpdatePhysics ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted February 1, 2015 Share Posted February 1, 2015 My understanding is that UpdatePhysics() is called x times a second no matter what the speed of the PC. Meaning sometimes if it needs to be called multiple times in a cycle to catch up or not called at all in a cycle to slow down it will. UpdateWorld() is called every cycle no matter what. It runs as fast as the PC can run. Nice find. I haven't looked at this in some time. Were you able to update the project? Is that why it showed up in a forum post again? If not I can update it to avoid that lag. That always bothered me. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted February 1, 2015 Author Share Posted February 1, 2015 Were you able to update the project? Is that why it showed up in a forum post again? If not I can update it to avoid that lag. That always bothered me. No it's your game, so if you want you can test what i did and upload a new version I remember i had some solution in the past that at final is same way : - a invisible character with SetInput called in UpdatePhysics() - A visible character with no collision, calling GetPosition on invisible character and calling SetPosition in himself in UpdateWorld() using position from invisible character. So the visible character was moving smoothly while invisible character was just dealing with navigation and moving very laggy. So i just found today calling SetInput in UpdateWorld() and your character will move smoothly , this past problem just driven me crazy with tons of tests Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted February 1, 2015 Share Posted February 1, 2015 Tested it out and that worked. Thanks for thinking of the game . re-uploaded with the fix just now! Much more enjoyable now lol 1 Quote Link to comment Share on other sites More sharing options...
YouGroove Posted February 1, 2015 Author Share Posted February 1, 2015 Much more enjoyable now Oh yes I couldnt' believe in the past that physics could behave so werid and laggy as i used other engines and didn't had that problem using simple physics moves also. FPS LE3 demo also uses SetInput in UpdatePhysics, but you see nothing as character is hidden and camera is smoothed. I just unhide the character and moved the camera behind it and its' a laggy physics, then i moved all movement code to UpdateWorld and the character is just moving smoothly in the FPS LE3 demo without needing any smoothing code. I don't know if Josh should not take a look, it's like SetInput is broken when used UpdatePhysics while good and smooth called in UpdateWorld ? Quote Stop toying and make games 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.