• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ TFS 1.5 - 8.60 Walk Delay.

Mythana

New Member
Joined
Dec 9, 2021
Messages
8
Reaction score
4
Hi, I'm using TFS 1.5 8.60. I'm having a problem with walking, there's a delay every 10 steps. I've checked before, someone else had the same problem as me but nobody managed to fix it.

This thread: TFS 1.X+ - [8.0 dg by nekiro] [TFS 1.5] Walking lag/delay (https://otland.net/threads/8-0-dg-by-nekiro-tfs-1-5-walking-lag-delay.287890/)

Whenever I use a map that is over 30MB it starts doing that. I doubt it could be because of the VPS specs, I'm using a highend one. Thanks for the help in advance.
 
It's pretty simple and the problem is solved. Just go to creature.cpp and find
this line.
C++:
//diagonal extra cost
lastStepCost = 3;
to
C++:
//diagonal extra cost
lastStepCost = 2;

other line.

C++:
int64_t Creature::getStepDuration() const
{
    if (isRemoved()) {
        return 0;
    }

    uint32_t groundSpeed;
    int32_t stepSpeed = getStepSpeed();
    Item* ground = tile->getGround();
    if (ground) {
        groundSpeed = Item::items[ground->getID()].speed;
        if (groundSpeed == 0) {
            groundSpeed = 150;
        }
    } else {
        groundSpeed = 150;
    }

    double duration = std::floor(1000 * groundSpeed) / stepSpeed;
    int64_t stepDuration = std::ceil(duration / 50) * 50;

    const Monster* monster = getMonster();
    if (monster && monster->isTargetNearby() && !monster->isFleeing() && !monster->getMaster()) {
        stepDuration *= 3;
    }

    return stepDuration;
}
to.
C++:
int64_t Creature::getStepDuration() const
{
    if(isRemoved()) {
        return 0;
    }

    uint32_t groundSpeed;
    int32_t stepSpeed = getStepSpeed();

    Item* ground = tile->getGround();
    if (ground) {
        groundSpeed = Item::items[ground->getID()].speed;
        if (groundSpeed == 0) {
            groundSpeed = 150;
        }
    } else {
        groundSpeed = 150;
    }

    int64_t stepDuration = (1000 * groundSpeed) / stepSpeed;

    const Monster* monster = getMonster();
    if (monster && monster->isTargetNearby() && !monster->isFleeing() && !monster->getMaster()) {
        stepDuration *= 3;
    }

    return stepDuration;
}
Recompile, and you're all set—enjoy! @Fabi Marzan and I worked on it until we got it right; it was just this simple fix that made it work well. His map is massive, 35k x 35k, and it runs smoothly. My map is 2500 x 2500, and it runs perfectly.
 
It's pretty simple and the problem is solved. Just go to creature.cpp and find
this line.
C++:
//diagonal extra cost
lastStepCost = 3;
to
C++:
//diagonal extra cost
lastStepCost = 2;

other line.

C++:
int64_t Creature::getStepDuration() const
{
    if (isRemoved()) {
        return 0;
    }

    uint32_t groundSpeed;
    int32_t stepSpeed = getStepSpeed();
    Item* ground = tile->getGround();
    if (ground) {
        groundSpeed = Item::items[ground->getID()].speed;
        if (groundSpeed == 0) {
            groundSpeed = 150;
        }
    } else {
        groundSpeed = 150;
    }

    double duration = std::floor(1000 * groundSpeed) / stepSpeed;
    int64_t stepDuration = std::ceil(duration / 50) * 50;

    const Monster* monster = getMonster();
    if (monster && monster->isTargetNearby() && !monster->isFleeing() && !monster->getMaster()) {
        stepDuration *= 3;
    }

    return stepDuration;
}
to.
C++:
int64_t Creature::getStepDuration() const
{
    if(isRemoved()) {
        return 0;
    }

    uint32_t groundSpeed;
    int32_t stepSpeed = getStepSpeed();

    Item* ground = tile->getGround();
    if (ground) {
        groundSpeed = Item::items[ground->getID()].speed;
        if (groundSpeed == 0) {
            groundSpeed = 150;
        }
    } else {
        groundSpeed = 150;
    }

    int64_t stepDuration = (1000 * groundSpeed) / stepSpeed;

    const Monster* monster = getMonster();
    if (monster && monster->isTargetNearby() && !monster->isFleeing() && !monster->getMaster()) {
        stepDuration *= 3;
    }

    return stepDuration;
}
Recompile, and you're all set—enjoy! @Fabi Marzan and I worked on it until we got it right; it was just this simple fix that made it work well. His map is massive, 35k x 35k, and it runs smoothly. My map is 2500 x 2500, and it runs perfectly.
Still the same, it skips 1 step and 'lags' for .1 second then resumes. Thanks for trying to help tho.
 
@Mateus Robeerto, @Fabi Marzan, @Mythana

I am running TFS 1.5 7.72 Nekiro Downgrade and have tried all your suggested solutions and I am still stuttering with a 90MB world map. Smaller maps work fine and doesnt affect the characters walking.

I tried the above but still stutters. I also tried what Fabi suggested in another thread, lowering max movement speed and a slightly different Creature::getStepDuration() const function. But still the same issue.

Anyone with a solution or have you guys solved it in some other way? :(
Thankful for any kind of help!
 
Same here as the 2 above.
Any help would be greatly appreciated, its a small but very much significant issue and has already driven me crazy.
Thanks in advance!
 
which client are you guys using? this is very important for troubleshoot this. before anything, try on cipsoft one to see if it behaves correctly. otcv8 doesn't have it correctly settled up if i'm not wrong, and mehah otclient has this option otclient/data/setup.otml at main · mehah/otclient (https://github.com/mehah/otclient/blob/main/data/setup.otml#L21) that changes walking formula (false for older protocols, since it uses less frames than newer versions).
I am using otcv8 and have customized the client so far that I don't want to change/abandon it. :(
Is there any way to make it smooth on otcv8 if the issue is not on server side? Reminder that the issue happens whenever you load a big world map, otherwise it's fine.

Here is walking.lua on otcv8 client side, unfortunately I did not find anything close to "force-new-walking false/true":


LUA:
smartWalkDirs = {}
smartWalkDir = nil
wsadWalking = false
nextWalkDir = nil
lastWalkDir = nil
lastFinishedStep = 0
autoWalkEvent = nil
firstStep = true
walkLock = 0
walkEvent = nil
lastWalk = 0
lastTurn = 0
lastTurnDirection = 0
lastStop = 0
lastManualWalk = 0
autoFinishNextServerWalk = 0
turnKeys = {}

function init()
  connect(g_game, { onTeleport = onTeleport })
 
  connect(LocalPlayer, {
    onPositionChange = onPositionChange,
    onWalk = onWalk,
    onWalkFinish = onWalkFinish,
    onCancelWalk = onCancelWalk
  })

  modules.game_interface.getRootPanel().onFocusChange = stopSmartWalk
  bindKeys()
end

function terminate()
  disconnect(g_game, { onTeleport = onTeleport })
 
  disconnect(LocalPlayer, {
    onPositionChange = onPositionChange,
    onWalk = onWalk,
    onWalkFinish = onWalkFinish
  })
  removeEvent(autoWalkEvent)
  stopSmartWalk()
  unbindKeys()
  disableWSAD()
end

function bindKeys()
  bindWalkKey('Up', North)
  bindWalkKey('Right', East)
  bindWalkKey('Down', South)
  bindWalkKey('Left', West)
  bindWalkKey('Numpad8', North)
  bindWalkKey('Numpad9', NorthEast)
  bindWalkKey('Numpad6', East)
  bindWalkKey('Numpad3', SouthEast)
  bindWalkKey('Numpad2', South)
  bindWalkKey('Numpad1', SouthWest)
  bindWalkKey('Numpad4', West)
  bindWalkKey('Numpad7', NorthWest)

  bindTurnKey('Ctrl+Up', North)
  bindTurnKey('Ctrl+Right', East)
  bindTurnKey('Ctrl+Down', South)
  bindTurnKey('Ctrl+Left', West)
  bindTurnKey('Ctrl+Numpad8', North)
  bindTurnKey('Ctrl+Numpad6', East)
  bindTurnKey('Ctrl+Numpad2', South)
  bindTurnKey('Ctrl+Numpad4', West)
end

function unbindKeys()
  unbindWalkKey('Up', North)
  unbindWalkKey('Right', East)
  unbindWalkKey('Down', South)
  unbindWalkKey('Left', West)
  unbindWalkKey('Numpad8', North)
  unbindWalkKey('Numpad9', NorthEast)
  unbindWalkKey('Numpad6', East)
  unbindWalkKey('Numpad3', SouthEast)
  unbindWalkKey('Numpad2', South)
  unbindWalkKey('Numpad1', SouthWest)
  unbindWalkKey('Numpad4', West)
  unbindWalkKey('Numpad7', NorthWest)

  unbindTurnKey('Ctrl+Up', North)
  unbindTurnKey('Ctrl+Right', East)
  unbindTurnKey('Ctrl+Down', South)
  unbindTurnKey('Ctrl+Left', West)
  unbindTurnKey('Ctrl+Numpad8', North)
  unbindTurnKey('Ctrl+Numpad6', East)
  unbindTurnKey('Ctrl+Numpad2', South)
  unbindTurnKey('Ctrl+Numpad4', West)
end

function enableWSAD()
  if wsadWalking then
    return
  end
  wsadWalking = true 
  local player = g_game.getLocalPlayer()
  if player then
    player:lockWalk(100) -- 100 ms walk lock for all directions   
  end

  bindWalkKey("W", North)
  bindWalkKey("D", East)
  bindWalkKey("S", South)
  bindWalkKey("A", West)

  bindTurnKey("Ctrl+W", North)
  bindTurnKey("Ctrl+D", East)
  bindTurnKey("Ctrl+S", South)
  bindTurnKey("Ctrl+A", West)

  bindWalkKey("E", NorthEast)
  bindWalkKey("Q", NorthWest)
  bindWalkKey("C", SouthEast)
  bindWalkKey("Z", SouthWest)
end

function disableWSAD()
  if not wsadWalking then
    return
  end
  wsadWalking = false

  unbindWalkKey("W")
  unbindWalkKey("D")
  unbindWalkKey("S")
  unbindWalkKey("A")

  unbindTurnKey("Ctrl+W")
  unbindTurnKey("Ctrl+D")
  unbindTurnKey("Ctrl+S")
  unbindTurnKey("Ctrl+A")

  unbindWalkKey("E")
  unbindWalkKey("Q")
  unbindWalkKey("C")
  unbindWalkKey("Z")
end

function bindWalkKey(key, dir)
  local gameRootPanel = modules.game_interface.getRootPanel()
  g_keyboard.bindKeyDown(key, function() changeWalkDir(dir) end, gameRootPanel, true)
  g_keyboard.bindKeyUp(key, function() changeWalkDir(dir, true) end, gameRootPanel, true)
  g_keyboard.bindKeyPress(key, function(c, k, ticks) smartWalk(dir, ticks) end, gameRootPanel)
end

function unbindWalkKey(key)
  local gameRootPanel = modules.game_interface.getRootPanel()
  g_keyboard.unbindKeyDown(key, gameRootPanel)
  g_keyboard.unbindKeyUp(key, gameRootPanel)
  g_keyboard.unbindKeyPress(key, gameRootPanel)
end

function bindTurnKey(key, dir)
  turnKeys[key] = dir
  local gameRootPanel = modules.game_interface.getRootPanel()
  g_keyboard.bindKeyDown(key, function() turn(dir, false) end, gameRootPanel)
  g_keyboard.bindKeyPress(key, function() turn(dir, true) end, gameRootPanel)
  g_keyboard.bindKeyUp(key, function() local player = g_game.getLocalPlayer() if player then player:lockWalk(200) end end, gameRootPanel)
end

function unbindTurnKey(key)
  turnKeys[key] = nil
  local gameRootPanel = modules.game_interface.getRootPanel()
  g_keyboard.unbindKeyDown(key, gameRootPanel)
  g_keyboard.unbindKeyPress(key, gameRootPanel)
  g_keyboard.unbindKeyUp(key, gameRootPanel)
end

function stopSmartWalk()
  smartWalkDirs = {}
  smartWalkDir = nil
end

function changeWalkDir(dir, pop)
  while table.removevalue(smartWalkDirs, dir) do end
  if pop then
    if #smartWalkDirs == 0 then
      stopSmartWalk()
      return
    end
  else
    table.insert(smartWalkDirs, 1, dir)
  end

  smartWalkDir = smartWalkDirs[1]
  if modules.client_options.getOption('smartWalk') and #smartWalkDirs > 1 then
    for _,d in pairs(smartWalkDirs) do
      if (smartWalkDir == North and d == West) or (smartWalkDir == West and d == North) then
        smartWalkDir = NorthWest
        break
      elseif (smartWalkDir == North and d == East) or (smartWalkDir == East and d == North) then
        smartWalkDir = NorthEast
        break
      elseif (smartWalkDir == South and d == West) or (smartWalkDir == West and d == South) then
        smartWalkDir = SouthWest
        break
      elseif (smartWalkDir == South and d == East) or (smartWalkDir == East and d == South) then
        smartWalkDir = SouthEast
        break
      end
    end
  end
end

function smartWalk(dir, ticks)
  walkEvent = scheduleEvent(function()
    if g_keyboard.getModifiers() == KeyboardNoModifier then
      local direction = smartWalkDir or dir
      walk(direction, ticks)
      return true
    end
    return false
  end, 20)
end

function canChangeFloorDown(pos)
  pos.z = pos.z + 1
  toTile = g_map.getTile(pos)
  return toTile and toTile:hasElevation(3)
end

function canChangeFloorUp(pos)
  pos.z = pos.z - 1
  toTile = g_map.getTile(pos)
  return toTile and toTile:isWalkable()
end

function onPositionChange(player, newPos, oldPos)
end

function onWalk(player, newPos, oldPos)
  if autoFinishNextServerWalk + 200 > g_clock.millis() then
    player:finishServerWalking()
  end
end

function onTeleport(player, newPos, oldPos)
  if not newPos or not oldPos then
    return
  end
  -- floor change is also teleport
  if math.abs(newPos.x - oldPos.x) >= 3 or math.abs(newPos.y - oldPos.y) >= 3 or math.abs(newPos.z - oldPos.z) >= 2 then 
    -- far teleport, lock walk for 100ms
    walkLock = g_clock.millis() + g_settings.getNumber('walkTeleportDelay')
  else
    walkLock = g_clock.millis() + g_settings.getNumber('walkStairsDelay')
  end
  nextWalkDir = nil -- cancel autowalk
end

function onWalkFinish(player)
  lastFinishedStep = g_clock.millis()
  if nextWalkDir ~= nil then
    removeEvent(autoWalkEvent)
    autoWalkEvent = addEvent(function() if nextWalkDir ~= nil then walk(nextWalkDir, 0) end end, false)
  end
end

function onCancelWalk(player)
  player:lockWalk(50)
end

function walk(dir, ticks)
  lastManualWalk = g_clock.millis()
  local player = g_game.getLocalPlayer()
  if not player or g_game.isDead() or player:isDead() then
    return
  end

  if player:isWalkLocked() then
    nextWalkDir = nil
    return
  end

  if g_game.isFollowing() then
    g_game.cancelFollow()
  end

  if player:isAutoWalking() then
    if lastStop + 100 < g_clock.millis() then
      lastStop = g_clock.millis()
      player:stopAutoWalk()
      g_game.stop()
    end
  end
    
  local dash = false
  local ignoredCanWalk = false
  if not g_game.getFeature(GameNewWalking) then
    dash = g_settings.getBoolean("dash", false)
  end

  local ticksToNextWalk = player:getStepTicksLeft()
  if not player:canWalk(dir) then -- canWalk return false when previous walk is not finished or not confirmed by server
    if dash then
      ignoredCanWalk = true
    else
      if ticksToNextWalk < 500 and (lastWalkDir ~= dir or ticks == 0) then
        nextWalkDir = dir
      end
      if ticksToNextWalk < 30 and lastFinishedStep + 400 > g_clock.millis() and nextWalkDir == nil then -- clicked walk 20 ms too early, try to execute again as soon possible to keep smooth walking
        nextWalkDir = dir
      end
      return
    end
  end
 
  --if nextWalkDir ~= nil and lastFinishedStep + 200 < g_clock.millis() then
  --  print("Cancel " .. nextWalkDir)
  --  nextWalkDir = nil
  --end
  if nextWalkDir ~= nil and nextWalkDir ~= lastWalkDir then
    dir = nextWalkDir
  end

  local toPos = player:getPrewalkingPosition(true)
  if dir == North then
    toPos.y = toPos.y - 1
  elseif dir == East then
    toPos.x = toPos.x + 1
  elseif dir == South then
    toPos.y = toPos.y + 1
  elseif dir == West then
    toPos.x = toPos.x - 1
  elseif dir == NorthEast then
    toPos.x = toPos.x + 1
    toPos.y = toPos.y - 1
  elseif dir == SouthEast then
    toPos.x = toPos.x + 1
    toPos.y = toPos.y + 1
  elseif dir == SouthWest then
    toPos.x = toPos.x - 1
    toPos.y = toPos.y + 1
  elseif dir == NorthWest then
    toPos.x = toPos.x - 1
    toPos.y = toPos.y - 1
  end
  local toTile = g_map.getTile(toPos)

  if walkLock >= g_clock.millis() and lastWalkDir == dir then
    nextWalkDir = nil
    return
  end

  if firstStep and lastWalkDir == dir and lastWalk + g_settings.getNumber('walkFirstStepDelay') > g_clock.millis() then
    firstStep = false
    walkLock = lastWalk + g_settings.getNumber('walkFirstStepDelay')
    return
  end
 
  if dash and lastWalkDir == dir and lastWalk + 50 > g_clock.millis() then
    return
  end 
 
  firstStep = (not player:isWalking() and lastFinishedStep + 100 < g_clock.millis() and walkLock + 100 < g_clock.millis())
  if player:isServerWalking() and not dash then
    walkLock = walkLock + math.max(g_settings.getNumber('walkFirstStepDelay'), 100)
  end
 
  nextWalkDir = nil
  removeEvent(autoWalkEvent)
  autoWalkEvent = nil
  local preWalked = false
  if toTile and toTile:isWalkable() then
    if not player:isServerWalking() and not ignoredCanWalk then
      player:preWalk(dir)
      preWalked = true
    end
  else
    local playerTile = player:getTile()
    if (playerTile and playerTile:hasElevation(3) and canChangeFloorUp(toPos)) or canChangeFloorDown(toPos) or (toTile and toTile:isEmpty() and not toTile:isBlocking()) then
      player:lockWalk(100)
    elseif player:isServerWalking() then
      g_game.stop()
      return
    elseif not toTile then
      player:lockWalk(100) -- bug fix for missing stairs down on map
    else
      if g_app.isMobile() and dir <= Directions.West then
        turn(dir, ticks > 0)
      end
      return -- not walkable tile
    end
  end

  if player:isServerWalking() and not dash then
    g_game.stop()
    player:finishServerWalking()
    autoFinishNextServerWalk = g_clock.millis() + 200
  end
  g_game.walk(dir, preWalked) 
 
  if not firstStep and lastWalkDir ~= dir then
    walkLock = g_clock.millis() + g_settings.getNumber('walkTurnDelay')   
  end
 
  lastWalkDir = dir
  lastWalk = g_clock.millis()
  return true
end

function turn(dir, repeated)
  local player = g_game.getLocalPlayer()
  if player:isWalking() and player:getWalkDirection() == dir and not player:isServerWalking() then
    return
  end
 
  removeEvent(walkEvent)
 
  if not repeated or (lastTurn + 100 < g_clock.millis()) then
    g_game.turn(dir)
    changeWalkDir(dir)
    lastTurn = g_clock.millis()
    if not repeated then
      lastTurn = g_clock.millis() + 50
    end
    lastTurnDirection = dir
    nextWalkDir = nil
    player:lockWalk(g_settings.getNumber('walkCtrlTurnDelay'))
  end
end

function checkTurn()
  for keys, direction in pairs(turnKeys) do
    if g_keyboard.areKeysPressed(keys) then
      turn(direction, false)
    end
  end
end
 
@Mateus Robeerto, @Fabi Marzan, @Mythana

I am running TFS 1.5 7.72 Nekiro Downgrade and have tried all your suggested solutions and I am still stuttering with a 90MB world map. Smaller maps work fine and doesnt affect the characters walking.

I tried the above but still stutters. I also tried what Fabi suggested in another thread, lowering max movement speed and a slightly different Creature::getStepDuration() const function. But still the same issue.

Anyone with a solution or have you guys solved it in some other way? :(
Thankful for any kind of help!
I made some changes to the code above, thinking it would work for me with the default TFS map that came with it. It ran smoothly. But then I switched to my large custom map, and it didn’t go well – only about 40% was resolved, not much. I couldn’t handle it anymore, so I decided to migrate to TFS 1.3 (8.6), and the walking is perfect, both in OTC and the old Cip client. It runs smoothly with the large map, so I’ve decided to stick with TFS 1.3 (8.6). I've been making a lot of improvements to version 1.3 and won’t switch to any other base, especially not Nekiro's, which is garbage. Nekiro is total trash because he didn’t fix this issue. If you want a solution for your TFS 1.5 (7.72), you can check Kondra’s commit and apply the changes to your source – it’ll work. I did it once, and the walk was smooth. I decided to revert it and keep the default settings. Be careful when modifying the new walk function.


which client are you guys using? this is very important for troubleshoot this. before anything, try on cipsoft one to see if it behaves correctly. otcv8 doesn't have it correctly settled up if i'm not wrong, and mehah otclient has this option otclient/data/setup.otml at main · mehah/otclient (https://github.com/mehah/otclient/blob/main/data/setup.otml#L21) that changes walking formula (false for older protocols, since it uses less frames than newer versions).
You have to understand, nobody really likes OTClient Mehah. Everyone just uses OTClient V8 because it's easier to work with custom modules and such. I also don’t like OTClient Mehah. There’s no point in saying people should migrate to Mehah – it all comes down to personal preference. Some people like OTClient V8, and others prefer Mehah.
 
I made some changes to the code above, thinking it would work for me with the default TFS map that came with it. It ran smoothly. But then I switched to my large custom map, and it didn’t go well – only about 40% was resolved, not much. I couldn’t handle it anymore, so I decided to migrate to TFS 1.3 (8.6), and the walking is perfect, both in OTC and the old Cip client. It runs smoothly with the large map, so I’ve decided to stick with TFS 1.3 (8.6). I've been making a lot of improvements to version 1.3 and won’t switch to any other base, especially not Nekiro's, which is garbage. Nekiro is total trash because he didn’t fix this issue. If you want a solution for your TFS 1.5 (7.72), you can check Kondra’s commit and apply the changes to your source – it’ll work. I did it once, and the walk was smooth. I decided to revert it and keep the default settings. Be careful when modifying the new walk function.



You have to understand, nobody really likes OTClient Mehah. Everyone just uses OTClient V8 because it's easier to work with custom modules and such. I also don’t like OTClient Mehah. There’s no point in saying people should migrate to Mehah – it all comes down to personal preference. Some people like OTClient V8, and others prefer Mehah.
Thank you so much for the very thorough answer @Mateus Robeerto.
I would switch but I have already pretty much fixed everything with nekiro's base, would be a shame for me to start over and throw a years work down the drain.. :/

I will try this commit when I get back home. Can you DM me your discord? I'll let you know how it goes!
 
You have to understand, nobody really likes OTClient Mehah. Everyone just uses OTClient V8 because it's easier to work with custom modules and such. I also don’t like OTClient Mehah.
don't understand me wrong, I just meant that otcv8 doesn't have a commit log related to this. I think the issue is totally client-sided if the walking works well on cipsoft client; a way to start looking into it is to check what is force-new-walking-formula on sources, how they're linked in mehah otclient (how does setup.otml reads the value from sources or wherever it comes), and try to replicate somehow on otcv8 sources (which I never used).

There’s no point in saying people should migrate to Mehah – it all comes down to personal preference. Some people like OTClient V8, and others prefer Mehah.
you just said, it all comes down to personal preference. Never said anything about migrating, you need to first try it on cipsoft client because that client is the one that OTCs are trying to replicate (in source-side). So, if any source-side feature works fine on cipsoft client, it means it is correctly implemented on server-side.

I've been making a lot of improvements to version 1.3 and won’t switch to any other base, especially not Nekiro's, which is garbage. Nekiro is total trash because he didn’t fix this issue. If you want a solution for your TFS 1.5 (7.72), you can check Kondra’s commit and apply the changes to your source – it’ll work. I did it once, and the walk was smooth. I decided to revert it and keep the default settings. Be careful when modifying the new walk function.

nekiro did an excellent work 3 years ago, cleaning-up the code from main branch to allow us to have 8.6 protocol running on latest sources (this allowed us to start using revscriptsys, among other features from main branch). as I say before, nekiro downgraded the sources thinking on matching the cipsoft client (which is the correct pipeline). I'm aware that those sources still have issues on vials and jugs, but they're 3 years old by now and there's many other forks that continued the work.

btw that github link could be a nice approach, try that and see what happens @L0FIC

Regards!
Post automatically merged:

Edit: you should definitely try this
And read this for in-depth explaination

Tell me how it goes! @L0FIC
 
Last edited:
"g_game.enableFeature(GameSlowerManualWalking)" in otcv8 solved it for manual walking, BUT, with the cost of general movement speed.
Meaning for example 1200 speed is now slower than actual 1200 speed. Or it simply feels slower, don't know which one it is.

Map Click walk is still stuttering every second step, it is horrible. Any fix in sources for map click in TFS 1.5?

Thanks a lot, manual walking super good now! @ralke
 
"g_game.enableFeature(GameSlowerManualWalking)" in otcv8 solved it for manual walking, BUT, with the cost of general movement speed.
Meaning for example 1200 speed is now slower than actual 1200 speed. Or it simply feels slower, don't know which one it is.

Map Click walk is still stuttering every second step, it is horrible. Any fix in sources for map click in TFS 1.5?

Thanks a lot, manual walking super good now! @ralke

Hey do you use OTC as base client or CIP aswell?
If you just use OTC then I recommend you to try speed formula a, b, c from main TFS or tfs 1.4.2
Just few changes and it will feel alot smoother
 
Hey do you use OTC as base client or CIP aswell?
If you just use OTC then I recommend you to try speed formula a, b, c from main TFS or tfs 1.4.2
Just few changes and it will feel alot smoother
Hey man, I am using OTCv8 Client only, using TFS 1.5.
You mean this in creature.cpp? :


LUA:
double Creature::speedA = 857.36;
double Creature::speedB = 261.29;
double Creature::speedC = -4795.01;

What do I change for - for smoother walking? Or should I change more places in the code?
Thanks mate!
 
"g_game.enableFeature(GameSlowerManualWalking)" in otcv8 solved it for manual walking, BUT, with the cost of general movement speed.
Meaning for example 1200 speed is now slower than actual 1200 speed. Or it simply feels slower, don't know which one it is.

Map Click walk is still stuttering every second step, it is horrible. Any fix in sources for map click in TFS 1.5?

Thanks a lot, manual walking super good now! @ralke
Should be correct behaviour since it is reproducing less frames * second than before. If you wish to know how is the accurate result, just compare the walk to cipsoft client and see if they match.

About map-click I think that is more pathfinding related than movement, because what the character does is to find or calculate which route is the best, probably, while the character is thinking where to go, it does generate a delay that affects your movement. I'm not completely sure if this

has pathfinding optimization on map clicks aswell. You can try, but idk if is the correct approach, i'll look into it if I can find something, but i'm kinda sure that map clicking is server-sided.
Post automatically merged:

Edit: If it's client sided, check this

Probably map.h has some information about it ^^ @L0FIC
 
Last edited:
About map-click I think that is more pathfinding related than movement, because what the character does is to find or calculate which route is the best, probably, while the character is thinking where to go, it does generate a delay that affects your movement. I'm not completely sure if this
has pathfinding optimization on map clicks aswell. You can try, but idk if is the correct approach, i'll look into it if I can find something, but i'm kinda sure that map clicking is server-sided.
okay guys, done some testing now.
changing max_node to a higher value on server side, only made it possible to map click further, did not remove stutter.

I also applied all the commits in here, but i did not notice any difference. smooth map click with otcv8 and TFS 1.5 is still a mystery for me.
but all in all for manual walking, g_game.enableFeature(GameSlowerManualWalking) in otcv8 in game features module, coupled with mateus robertos creaturewalk in creature.cpp, made manual walking super good.

If anyone knows how to fix good map click on tfs 1.5 + otcv8, let me know!

Best,
L0FiC
 
okay guys, done some testing now.
changing max_node to a higher value on server side, only made it possible to map click further, did not remove stutter.

I also applied all the commits in here, but i did not notice any difference. smooth map click with otcv8 and TFS 1.5 is still a mystery for me.
but all in all for manual walking, g_game.enableFeature(GameSlowerManualWalking) in otcv8 in game features module, coupled with mateus robertos creaturewalk in creature.cpp, made manual walking super good.

If anyone knows how to fix good map click on tfs 1.5 + otcv8, let me know!

Best,
L0FiC
My biggest advice would be to compare it with that of a TFS 1.3, compare map.cpp and creature.cpp, or as other people say, use otclient mehah in the meantime.

@Mateus Robeerto and I were investigating the problem for weeks and found nothing until I decided to quit.

I feel like you have to pray to a saint to help you with that.
 
My biggest advice would be to compare it with that of a TFS 1.3, compare map.cpp and creature.cpp, or as other people say, use otclient mehah in the meantime.

@Mateus Robeerto and I were investigating the problem for weeks and found nothing until I decided to quit.

I feel like you have to pray to a saint to help you with that.

Haha I agree super weird. But lowering manual walking speed in otcv8 helped together with your solution in creature.cpp!

The manual walking speed was too high for pvp anyways so might as well use that client command..

Did you guys manage to solve clean "map click" walk though?? On TFS 1.5 and otcv8?
Or perhaps that is what you meant is a mystery still?
 
Hey everyone,

Recently, @Fabi Marzan and I compared the performance between TFS 1.3 and TFS 1.5 on my OT server. I noticed that TFS 1.3 is much smoother, without the small stutters while walking, whereas TFS 1.5 showed some performance issues. After investigating, I realized that in TFS 1.3, the function responsible for item decay (checkDecay) was removed from game.cpp, which seems to be the cause of the performance difference.

In the Game::start function in TFS 1.5, there’s a line that schedules the decay checks to run periodically:
game.cpp
C++:
g_scheduler.addEvent(createSchedulerTask(EVENT_DECAYINTERVAL, std::bind(&Game::checkDecay, this)));
I noticed that by completely removing this line, the performance of movement in the game improved significantly, making walking much smoother and eliminating the stutters. It seems that the decay check process, especially on larger maps with many items, was overloading the server.


Hey @Gesior.pl , could you give your opinion on removing this line and whether it could cause any issues or crashes? I've tested it several times and haven't had any problems so far, but we'd like your input. If we remove it, is there any risk? We just want smoother walking because after I removed it, the movement improved a lot, 100% better.
 
I use TFS 1.3 MovieBr version 8.6, which has the old decay system. The line was already removed, and the walking became smooth, while the decay still worked correctly, causing items like torches and other objects to disappear at the right time. My friend and I decided to remove the old decay system and implement the new decay system from an official TFS commit. After compiling and testing, the walking performance worsened again. I identified the issue, removed the line, and the walking performance improved. However, items no longer decay or disappear correctly, so I will have to revert everything and stick with the old decay system.

The ideal solution would be to remove the new decay system from TFS 1.5 Nekiro and implement the old decay system, which would result in smoother walking performance and ensure that items like torches and other objects disappear at the correct time after their duration &lt;attribute key="duration"... has elapsed. 🤷‍♂️

 

Similar threads

Back
Top