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

OTClient Screen render freezing while keyboard walking

joaobobalhao

Member
Joined
Aug 30, 2011
Messages
21
Reaction score
13
Hello,
I'm using 772 client (edubart otclient) with Nostalrius server (772)

When I walking on otclient using keyboard happens small cuts for each walking SQM:

Another example on different ground:

But on click map (autowalk) this work very well:


I tested keyboard walking on otclientv8 and it works better (more smooth too):


These little freezes on keyboard walking occur at any speed and on different ground.

I tried to implement otv8 walk system but it wasn’t cool because they use another way of drawing (they don't share full source =[)

Can someone help me think of a way to render more smoothly or render normal walking like auto walk (when you click on the map)?
 
I can't find the problem, I tested OTHire with the same OTClient and it is much smoother with fewer frames locking when walking.

I tried to change the getSpeedDuration method of creature.cpp and leave the duration equal to that of OTHire, but that didn't work either.
I tried to change several parts of the code from player.cpp, creature.cpp and even OTClient but nothing works. Nostalrius is much slower / freezing when using otclient.
 
The same happens to me with a downgraded TFS. Another OTClient with modified walksystem is @Mehah (no support for old versions). Maybe if we convert it to works for 7.x this issue get fixed.
I will link the github:
 
found a solution?
Hello,
I'm using 772 client (edubart otclient) with Nostalrius server (772)

When I walking on otclient using keyboard happens small cuts for each walking SQM:

Another example on different ground:

But on click map (autowalk) this work very well:


I tested keyboard walking on otclientv8 and it works better (more smooth too):


These little freezes on keyboard walking occur at any speed and on different ground.

I tried to implement otv8 walk system but it wasn’t cool because they use another way of drawing (they don't share full source =[)

Can someone help me think of a way to render more smoothly or render normal walking like auto walk (when you click on the map)?
found a solution?
 
@joaobobalhao @wlucas try this and see if works
First go to your server sources (not OTC sources) and find
C++:
int64_t Creature::getStepDuration() const
{
    if (isRemoved()) {
        return 0;
    }

Then replace this
C++:
uint32_t calculatedStepSpeed;
uint32_t groundSpeed;

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

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 / calculatedStepSpeed);
int64_t stepDuration = std::ceil(duration / 50) * 50;

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

return stepDuration;

For this
C++:
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;

Regards!
 
@joaobobalhao @wlucas try this and see if works
First go to your server sources (not OTC sources) and find
C++:
int64_t Creature::getStepDuration() const
{
    if (isRemoved()) {
        return 0;
    }

Then replace this
C++:
uint32_t calculatedStepSpeed;
uint32_t groundSpeed;

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

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 / calculatedStepSpeed);
int64_t stepDuration = std::ceil(duration / 50) * 50;

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

return stepDuration;

For this
C++:
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;

Regards!
in which file? i got the same behauvior
 
@potinho Can't remember when I posted on this thread but here you go, this is how I have it on my server :rolleyes:

creature.cpp line 1400

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;
}
 
Last edited:
Back
Top