DayZMod / DayZ

DayZMod Public Files
https://dayz.com/
186 stars 90 forks source link

Switch junk streaming from client to server & make permanent #44

Closed joikd2 closed 11 years ago

joikd2 commented 11 years ago

Instead of the client streaming in the roadblocks/wrecks/junk, which sometimes causes a sudden appearance in front of a fast moving vehicle, the server streams it once upon server start, and makes it permanent. I have tested this on my server. It worked great with minimal server performance loss while giving a performance boost to clients. Credit for this goes to isathar at opendayz.net.

  1. Remove the stream code in player_monitor.fsm
  2. Remove stream_locationCheck.sqf, stream_locationFill.sqf, & stream_locationDel.sqf
  3. Create an sqf (we'll call it server_fillLocs.sqf for now) with the following code:

private ["_configBase","_tempList"];

if (isServer) then { _tempList = ["Chernogorsk","Elektrozavodsk","Balota","Komarovo","Kamenka","Kamyshovo","Prigorodki","Kabanino","Solnichniy","StarySobor","NovySobor","SouthernAirport","NorthernAirport","Berezino","Lopatino","GreenMountain","Zelenogorsk","Nadezhdino","Kozlovka","Mogilevka","Pusta","Bor","Pulkovo","Vyshnoye","Drozhino","Pogorevka","Rogovo","Guglovo","Staroye","Pavlovo","Shakhovka","Sosnovka","Msta","Pustoshka","Dolina","Myshkino","Tulga","Vybor","Polana","Gorka","Orlovets","Grishino","Dubrovka","Nizhnoye","Gvozdno","Petrovka","Khelm","Krasnostav","Olsha"]; for "_j" from 0 to ((count _tempList) - 1) do { _configBase = configFile >> "CfgTownGenerator" >> (_tempList select _j);

    for "_i" from 0 to ((count _configBase) - 1) do 
    {
        private ["_config","_type","_position","_dir","_onFire","_object"];

        _config =   (_configBase select _i);
        if (isClass(_config)) then {
            //filter:

                _type =     getText     (_config >> "type");
                //if (((getText (_config >> "type")) != "Body1") and ((getText (_config >> "type")) != "Body2")) then {
                    _position = [] + getArray   (_config >> "position");
                    _dir =      getNumber   (_config >> "direction");
                    _onFire =   getNumber   (_config >> "onFire");

                    _object =  _type createVehicle _position;
                    _object setPos _position;
                    _object setDir _dir;
                    _object allowDamage false;

                    //diag_log format["CreateObj: %1 / %2",_type,_position];
                    /*
                    if (_onFire > 0) then {
                        nul=[_object,_onFire,time,false,false] spawn BIS_Effects_Burn;
                    };
                    */
            //};
        };
        //sleep 0.1; // for longer load, but better startup performance
    };
    sleep 0.5; //comment the other sleep and uncomment this for faster load but slower startup performance
    diag_log ("Creating Objects: " + str(_configBase));
};

};

  1. Add it it to server_functions.sqf

server_fillLocs = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_fillLocs.sqf";

  1. Add it to server_monitor.sqf

_id = [] spawn server_fillLocs;

crazykid1297 commented 11 years ago

Would making roadblocks and trash piles server-side actually help? As it is, clients are not rendering them in time. Even with the latest patch, the problem still does happen.

If it in fact would help the issue even more, I would love to see this happen. But if clients would still have trouble rendering the blocks even if they are server side there wouldn't be a point.

But I'd love to hear a developer's point of view on this, and if making them server-side would actually make any difference.

marceldev89 commented 11 years ago

Spawning those objects server side wouldn't solve any gameplay related issues... Whether the objects are created locally when logging in or globally server side, the objects are there in both cases.

joikd2 commented 11 years ago

They currently aren't created locally when logging in by the client. They are streamed in on-the-fly by the client at a certain distance, then deleted again at a certain distance. That's where the server-side permanent spawning would eliminate the issue. Plus, my server has way more headroom than my client system. So, this would give a small performance boost to the clients, at a cost to the server (which can afford it).

marceldev89 commented 11 years ago

Oops, you're right. Not sure what the hell I was thinking about. :smile:

facoptere commented 11 years ago

I will revert to 1.7.6.1 behavior, where objects of the area were spawned at once to the incoming player. It will be to the detriment to the fps, but since in 1.7.6.1 nobody where complaining of this pseudo "streaming", we can revert to it.

Putting this to the server side is a very bad idea, since these data will be uploaded to every client connecting to the server (what is the benefit to this?), and the client will have to display all objects around 1600m (I think and I hope it's the limit), so less and less fps.

This functionality was there since the beginning of DayZ mod.

PS: I would like some video of the issue, just to see how bad it is.

crazykid1297 commented 11 years ago

I will record some gameplay of my server when there are very many people playing and post it here ASAP.

facoptere commented 11 years ago

any news?

crazykid1297 commented 11 years ago

So sorry, forgot to record the video. Will be doing that tomorrow after I'm available.

I was playing tonight, and the problem still persists for many people.

crazykid1297 commented 11 years ago

Video was recorded just yesterday of my server with only a little amount of players online. It shows some roadblocks rendering seconds before I drive into the area, and a roadblock spawning as a slam into it with my vehicle, busting a tire.

www.youtube.com/watch?v=__HcFT4Gevc