Jump to content

Recommended Posts

Posted

Hello, I've created custom vehicle entity which is controllable. However I have quite big issue - as soon as I attempt to drive, the entity teleports back few times and then starts moving (while sometimes teleporting a bit). Also when I dismount the entity, it starts teleporting every second until it loses it's velocity. I have been reading few threads about this, but nothing worked. I made whole entity move on both sides, even started sending input packets to have most precise calculations, but nothing works. I'm out of ideas. I have been playing quite a lot with the updateFrequency on registration, but couldn't find anything what would work perfectly, it always had some kind of teleportation issues.

For registration I use the forge event and entry system, with tracking range of 256 blocks and update frequency of 20.

 

If it's helpful there's the entity code:

  Reveal hidden contents

 

Input is being taken from ClientTickEvent and is synced throught packet to the entity - not sure if it's good idea, but I gave it a try, since nothing seemed to work

 

Posted

You may already know this, but an update frequency of 20 means once per second.  The variable is not actually the frequency; it is actually the delay (opposite of frequency).  Ie. it's not 20 updates per tick, it's one update per 20 ticks.  If you haven't tried setting it to 1, go ahead and try it just to see if it resolves the issue or not.  It will give a better idea of where the issue may lie.

 

Iirc, either ridden entities or riding entities (or maybe both?  I can't remember) update every tick (update frequency of 1)...but I could be remembering that wrong.  I know animals use an update frequency of 3, and they're all over the place, so quite honestly having your vehicles update every tick may not be an issue.  This somewhat depends on how many vehicles you expect to be loaded at once I guess, but that falls more into the server admin category imo.

I was going to mention the possibility of rubberbanding if you don't use the built-in motion variables, but it looks like you're doing so.  Still might want to verify them though, just in case they're eg. being transferred *before* you update them each tick or something.

 

Oh, and if your tracker entry does not have "sendVelocityUpdates" set to true, you may want to try setting that to true as well.

Also, if you're doing any position/velocity computation client-side, it may actually be causing conflicts with the normal position/velocity tracking.  First I'd try removing all custom client-side position/velocity and use and update frequency of 1 with velocity updates enabled.  If it works nicely, you can try disabling velocity updates or increasing the delay between updates a bit and see what happens.  If it doesn't work...well then something more complicated is probably going wrong.

Posted

Okay, thanks for suggestion and information, I thought updateFrequency is how often is entity being updated... 

Anyway, I have tried pretty much all values ranging from 1 to 80 and every time I had issues. When I used 1 from what I remember the entity was rubberbanding quite a lot. I will try to move the motion logic on server, to see if it helps, although I'm pretty sure I've seen someone comment here about how it is important to handle motion logic on both sides, and I don't really think there would be different calculations on server and client (but I'm not expert at all). I was even debugging all motion related variables to see if they're the same and they were. I will try to move it on server, if it improves at least a bit I will be happy. Thanks for a lot of information

Posted
  On 3/2/2019 at 10:42 PM, Toma™ said:

I've seen someone comment here about how it is important to handle motion logic on both sides

Expand  

They were absolutely right, but the entity tracker does this automatically, which is why if you also do it, and end up with different values, you will absolutely see rubberbanding, and if that happens then it will be worse at higher update frequencies (eg. when setting it to 1).

Basically you should either be using the built-in entity tracker synchronization, or you should use your own custom synchronization, but not both.  I'd suggest trying the built-in one first because if it works, it's a lot less programming.

  • Like 1
Posted

It appears that moving whole movement logic on server pretty much solved the issue. However the entity still sometimes rubberbands, but I guess thats because of it's speed. I changed the updateFrequency to 1. Thanks a lot for help

Posted

No problem.  And yeah, if it's moving faster than most vanilla stuff you might still notice some rubberbanding.  Hopefully it's not too bad though, because trying to fix it in an accurate way is a pain if you're already at max update frequency (1).

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.