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

[Sky/EO2-4] LocalTime Based Movement


SkywardRiver
 Share

Recommended Posts

So, this has long been an issue with Eclipse Engines. If your game is lagging due to too many animated tiles, large maps, autotiles, or whatnot, on a not so great computer you start to notice an increase in movement speed. This tutorial should fix that issue.

It should be noted that I'm not completely sure of this at all. This is outside my realm of experience so any input/feedback on the matter would be greatly appreciated.

This is all Client Sided:

To start off, add these variables to modGlobals

```
Public TimeGetTimeS As Long
Public TimeGetTimeM As Long
```
Next head to modGameLogic and add this:
```
Dim STick As Long
Dim ComTimeS As Long
ComTimeS = 120000
```

Under this:
```
Dim Tmr1000 As Long
```Now add this just below "FrameTime = Tick"

```
' Trying out a new method of processing movement. This will attempt to use computer time rather than program time.
       TimeGetTimeS = Second(Now)

       If TimeGetTimeS > 59 Then
           TimeGetTimeM = TimeGetTimeM + 1
       End If

       STick = (TimeGetTimeS * 1000) + ((TimeGetTimeM + 1) * 60000)

       ComTimeS = ComTimeS + 600 'Edit this number to effect speed.
```

Now find this:
```
' Process input before rendering, otherwise input will be behind by 1 frame

       If ComTimeS > (STick) Then

           For i = 1 To Player_HighIndex
               If IsPlaying(i) Then
                   Call ProcessMovement(i)
               End If
           Next i

           ' Process npc movements (actually move them)
           For i = 1 To Npc_HighIndex
               If Map.NPC(i) > 0 Then
                   Call ProcessNpcMovement(i)
               End If
           Next i

           If Map.CurrentEvents > 0 Then
               For i = 1 To Map.CurrentEvents
                   Call ProcessEventMovement(i)
               Next i
           End If

           ComTimeS = STick - 1000            
       End If
```

Now again, this is just a trial. A test-run, if you will. I'm tired and not sure if I've done this right. Any feedback would be greatly appreciated.
Link to comment
Share on other sites

@'Growlith1223':

> Time based movement within the eclipse engine was more or less an expirement and turned out to be a failure. regardless, good tutorial, I don't see anything wrong with what you have here!

What was wrong with Time based movement? Does it not solve the problem of lag-moving?
Link to comment
Share on other sites

@'Jaxx':

> @'Growlith1223':
>
> > Time based movement within the eclipse engine was more or less an expirement and turned out to be a failure. regardless, good tutorial, I don't see anything wrong with what you have here!
>
> What was wrong with Time based movement? Does it not solve the problem of lag-moving?

It would cause the player to jump around beyond belief, even with a good computer mind you, the client would desync a lot and cause other players to be at like x 10, to x 33 or something, lol
Link to comment
Share on other sites

@'Jaxx':

> Dang xD I thought I was being so clever with this 'fix'.
>
> Hmmm, well we'll see if I use it in EOO. As for everyone else, it's here for use haha.

owait nvm, ignore what I am saying, I thought this was modifying the movement speed, looking into this further, it looks good for what its doing but I actually don't see any difference using timeGetTime vs this method.
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...