Jump to content
dr. hladik

New command createObject for decorative objects

Recommended Posts

Do you plan to add this to this Eden editor ? Something like a check box in object's attributs which create the object with this command instead of the usual one ?

 

Yes.

  • Like 2

Share this post


Link to post
Share on other sites
 dr.hladik Not even with hideAnimationSelection command?

 

 

Not in my test, hideAnimationSelection was working for tanks and vehicles.

I will take another look when I get back and double check, I don't think it found any selections when I looked in the array but there were lots listed for the tank.

 

Share this post


Link to post
Share on other sites

Not in my test, hideAnimationSelection was working for tanks and vehicles.

I will take another look when I get back and double check, I don't think it found any selections when I looked in the array but there were lots listed for the tank.

Why don't you use the model without the trail instead?

CSHWzxp.png

https://community.bistudio.com/wiki/createObject/objects  <--- almost every missile has normal and xxx_fly model, the latter is the one with the tail.

Share this post


Link to post
Share on other sites

Thanks KK I asked before if there was a version and was told that there wasn't.

 

Cheers.

Share this post


Link to post
Share on other sites

A quick play with new command:

* You can create trees and bushes

* You can create bridges

* Object created has basic collision but cannot be destroyed

 

 

How did you create trees with it ?

 

I got the texture path with

getModelInfo  cursorObject select 1

and tried

createObject ["a3\plants_f\tree\t_ficusb1s_f.p3d",position player];

but it doesn't work.

Share this post


Link to post
Share on other sites

How did you create trees with it ?

 

I got the texture path with

getModelInfo  cursorObject select 1

and tried

createObject ["a3\plants_f\tree\t_ficusb1s_f.p3d",position player];

but it doesn't work.

 

It works, it just creates it underground, something that should probably be improved. Either setpos it higher after creation or give higher position on creation.

Share this post


Link to post
Share on other sites

It works, it just creates it underground, something that should probably be improved. Either setpos it higher after creation or give higher position on creation.

 

Ah..and I am sitting here, trying to figure out what's wrong:D Thank you.

 

 

Edit: Works splendid now ;)

 

CFhgqFf.jpg

  • Like 1

Share this post


Link to post
Share on other sites

 

Here are some numbers to start with.

 

See screens under spoiler

3k_objects_SP_create_Object.jpg

 

3k_objects_SP_create_Vihicle.jpg

 

6k_objects_SP_create_Object.jpg

 

6k_objects_SP_create_Vihicle.jpg

 

Numbers as text

3k objects SP createObject - 14 FPS

3k objects SP createVihicle - 20 FPS

 

6k objects SP createObject - 7 FPS

6k objects SP createVihicle - 10 FPS

 

 

 

Could you please retest it?

I had better results with createObject (some changes were made).

 

Just please be careful, that you move created Objects to correct height. It can make huge difference if in one scenario you can/cannot see windows on top of that lighthouse.

 

If the results are still worse, could you please send me your test missions?

(btw, this is not he best object to show the difference, vehicle would be better :))

Share this post


Link to post
Share on other sites

Could you please retest it?

I had better results with createObject (some changes were made).

 

Just please be careful, that you move created Objects to correct height. It can make huge difference if in one scenario you can/cannot see windows on top of that lighthouse.

 

If the results are still worse, could you please send me your test missions?

(btw, this is not he best object to show the difference, vehicle would be better :))

 

Chances are most people will use this command for small objects / buildings / plants  not static vehicles with no simulation :P

So using Vehicles as a benchmark isnt exactly a real world test imo

Share this post


Link to post
Share on other sites

For trees it works flawlessly. I spawned 10.000 trees in an area 1000 x 1000 and had nearly the same fps.

 

Really hope we'll get a new category in 3den for placing vegetation objects.

  • Like 2

Share this post


Link to post
Share on other sites

Could you please retest it?

I had better results with createObject (some changes were made).

 

Just please be careful, that you move created Objects to correct height. It can make huge difference if in one scenario you can/cannot see windows on top of that lighthouse.

 

If the results are still worse, could you please send me your test missions?

(btw, this is not he best object to show the difference, vehicle would be better :))

Why not vehicles? Say, you need a scene with a 100 static tanks in the distance to prove the significance of army A. This command is perfect for immersion building. ;)

Share this post


Link to post
Share on other sites

Could you please retest it?

...

How can I say "no" when BI ask for something?  :rolleyes:

Here you go, same test and few additional tests. Same specs, same video options.

 

Results as screenshots

