Jump to content

Recommended Posts

I created simple mission which contains simple elevator module for mission makers. The plan was to use empty elevator shaft inside Altis hotel building and recreate fully working elevator cabin and doors. I set followings targets

  • Elevator should operate as close as possible to standard real elevators.
  • Internal and external doors.
  • Supported in multiplayer.
  • Make it possible to walk inside cabin during movement.
  • All kind of equipment should be transportable with elevator on the floor.

Originally I wanted to make two separated independent cabins. Nevertheless it would brought several problems like increased number of objects, less space inside cabin and door wings do not have enough space to hide completely when two wings are considered as can be seen in following image.


That mean 4 wings for internal and 4 wings for external doors would be required for each cabin. For this reason I have chosen simplification to one large cabin occupying whole shaft. And one internal sliding door and one external sliding door at each floor.

In the next step I built cabin and doors from standard ArmA 3 objects. Number of object was kept low as possible in order to reduce HW load.

Next phase was scripting stage. Multiple problems emerged. Originally was cabin pars held together using command attachto. Each component was attached to one root component, the floor. This root component was then moved between floors with small steps using setpost command. As the root component moved relatively smoothly the rest of the components was jumping and its refresh rate was roughly 0.5 s.

Reason for his problem is hidden inside function attachto which has lower refresh rate for certain object types. This problem was solved by custom made function that simply set position to all components relatively to the root floor component in each floor step of the movement. Another problem happens when player try to walk on the elevator floor during movement. It is impossible and player is breezed. Solution I was able to found is following command

player setvelocity [0,0,-0.4];

This command push player to the floor so there is contact between foots and the floor. Every time cabin move it is necessary to perform this command to provide player ability to move.

Another problem emerged when scripts was tested at server. Cabin position was controlled server side only as setpos function has global effect. Object position refresh rate between server and client is very low, roughly 5 seconds. This problem makes elevator cabin at standard speed jump by 2 metres steps which basically leave player behind in the empty shaft. Solution for this problem is to build cabin completely locally at each client using createVehicleLocal and synchronise cabin position with server. Server control cabin position and broadcast frequently one value to the clients. This value represent current cabin altitude in the shaft. This helped increase refresh rate significantly. Cabin position was however still twitchy as server broadcast rate for variables is not high. For this reason another additional value is broadcasted from server which represent current elevator velocity. Velocity value is used at clients to interpolate movement between two received cabin positions.

Another problem is transport of equipment especially dropped items inside cabin just freeze at the place where are laid and completely ignore cabin movement. The reason is that dropped is object type GroundWeaponHolder, this object does not simulate object physics so it has to be replaced with object type WeaponHolderSimulated. Thus server side script search constantly for GroundWeaponHolder objects inside the elevator cabin using command

allMissionObjects "GroundWeaponHolder";

and replace them. Even thou WeaponHolderSimulated performs object physics simulation, it ceases to be simulated when engine detect that object is in stable position in order to reduce HW load. This make WeaponHolderSimulated objects to ignore elevator floor when cabin move. Solution is to frequently check whether WeaponHolderSimulated objects has zero velocity. If cabin is on the move and WeaponHolderSimulated object inside cabin has velocity it is nudged using command

setvelocity [0,0, ElvtrCurrentSpeed];

This way is object speed synchronised with cabin speed.

Another problem are small vehicles like robots. Their physics simulation also ceases when game engine detect stable position. This problem is solved similarly as pervious problem with dropped equipment using command setvelocity. Only problem is that it has to be performed at computer where robot is local (usually person who control the robot). For this reason server uses CBA_fnc_globalExecute function to make sure the command is performed at each computer.

Elevator internal and external doors are synchronised same way as whole elevator vertical position using broadcasted variable.

For user interaction ace interaction menu was used as more visually appealing counterpart to standard ArmA 3. Server side manager receive user inputs and control movement of the elevator to simulate real elevator behaviour.

This experimental module proven that it is possible to simulate heavy machinery and its interaction with players and vehicles even in multiplayer.


Workshop DOWNLOAD: https://steamcommunity.com/sharedfiles/filedetails/?id=2080529811

Direct DOWNLOAD: http://server.btkclan.cz/Hotel_Eleveator.Altis.zip

Required mods

CBA https://steamcommunity.com/workshop/filedetails/?id=450814997

Recommended mods

ACE https://steamcommunity.com/workshop/filedetails/?id=463939057

Edited by masaker
ACE requirement was removed
  • Like 4
  • Thanks 1

Share this post

Link to post
Share on other sites

Thanks man, this is really great.  You overcame many challenges to get this to work.  Good man!

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