View Single Post
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 09-15-2009 , 13:33   Re: [INFO] Fakemeta & Ham detailed function descriptions and examples
Reply With Quote #3

Fakemeta function:
PHP Code:
EngFunc_EntitiesInPVS 
Description:
This function checks entities that are in the PVS of an entity.
It can be used on all entities except worldspawn!

What is PVS?
PVS means potentially visible set, this means that the entities that we have in this list can be seen.
PVS does not hold just the entities that we see!
By knowing this we can get to the conclusion that PVS has the role of limiting data transfer for better internet connection/lower amount of data transfer!

So in small words I want to say something like this:
Code:
Entity that is in PVS => Can be seen => Data Transfer about that entity
Entity that it is not in PVS => Can not be seen => No data transfer => Save bandwidth
How does it work?
Well let's say that every room of the map is a cube.
We find ourselves in a room and that also means that we are in the cube of that room.
We can see the entities in the next rooms because the cubes of that room touch with the cube of the room we are in.

How do I use this function?
Well this function doesn't work like EngFunc_FindEntityInSphere so the HL engine has another method of providing the information.
At first this function returns a start entity and after that we can find the next entity using pev_chain/EV_ENT_chain. And so on, untill pev_chain is NULL.

Example Usage:
PHP Code:
public whatisonPVS(id)
{
    static 
nextchain
    
static class[32]
    
    
next engfunc(EngFunc_EntitiesInPVSid)
    while(
next)
    {
        
pev(nextpev_classname, class, charsmax(class))
        
chain pev(nextpev_chain)
        
        
server_print("Found entity in player (%i) PVS: ent(%i) class(%s)"idnext, class)
        
        if(!
chain)
            break
    
        
next chain
    
}

__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 09-15-2009 at 13:40.
ot_207 is offline