Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[Experimental] Server/Client Player Movement Desync Fix


balliztik1
 Share

Recommended Posts

  • Replies 54
  • Created
  • Last Reply

Top Posters In This Topic

Right, edited up the client.

Try this, seems to work.

Change the packet to this:

```
    If (casestring = "playernewxy") Then
        NewPosX = Val(parse(1))
        NewPosY = Val(parse(2))
        IsNewPos = True

        Exit Sub
    End If
```
Find:

```
Call CheckMovement
```
In gameloop

Add this above it:

```
            ' Check if X and Y is the same
            If Player(MyIndex).Moving > 0 Then
                If IsNewPos = True Then
                    If Not GetPlayerX(MyIndex) = NewPosX Then SetPlayerX MyIndex, NewPosX
                    If Not GetPlayerY(MyIndex) = NewPosY Then SetPlayerY MyIndex, NewPosY
                    IsNewPos = False
                End If
            End If
```
Add these in modGlobals:

```
' Position buffer
Public NewPosX As Long
Public NewPosY As Long
Public IsNewPos As Boolean
```
Link to comment
Share on other sites

@Robin:

> Eh, in that case I'll try it out.
>
> I can't see it being a problem in theory, but I'll have a look.

Heh, and your telling me I didn't test it out ;)
In theory this all looks very nice… thats why I made this myself... but it ended up the same.

Thanks for making a new fix tho, i wouldn't have seen it in that way.
Link to comment
Share on other sites

@Tyr:

> Heh, and your telling me I didn't test it out ;)
> In theory this all looks very nice… thats why I made this myself... but it ended up the same.
>
> Thanks for making a new fix tho, i wouldn't have seen it in that way.

Yeah, sorry about that. I'm used to people posting before actually testing things out :x
Link to comment
Share on other sites

Well, I can't seem to get it to jump. Though, to be fair, I did do all my testing on a fairly new Alienware computer with high-speed internet as well.

I'm going to try this on the laptop and observe. I might need a couple testers to connect to me. If you want to help with this, PM me and I'll give out server details.

I'm surprised at how this is acting. The theory behind it seems rather simple, yet it just screws things up worse. Well, this is why I labeled it as experimental, I suppose.
Link to comment
Share on other sites

@♪♫♪:

> Well, I can't seem to get it to jump. Though, to be fair, I did do all my testing on a fairly new Alienware computer with high-speed internet as well.
>
> I'm going to try this on the laptop and observe. I might need a couple testers to connect to me. If you want to help with this, PM me and I'll give out server details.
>
> I'm surprised at how this is acting. The theory behind it seems rather simple, yet it just screws things up worse. Well, this is why I labeled it as experimental, I suppose.

It's down to syncing, yet again. You're just assuming that by the time the packet is received, the player is moving in time.

The way I posted buffers the change until the player gets to a suitable point, so it should remove the jerking.
Link to comment
Share on other sites

well, your way does work when you dont use warppoints robin, but when you do use them, it warps to new map, and then decides to set teh x and y right for the player.

it warped me across a whole map ^^
so, i think its needs still a little work :)

Damian666
Link to comment
Share on other sites

@Damian666:

> well, your way does work when you dont use warppoints robin, but when you do use them, it warps to new map, and then decides to set teh x and y right for the player.
>
> it warped me across a whole map ^^
> so, i think its needs still a little work :)
>
> Damian666

I just tested Robin's and its working fine. Warps work fine, moving around doesnt make it jumpy, and it fixes the problem.
Link to comment
Share on other sites

aaaah, nevermind, i got it.

i added it to modhandledata.

when it gets a new map, it sets it to false now.
this fixes the warps for me :)

all is well now, player jumps 1 time after mapswitch, to re-set the position, after that, all is well.

i like it ^^

Damian666
Link to comment
Share on other sites

Btw for those who fell onto this thing and want to try it, dont bother. Unlike what it says in the first post, this is NOT stable. Ive tryd it yesterday and the player movement becomes extremely screwed up.

Im saying this because i know Aksel J wanted to put this in 2.8 and such and i hope he doesnt. I like the effort put into this and keep up the good work but fix the movements
Link to comment
Share on other sites

@Damian666:

> well… for me personally it works great, it doesnt hang anymore, sure, sometimes it jumps...
>
> but it beats hanging on mapswitch ^^
>
> Damian666

you don't notice the effect local host its only when your connecting to the server from another network that you get huge issues with jumping me and dan tried it.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×
×
  • Create New...