• 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!

TFS 1.X+ [8.0 dg by nekiro] [TFS 1.5] Walking lag/delay

Hashcube

Member
Joined
Jun 28, 2023
Messages
27
Reaction score
12
Hello community! šŸ«”


Walking with arrows or map click results with the same behavior - character stops for a very short moment and then moves forward. It happens very often with some short moments of absence (usually out of town).
It happens both on cipsoft client and otc, and only when map is big.
It doesn't happen on tfs original map or any other relatively small map.


Local VM: Ubuntu 22.04.3 LTS, 8 GB RAM, 2 cores 3,7 GHz. I am the only player on the server (Btw I reinstalled VM already a few times, and the issue is still occuring).
Maps used for testing: my custom map and RL map from this thread and both result with the same walking issue.
For the purpose of testing I used only clean repos with following results:
tfs 1.5 dg 8.0 by nekiro - walking issue on big map
tfs 1.5 dg 8.6 by nekiro continued by millhiorebt - walking issue on big map
tfs 1.4 10.98 - 0 issues, works perfect

I'm wondering if this problem is somehow connection related. When I run tfs 1.4 10.98 then OTC properly shows the ping and the game is going ultra smoothly. When I run tfs 1.5 dg by nekiro then OTC for some reason doesn't show ping at all and the problem with moving starts to happen.
 
Its called being a leech.
You suggest that someone "optimize" something that you are completely oblivious to, you suggest someone spends money on something that is not a problem here.
Stop cherrypicking posts that fits your narrative. Follow this in more general manner and you will stop making life hard for yourself.


That is also possible, the commit I suggested will partially fix that issue even if you broke it during the downgrade.
But of course, it's better to fix the origin.


Nothing meaningful changed there. All it takes is very basic C++ knowledge.
I suggest you hire someone trustworthy to do it for you.
Before throwing stones at someone gratuitously, see what the person said before jumping to conclusions!
 
Before throwing stones at someone gratuitously, see what the person said before jumping to conclusions!
There is nothing to optimize and its not related to general performance.
It's you suggesting I am a scammer and throwing stones, are you mentally challenged?
 
Has anyone fixed it yet?
We have a potential solution, but for me it is too inconsistent with the tfs 1.5 dg by nekiro source code.

Wouldn't it be here?
Thats right, this is the correct answer.
 
0 monsters and 0 npcs are spawned on the map. I am the only player on the server. Literally nothing is going on. You want to tell me that the code can't handle one player moving on the map?

Did you manage to have any success in your attempts?
Post automatically merged:

Most likely wrong speed formula, otc/cip client calculates its own speed duration, if it doesnt match the tfs one you can feel it like a lag, because server/client wont let you take a step before the time passes.
Without wanting to abuse your goodwill, wouldn't you be able to kindly help us?
 
Last edited:
We have a potential solution, but for me it is too inconsistent with the tfs 1.5 dg by nekiro source code.
this fix the problem for walk lag but appear another problem, a black part start appearing on top and right screen, iadded the mapawarerange part and still appearinh this black part like its end of the map lol and it ever happens when u use diagonal keys too fast, but the walk problem is really solved with it, walk very smooth after the chances but couldnt fix the new problem lol
 
you can try too

LUA:
        if (!teleport) {
            if (oldPos.z != newPos.z) {
                //floor change extra cost
                lastStepCost = 2;
            } else if (Position::getDistanceX(newPos, oldPos) >= 1 && Position::getDistanceY(newPos, oldPos) >= 1) {
                //diagonal extra cost
                lastStepCost = getPlayer() ? 2 : 3;
            }
        } else {
            stopEventWalk();
        }
 
By placing this, you can see a better improvement regarding the movement, but it may need one or another detail or improvement.

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

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

    uint32_t groundSpeed = 100;
    int32_t stepSpeed = getStepSpeed();

    uint32_t calculatedStepSpeed;
    if (stepSpeed > -Creature::speedB) {
        calculatedStepSpeed = std::floor((Creature::speedA * std::log((stepSpeed / 2) + Creature::speedB) + Creature::speedC) + 0.5);
        if (calculatedStepSpeed == 0) {
            calculatedStepSpeed = 1;
        }
    } else {
        calculatedStepSpeed = 1;
    }

    // Players = 100, Monsters = 150
    if (getPlayer()) {
        groundSpeed = 100;
    } else {
        groundSpeed = 150;
    }

    int64_t stepDuration = (1000 * groundSpeed) / calculatedStepSpeed;

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

    return stepDuration;
}

creature.h
Code:
static double speedA, speedB, speedC;

Since the ground is at 150 speed, the player gets stuck and usually walks slower than normal.

I changed it to 100 and I saw that it improved a lot with a player speed of 780, the more speed the player has, the more it gets stuck, I don't understand very well.

in player.h
you can change this:
static constexpr int32_t PLAYER_MAX_SPEED = 1500;
for:
static constexpr int32_t PLAYER_MAX_SPEED = 850;


The player will be limited up to 850, for a strange reason when the player goes to 900 or less 1000, this behavior happens.
In the future I hope to resolve this and make it 100%.
 
Back
Top