Jump to content
billyeatworld

Alternative to BIS_fnc_replaceWithSimpleObject?

Recommended Posts

Hi guys!

Apparently according to the Wiki, BIS_fnc_replaceWithSimpleObject is "not very clean - should not be used for many objects and definitely not in MP games."

This function actually works perfectly for what I'm trying to achieve (replacing a vehicle with a simple object of the same type in same position, direction etc). Is there a better alternative?

I've actually tested BIS_fnc_replaceWithSimpleObject in multiplayer and it works fine, although it takes ages for the model to respond to commands like setDir on the client.
 

Thanks!

Share this post


Link to post
Share on other sites

In 3den, you can make vehicles as simple objects, and if not compatible, you can disable the simulation and damage. That's my choice because you don't need to spawn something during game (just play with hideObject or not if necessary) and the positioning is fine.

 

There is no real added value to use Bis_fnc_replaceWithSimpleObject. Spawning vehicle, replacing it... more codes running in game.

You have also  bis_fnc_createSimpleObject , or even  createSimpleObject command...

 

Well, imho, 3den is enough. You can place all your scenery objects. If you spawn something during game, that should be something interesting as an animated/simulated unit/vehicle/crate or holder.

I know there are some scripts to spawn entire compositions (base, garrison, checkpoint..) But I prefer editing them all, then play with hide/show,  simul. false/true  during the scenario. The limit on that, is for furniture on wide scale. But there is also the phronk's script for that.

 

  • Like 2

Share this post


Link to post
Share on other sites

Thanks mate.

 

For context I’ve actually built a dynamic PVE scenario, kind of a cross between Invade And Annex and Old Man / Contact campaign.

 

Almost nothing is directly placed in the editor. The initial player vehicles are placed and then immediately deleted on mission start and respawned as simple objects, which players can then “activate”. Invade and Annex has a very similar system.

 

Obviously simple objects have many disadvantages; wondering if there is much performance benefit to be had using them initially over just disabling simulation?  There’s probably 40+ respawning player vehicles in the mission.

Share this post


Link to post
Share on other sites
10 minutes ago, billyeatworld said:

Almost nothing is directly placed in the editor. The initial player vehicles are placed and then immediately deleted on mission start and respawned as simple objects, which players can then “activate”. Invade and Annex has a very similar system.

Obviously simple objects have many disadvantages; wondering if there is much performance benefit to be had using them initially over just disabling simulation?  There’s probably 40+ respawning player vehicles in the mission.

 

The performances... for local CPU but also for network.

I don't know what you mean by "activate" a simple object.

So to be tested and compared, all these ways:

- edited + dynamic simulation (my preferred for player environment/vehicles/ non-randomized enemies)

- spawned in game (excellent for enemies, civilian life, all randomized things) + dynamic sim. or equivalent (created/deleted in areas of the players)

- spawned locally (createVehicleLocal) then replaced by global createVehicle on JIP for "activated" vehicle

- spawned as simple object, then "activated" as you wrote, if you can elaborate... but, the spawn normally/ replace by simple object/ "activate"... seems to me a complicated sequence.

 

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

 

The performances... for local CPU but also for network.

I don't know what you mean by "activate" a simple object.

So to be tested and compared, all these ways:

- edited + dynamic simulation (my preferred for player environment/vehicles/ non-randomized enemies)

- spawned in game (excellent for enemies, civilian life, all randomized things) + dynamic sim. or equivalent (created/deleted in areas of the players)

- spawned locally (createVehicleLocal) then replaced by global createVehicle on JIP for "activated" vehicle

- spawned as simple object, then "activated" as you wrote, if you can elaborate... but, the spawn normally/ replace by simple object/ "activate"... seems to me a complicated sequence.

 

 

Sorry I should have been clearer... (thanks again for your replies by the way)

 

My current system:

 

Vehicle placed in editor  > Replaced on mission start by simple object. Script then waits until the simple object is deleted > “Activate Vehicle” Addaction (created on the player on respawn) checks for simple objects with cursorObject > player can then activate the action, which deletes the simple object vehicle player is looking at  > the script continues and the actual non simple object vehicle is then created > script waits until vehicle is !alive and then loops, respawning another simple object at the original pos and dir 

 

Previously rather than creating the simple object at all I just had the simulation disabled on the vehicle until the player entered. I’m not sure which system is better performance wise.

 

I thought about using dynamic simulation, but the big issue is that 30+ of the vehicles are parked at a central base in close proximity to the players. Obviously this is where the FPS starts to chug the most.

 

 

 

 

 

 

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

×