Raised This Month: $51 Target: $400
 12% 

[TUT] Semiclip


Post New Thread Reply   
 
Thread Tools Display Modes
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 08-30-2007 , 14:38   Re: [TUT] Semiclip
Reply With Quote #21

Quote:
If you can challenge the above statement, feel free to.

PreThink is called once per frame, per client.

Touch is calculated at most once per frame.

The way you have it (with the constantly thinking entity) is equivalent to having a server frame hook.

The prethink hook just may not have been working because physics may be done before prethink is called, not sure on that.
__________________
fyren sucks
sawce is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 08-30-2007 , 14:56   Re: [TUT] Semiclip
Reply With Quote #22

Quote:
Originally Posted by sawce View Post
PreThink is called once per frame, per client.

Touch is calculated at most once per frame.

The way you have it (with the constantly thinking entity) is equivalent to having a server frame hook.

The prethink hook just may not have been working because physics may be done before prethink is called, not sure on that.
If the server is getting much higher FPS than the client then that's why that method works better. On a slower server nothing will work properly.

The prethink hook is just not fast enough because a lot of clients get really low FPS. It's really a tradeoff, but the server tends to be faster (even though the think isn't really being called every 0.01 seconds).
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 08-31-2007 , 22:36   Re: [TUT] Semiclip
Reply With Quote #23

Prethink doesn't depend on client FPS, it depends on server FPS.
__________________
fyren sucks
sawce is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 11-23-2007 , 04:24   Re: [TUT] Semiclip
Reply With Quote #24

I did not know it was based on the server's FPS, though I do avoid using it for velocity calculations because some servers are slower than others and that can really screw things up.
__________________
Bad_Bud is offline
OneEyed
AMX Mod X Beta Tester
Join Date: Jun 2005
Old 01-08-2008 , 07:36   Re: [TUT] Semiclip
Reply With Quote #25

Instead of using FindEntInSphere for IsColliding(id)

You could also do this.

Code:
bool:IsColliding(player, Float:distance) {     new Float:myOrigin[3];     new Float:orig[3];     new Float:dir[3];     new id;     new Float:maxdistance = distance * distance;     pev( player, pev_origin, myOrigin );     for(id=1; id<=get_maxplayers(); id++)     {           if(id == player || !is_user_connected(id) || !is_user_alive(id))                 continue;               pev( id, pev_origin, orig);                     orig[0] = orig[0] - myOrigin[0];           orig[1] = orig[1] - myOrigin[1];           orig[2] = orig[2] - myOrigin[2];           distance = (orig[0]*orig[0]) + (orig[1]*orig[1]) + (orig[2]*orig[2]);            if(distance <= maxdistance)                  return true;     }     return false; }

FindEntInSphere does this distance check against every single entity in the map. This just checks every player. Now you can go crazy using semi-clip and not worry about it slowing your server down.
__________________

Last edited by OneEyed; 01-08-2008 at 07:46.
OneEyed is offline
hoboman
Senior Member
Join Date: Jul 2007
Old 03-28-2008 , 00:47   Re: [TUT] Semiclip
Reply With Quote #26

has anything better than the methods in the first post been made yet?

I think I am gonna start trying my own methods if there haven't, but I don't wanna be reinventing the wheel here.

My big idea is to put some sort of invisible, noclipped entities ( boxes ) on every spawned player, then when the boxes of two players touch set those players to not solid. Also I wanna investigate what amxx things could help tweak the client prediction...I haven't really been able to find anything regarding this in the funcwiki except maybe setting a player's movetype to FL_ONTRAIN....lol
__________________
hoboman is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 03-28-2008 , 04:15   Re: [TUT] Semiclip
Reply With Quote #27

Quote:
Originally Posted by hoboman View Post
has anything better than the methods in the first post been made yet?

I think I am gonna start trying my own methods if there haven't, but I don't wanna be reinventing the wheel here.

My big idea is to put some sort of invisible, noclipped entities ( boxes ) on every spawned player, then when the boxes of two players touch set those players to not solid. Also I wanna investigate what amxx things could help tweak the client prediction...I haven't really been able to find anything regarding this in the funcwiki except maybe setting a player's movetype to FL_ONTRAIN....lol
shitty ? You can make this without any "lol" ents...when 2 players touched set to unsolid, but that method is useless and inefficient!And what predicition? -_-

Use OneEyed version...should work!
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
hoboman
Senior Member
Join Date: Jul 2007
Old 03-28-2008 , 13:23   Re: [TUT] Semiclip
Reply With Quote #28

OneEyed posted a more efficient method for hawk's third semi clip method which is still inefficient due to the entity that thinks 100 times a second and not to mention that it still runs the risk of crashing the server because trigger_* entites and not solid players do not mix well...and I dunno why I just paraphrased hawk....


edit: I think I got a better method...gonna release it after I test it a bit more
__________________

Last edited by hoboman; 03-28-2008 at 17:55.
hoboman is offline
hoboman
Senior Member
Join Date: Jul 2007
Old 04-03-2008 , 18:37   Re: [TUT] Semiclip
Reply With Quote #29

this is the best and most efficient way to semiclip:

Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN    "Hobo Semi Clip Lite"
#define AUTHOR    "hoboman313"
#define VERSION    "1.0"

#define MAX_PLAYERS 32
#define SEMI_CLIP_DISTANCE 100.0

new sclippedPlayer[MAX_PLAYERS+1], maxplayers

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
        
    maxplayers = get_maxplayers()
    
    register_forward( FM_ShouldCollide, "make_unsolid" )
    register_forward( FM_PlayerPreThink, "make_solid" )
}

public make_unsolid( entTouched, entOther )
{    

    if( is_user_alive(entOther) && is_user_alive(entTouched) && close_enough(entTouched, entOther )  )
    {
        if( !sclippedPlayer[entOther] )
        {
            set_pev( entOther, pev_solid, SOLID_NOT )
            
            sclippedPlayer[entOther]=true
        }
        
        if( !sclippedPlayer[entTouched] )
        {
            set_pev( entTouched, pev_solid, SOLID_NOT )
            
            sclippedPlayer[entTouched]=true
        }
    }
}


public make_solid( id )
{
    if( sclippedPlayer[id] && is_user_alive(id) )
    {        
        for( new i=1; i<=maxplayers; i++ )
        {
            if( is_user_alive(i) && i!=id && close_enough(i, id) )
            {
                return
            }
        }
        
        sclippedPlayer[id]=false
        set_pev( id, pev_solid, SOLID_BBOX )
    }
}


public bool:close_enough(ent1, ent2)
{
    new Float:origin[3], Float:origin2[3]
    
    pev(ent1, pev_origin, origin )
    pev(ent2, pev_origin, origin2 )
    
    if( get_distance_f( origin, origin2 ) <= SEMI_CLIP_DISTANCE )
        return true

    return false    
}
I was gonna release it as a new plugin, but now I have given up ( and quite honestly I am sick of this plugin, lol ) because if two players are sitting inside each other they are SOLID_NOT and cannot be shot
__________________

Last edited by hoboman; 04-04-2008 at 02:48. Reason: update
hoboman is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 04-03-2008 , 19:11   Re: [TUT] Semiclip
Reply With Quote #30

That's neither the best, nor the most efficient way. It's actually one of the least efficient. Try using it on a surf server.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Old 04-03-2008, 19:15
hoboman
This message has been deleted by hoboman.
Old 04-03-2008, 19:50
Hawk552
This message has been deleted by Hawk552.
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode