Jump to content

Turn custom map content from vehicles to objects


Recommended Posts

How many KB's of buildings/map edits do you guys have? I have found a ton of cool map additions and have spent allot of time in the editor but i think i am soon gonna have to stop due to the amount of things. (currently on 900 KB of added buildings loaded server sided :/)

When I ran a Cherno Server I had something around 20 different SQF files with different map additions. Most likely 900kb+ 

Link to comment
Share on other sites

I have a couple questions on this. What file(s) are you putting the publiceventhandler "init_done" in?

 

Second question is where exactly did you put the code inside the forEach (_BuildingQueue + _objectQueue); loop? Here's where I put it, but this is where I seem to be stuck and the server monitor will not complete.

 

_BuildingQueue = [];
    _objectQueue = [];

    if ((_hiveResponse select 0) == "ObjectStreamStart") then {

        // save superkey
        profileNamespace setVariable ["SUPERKEY",(_hiveResponse select 2)];

        _hiveLoaded = true;

        diag_log ("HIVE: Commence Object Streaming...");
        _key = format["CHILD:302:%1:", dayZ_instance];
        _objectCount = _hiveResponse select 1;
        _bQty = 0;
        _vQty = 0;
        for "_i" from 1 to _objectCount do {
            _hiveResponse = _key call server_hiveReadWriteLarge;
            //diag_log (format["HIVE dbg %1 %2", typeName _hiveResponse, _hiveResponse]);
            if ((_hiveResponse select 2) isKindOf "ModularItems") then {
                //-------------------Load as objects for faster FPS----------------------------
                {
                        _idKey        = _x select 1;
                        _type        = _x select 2;
                        _ownerID    = _x select 3;
                        _worldspace    = _x select 4;
                        _inventory    = _x select 5;
                        _hitPoints    = _x select 6;
                        _fuel        = _x select 7;
                        _damage        = _x select 8;
                        _dir        = 0;
                        _pos        = [0,0,0];
                        _wsDone        = false;
                        _skip        = false;

                        if(_type in _cpcimmune) then {
                            localObjects set[count localObjects, [_type,_ownerID,_worldspace,_damage]];
                            _skip = true;
                        };

                        if(!_skip) then {
                              // continue with spawning server-side items
                //-------------------End Load Objects-----------------------------------------------------------------

                _BuildingQueue set [_bQty,_hiveResponse];
                _bQty = _bQty + 1;
            } else {
                //-------------------Load as objects for faster FPS----------------------------
                {
                        _idKey        = _x select 1;
                        _type        = _x select 2;
                        _ownerID    = _x select 3;
                        _worldspace    = _x select 4;
                        _inventory    = _x select 5;
                        _hitPoints    = _x select 6;
                        _fuel        = _x select 7;
                        _damage        = _x select 8;
                        _dir        = 0;
                        _pos        = [0,0,0];
                        _wsDone        = false;
                        _skip        = false;

                        if(_type in _cpcimmune) then {
                            localObjects set[count localObjects, [_type,_ownerID,_worldspace,_damage]];
                            _skip = true;
                        };

                        if(!_skip) then {
                // continue with spawning server-side items

                _objectQueue set [_vQty,_hiveResponse];
                _vQty = _vQty + 1;
            };
        };
        diag_log ("HIVE: got " + str(_bQty) + " Epoch Objects and " + str(_vQty) + " Vehicles");
    };

Link to comment
Share on other sites

I have a couple questions on this. What file(s) are you putting the publiceventhandler "init_done" in?

 

Second question is where exactly did you put the code inside the forEach (_BuildingQueue + _objectQueue); loop? Here's where I put it, but this is where I seem to be stuck and the server monitor will not complete.

 

_BuildingQueue = [];

    _objectQueue = [];

    if ((_hiveResponse select 0) == "ObjectStreamStart") then {

        // save superkey

        profileNamespace setVariable ["SUPERKEY",(_hiveResponse select 2)];

        _hiveLoaded = true;

        diag_log ("HIVE: Commence Object Streaming...");

        _key = format["CHILD:302:%1:", dayZ_instance];

        _objectCount = _hiveResponse select 1;

        _bQty = 0;

        _vQty = 0;

        for "_i" from 1 to _objectCount do {

            _hiveResponse = _key call server_hiveReadWriteLarge;

            //diag_log (format["HIVE dbg %1 %2", typeName _hiveResponse, _hiveResponse]);

            if ((_hiveResponse select 2) isKindOf "ModularItems") then {

                //-------------------Load as objects for faster FPS----------------------------

                {

                        _idKey        = _x select 1;

                        _type        = _x select 2;

                        _ownerID    = _x select 3;

                        _worldspace    = _x select 4;

                        _inventory    = _x select 5;

                        _hitPoints    = _x select 6;

                        _fuel        = _x select 7;

                        _damage        = _x select 8;

                        _dir        = 0;

                        _pos        = [0,0,0];

                        _wsDone        = false;

                        _skip        = false;

                        if(_type in _cpcimmune) then {

                            localObjects set[count localObjects, [_type,_ownerID,_worldspace,_damage]];

                            _skip = true;

                        };

                        if(!_skip) then {

                              // continue with spawning server-side items

                //-------------------End Load Objects-----------------------------------------------------------------

                _BuildingQueue set [_bQty,_hiveResponse];

                _bQty = _bQty + 1;

            } else {

                //-------------------Load as objects for faster FPS----------------------------

                {

                        _idKey        = _x select 1;

                        _type        = _x select 2;

                        _ownerID    = _x select 3;

                        _worldspace    = _x select 4;

                        _inventory    = _x select 5;

                        _hitPoints    = _x select 6;

                        _fuel        = _x select 7;

                        _damage        = _x select 8;

                        _dir        = 0;

                        _pos        = [0,0,0];

                        _wsDone        = false;

                        _skip        = false;

                        if(_type in _cpcimmune) then {

                            localObjects set[count localObjects, [_type,_ownerID,_worldspace,_damage]];

                            _skip = true;

                        };

                        if(!_skip) then {

                // continue with spawning server-side items

                _objectQueue set [_vQty,_hiveResponse];

                _vQty = _vQty + 1;

            };

        };

        diag_log ("HIVE: got " + str(_bQty) + " Epoch Objects and " + str(_vQty) + " Vehicles");

    };

 

 

 

With the risk of sounding like an ass - which is definitely not my intention - if you cannot figure that out, you probably shouldn't be trying to add this to your server. If i make this into a tutorial and people fail to get it working, they'll come to me asking for help and I'll feel obliged to give them support, i'd rather not spend my time on support.

 

Furthermore none of the code posted by me in this thread is ready to be used on a live server. A lot of stuff, like security for example, has not been thought through and it needs a lot more field testing before it can be deemed stable or even usable.

 

Link to comment
Share on other sites

 

I know, but it sounded like a couple other people got this working and I was hoping one of them might just post the block of code in server_monitor.sqf. That's really all I have left to figure out on this one. I'll keep working at it. I'm a novice, but I usually figure out 95% of the things I get stuck on. Would be nice to get help on occasion to save me several hours.

Link to comment
Share on other sites

nice post ebay, and yeah i think the purpose of this was for buildings that are indestructible, not for normal epoch (wooden) ones. For example i have cinder walls etc indestructible in the server...they are about 4000 objects in the database...Since upgrading and downgrading them will delete the object locally and create a new one on the server, on next restart they will be local again for each player.

-4000 object is a lot !! Plus the trader city objects....thats like 5000 less objects spawning on the map for the server. I havent tested it yet on the real server, but on my crappy Quad Core, and only me online....i had (as a client) 30-40fps, and the server was around 22-30 fps....with 9450 objects in the database and all my scripts in the 2.5mb misson file :P

I dont know...but i think thats a lot of FPS....we'll see when i turn this over to the live server.

Link to comment
Share on other sites

Jup everything you say is correct ebaydayz. Creating and deleting vehicles (locally) does not put a noticeable strain on the client. Although, if hideObjects proves better then obviously that is the way to go.

If you want i could send you the latest files i've got and you can work with them, some of the problems you mentioned have already been solved. And yes, right now we only use it for industructable items, the rest is still handled server side.

Link to comment
Share on other sites

Well i think the Taviana 2.0 map has some kind of hideObject in it by default. The calculation was off though, which caused objects to disappear (when alt+viewing around) instead of appear in front of you. But they may have been testing, i did not see any difference in client fps after spawning about 1500 objects total.

 

Don't really believe the devs are going to release another A2 Epoch version, but yeah i guess they could use this as a default way method to spawn objects, i like how you combined objects + traders. On the previous page i posted a Search and Replace (+ regex) to easily convert map add-ons to the array. Takes about 2 minutes to convert any sqf file if you learn how to use that..

I guess you could put it in the mission file, but it does mean a bigger mission file and i guess some people want to keep their custom add-ons to themselves. I prefer keeping it in the server just because it enables me to change it without forcing our players to redownload the mission pbo.

 

--

 

Edit: Almost forgot, you also need to spawn the objects local on the server in order for the AI to see it.

Link to comment
Share on other sites

We hit 10k today, and i wanted to try this but something must have gone wrong cause although in the test server i was able to load in, in 1-2 minutes.....(with the live db on it)on the live server it was as if it was streaming objects 1 by 1 and we all had to wait for everyone else to load that object first before moving to the next one....

It was really weird....i mean 40 min to load 10k oO.......

 

but then again...i was all alone in the test server...while on the live one 20 people tried to log in at the same time

Link to comment
Share on other sites

  • enableSimulation false: significant difference with 100k objects spawned on the server, client FPS jumped from 5 all the way to 51-52 after disabling simulation client side

 

Very interesting.

  • You could do a getIn/hit eventHandler on vehicles that starts enableSimulation as soon as someone gets in them or when it gets hit (possibly disable it again as soon as they get out again).
  • You could spawn in all epoch objects (e.g. safes / doors etc.) with enableSimulation false and only enable it when a player is in the area and speed is below a certain amount (possibly disable it again as soon as they get out of the area).

On estimate i think that on a server cycle max 10% of the objects spawned are actually used by players online. That would mean a huge FPS boost

Link to comment
Share on other sites

Very interesting.

  • You could do a getIn/hit eventHandler on vehicles that starts enableSimulation as soon as someone gets in them or when it gets hit (possibly disable it again as soon as they get out again).
  • You could spawn in all epoch objects (e.g. safes / doors etc.) with enableSimulation false and only enable it when a player is in the area and speed is below a certain amount (possibly disable it again as soon as they get out of the area).

On estimate i think that on a server cycle max 10% of the objects spawned are actually used by players online. That would mean a huge FPS boost

 

Taken from the arma page about enableSimulation:

  • Units that have been previously subjected to enableSimulation false; or enableSimulationGlobal false; may stay unrecognised for a long time even after simulation was re-enabled, returning objNull as cursorTarget. Force revealing units with reveal command usually solves the problem. For example: {player reveal _x} forEach allUnits;

 

 

And a question....I kinda got lost in thinking about this........How 'bad' is it to NOT spawn any objects on the server for a specific classname...

Like for example not to create locally for the server for all cinder walls....but do send it in the localbobjects array for the clients to spawn it.

I mean ...besides AI Bots....how 'bad' is it for the server NOT knowing that there is an object there.

What if the player decides to delete it....will all hell break lose on the server ?

Link to comment
Share on other sites

I finally got this working on my test server. A couple things that would need to be addressed in my opinion. If a player logs out on top of a base, he will spawn inside the base upon login. Vehicles will also be inside the building after a server restart.

 

One option for the vehicles could be to spawn the objects on the server at restart, but then delete the objects once all vehicles have spawned. A second option, would be to spawn metal floor only on server side and make sure your players know to cover the roof of their bases with metal panels. This would solve both the player and vehicle issue.

Link to comment
Share on other sites

Very interesting.

  • You could do a getIn/hit eventHandler on vehicles that starts enableSimulation as soon as someone gets in them or when it gets hit (possibly disable it again as soon as they get out again).
  • You could spawn in all epoch objects (e.g. safes / doors etc.) with enableSimulation false and only enable it when a player is in the area and speed is below a certain amount (possibly disable it again as soon as they get out of the area).

On estimate i think that on a server cycle max 10% of the objects spawned are actually used by players online. That would mean a huge FPS boost

 

Seems like epoch is already doing it for all the epoch objects. You could still enable it on vehicles though to do some optimization. Did you run any tests with vehicles ebaydayz?

Link to comment
Share on other sites

enableSimulation false; works ONLY on the machine its run on. To fix the Epoch objects, enableSimulation false; needs to be added to the object's vehicleInit, then the processInitCommands needs to be run on each client.

Link to comment
Share on other sites

  • 2 weeks later...

The plot pole maintain script will not update for any of the objects spawned locally.

 

Remove it from the array.

 

Can we please post some times it takes for the servers to load ?

 

I am using these objects to be sent to each client:

["MetalFloor_DZ","CinderWallHalf_DZ","CinderWall_DZ","CinderWallSmallDoorway_DZ","CinderWallDoorSmall_DZ","CinderWallDoorway_DZ","CinderWallDoor_DZ"];

Basically they are 3044 industructable Epoch buildables in the array.

 

And here are my stats (started counting after i saw "Game Started" on the console):

 

14:04:25 "HIVE: Commence Object Streaming..."

14:07:53 "HIVE: got 9832 Epoch Objects and 476 Vehicles. Total : 10308 objects"          // 3m28s to bring them all from the db

14:10:18 Got inside the  'count (_BuildingQueue + _objectQueue)'                                  // 3m25s to build the array :/

 

Spawning the objects takes about 10 seconds...after that the client loads

 

Overall: about 7min

Link to comment
Share on other sites

Remove it from the array.

 

 

 

Removing them from the array defeats the purpose of having maintenance. The server can not update the objects since they are loaded locally.  I tried creating a local version of the PVDZE_maintainArea script that uses the "_key call server_hiveReadWrite;" instead of  "_key = format["CHILD:397:%1:", _objectUID];".

 

It would update the objects in the server, but it would never actually update the backend SQL. I got busy with other things and gave up on trying to get it to work.

 

 

Link to comment
Share on other sites

 

I think you have hardware issues...

 

Current time:  2014/12/11 12:53:55
12:55:15 "HIVE: Commence Object Streaming..."
12:55:18 "HIVE: got 7799 Epoch Objects and 3443 Vehicles"

 

W...T....F !   No fucking way....(excuse my language mods but its the best word for what i just saw)

3 seconds to get 10k objects.....impossible ... i feel like...violated or something....literally i just turned gay a little bit.

What type of machine do you have?

 

 

 

 

Removing them from the array defeats the purpose of having maintenance. The server can not update the objects since they are loaded locally.  I tried creating a local version of the PVDZE_maintainArea script that uses the "_key call server_hiveReadWrite;" instead of  "_key = format["CHILD:397:%1:", _objectUID];".

 

It would update the objects in the server, but it would never actually update the backend SQL. I got busy with other things and gave up on trying to get it to work.

Remove the plot pole only from the array...not the other objects....You are sending a <local> object to the server...the server doesnt know about it....i mean its not a dealbreaker...how many plotpoles do you have? 300 ? even so... thats nothing compared to the cinderwalls you still have in the array

Link to comment
Share on other sites

Remove the plot pole only from the array...not the other objects....You are sending a <local> object to the server...the server doesnt know about it....i mean its not a dealbreaker...how many plotpoles do you have? 300 ? even so... thats nothing compared to the cinderwalls you still have in the array

 

I don't care about the plot pole itself. I'm saying the players can't perform the maintenance for the objects that are loaded locally. I still loaded anything with a door on the server so that all players could see the doors opening. I do not want to remove maintenance requirement so the server doesn't get overloaded with objects no one is using. 

Link to comment
Share on other sites

I don't care about the plot pole itself. I'm saying the players can't perform the maintenance for the objects that are loaded locally. I still loaded anything with a door on the server so that all players could see the doors opening. I do not want to remove maintenance requirement so the server doesn't get overloaded with objects no one is using.

 

This is why you either want to spawn the objects local on the server (preferably so that AI / server zombies can see them) OR change your maintain script to send a PV with objectID's to the server. I did the first (which postpones the actual maintenance in-game to after server restart). In order to prevent a player from maintaining the same plot twice i simply set a "maintained" true variable which i check before maintenance. I guess you could make it a bit more fancy by sending a "healed" PV after maintaince so you can sync the removal of damage with all the players, i didnt see the need for it since the objects are indestructible on our server anyway.

--

@SandBird: Definite hardware/config issue.

 

15:10:29 "HIVE: trying to get objects for instance 11"
15:10:29 "HIVE: Found 6146 objects to load"
15:10:29 "HIVE: SUPERKEY set (XXXX), retrieving (6146) objects.."
15:10:30 "HIVE: All objects received, continue with spawning them on the server and client.."
Link to comment
Share on other sites

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