17 big images. (see gallery at http://picsurge.com/g/4ihMN3).

2016_02_11_00001.jpg2016_02_11_00002.jpg

2016_02_11_00003.jpg2016_02_11_00004.jpg2016_02_11_00005.jpg2016_02_11_00006.jpg2016_02_11_00007.jpg2016_02_11_00008.jpg2016_02_11_00009.jpg2016_02_11_00010.jpg2016_02_11_00011.jpg2016_02_11_00012.jpg2016_02_11_00013.jpg2016_02_11_00014.jpg2016_02_11_00015.jpg2016_02_11_00016.jpg2016_02_11_00017.jpg

 

Results as text

"Lighthouse" - createObject - ORIGINAL TEST
28 FPS - #1 - 3k - 500x500 m - 18 m above ATL
14 FPS - #2 - 6k - 500x500 m - 18 m above ATL
9 FPS - #3 - 9k - 500x500 m - 18 m above ATL
 
"Underground lighthouse" - createObject
27 FPS - #4 - 3k - 500x500 m - Under terrain (-20 ATL)
14 FPS - #5 - 6k - 500x500 m - Under terrain (-20 ATL)
9 FPS - #6 - 9k - 500x500 m - Under terrain (-20 ATL)
 
"Chair" - createObject
90 FPS - #7 - 3k - 100x100 m - 5 m above ATL
60 FPS - #8 - 6k - 100x100 m - 5 m above ATL
45 FPS - #9 - 9k - 100x100 m - 5 m above ATL
 
"Chair" - createVehicle
61 FPS - #10 - 3k - 100x100 m - 0 m above ATL - sim OFF
35 FPS - #11 - 6k - 100x100 m - 0 m above ATL - sim OFF
24 FPS - #12 - 9k - 100x100 m - 0 m above ATL - sim OFF
 
"Pickup" - createObject
18 FPS - #13 - 3k - 500x500 m - 7 m above ATL
9 FPS - #14 - 6k - 500x500 m - 7 m above ATL
5 FPS - #15 - 9k - 500x500 m - 7 m above ATL
 
"Pickup" - createVehicle
14 FPS - #16 - 3k - 500x500 m - 0 m above ATL - sim OFF
6 FPS - #17 - 6k - 500x500 m - 0 m above ATL - sim OFF
 
Side notes
1) in tests from #1 to #15 spawning took relatively same amount of time (0.1 to 1.5 secs)
but test #16 took about 7 secs and #17 took about 12 secs.
 
2) in tests #16 and #17 spawn stopped responding completely, even after minute of waiting,
i was forced to actually call hintSilent to see results.
 
Testing methods
Scritps:

OBJECTS = [];
STEXT = "";
TEST = {
	{deleteVehicle _x} forEach OBJECTS;
	OBJECTS deleteRange [0, count OBJECTS];
	STEXT = "";
	_range = _this select 0;
	_height = _this select 1;
	_type = _this select 2;
	_item = _this select 3;
	_count = _this select 4;
	_testNum = _this select 5;
	_testName = _this select 6;
	_simulation = _this select 7;
	_pp = getPos player;
	_obj = objNull;
	for "_i" from 1 to _count do {
		_pos = [((_pp select 0) + random _range),((_pp select 1) + random _range),_height];
		if (_type == "createVehicle") then {
			_obj = createVehicle [_item, _pos, [], 0, "CAN_COLLIDE"];
			_obj enableSimulation _simulation;
		};
		if (_type == "createObject") then {
			_obj = createObject [_item, _pos];
		};
		OBJECTS pushBack _obj;
	};
	_textSize = (0.9 / (getResolution select 5));
	_colorWhite = "FFFFFF";
	_colorYellow = "FFD30D";
	STEXT = composeText [STEXT,(parseText format["<t size='%1' align='left' color='#%2'>Test:<t align='right' color='#%3'>#%5 - %4</t>", _textSize, _colorWhite,_colorYellow,_testName,_testNum]), lineBreak];
	STEXT = composeText [STEXT,(parseText format["<t size='%1' align='left' color='#%2'>Command:<t align='right' color='#%3'>%4</t>", _textSize, _colorWhite,_colorYellow,_type]), lineBreak];
	STEXT = composeText [STEXT,(parseText format["<t size='%1' align='left' color='#%2'>Objects count:<t align='right' color='#%3'>%4</t>", _textSize, _colorWhite,_colorYellow,_count]), lineBreak];
	STEXT = composeText [STEXT,(parseText format["<t size='%1' align='left' color='#%2'>Simulation:<t align='right' color='#%3'>%4</t>", _textSize, _colorWhite,_colorYellow,(if (_simulation) then {"ON"} else {"OFF"})]), lineBreak];
	STEXT = composeText [STEXT,(parseText format["<t size='%1' align='left' color='#%2'>Radius:<t align='right' color='#%3'>%4x%4 m</t>", _textSize, _colorWhite,_colorYellow,_range]), lineBreak];
	STEXT = composeText [STEXT,(parseText format["<t size='%1' align='left' color='#%2'>Height ATL:<t align='right' color='#%3'>%4</t>", _textSize, _colorWhite,_colorYellow,_height]), lineBreak];
};
terminate THREAD;
THREAD = [] spawn {
	_textSize = (0.9 / (getResolution select 5));
	_colorWhite = "FFFFFF";
	_colorYellow = "FFD30D";
	while {true} do {
		sleep 0.2;
		_temp = composeText [STEXT,(parseText format["<t size='%1' align='left' color='#%2'>FPS:<t align='right' color='#%3'>%4</t>", _textSize * 1.3, _colorWhite,_colorYellow,round diag_fps])];
		hintSilent _temp;
	};
};

 
Tests:

