striker Posted December 7, 2014 Report Share Posted December 7, 2014 This is an extremely ALPHA project and by no means is appropriate for production servers! ONLY FOR DEVELOPMENT SERVERS (when released) Hey guys, Intro Just want to share with you my latest project that I have been working on. One of the biggest issues I have seen with running a server is low fps do to the shear amount of objects in the server. I pondered on how I could solve this issue. One of the first games to pop into my head was Minecraft. Why is Minecraft significant? It's significant because the size the levels can be can practically be unlimited to the average person, and the way they achieve this is, well, level chunks. So I decided I would take this concept and apply it to the object spawning mechanism. The Mechanism The way dayz currently spawns in objects is it spawns everything in at once when the server starts. This creates lower FPS on the client side because the clients have to account for all of those vehicles. The way I have reworked the mechanism is to put all the objects into an array for later access. I get the chuck the players are in by using a function that divides their location by the chunk size. This in turn, creates a array location which can also get the objects within their chunk. You can also apply a chunk radius which will be added and subtracted from the current chunks location. This is done to prevent only one chunk to load at once. Benchmark Here is a few screen shots of the script in action and then without the script. This is on a public server with less than a thousand objects on the server. (FPS in upper right hand corner) With chunk script Without chunk script Result: As you can see from the pictures, rural areas on the map, FPS increase is close to +20, while on the city side of the spectrum, FPS increase is a mere +5 FPS. But that is not where the script is suppose to shine... What if I told you we could have 10,000 object on the server with a decent FPS? Lets try it at 2,000 vehicles first shall we ;) With chunk script Without chunk script Result: Yep, chunks helped tremendously with the FPS of the client. It's FPS was a shear +38 fps more and there was 2,000 vehicles. The performance increase is great but there still is a long road(network lag) ahead of the script. Any thoughts? Should I continue with it? IS IT THE FUTURE? Ill share the script once I have it to an exceptionable point. However, if there is a massive influx of people who want to see it for themselves, I might release what I have now. Appreciate and support my work? GZA, TNT, RiMMON and 7 others 10 Link to comment Share on other sites More sharing options...
Sandbird Posted December 8, 2014 Report Share Posted December 8, 2014 Nice idea...i hope without that endless pit where the chunks were missing in minecraft and you just saw lava flowing from holes down to oblivion :P You should check this post here: I think these 2 combined (if you are not already doing it with a similar way) will really boost both server and client fps. Markokil321 1 Link to comment Share on other sites More sharing options...
Markokil321 Posted December 8, 2014 Report Share Posted December 8, 2014 Fuck yes, DO IT! :P Got me testserver on standby, lol Tricks 1 Link to comment Share on other sites More sharing options...
fallingsheep Posted December 8, 2014 Report Share Posted December 8, 2014 Why is this not standard in dayz!!! dude you may just changed they way dayz works forever! Question time. 1. Are the chunks loaded local or still serverside? 2. If im in a chunk with 100+ vehicles will it affect others in different chunks? 3. Is there any lag/loadtime when moving from chunk to chunk? (i saw there was network lag in your post is this the issue? ) Link to comment Share on other sites More sharing options...
Zupa Posted December 8, 2014 Report Share Posted December 8, 2014 THe idea is nice. But is it doable spawning alot of vehicles moving to a neighbour chunk on a populated server. Link to comment Share on other sites More sharing options...
f3cuk Posted December 8, 2014 Report Share Posted December 8, 2014 Please show us code. Link to comment Share on other sites More sharing options...
cen Posted December 8, 2014 Report Share Posted December 8, 2014 I'll take any performance increases I can get! ARcoolJ 1 Link to comment Share on other sites More sharing options...
ARcoolJ Posted December 8, 2014 Report Share Posted December 8, 2014 Awesome Idea, Performance FTW! cen 1 Link to comment Share on other sites More sharing options...
striker Posted December 9, 2014 Author Report Share Posted December 9, 2014 Hey everyone, Thanks for your interest, ill be releasing some code tomorrow. :lol: I have to get the Build Vectors update out first, then Ill be moving onto this project more. :) @f3cuk, I seen your work from Sandbirds link in his post, and mixing the too scripts should be a really good mixture. Your script handles objects that can be spawned client side and my script to handle objects that need to be synced across all clients. So, in basic terms, mine will handle Vehicles, Storage, Doors, and the Dynamic Debris stuff, while yours handles Map Addons, and most Modular Building Objects. We can discuss more if you would like. striker Markokil321 1 Link to comment Share on other sites More sharing options...
f3cuk Posted December 9, 2014 Report Share Posted December 9, 2014 Check PM ;-) Link to comment Share on other sites More sharing options...
cen Posted December 9, 2014 Report Share Posted December 9, 2014 You two working together makes me feel good in my pants Logan, LunatikCH and Richie 3 Link to comment Share on other sites More sharing options...
Richie Posted December 9, 2014 Report Share Posted December 9, 2014 You two working together makes me feel good in my pants That is wrong on so many levels :lol: I was actully eating when i read that, now i'm not so hungry, thanks for that :P Link to comment Share on other sites More sharing options...
cen Posted December 9, 2014 Report Share Posted December 9, 2014 :D Link to comment Share on other sites More sharing options...
L3G0 Posted December 12, 2014 Report Share Posted December 12, 2014 The Mechanism The way dayz currently spawns in objects is it spawns everything in at once when the server starts. This creates lower FPS on the client side because the clients have to account for all of those vehicles. The way I have reworked the mechanism is to put all the objects into an array for later access. I get the chuck the players are in by using a function that divides their location by the chunk size. This in turn, creates a array location which can also get the objects within their chunk. You can also apply a chunk radius which will be added and subtracted from the current chunks location. This is done to prevent only one chunk to load at once. If i understood it correctly, you are iterating over the array x times per minute and check if the player is near the object? The question is, if this is realy more sufficient then the current solution. Do you plan the to delete the objects after the player has left the corridor? Because this would produce a lot of lag, but keeping them would result in lower fps... Well the other Question is, why are your fps so low? Our server has >7000 Objects and the fps is pretty good about 60fps on most clients. The only issue we got (why we need to delete them sometimes) is, that the player sometimes spawn as seagull, if there was a lot of action... so the synchronization is a huge problem. This way maybe it would be better to spawn the non gear objects local instead and broadcast all damage informations about the network. Link to comment Share on other sites More sharing options...
jahangir13 Posted December 12, 2014 Report Share Posted December 12, 2014 I am always happy with some nice ideas but I am not sure if Minecraft is what we want here ;)) I have a tekkit lite server now for about 2 years and one of the things which does not work very well in my opinion is chunk-loading. People moving fast (flying around) or teleporting (not important in epoch) slow down the server enormeously. How does that normally work in dze: is the load only generated at server start as you point out in 'The Mechanism' or is the game looping over all objects the map all x secs/mins? How did you then create the screenshots with the measurements? Is that what we see when you login or at any time standing there. I guess I did not understand processing of objects so far ,) Link to comment Share on other sites More sharing options...
L3G0 Posted December 12, 2014 Report Share Posted December 12, 2014 is the load only generated at server start did you mean loot? the lootspawn is triggered every few seconds, the lootspawn function gets called and then checks if you are in a vehicle or something like that. if not it gets all buildings arround you, reads and adds some variables (if loot got spawned or when the building got lootet) and then the loot gets spawned or not... this function also spawns the zombies following some rules. afterwards there is a cleanup loop which delets the lootpiles and resets the variables. This was a very short and inaccurate explanation, if you want to see how it realy works consider the file "player_spawnCheck.sqf". Link to comment Share on other sites More sharing options...
f3cuk Posted December 12, 2014 Report Share Posted December 12, 2014 If i understood it correctly, you are iterating over the array x times per minute and check if the player is near the object? The question is, if this is realy more sufficient then the current solution. Do you plan the to delete the objects after the player has left the corridor? Because this would produce a lot of lag, but keeping them would result in lower fps... Well the other Question is, why are your fps so low? Our server has >7000 Objects and the fps is pretty good about 60fps on most clients. The only issue we got (why we need to delete them sometimes) is, that the player sometimes spawn as seagull, if there was a lot of action... so the synchronization is a huge problem. This way maybe it would be better to spawn the non gear objects local instead and broadcast all damage informations about the network. Ugh all these assumptions.. -- I'm not sure what approach striker is talking about, but the way we did it (note present tense) is simply spawning objects around a player that is within their view range. It's hardly optimized and already producing really good results. After I'm done optimizing it, which basically means making a better prediction of what needs to spawn when in order to prevent a player from seeing objects appear. If a player is not moving, do not update - Done Only update when the player has moved X meters from when the last check took place - Done Increase check interval if player gets close to the edge of the update radius - Done Calculate the speed in which a player is moving and adjust either the interval/or object spawn range - To do Based on the the direction and speed the player is moving, shift the center of the object spawn radius. - To do Adjust settings based on PC performance, a faster pc can have a lower radius because it handles objects spawning quicker - To do Link to comment Share on other sites More sharing options...
L3G0 Posted December 12, 2014 Report Share Posted December 12, 2014 If a player is not moving, do not update - Done Only update when the player has moved X meters from when the last check took place - Done Increase check interval if player gets close to the edge of the update radius - Done Calculate the speed in which a player is moving and adjust either the interval/or object spawn range - To do Based on the the direction and speed the player is moving, shift the center of the object spawn radius. - To do Adjust settings based on PC performance, a faster pc can have a lower radius because it handles objects spawning quicker - To do Well yeah, this this sounds more interesting, but maybe you should think about spawning all buildables without gear just local, this way the game itself does not have to synchronize them. The only important synchronizations could be done via script. Specially how do you plan to handle the gear, if you are really deleting the objects (since you did not answer this question)? Link to comment Share on other sites More sharing options...
f3cuk Posted December 12, 2014 Report Share Posted December 12, 2014 Well yeah, this this sounds more interesting, but maybe you should think about spawning all buildables without gear just local, this way the game itself does not have to synchronize them. The only important synchronizations could be done via script. Specially how do you plan to handle the gear, if you are really deleting the objects? We spawn all indestructible / non-interactive objects local on the client. For more info check the thread SandBird linked above. -- Striker is working on something that would do the same thing but for the objects spawned by the server (e.g. destructible / interactive objects). Link to comment Share on other sites More sharing options...
L3G0 Posted December 12, 2014 Report Share Posted December 12, 2014 Striker is working on something that would do the same thing but for the objects spawned by the server (e.g. destructible / interactive objects). Sorry didn't get your are talking about another script :D Link to comment Share on other sites More sharing options...
striker Posted December 12, 2014 Author Report Share Posted December 12, 2014 Hey guys, I'll talk more when I get home. :) @L3GO 7000+ objects at 60fps? I find that impossible... :D striker pepstar34 1 Link to comment Share on other sites More sharing options...
ARcoolJ Posted December 12, 2014 Report Share Posted December 12, 2014 Hey guys, I'll talk more when I get home. :) @L3GO 7000+ objects at 60fps? I find that impossible... :D striker Pretty sure he is talking about some Client FPS and not Server FPS ... Link to comment Share on other sites More sharing options...
cen Posted December 12, 2014 Report Share Posted December 12, 2014 Pretty sure he is talking about some Client FPS and not Server FPS ... I would hope so, server FPS is capped at 50 :D ARcoolJ 1 Link to comment Share on other sites More sharing options...
warchild Posted December 12, 2014 Report Share Posted December 12, 2014 Yesyesyes! Can't wait for this to be released. Will throw it on a testserver and test it thoroughly. :-) Hope you'll release it on github/gitlab so people can work together in perfecting it. Link to comment Share on other sites More sharing options...
DimitriPokki Posted December 14, 2014 Report Share Posted December 14, 2014 when release ?... Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now