Jump to content
  • Advertisement
Sign in to follow this  
n123q45

Fixing client lag (delay movement)? (any math wizzes plz help)

This topic is 1331 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

ok, heres what I'm doing: I have a model spawned and I have a for loop that will keep setting it to the player's location every .05 seconds (minimun time allowed by the engine)... And it works fine, but if you move too fast or spin too fast, it will be like a second behind the player, causing it to go through the player. The language is called GSC ( Call of Duty's personal language), but it is alot like other scripting languages. Heres my script and I want to know if anyone can think of any ways to do it. My friend has done it and figured it out while he was scripting in Javascript (i think). Then he converted it to GSC. But he wont tell me how he did it so... I would like to figure out it. 

for(;;)
{
  model.origin = self.origin + (0,0,50);
  model.angles = self.angles;
  wait(.05);
}

self is the player, and model is my model that will lag into the player when moving fast (aka sprinting). .origin and .angles are already defined via the engine. This is a picture of what the model looks like on a playermodel (this is not the player because I did not have third person available when I built the mod). 

hyK9l.jpg

 

 

I hope someone could help think of a way to stop it from entering the player

Edited by n123q45

Share this post


Link to post
Share on other sites
Advertisement
I'm not familiar with the scripting system you're using, but traditionally script engines have a "per frame" callback that is invoked every time the game engine updates. You should look for such a way to run code - every game frame instead of every 0.05 seconds. That is the best way to correct the problem.

[edit] Afterthought: if the engine allows you to simply specify that one model should be attached to another, e.g. through a scenegraph, you should do that instead of trying to script in the behavior. Edited by ApochPiQ

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!