[500, 18, "createObject", "A3\Structures_F\Dominants\Lighthouse\LightHouse_F.p3d", 3000, 1, "Lighthouse",true] call TEST;
[500, 18, "createObject", "A3\Structures_F\Dominants\Lighthouse\LightHouse_F.p3d", 6000, 2, "Lighthouse",true] call TEST;
[500, 18, "createObject", "A3\Structures_F\Dominants\Lighthouse\LightHouse_F.p3d", 9000, 3, "Lighthouse",true] call TEST;

[500, -20, "createObject", "A3\Structures_F\Dominants\Lighthouse\LightHouse_F.p3d", 3000, 4, "Underground lighthouse",true] call TEST;
[500, -20, "createObject", "A3\Structures_F\Dominants\Lighthouse\LightHouse_F.p3d", 6000, 5, "Underground lighthouse",true] call TEST;
[500, -20, "createObject", "A3\Structures_F\Dominants\Lighthouse\LightHouse_F.p3d", 9000, 6, "Underground lighthouse",true] call TEST;

[100, 5, "createObject", "a3\structures_f\furniture\chairwood_f.p3d", 3000, 7, "Chair",true] call TEST;
[100, 5, "createObject", "a3\structures_f\furniture\chairwood_f.p3d", 6000, 8, "Chair",true] call TEST;
[100, 5, "createObject", "a3\structures_f\furniture\chairwood_f.p3d", 9000, 9, "Chair",true] call TEST;

[100, 0, "createVehicle", "Land_ChairWood_F", 3000, 10, "Chair",false] call TEST;
[100, 0, "createVehicle", "Land_ChairWood_F", 6000, 11, "Chair",false] call TEST;
[100, 0, "createVehicle", "Land_ChairWood_F", 9000, 12, "Chair",false] call TEST;

[500, 7, "createObject", "a3\soft_f\offroad_01\offroad_01_unarmed_f.p3d", 3000, 13, "Pickup",true] call TEST;
[500, 7, "createObject", "a3\soft_f\offroad_01\offroad_01_unarmed_f.p3d", 6000, 14, "Pickup",true] call TEST;
[500, 7, "createObject", "a3\soft_f\offroad_01\offroad_01_unarmed_f.p3d", 9000, 15, "Pickup",true] call TEST;

[500, 0, "createVehicle", "C_Offroad_01_F", 3000, 16, "Pickup",false] call TEST;
[500, 0, "createVehicle", "C_Offroad_01_F", 6000, 17, "Pickup",false] call TEST;

Share this post


Link to post
Share on other sites

Why not vehicles? Say, you need a scene with a 100 static tanks in the distance to prove the significance of army A. This command is perfect for immersion building. ;)

 

> vehicle would be better

Yes, yes. It IS  (should be) perfect for vehicles.

Share this post


Link to post
Share on other sites

In the past some nice commands we've seen in dev build haven't made it into the subsequent stable build. For example conditional select was in dev well before 1.54, but never made it into that build. I was wondering what are the chances we'll see createobject in 1.56?

 

Also, it's great having a command, but is there a way we can use the 3den editor to make and place objects as if they have been created by this command?

Share this post


Link to post
Share on other sites

In the past some nice commands we've seen in dev build haven't made it into the subsequent stable build. For example conditional select was in dev well before 1.54, but never made it into that build. I was wondering what are the chances we'll see createobject in 1.56?

 

Also, it's great having a command, but is there a way we can use the 3den editor to make and place objects as if they have been created by this command?

 

Probably not (2nd line of the opening post)

 

 

 

since 134151 there is a new command in dev. version - createObject

(will not yet be part of next patch)

Share this post


Link to post
Share on other sites

OK, thanks KK. Any info on my second question? How can we create objects in 3den that have the same properties as those created by this command?

Share this post


Link to post
Share on other sites

I thought I'd try spawning lots of small physics objects (as that is what interests me).

 

I checked this new command "createObject" vs "createVehicle" & "_thing enableSimulation false".

 

2500 x "Land_ButaneCanister_F"

 

Here are the two scripts (tested in Single player VR map)

 

CreateObject:   0.154053 seconds - 60 fps

 

0 = 0 spawn {
    _start = diag_tickTime;
    for "_i" from 1 to 50 do {
        for "_j" from 1 to 50 do {
            _coord = position player vectorAdd [_i,_j,5.1];
            _thing = createObject ["A3\Structures_F_EPA\Items\Tools\ButaneCanister_F.p3d",_coord];
        };
    };
    diag_log format ["finished in %1 seconds",diag_tickTime - _start];
    systemChat format ["finished in %1 seconds",diag_tickTime - _start]
};

 

CreateVehicle & enableSimulation false: 2.073 seconds -37 fps

 

0 = 0 spawn {
    _start = diag_tickTime;
    for "_i" from 1 to 50 do {
        for "_j" from 1 to 50 do {
            _coord = position player vectorAdd [_i,_j,0];
            _thing = createVehicle ["Land_ButaneCanister_F",_coord,[],0,"can_collide"];
            _thing enableSimulationGlobal false;
        };
    };
    diag_log format ["finished in %1 seconds",diag_tickTime - _start];
    systemChat format ["finished in %1 seconds",diag_tickTime - _start]
};

 

Okay, so the second script has to run an additional command to disable the physics, but overall, it's much faster for me to use createObject, plus the fps is much better than with the canisters created as vehicles.  The only annoying thing is you need to set the z-position manually.  I played around with the number to get a satisfactory height for the cans, and it seems from other users posts that the number changes based on what object you are spawning.

 

If there is a correlation (I haven't properly investigated yet) then that would be ok; but if it is random, then it makes the command annoying for dynamic spawning of different objects.  If that gets changed (model spawns equivalent to where it would do if created as a vehicle by default) then that would be a really good thing imo and make the command very useful.  At the moment, it seems a bit niche with this z-issue.

 

On a further note, I initially created 10,000 objects, but on the CV script the game would not process the script after a while until I had run away from the starting position, so maybe there is some sort of engine limit as to how many entities can be in scene.  It's weird that it seemed to affect the script as well (no rpt message or chat message on screen if you are stationary as it will not finish unless you move somewhere else - try it and you'll hopefully see what I mean).

 

Also, there's a weird quirk where if you bring up sights on your gun with lots of physics objects spawned, then it skips the animation.  Perhaps this and the lowered fps means there's still too much going on under the hood with the cans (even though they aren't simulated),  This makes me think that enableSimulation works in the engine by still checking every simulation cycle, but with a flag set to skip, rather than a 'one-time switch' and then it doesn't even try to check simulation until a script command tells it to (from console/script etc). Also, even non-simulated vehicles still have checks (damage for example) so it's not truly non-simulated by the engine as there's still some behind-the scenes stuff going on. Anyway, that is all idle conjecture.

 

Overall, good job BIS (but please look at z-placement for convenience)   :thumb:

Share this post


Link to post
Share on other sites
I ran some tests to compare the new command createObject against the existing createVehicle (with simulation disabled), just for my own little project's sake.

 


 

Test 1a: 67 objects, createObject

213.379 ms avg creation time

41.31616 avg fps

 

Test 1b: 67 objects, createVehicle (simulation off)

117.513 ms avg creation time

41.3357 avg fps

 

Test 2a: 290 objects, createObject

1568.6025 ms avg creation time

21.26614 avg fps

 

Test 2b: 290 objects, createVehicle (simulation off)

2821.7775 ms avg creation time

21.29106 avg fps

 

Conclusions (take with a grain of salt, this wasn't a lot of data to work with, and the testing environment was not completely perfect):

1) Conflicting results in composition creation time. The 67-object test was faster with createVehicle. The 290-object test was faster with createObject. The createObject method has to pull config data on each object and then use another function (using splitString, loop to capture all characters except the first, and joinString) to remove a leading slash from the .p3d path string. I'm probably going about that the wrong way..



opec_strRight = {
_arr = _this splitString "";
_out = [];
for "_i" from 1 to ( ( count _arr ) - 1 ) do {
_out = _out + [ ( _arr select _i ) ];
};
_out joinString ""
};
 
_modelPath = ( configFile >> "CfgVehicles" >> _class_obj >> "model" ) call BIS_fnc_GetCfgData;
_fixModelPath = _modelPath call opec_strRight;
_obj = createObject [ _fixModelPath, [ _new_coord_x, _new_coord_y, _new_coord_z ] ];


2) Not much difference in FPS (createVehicle is barely a scratch better). Other people have found bigger differences when spawning hundreds or thousands of objects.

3) createObject is (probably) still worth using due to the reduction in network sync traffic... the exception being for objects you need to be manipulated (such as with ladders, doors, or animated parts).

 


 

As for embedding .p3d's into missions without addons... I haven't tried this yet but am interested. Is it easy/possible to include textures and animations for these objects as well?

Share this post


Link to post
Share on other sites

 

 I'm probably going about that the wrong way..

 

Probably:

fnc_remove_1st_char = 
{
	_this select [1]
};

fnc_remove_leading_slash_if_exists = 
{
	_this splitString "\" joinString "\"
};
  • Like 1

Share this post


Link to post
Share on other sites

Thanks KK. Here's the code performance data on each fnc:

 

opec_strRight: 0.253789 ms

fnc_remove_1st_char: 0.0408997 ms

fnc_remove_leading_slash_if_exists: 0.0494019 ms

 

Re-running the tests with fnc_remove_1st_char, I find that createObject is now performing about 33-50% faster than createVehicle.

Share this post


Link to post
Share on other sites

Regarding creating of roads. The road segments will remove all the grass but not bushes and trees. Also the road segment need to have correct z positioning otherwise it may flicker when viewed under certain angles. createObject expects ASL position or probably even World. But for road segments ASL would do:

myRoad = createObject ["a3\roads_f\roads_new\road_W10_A12_032_R100.p3d", AGLtoASL (player getRelPos [10, 0])]; 

getRelPos will return z on surface so it is perfect for this task. It will even create road under water ;)

Share this post


Link to post
Share on other sites

Regarding creating of roads. The road segments will remove all the grass but not bushes and trees. Also the road segment need to have correct z positioning otherwise it may flicker when viewed under certain angles. createObject expects ASL position or probably even World. But for road segments ASL would do:

myRoad = createObject ["a3\roads_f\roads_new\road_W10_A12_032_R100.p3d", AGLtoASL (player getRelPos [10, 0])]; 

getRelPos will return z on surface so it is perfect for this task. It will even create road under water ;)

We'll see this among other smaller details / methods outlined in the wiki article of createObj, right? ;)

Share this post


Link to post
Share on other sites
It seems there's some inconsistencies in the configs of objects. None of the BagFence objects (probably others too) have the leading slash for the .p3d location... so the below code works for everything except BagFence objects (they do work if using the _modelPath). I'm guessing this could be best solved if createObject was made smart enough to resolve the leading slash issue on its own.

 

I'm not sure why the Z value is so low. I thought it might be a sea/terrain level issue, so I plugged in an ASL value to run on the VR map, but the objects still spawn just a few meters too low.


{
_modelPath = ( configFile >> "CfgVehicles" >> _x >> "model" ) call BIS_fnc_GetCfgData;
_fixModelPath = _modelPath select [1];
_obj = createObject [ _fixModelPath, getPosASL player ];
} forEach [
"Land_PierLadder_F",
"Land_LightHouse_F",
"Land_FieldToilet_F",
"Land_FuelStation_Build_F",
"Land_Research_house_V1_F",
"Windsock_01_F",
"Land_LampHarbour_F",
"Land_LampHalogen_F",
"Land_BagFence_End_F",
"Land_BagFence_Short_F",
"Land_BagFence_Long_F",
"Land_BagFence_Corner_F",
"Land_BagFence_Round_F"
];

Share this post


Link to post
Share on other sites

 

It seems there's some inconsistencies in the configs of objects. None of the BagFence objects (probably others too) have the leading slash for the .p3d location... so the below code works for everything except BagFence objects (they do work if using the _modelPath). I'm guessing this could be best solved if createObject was made smart enough to resolve the leading slash issue on its own.
 
I'm not sure why the Z value is so low. I thought it might be a sea/terrain level issue, so I plugged in an ASL value to run on the VR map, but the objects still spawn just a few meters too low.

 

 

use fnc_remove_leading_slash_if_exists

 

as for position it expects position World, not ASL https://community.bistudio.com/wiki/Position#PositionWorld

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×