Multithreaded PAWN using just standard NPCs
#10

I just stumbled upon this thread when searching for something else.
Now 2 years later I actually made use of that idea in RNPC.

I use the NPC processes to check for players in a certain range around the NPC, to use that information in the gamemode process, and for my purpose those checks have to run quite often (<200ms intervals)
Checking for close players will, in the big majority of the cases, return no result, as most of the time most players wont be near the NPC. Still that distance checks are a quite heavy task for a server with many players and/or many NPCs.
Communication is realized over a command that is sent to the server to notify about any players within the range, so that event can then be handled by the server (in my case, check whether the players vehicle is standing directly on the NPC, or driving over it).
I really dont know how much work exactly it is for the server to receive and handle an incomming command, but Im pretty sure that the communication overhead is much lighter than running all the checks directly on the server, considering the rareness of the event and the high frequency of the checks.

Also, now that there is the possibility/knowledge to create NPC plugin and so greatly expand the power of NPC scripts, I thought it would be worth reviving a two years old thread, cant harm to have that concept in your stock.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)