NPC/Bots implementation in VCMP 0.4 Servers

Started by habi, Apr 01, 2022, 05:37 PM

Previous topic - Next topic

habi2

Quote from: PSL on Jul 26, 2024, 08:52 AMHi Habi,What is the current status of NPC plugin updates :)  :)  :)
The new npc can connect to windows server. I have fixed all version error, etc. New npc knows different messages send by server -join, death, etc.
I have found new vcmp client sends onfoot and onfoot-aim packets differently. Rest all(vehicle drive, passenger,..) is assumed to be same.
This foot sync packets have extra 9 float values 4 of them always zero, other in range -1 to 1. When player angle is special like 0, pi/2, pi etc, some become exactly equal to 1 while others are 0 or 0.3 etc.


Moreover, when the player shoots an extra vector apart from aimdir and aimpos is send. This extra vector close to aimdir and its magnitude is always 1.

Interesting, huh ?

vitovc

new vector is most likely point at center of screen (camera)
...::: vice city :::...
Useful things for vcmp: Relative position and finding an angle (in 3d), 3d line (like laser)

PSL

Hi Habi.
Thank you very much for your explanation.  I have understood the development situation you mentioned.  I am looking forward to receiving your plug-in as soon as possible.  I am looking forward to and excited about it!
Thanks again for your hard work and the development of this plugin!

StingRay_

Hi habi.
I was running server on linux and when I used ConnectNPCEx, it just came:
sh: 1: /home/fidlar/vcmp/test: not found
Nothing else, and the npc was not connected. I found the path above to my server was truncated (originally 'test server'), it seemed spaces could not be included in the path, and with spaces removed it turned out fine. Trivial though, could this one be fixed? Thanks a lot for your continuous efforts.
Btw it worked fine with windows version plugin.

habi2

Quote from: StingRay_ on Aug 18, 2024, 05:15 PMHi habi.
I was running server on linux and when I used ConnectNPCEx, it just came:
sh: 1: /home/fidlar/vcmp/test: not found
Sorry i have not seen your message.
I will take care of this issue in next build.

vitovc

hi habi. please add InPoly function. its useful to calcualte model of vehicle's "collisions" (by rotated rectangles) on side of npc's scripts


inline bool Internal_InPoly(float fX, float fY,
    const unsigned int uiPoints, const AreaPoints fPoints[])
{
    // http://sidvind.com/wiki/Point-in-polygon:_Jordan_Curve_Theorem

    // The points creating the polygon
    float x1, x2;

    // How many times the ray crosses a line segment
    int crossings = 0;

    // Iterate through each line
    for (unsigned int i = 0; i < uiPoints; i++)
    {
        // This is done to ensure that we get the same result when
        // the line goes from left to right and right to left.
        if (fPoints[i].x < fPoints[(i + 1) % uiPoints].x)
        {
            x1 = fPoints[i].x;
            x2 = fPoints[(i + 1) % uiPoints].x;
        }
        else
        {
            x1 = fPoints[(i + 1) % uiPoints].x;
            x2 = fPoints[i].x;
        }

        // First check if the ray is able to cross the line
        if (fX > x1 && fX <= x2 && (fY < fPoints[i].y || fY <= fPoints[(i + 1) % uiPoints].y))
        {
            static const float eps = 0.000001f;

            // Calculate the equation of the line
            float dx = fPoints[(i + 1) % uiPoints].x - fPoints[i].x;
            float dy = fPoints[(i + 1) % uiPoints].y - fPoints[i].y;
            float k;

            if (fabs(dx) < eps)
                k = 0xffffffff;
            else
                k = dy / dx;

            float m = fPoints[i].y - k * fPoints[i].x;

            // Find if the ray crosses the line
            float y2 = k * fX + m;
            if (fY <= y2)
                crossings++;
        }
    }

    if (crossings % 2 == 1)
        return true;

    return false;
}
...::: vice city :::...
Useful things for vcmp: Relative position and finding an angle (in 3d), 3d line (like laser)

habi2


habi2

#142
NPCClient v1.8 beta 3 Released - Now with 0.4.7.1 Support!

We're excited to announce the release of npcclient v1.8 beta 3! This release comes with several key updates and bug fixes that will improve compatibility and stability for VCMP servers.

What's New in v1.8 beta 3:
    • Added support for 0.4.7.1: Now fully compatible with the latest server version.
    • Fixed a possible bug in rel004 servers: Related to passenger updates, enhancing overall stability.
    • Fixed plugin truncating path to the server: When paths contain spaces using ConnectNPCEx/ConnectNPC.
    • New InPoly function: Added a function to check if a two-dimensional point is inside a polygon by providing the vertices of the polygon. This can help with advanced scripting and positioning logic.

    For more details on the changes, please refer to the full release notes: Release Notes

    Downloads:

    Operating SystemVersionDownload Link
    Windows0.4.7.1npc_vcmp_0471_windows_v1.8-beta-3.zip
    Linux x640.4.7.1npc_vcmp_0471_linux_x64_v1.8-beta-3.zip
    Linux x860.4.7.1npc_vcmp_0471_linux_x86_v1.8-beta-3.zip
    Windowsrel006npc_vcmp_rel006_windows_v1.8-beta-3.zip
    Linux x64rel006npc_vcmp_rel006_linux_x64_v1.8-beta-3.zip
    Linux x86rel006npc_vcmp_rel006_linux_x86_v1.8-beta-3.zip
    Windows/Linuxrel004npc_vcmp_rel004_win_lin_v1.8-beta-3.zip
    Source CodeAll versionsNPC-VCMP-master-v1.8-beta-3.zip
    API Plugin1.6npc_vcmp_plugin_API_1_6.zip

    ---

    Thank you all for your continued support and for using npcclient! Your feedback and dedication help us keep improving. Please feel free to share your thoughts and report any issues.

    Happy scripting!