Korwiin

initServer vs initPlayerLocal

9 posts in this topic

I noticed that the default Tanoa Exile mission has Vendor NPCs created in the initPlayerLocal file, but the trader city objects are in the InitServer file.  I am curious why not have both in the initPlayerLocal?   I am thinking along the lines of any walls or barrier objects would need to be server side so that AI will walk around them, but the decorative stuff like beer bottles, photos, guns on the walls could move client side only, and possibly conserve server resources?

  

 

Share this post


Link to post
Share on other sites

If the objects where in initPlayerLocal, they'd be created every time anyone joined the server so you'll end up with dozens of the same buildings and items all overlapping. The server also then has to deal with all the extra objects.

Loading these objects via initServer means the server loads them just the once.

  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

I can see why that would be a problem.    So the NPC Traders are loaded in the initPlayerLocal file by default.     Are they somehow local client side only?  
 

 

Share this post


Link to post
Share on other sites

Okay, I see now... createVehicleLocal is used for NPC traders.    So for custom map edits/decorations,  and most of the trader cities, wouldn't it be better if it was in InitPlayerLocal as  a createVehicleLocal instead of a simple object on the server?

Share this post


Link to post
Share on other sites

Put the trader NPCs in initPlayerLocal, put objects in initServer. That's the way to do it.

Edited by kuplion

Share this post


Link to post
Share on other sites
On 10/11/2016 at 5:37 AM, Korwiin said:

Okay, I see now... createVehicleLocal is used for NPC traders.    So for custom map edits/decorations,  and most of the trader cities, wouldn't it be better if it was in InitPlayerLocal as  a createVehicleLocal instead of a simple object on the server?

The server spawning these objects is a one time thing. It happens when the server loads and that's it. You're not going to improve server performance by spawning them with the client, you're just going to slow the clients loading time.

  • Like 2

Share this post


Link to post
Share on other sites

@Mezo   thanks for the reply.       The real question I should have asked is:   

When adding decorations to a trader area, would it be BETTER for server performance to use createVehicleLocal inside the initPlayerLocal.sqf instead of the conventional createSimpleObject inside the initServer.sqf? 

From the wiki createSimpleObject uses very little network traffic while createVehicleLocal the created object is not transferred through network in MP games.  So the assumption is that simpleobjects still use some network/memory/cpu on server and local vehicles don't.

Share this post


Link to post
Share on other sites
20 minutes ago, Korwiin said:

@Mezo   thanks for the reply.       The real question I should have asked is:   

When adding decorations to a trader area, would it be BETTER for server performance to use createVehicleLocal inside the initPlayerLocal.sqf instead of the conventional createSimpleObject inside the initServer.sqf? 

From the wiki createSimpleObject uses very little network traffic while createVehicleLocal the created object is not transferred through network in MP games.  So the assumption is that simpleobjects still use some network/memory/cpu on server and local vehicles don't.

I see what you're saying and the theory is correct, providing createVehicleLocal does what it says it does... which it doesn't half of the time xD

letting the server create the objects on start with createSimpleObject is for sure the best way to do it. This really isn't that big of a task for the server to handle.

  • Like 2

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.