Datasets:
Tasks:
Text Generation
Modalities:
Text
Formats:
text
Languages:
Russian
Size:
10K - 100K
Tags:
code
License:
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 next, chain | |
static class[32] | |
next = engfunc(EngFunc_EntitiesInPVS, id) | |
while(next) | |
{ | |
pev(next, pev_classname, class, charsmax(class)) | |
chain = pev(next, pev_chain) | |
server_print("Found entity in player (%i) PVS: ent(%i) class(%s)", id, next, class) | |
if(!chain) | |
break | |
next = chain | |
} | |
} |