Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Nostale
You last visited: Today at 04:22

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Clientless "realistic" movement

Discussion on Clientless "realistic" movement within the Nostale forum part of the MMORPGs category.

Reply
 
Old   #1
 
Roxeez's Avatar
 
elite*gold: 0
Join Date: Jun 2019
Posts: 102
Received Thanks: 228
Clientless "realistic" movement

Hey, i'm working on some clientless stuff, i've made something to make my character move to X/Y position using walk packet the problem his i currently just move to X position then to Y position that's not really "realistic" and can be a problem in some case, do you have any idea how can i make something more realistic (like moving in diagonal)

Btw is there a way to know if we can walk at a given position (like if there is a wall or something)
Roxeez is offline  
Old 07/13/2019, 17:41   #2

 
FI0w's Avatar
 
elite*gold: 50
Join Date: Jul 2014
Posts: 1,700
Received Thanks: 1,165
Quote:
Originally Posted by Roxeez View Post
Hey, i'm working on some clientless stuff, i've made something to make my character move to X/Y position using walk packet the problem his i currently just move to X position then to Y position that's not really "realistic" and can be a problem in some case, do you have any idea how can i make something more realistic (like moving in diagonal)

Btw is there a way to know if we can walk at a given position (like if there is a wall or something)
with grid given by client and with a Path Finding Algo.
FI0w is offline  
Old 07/13/2019, 17:48   #3
 
elite*gold: 0
Join Date: Dec 2018
Posts: 70
Received Thanks: 28
Or if you have to make a simple thing, you can use something like
Code:
if(std::abs(objX-tempX) == std::abs(objY-tempY))
            {
                if(objX-tempX < 0 && objY-tempY < 0)
                {
                    tempX--;
                    tempY--;
                }
                else if(objX-tempX > 0 && objY-tempY > 0)
                {
                    tempX++;
                    tempY++;
                }
                else if(objX-tempX > 0 && objY-tempY < 0)
                {
                    tempX++;
                    tempY--;
                }
                else if(objX-tempX < 0 && objY-tempY > 0)
                {
                    tempX--;
                    tempY++;
                }
            }
            else
            {
                if(std::abs(objY-tempY) > std::abs(objX-tempX))
                {
                    if(objY < tempY)
                    {
                        tempY--;
                    }
                    else {
                        tempY++;
                    }
                }
                else
                {
                    if(objX < tempX)
                    {
                        tempX--;
                    }
                    else
                    {
                        tempX++;
                    }
                }
            }
Nortank is offline  
Old 07/13/2019, 18:00   #4
 
Roxeez's Avatar
 
elite*gold: 0
Join Date: Jun 2019
Posts: 102
Received Thanks: 228
Quote:
Originally Posted by FI0w View Post
with grid given by client and with a Path Finding Algo.
That's what you're talking about when you say grid given by client right ?
Roxeez is offline  
Old 07/13/2019, 18:16   #5

 
FI0w's Avatar
 
elite*gold: 50
Join Date: Jul 2014
Posts: 1,700
Received Thanks: 1,165
Quote:
Originally Posted by Roxeez View Post
That's what you're talking about when you say grid given by client right ?
yes you can get the grid using NosPack all other i think convert it into a Picture.

You can see how to use the grid in OpenNos for example.
FI0w is offline  
Old 07/13/2019, 18:17   #6
 
elite*gold: 0
Join Date: Dec 2018
Posts: 70
Received Thanks: 28
Yes he is.
Dark cell : non walkable
White cell : walkable
Nortank is offline  
Old 07/13/2019, 22:50   #7
 
Roxeez's Avatar
 
elite*gold: 0
Join Date: Jun 2019
Posts: 102
Received Thanks: 228
Ok so i've implemented the wall detection using NStcData.NOS files and it work fine

That's what i've done
Code:
public async Task Walk(Vector2D target)
{
    var distance = Position.Distance(target);

    bool positiveX = target.X > Position.X;
    bool positiveY = target.Y > Position.Y;

    for (var i = 0; i < distance.X; i++)
    {
        var position = Position.Clone();

        position.X = (positiveX ? 1 : -1) + position.X;

        if (Map.IsWalkable(position))
        {
            await _clientSession.SendPacket(new WalkPacket
            {
                Position = position,
                Speed = Speed
            });

            Position = position;
            await Task.Delay(200);
        }
    }

    for (var i = 0; i < distance.Y; i++)
    {
        var position = Position.Clone();

        position.Y = (positiveY ? 1 : -1) + position.Y;

        if (Map.IsWalkable(position))
        {
            await _clientSession.SendPacket(new WalkPacket
            {
                Position = position,
                Speed = Speed
            });

            Position = position;
            await Task.Delay(200);
        }
    }
}
but i'm still stuck on a wait to make the movement more realistic (like moving on X/Y axis in same time

Ok i've made something else and everything looks fine
Code:
public async Task<bool> Walk(Vector2D destination)
{
    if (!Map.IsWalkable(destination)) return false;

    bool positiveX = destination.X > Position.X;
    bool positiveY = destination.Y > Position.Y;

    var blocked = false;

    while(!Position.Equals(destination) && !blocked)
    {
        var position = Position.Clone();
        var distance = position.Distance(destination);

        int stepX = distance.X >= 5 ? 5 : distance.X;
        int stepY = distance.Y >= 5 ? 5 : distance.Y;

        position.X = (positiveX ? 1 : -1) * stepX + position.X;
        position.Y = (positiveY ? 1 : -1) * stepY + position.Y;

        if (Map.IsWalkable(position))
        {
            await _clientSession.SendPacket(new WalkPacket
            {
                Position = position,
                Speed = Speed
            });

            await Task.Delay((stepX + stepY) * (1000 / Speed));
            Position = position;
        }
        else
        {
            blocked = true;
        }
    }

    return !blocked;
}
I've one last question what's the third parameter of the Walk packet ?
Actually i'm just setting it to 0 but my character looks like i'm lagging (running faster some time) it's because of this parameter ?

I've looked with packet logger but i can't find something logical about this parameter if someone can tell me in which case the value is 1 or 0 thanks alot
Roxeez is offline  
Old 07/14/2019, 05:48   #8
 
0Lucifer0's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 1,005
Received Thanks: 1,018
Checksum
0Lucifer0 is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Buying] """""PUBG Key""""""""
09/28/2017 - PlayerUnknown's Battlegrounds Trading - 5 Replies
Moin, ich suche noch einen Key von PUBG. Bezahle per PP.(kein Family& Friends) Nur mit RAT! mfg :mofo:
WEAPONSCRIPT!!!!!!!!!!!!!!!!!!!!!!!!!HOT"""""""""" """""""""""""""""""""
08/06/2011 - WarRock Hacks, Bots, Cheats & Exploits - 7 Replies
detetected



All times are GMT +1. The time now is 04:22.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.