dreamstalker / rehlds

Reverse-engineered HLDS
GNU General Public License v3.0
649 stars 167 forks source link

Stuck on Spawnpoint #864

Open Maxi605 opened 2 years ago

Maxi605 commented 2 years ago

Same as this, https://forums.alliedmods.net/showthread.php?t=289310

In certain maps the players are stucked in the spawnpoint, can't move, there's like a block on them and you can press E on it (makes a sound). Restarting the server "fixes" the issue, after a few days the issue happens again but in different maps (It can happen on the same ones, but usually is on different ones).

RauliTop commented 2 years ago

same as: https://github.com/dreamstalker/rehlds/issues/852 Probably related to some rehlds mistake at entities

Try downgrading rehlds version to find what version has this error.

StevenKal commented 2 years ago

Hum, I can confirm this bug is real & pretty annoying, and also specify that it is not "ReHLDS" only. I have it from a while on my servers using legit HLDS (build #6153) + ReGameDLL_CS, and I had to set up "two reboots" per day to avoid this, because when it happens, well, that's obviously unplayable and need a change map or reboot as definitive fix. We spawn at our spawns, but it is basically like if we were in a map's wall, we can only move if we use "noclip"... air becomes "solid" as specified in the #852.

I did not took time to make deeper tests to figure out where this crap come from, but I put my config with a different mapcycle (only official maps), and make it turn a lot of hours until "this should happen", and this never happenned. So I am guessing this might be due to some entities (or their settings) present on some specific maps which generate this problem at the end, and where this seems to "fuck up the physics", possibly something in the PM_* functions. But I am wondering if this is not a ReGameDLL_CS issue, I did not tested with legit CS as my config is custom & more adapted for ReGameDLL_CS.

@Maxi605: Do you use ReGameDLL_CS? If yes, can you test with the legit CS & tell if this happens too? Also, do you run some Half-Life Deathmatch maps?

Maxi605 commented 2 years ago

Hum, I can confirm this bug is real & pretty annoying, and also specify that it is not "ReHLDS" only. I have it from a while on my servers using legit HLDS (build #6153) + ReGameDLL_CS, and I had to set up "two reboots" per day to avoid this, because when it happens, well, that's obviously unplayable and need a change map or reboot as definitive fix. We spawn at our spawns, but it is basically like if we were in a map's wall, we can only move if we use "noclip"... air becomes "solid" as specified in the #852.

I did not took time to make deeper tests to figure out where this crap come from, but I put my config with a different mapcycle (only official maps), and make it turn a lot of hours until "this should happen", and this never happenned. So I am guessing this might be due to some entities (or their settings) present on some specific maps which generate this problem at the end, and where this seems to "fuck up the physics", possibly something in the PM_* functions. But I am wondering if this is not a ReGameDLL_CS issue, I did not tested with legit CS as my config is custom & more adapted for ReGameDLL_CS.

@Maxi605: Do you use ReGameDLL_CS? If yes, can you test with the legit CS & tell if this happens too? Also, do you run some Half-Life Deathmatch maps?

Hi there. This issue only happens to me on my Deathrun Server, it used to happen on my MultiMod server where i had a Deathrun Mod (The bug also affected maps from Deathrace and Capture The Flag) but haven't seen it for a while since i moved my deathrun to it's own server (Where the problem didn't continue happening untill i installed more maps). I am running ReGameDLL, i never had this issue happen with HLDS so i assumed it was ReHLDS. I can also confirm that a friend has the same issue but on his case, is on a KZ server.

StevenKal commented 2 years ago

O.K., if you can set up back the exact config where this happenned, then if yes, try with legit CS, in order to try "isolating", if this comes from ReGameDLL or not. But as I said this issue happens on both HLDS & ReHLDS, so the source of the problem might be elsewhere.

PentalginPlus commented 2 years ago

to "fuck up the physics", possibly something in the PM_* functions

You can check if it is the same as in my case or not with this plugin. Cycler_sprite size should be always zero, but when the issue happens, it will become non-zero. Since cycler_sprite is solid (but we don't notice it because it has no size by default), people will stuck in it when it get enormous sizes.

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new g_szMapname[32];

public plugin_init()
{
    register_plugin("Stuck test", "1.0", "Pentalgin");
}

public plugin_precache()
{
    get_mapname(g_szMapname, charsmax(g_szMapname));
    RegisterHam(Ham_Spawn, "cycler_sprite", "Ham_Spawn_Cycler", 1);
}

public Ham_Spawn_Cycler(ent)
{
    new Float:Mins[3], Float:Maxs[3];
    pev(ent, pev_mins, Mins);
    pev(ent, pev_maxs, Maxs);
    log_to_file("stuckdebug.log", "Map: %s ent: %i size: %f %f %f %f %f %f", g_szMapname, ent, Mins[0], Mins[1], Mins[2], Maxs[0], Maxs[1], Maxs[2]);
}

I think the root of the issue is in maps. Maybe there's something wrong when you load a lot of different maps with big list of textures or resources.

StevenKal commented 2 years ago

This is also a possibility, but why suddenly a "cycler_sprite" (or another kind of entity) will get a different size than usual (I mean, a size of the whole map...)? Besides to get stuck inside this needs a higher solidity, not only "SOLID_TRIGGER" (as for portals & cie). Also, did you have tested this bug with legit CS?

Maxi605 commented 2 years ago

This is also a possibility, but why suddenly a "cycler_sprite" (or another kind of entity) will get a different size than usual (I mean, a size of the whole map...)? Besides to get stuck inside this needs a higher solidity, not only "SOLID_TRIGGER" (as for portals & cie). Also, did you have tested this bug with legit CS?

Hard to do so, my plugins are dependent from ReHLDS, ReGameDLL and ReAPI so i can't go back to HLDS and test it out

RauliTop commented 2 years ago

Bug also mentioned here to 'cycler': https://amxmodx-es.com/showthread.php?tid=18342

Fix code published here: https://github.com/dreamstalker/rehlds/issues/864#issuecomment-1074456427

Maxi605 commented 2 years ago

L 11/05/2021 - 19:08:34: Map: deathrun_yellowbase_remastered ent: 54 size: -128.000000 -128.000000 -128.000000 128.000000 128.000000 128.000000 L 11/05/2021 - 19:09:05: Map: deathrun_woodo ent: 151 size: -3873.000000 -1.000000 -929.000000 3633.000000 3873.000000 1953.000000 L 11/05/2021 - 19:09:52: Map: deathrun_woodo_easy ent: 110 size: -3873.000000 -1.000000 -929.000000 3633.000000 3873.000000 1953.000000

All cyclers (on each map) have the same position

RauliTop commented 2 years ago

L 11/05/2021 - 19:08:34: Map: deathrun_yellowbase_remastered ent: 54 size: -128.000000 -128.000000 -128.000000 128.000000 128.000000 128.000000 L 11/05/2021 - 19:09:05: Map: deathrun_woodo ent: 151 size: -3873.000000 -1.000000 -929.000000 3633.000000 3873.000000 1953.000000 L 11/05/2021 - 19:09:52: Map: deathrun_woodo_easy ent: 110 size: -3873.000000 -1.000000 -929.000000 3633.000000 3873.000000 1953.000000

All cyclers (on each map) have the same position

Strange why is happening this... and what is his normal size? 0?

as workaround try setting his sizes to 0.0

Maxi605 commented 2 years ago

L 11/05/2021 - 19:08:34: Map: deathrun_yellowbase_remastered ent: 54 size: -128.000000 -128.000000 -128.000000 128.000000 128.000000 128.000000 L 11/05/2021 - 19:09:05: Map: deathrun_woodo ent: 151 size: -3873.000000 -1.000000 -929.000000 3633.000000 3873.000000 1953.000000 L 11/05/2021 - 19:09:52: Map: deathrun_woodo_easy ent: 110 size: -3873.000000 -1.000000 -929.000000 3633.000000 3873.000000 1953.000000 All cyclers (on each map) have the same position

Strange why is happening this... and what is his normal size? 0?

as workaround try setting his sizes to 0.0

The normal sizes are all 0.0.

Is it possible to force set the size?

StevenKal commented 2 years ago

Yes, very strange problem... But this is already good someone figured out a part of the location of the issue. Are all of those entities concerned always "cycler" and not "cycler_sprite" or other cycler type?

RauliTop commented 2 years ago

The normal sizes are all 0.0.

Is it possible to force set the size?

Yeah of course.

If size is not 0.0, then set it to 0.0 with entity_set_size

RauliTop commented 2 years ago

Someone asking for help with this issue

This is the possible plugin fix:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

//new g_szMapname[32];

public plugin_init()
{
    register_plugin("cycler size fix", "0.1", "RauliTop");
}

public plugin_precache()
{
    //get_mapname(g_szMapname, charsmax(g_szMapname));
    RegisterHam(Ham_Spawn, "cycler", "Ham_Spawn_Cycler", 1);
    RegisterHam(Ham_Spawn, "cycler_sprite", "Ham_Spawn_CyclerSpr", 1);
}

public Ham_Spawn_Cycler(ent)
{
    new Float:Mins[3], Float:Maxs[3];
    pev(ent, pev_mins, Mins);
    pev(ent, pev_maxs, Maxs);
    //log_to_file("stuckdebug.log", "cycler. Map: %s ent: %i size: %f %f %f %f %f %f", g_szMapname, ent, Mins[0], Mins[1], Mins[2], Maxs[0], Maxs[1], Maxs[2]);

    if (Mins[0] != 0.0 && Maxs[0] != 0.0)
    {
        set_pev(ent, pev_mins, {0.0, 0.0, 0.0})
        set_pev(ent, pev_maxs, {0.0, 0.0, 0.0})
        set_pev(ent, pev_size, Float:{0.0, 0.0, 0.0, 0.0, 0.0, 0.0})
    }
}

public Ham_Spawn_CyclerSpr(ent)
{
    new Float:Mins[3], Float:Maxs[3];
    pev(ent, pev_mins, Mins);
    pev(ent, pev_maxs, Maxs);
    //log_to_file("stuckdebug.log", "cycler_sprite. Map: %s ent: %i size: %f %f %f %f %f %f", g_szMapname, ent, Mins[0], Mins[1], Mins[2], Maxs[0], Maxs[1], Maxs[2]);

    if (Mins[0] != 0.0 && Maxs[0] != 0.0)
    {
        set_pev(ent, pev_mins, {0.0, 0.0, 0.0})
        set_pev(ent, pev_maxs, {0.0, 0.0, 0.0})
        set_pev(ent, pev_size, Float:{0.0, 0.0, 0.0, 0.0, 0.0, 0.0})
    }
}
StevenKal commented 1 year ago

Yeah those cyclers which turns very large & solid... But I remember last year, I made a quick test, I removed all of those entities with a test command, I was able to move (no longer stuck), but after that I changed the map to the same one via "amx_rcon restart" (in usual the map should reinitialize entities), but I was still stuck, and, the cyclers were no longer there just like if I had not changed the map.

I run legit GoldSrc with ReGameDLL_CS, I have the feeling this is a ReGameDLL_CS specific-issue and when running some maps (because if we play for example, the legit maps cycle, this normally does not happen). I am wondering if this is not due to the save/restore code or similar, hard to figure out this one! Will need deep tests & investigation. For now, best solution is to program a server reboot, one per day at least, in the night (I personnaly have 2 per day (5AM + 2PM) because this shit can happen before 24h range!).

Hedgefog commented 1 year ago

Yeah, the same issue. After a while collision starts working incorrectly, weapon boxes start floating, trace lines start returning hit results for void, entities detect touch with air and models disappears. I spent a lot of time to find a pattern and reason for the bug thinking that it was a problem on my side and that maybe my mods breaks entities or work with entities in the wrong way sometimes, but I didn't find why...

P.S.: The bug is reproducible even with the cycler fix.

Maxi605 commented 1 year ago

After extensive testing, this "solves" the problem. It'll cause some issues in some maps that rely on the hitboxes of the cycler itself, since it removes said hitbox, if you have other plugins to create blocks (like walkguard) you can patch that up.

#include <amxmodx>
#include <engine>
#include <xs>

/* =================================================================================
*               [ Global ]
* ================================================================================= */

enum _:Fix_Entity_Struct
{
    Fix_Entity_Index,
    Float:Fix_Entity_Mins[ 3 ],
    Float:Fix_Entity_Maxs[ 3 ]
}

/* =================================================================================
*               [ Plugin Events ]
* ================================================================================= */

public plugin_init( )
{
    register_plugin( "Random Fixes", "1.0", "Manu" );

    register_logevent( "OnRoundStart", 2, "1=Round_Start" );

    RemoveBigCyclers( );
    MakeCyclersNonSolid( );
}

/* =================================================================================
*               [ Round Events ]
* ================================================================================= */

public OnRoundStart( )
{
    MakeCyclersNonSolid( );
}

/* =================================================================================
*               [ Remove Big Cyclers ]
* ================================================================================= */

RemoveBigCyclers( )
{
    new const szClassnames[ ][ ] = {
        "cycler",
        "cycler_sprite"
    };

    new Float:flOrigin[ 3 ];
    new Float:flMins[ 3 ];
    new Float:flMaxs[ 3 ];

    new iEnt;

    for ( new i = 0, j = 0 ; i < sizeof( szClassnames ) ; i++ )
    {
        iEnt = 0;

        while ( ( iEnt = find_ent_by_class( iEnt, szClassnames[ i ] ) ) > 0 )
        {
            entity_get_vector( iEnt, EV_VEC_origin, flOrigin );
            entity_get_vector( iEnt, EV_VEC_mins, flMins );
            entity_get_vector( iEnt, EV_VEC_maxs, flMaxs );

            xs_vec_add( flOrigin, flMins, flMins );
            xs_vec_add( flOrigin, flMaxs, flMaxs );

            for ( j = 0 ; j < 3 ; j++ )
            {
                if ( floatabs( flMaxs[ j ] - flMins[ j ] ) < 1024.0 )
                {
                    continue;
                }

                remove_entity( iEnt );

                break;
            }
        }
    }
}

/* =================================================================================
*               [ Make Cyclers Non Solid ]
* ================================================================================= */

MakeCyclersNonSolid( )
{
    new const szClassnames[ ][ ] = {
        "cycler",
        "cycler_sprite"
    };

    new iEnt;

    for ( new i = 0 ; i < sizeof( szClassnames ) ; i++ )
    {
        iEnt = 0;

        while ( ( iEnt = find_ent_by_class( iEnt, szClassnames[ i ] ) ) > 0 )
        {
            entity_set_int( iEnt, EV_INT_solid, SOLID_NOT );
        }
    }
}
di57inct commented 1 year ago

That's very poorly written. Just restore their sizes to normal on spawn or after a certain time after spawn or set them to solid trigger. If they aren't allowed to be modified in any way you can also fake the properties to the players in addtofullpack.

Maxi605 commented 1 year ago

That's very poorly written. Just restore their sizes to normal on spawn or after a certain time after spawn or set them to solid trigger. If they aren't allowed to be modified in any way you can also fake the properties to the players in addtofullpack.

Works as intended. You can't restore their size due to them re-sizing again and again, it's pointless. We tried multiple ways to solve the problem, the only useful way is to just remove the hitboxes. We did extensive testing, this is the best way we found so far.

di57inct commented 1 year ago

Check if the solid state changes or not. If it doesn't, set them to SOLID_TRIGGER. If it does, use AddToFullPack. EDIT: You can also set your wanted properties on entity think.

justgo97 commented 1 year ago

Have anyone tried setting sv_rehlds_local_gametime to 1 and see if that helps?

Hedgefog commented 1 year ago

Have anyone tried setting sv_rehlds_local_gametime to 1 and see if that helps?

yep, it doesn't help me