Skip to content

Commit

Permalink
Merge pull request #4212 from acemod/createVehiclePerfWikiFix
Browse files Browse the repository at this point in the history
Improve createVehicle(Local) performance consideration description
  • Loading branch information
bux authored Aug 7, 2016
2 parents 5652a88 + 22cb52c commit c207715
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions wiki/development/coding-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -697,16 +697,17 @@ When adding multiple elements to an array, the binary addition may be used for t
`createVehicle` array shall be used.

### 8.3. `createVehicle(Local)` position
`createVehicle(Local)` shall be used with `[0, 0, 0]` where possible due to performance (using any other position performs search for empty space to prevent collisions).
`createVehicle(Local)` used with a non-`[0, 0, 0]` position performs search for empty space to prevent collisions on spawn.
Where possible `[0, 0, 0]` position shall be used, except on `#` objects (e.g. `#lightsource`, `#soundsource`) where empty position search is not performed.

This code requires ~1.00ms:
This code requires ~1.00ms and will be higher with more objects near wanted position:

```js
_vehicle = _type createVehicleLocal _posATL;
_vehicle setposATL _posATL;
```

While this one requires ~0.08ms:
While this one requires ~0.04ms:

```js
_vehicle = _type createVehicleLocal [0, 0, 0];
Expand Down

0 comments on commit c207715

Please sign in to comment.