Jump to content

Performance of using a lot of setElementData with synchronization disabled


Geo

Recommended Posts

Hello guys, I'm writing a gamemode and I'm using a lot of setElementData in order to work with the functionality of the items in my script. The synchronization between server and client is disabled, all the element data is handled server side. I was wondering, is this a bad practice? Since I've read using synchronization takes a toll on server performance, I was wondering how much of a toll would be without synchronization. 

Link to comment
  • Moderators
10 minutes ago, Geo said:

I was wondering how much of a toll would be without synchronization. 

If synchronization is enabled, the server as well as all players have that performance penalty. If disabled, it is just the server (and exclusive network packets management).

 

10 minutes ago, Geo said:

I was wondering, is this a bad practice?

It is not bad practice, but if you could use Lua instead, it would be even better since it is a lot faster (and doesn't trigger the event system)

Edited by IIYAMA
Link to comment
Just now, IIYAMA said:

If synchronization is enabled, the server as well as all players have that performance penalty. If disabled, it is just the server (and exclusive network packets management).

 

It is not bad practice, but if you could use Lua instead, it would be even better since it is a lot faster (and doesn't trigger the event system)


What would be an example of doing this in Lua? 
What I'm doing is setting data to an created object element in order to act accordingly when that object is used by players

Edited by Geo
Link to comment
  • Moderators
27 minutes ago, Geo said:

What would be an example of doing this in Lua? 

 

The very basic.

local example = {}


function saveExample (object, player)
	example[object] = player
	return true
end

function loadExample (object)
	return example[object]
end

 

 

Edited by IIYAMA
  • Thanks 1
Link to comment
Just now, IIYAMA said:

 

The very basic.


local example = {}


function saveExample (object)
	example[object] = player
	return true
end

function loadExample (object)
	return example[object]
end

 

I understand. Thanks!

 

  • Like 1
Link to comment

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.
×
×
  • Create New...