Jump to content

SetInput better be called in UpdateWord


YouGroove
 Share

Recommended Posts

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 ?

Stop toying and make games

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 smile.png

 

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 laugh.png

Stop toying and make games

Link to comment
Share on other sites

Much more enjoyable now

Oh yes biggrin.png

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 ?

Stop toying and make games

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...