vovo4ka Posted November 22, 2009 Share Posted November 22, 2009 I need to send client a large dynamic array. But I doubt how best to - send a big chunk at once, triggerClientEvent(player, "AcceptData", player, serialize(array)) or send by parts like: for ElementKey, ElementValue in ipairs (array) do triggerClientEvent(player, "AcceptChunkData", player, ElementKey, ElementValue) end Are there any limits on the maximum size of data on triggerClientEvent params? Link to comment
Gamesnert Posted November 22, 2009 Share Posted November 22, 2009 Keep in mind the bandwidth issues when using events - don't pass a large list of arguments unless you really need to. It is marginally more efficient to pass one large event than two smaller ones. There are limits on everything. I doubt you'd hit this limit very quickly though. Why not just try and see? It won't destroy your PC or anything. Link to comment
50p Posted November 22, 2009 Share Posted November 22, 2009 Keep in mind the bandwidth issues when using events - don't pass a large list of arguments unless you really need to. It is marginally more efficient to pass one large event than two smaller ones. If your array is small (say, 1 - 4), you can loop through it but it's not good idea to do so. Just send the array with 1 call. Link to comment
vovo4ka Posted November 22, 2009 Author Share Posted November 22, 2009 thanks. I thought - probably it really better Link to comment
subenji99 Posted November 23, 2009 Share Posted November 23, 2009 It is possible to send too much at once, but such data would be so considerably large that it would be a simple matter to split it up then. I'll give an example from a script I was working on recently - I formed an array containing every gamemode (and it's "friendly name"), with a sub-array of every map compatible with that gamemode (and it's "friendly name" too) for sending to the client for a GUI. (getResourceInfo etc. functions are server-side only) With 10+ gamemodes and over 400+ maps, some of which are used in multiple gamemodes, that made for an incredibly large array, and was too much to send. Such a large array was easily split by only requesting the gamemode list, then when a gamemode was selected, request the map list for just that gamemode. Even with 600+ individual race maps, this has been handled fine. Basically, you can send very large arrays without issue, but not insanely large - which you'll be more than aware that it's too big if you attempted to! Link to comment
eAi Posted November 24, 2009 Share Posted November 24, 2009 If this is data that does't change, store it as a file in the resource. That way it can be cached client-side. If not, does the every client really need all the data all the time? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now