Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve createVehicle(Local) performance consideration description #4212

Merged
merged 1 commit into from
Aug 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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