RizoN Posted October 31, 2016 Share Posted October 31, 2016 Hello there. I'm having a dilemma about this. Is it better to create all elements(like objects) on client side, or server side? Of course, there are lot of things which could determine which option is better. Pros of client-side 1. Creating thousands of objects on client-side is far better than on server-side (example: DM Maps) 2. Good for gamemodes which don't require too much syncCons of client-side 1. Vehicles, peds, breakable objects aren't that well synced as if they would be on server-side 2. Security issues (everything on client side could be manipulated into malicious client's will) 3. Maps could be stolenPros of server-side 1. Great sync for vehicles, peds, breakable objects 2. Clients cannot manipulate or steal server-sided elements by themselves Cons of server-side 1. Huge performance impact when dealing with lot of elements(objects, vehicles) 2. Makes server laggy after some time So, what do you think? Is it better to sacrifice security for better loading or should the server handle it? Should map loading type be based on gamemode/what we're loading? Any better ideas? Thanks for reading I would appreciate if someone with experience could reply to this topic. Link to comment
Gravestone Posted October 31, 2016 Share Posted October 31, 2016 22 minutes ago, RizoN said: 1. Huge performance impact when dealing with lot of elements(objects, vehicles) This is the most important point you should consider, since the performance of the server matters alot. I know an idea about having the map's on client sided. You can convert your maps to lua form using something like this and then use any client file protecting way for example the most common, 'cache=false' attribute in the meta. However this does not fully protect your files but there are many other tutorials by forum members, you can go look for them. Link to comment
RizoN Posted October 31, 2016 Author Share Posted October 31, 2016 7 minutes ago, Gravestone said: This is the most important point you should consider, since the performance of the server matters alot. I know an idea about having the map's on client sided. You can convert your maps to lua form using something like this and then use any client file protecting way for example the most common, 'cache=false' attribute in the meta. However this does not fully protect your files but there are many other tutorials by forum members, you can go look for them. Thanks for replying, I am already extracting XML data from .map files and placing it inside of a Lua table containing all elements. Using external convertor is a much slower method of achieving this, and in case of the website being offline/having bugs, I wouldn't be able to do anything about it. The maps when transferred to client are already in his computer's memory and are deleted when all necessary elements(objects, vehicles, etc) are created. Link to comment
Gravestone Posted October 31, 2016 Share Posted October 31, 2016 1 minute ago, RizoN said: Thanks for replying, I am already extracting XML data from .map files and placing it inside of a Lua table containing all elements. Using external convertor is a much slower method of achieving this, and in case of the website being offline/having bugs, I wouldn't be able to do anything about it. The maps when transferred to client are already in his computer's memory and are deleted when all necessary elements(objects, vehicles, etc) are created. Are you sure? The website is online for me. Link to comment
GTX Posted October 31, 2016 Share Posted October 31, 2016 It really depends: Are you making a multigamemode? If so, go for client side because if you do it on server side, you will load map for every player in the server, which is not good. On the other hand, if you want to load a map for all players in the server, you should go for server side. Link to comment
RizoN Posted October 31, 2016 Author Share Posted October 31, 2016 49 minutes ago, Gravestone said: Are you sure? The website is online for me. You've misread my post. I said: in case of being offline, I haven't said that it's offline 48 minutes ago, GTX said: It really depends: Are you making a multigamemode? If so, go for client side because if you do it on server side, you will load map for every player in the server, which is not good. On the other hand, if you want to load a map for all players in the server, you should go for server side. Thanks for replying, What about the security issues? Maps could be stolen this way Also, another question popped in my head. Which way would be recommended to download maps? (I believe you have experience with this) There are couple of things that get transferred from a custom maploader to client 1. Map settings (extracted from .map file) (is sending this to a client via triggerClientEvent bad?) 2. Map files(sounds, mods) (would downloadFile be fine, or do i need to download it from a server via fetchRemote? there's also latent events, but I hear they're bad impact on server when lots of players) I hope you or somebody else could give me a clear thought about this, since I'm not really sure anymore which is the best way. Link to comment
GTX Posted October 31, 2016 Share Posted October 31, 2016 (edited) Well, only people with experience in networking could steal maps if you use triggerLatentClientEvent (not triggerClientEvent, in latent event other network traffic isn't blocked while the data is being transfered). You could even encrypt data if you'd like. FetchRemote is definitely faster but it's not secure. I'd suggest to compress map data and send it through triggerLatentClientEvent (so you don't need to worry about security much) and files through fetchRemote (that's what I use). So, you have three options: Go for fetchRemote on both (in terms of security, this is bad, but in terms of speed, it's faster than latent event, especially if you use Gzip compression) Go for latent event on both (in terms of speed, this is slow and is bad when all players download at the same time, but in terms of security, I think you're good to go) Use latent events and for files use fetchRemote (which are usually bigger than map and you usually don't need to protect them) It's up to you. If someone finds any other (better) way, let me know. Edited October 31, 2016 by GTX 1 Link to comment
RizoN Posted October 31, 2016 Author Share Posted October 31, 2016 Thank you for explaining this to me. Could you please tell me why is fetchRemote so insecure as you are saying? Also I don't really know how to use that compression thing which you were saying (if you got the time could you shortly introduce me to it?) Link to comment
GTX Posted October 31, 2016 Share Posted October 31, 2016 Well, you need a webserver to access it and since you need to access it with fetchRemote, everyone can access it in browser. For compression thing, use your logic Link to comment
RizoN Posted October 31, 2016 Author Share Posted October 31, 2016 Okay, thanks for answering my questions Luckily there's a .htaccess file with which you can restrict access just to your server ip (yes I'm aware that only a serverside fetchRemote function will work for these files) Link to comment
roaddog Posted November 1, 2016 Share Posted November 1, 2016 Compile and Create a backdoor for yourself for example; You set a root element data like setElementData(root, "mapSecure", "randomCodes") and then in your every map put a check on very top before your main script if the elment data is right otherwise return false and not loading the maps. Eg: if getElementData(root, "mapSecure") ~= "randomCodes" then return false end --rest of the codes--- Link to comment
RizoN Posted November 1, 2016 Author Share Posted November 1, 2016 3 hours ago, NeverGiveup said: Compile and Create a backdoor for yourself for example; You set a root element data like setElementData(root, "mapSecure", "randomCodes") and then in your every map put a check on very top before your main script if the elment data is right otherwise return false and not loading the maps. Eg: if getElementData(root, "mapSecure") ~= "randomCodes" then return false end --rest of the codes--- Could you please explain what is this useful for? I don't think there's a need for this since everything here is happening at server-side, and using root on setElementData is a little bit inefficient, don't you think? Link to comment
RizoN Posted November 1, 2016 Author Share Posted November 1, 2016 Also, if let's say 50 players start downloading a 1MB file from server via latent client event, would that make the server lag? Also what bandwidth limit is recommended in these situations?@GTX Link to comment
GTX Posted November 1, 2016 Share Posted November 1, 2016 I didn't try with 50 players yet. I tried with 10 and it worked really good. I got bandwidth set to 2 MB. I don't think downloading 1 MB file will cause lag. 1 Link to comment
roaddog Posted November 2, 2016 Share Posted November 2, 2016 (edited) 12 hours ago, RizoN said: Could you please explain what is this useful for? I don't think there's a need for this since everything here is happening at server-side, and using root on setElementData is a little bit inefficient, don't you think? https://github.com/nokizorque/GTI-source-2014/tree/master/[Maps]/GTImapConverter I thougjt you gonna make it clientside, i usually convert my map file to lua using the res above then i put the security code and then compile it. Once you check the security code and it returns false then the map wont be loaded Edited November 2, 2016 by NeverGiveup Link to comment
GTX Posted November 2, 2016 Share Posted November 2, 2016 It's useless and not worth it. If he wants to create objects client side, he can just send data from server and create them - and it's most safest way too. 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