Commit Graph

2316 Commits

Author SHA1 Message Date
Imbris
e4c3a07b6a Merge branch 'haslersn/bugfix/default-pos-iterator' into 'master'
Bugfix: DefaultPosIterator now starts at lower_bound

See merge request veloren/veloren!492
2019-09-11 02:47:02 +00:00
haslersn
51718c32a6 Bugfix: DefaultPosIterator now starts at lower_bound
Previosly the first iteration was skipped.
2019-09-11 01:48:28 +02:00
Marcel
a5962da2b2 Merge branch 'prometheus' into 'master'
Fix panic if starting singleplayer twice without closing the game

See merge request veloren/veloren!491
2019-09-10 13:33:42 +00:00
Marcel Märtens
02fe9adfb7 Fix panic if starting singleplayer twice without closing the game
reduce costs for metrics by checking chunks only every 100th tick
add metrics for "server start time" and ingame "time of day"
2019-09-10 15:22:34 +02:00
Joshua Barretto
bb93585499 Merge branch 'zesterer/more-movement' into 'master'
More Movement

See merge request veloren/veloren!471
2019-09-09 19:11:40 +00:00
Joshua Barretto
3f2e22f039 Exponential interpolation for linear damping
With an additional approximation to allow for the same size jumps given different framerates.
2019-09-09 19:11:40 +00:00
Marcel
980bbbb711 Merge branch 'prometheus' into 'master'
Prometheus

See merge request veloren/veloren!486
2019-09-09 09:04:03 +00:00
Marcel Märtens
58b0b49dfe adjust metrics to rebased Chunks 2019-09-09 10:47:40 +02:00
Marcel Märtens
49b08b55c7 switch from hyper http to rouille for http server 2019-09-09 10:07:25 +02:00
Marcel Märtens
b05e51152f update version, revert from static prometheus back to normal because static doesnt supprot registries, and implement most of the metrics except for entity count 2019-09-09 09:54:30 +02:00
Marcel Märtens
8d3fb40419 first implementation of prometheus in veloren for git hash, tick times, chunks loaded, player online, entity count and light count 2019-09-09 09:48:44 +02:00
Joshua Barretto
933e48ac3b Merge branch 'fix-jump-height' into 'master'
Fix jump height

See merge request veloren/veloren!485
2019-09-08 15:50:08 +00:00
Joshua Barretto
242ac332e3 Merge branch 'telastrus/vol-fix' into 'master'
Footstep volume fix

See merge request veloren/veloren!489
2019-09-08 15:47:52 +00:00
Geno
247f0818c1 Footstep volume fix 2019-09-08 15:47:52 +00:00
Forest Anderson
8b654df81e Merge branch 'angelonfira/bump-gfx-device-gl-to-allow-new-nightly' into 'master'
Bumped version

See merge request veloren/veloren!490
2019-09-08 15:34:17 +00:00
Forest
000efebfd1 Updated cargo lock 2019-09-08 11:28:56 -04:00
Forest
c31b01b051 Bumped version 2019-09-08 11:15:46 -04:00
Joshua Barretto
26a027745e Merge branch 'scott-c/fix-performance-regression' into 'master'
Fix performance regression; simplify FigureKey

See merge request veloren/veloren!483
2019-09-08 12:01:45 +00:00
scott-c
2b3749d2f4 Fix performance regression; simplify FigureKey 2019-09-08 19:52:57 +08:00
Forest Anderson
9ea06c08cf Merge branch 'angelonfira/parallelize-ci-better' into 'master'
Changed stages

See merge request veloren/veloren!488
2019-09-07 16:35:10 +00:00
Forest Anderson
2c3c758cbf Changed stages 2019-09-07 16:35:10 +00:00
Andrew Pritchard
2e63152d90 Merge branch 'fix-jump-height' into 'fix-jump-height'
Fix jump height

See merge request veloren/veloren!477
2019-09-07 12:48:49 +00:00
Timo Koesters
92c0edcb98 Merge branch 'timo-attack' into 'master'
Fix wolfs not attacking and adjust movement while attacking

See merge request veloren/veloren!484
2019-09-07 10:25:57 +00:00
timokoesters
f3593371ea
Make npcs attack in a smarter way 2019-09-07 12:16:55 +02:00
timokoesters
9f83130466
Fix audio 2019-09-07 11:46:21 +02:00
Joshua Barretto
a9f06b1c65 Merge branch 'haslersn/block-groups' into 'master'
common: Rework `Chunk` and `Chonk` implementation

See merge request veloren/veloren!475
2019-09-07 09:14:54 +00:00
Forest Anderson
d41d020e06 Merge branch 'revert-d71f2ebf' into 'master'
Revert "Merge branch 'angelonfira/bump-toolchain-sept' into 'master'"

See merge request veloren/veloren!482
2019-09-06 20:19:14 +00:00
Forest Anderson
c81363e02b Revert "Merge branch 'angelonfira/bump-toolchain-sept' into 'master'"
This reverts merge request !481
2019-09-06 20:17:57 +00:00
Forest Anderson
d71f2ebf9c Merge branch 'angelonfira/bump-toolchain-sept' into 'master'
Bump toolchain

See merge request veloren/veloren!481
2019-09-06 19:05:51 +00:00
Forest Anderson
db8941210d Bump toolchain 2019-09-06 15:02:48 -04:00
haslersn
b26043b0e6 common: Rework Chunk and Chonk implementation
Previously, voxels in sparsely populated chunks were stored in a `HashMap`.
However, during usage oftentimes block accesses are followed by subsequent
nearby voxel accesses. Therefore it's possible to provide cache friendliness,
but not with `HashMap`.

The previous merge request [!469](https://gitlab.com/veloren/veloren/merge_requests/469)
proposed to order voxels by their morton order (see https://en.wikipedia.org/wiki/Z-order_curve ).
This provided excellent cache friendliness. However, benchmarks showed that
the required indexing calculations are quite expensive. Particular results
on my _Intel(R) Core(TM) i7-7500U CPU @ 2.70 GHz_ were:

| Benchmark                                | Before this commit @ d322384bec | Morton Order @ ec8a7caf42 | This commit          |
| ---------------------------------------- | --------------------------------- | --------------------------- | -------------------- |
| `full read` (81920 voxels)               | 17.7ns per voxel                  | 8.9ns per voxel             | **3.6ns** per voxel  |
| `constrained read` (4913 voxels)         | 67.0ns per voxel                  | 40.1ns per voxel            | **14.1ns** per voxel |
| `local read` (125 voxels)                | 17.5ns per voxel                  | 14.7ns per voxel            | **3.8ns** per voxel  |
| `X-direction read` (17 voxels)           | 17.8ns per voxel                  | 25.9ns per voxel            | **4.2ns** per voxel  |
| `Y-direction read` (17 voxels)           | 18.4ns per voxel                  | 33.3ns per voxel            | **4.5ns** per voxel  |
| `Z-direction read` (17 voxels)           | 18.6ns per voxel                  | 38.2ns per voxel            | **5.4ns** per voxel  |
| `long Z-direction read` (65 voxels)      | 18.0ns per voxel                  | 37.7ns per voxel            | **5.1ns** per voxel  |
| `full write (dense)` (81920 voxels)      | 17.9ns per voxel                  | **10.3ns** per voxel        | 12.4ns per voxel     |

This commit (instead of utilizing morton order) replaces `HashMap` in the
`Chunk` implementation by the following data structure:

The volume is spatially subdivided into groups of `4*4*4` blocks. Since a
`Chunk` is of total size `32*32*16`, this implies that there are `8*8*4`
groups. (These numbers are generic in the actual code such that there are
always `256` groups. I.e. the group size is chosen depending on the desired
total size of the `Chunk`.)

There's a single vector `self.vox` which consecutively stores these groups.
Each group might or might not be contained in `self.vox`. A group that is
not contained represents that the full group consists only of `self.default`
voxels. This saves a lot of memory because oftentimes a `Chunk` consists of
either a lot of air or a lot of stone.

To track whether a group is contained in `self.vox`, there's an index buffer
`self.indices : [u8; 256]`. It contains for each group

* (a) the order in which it has been inserted into `self.vox`, if the group
    is contained in `self.vox` or
* (b) 255, otherwise. That case represents that the whole group consists
    only of `self.default` voxels.

(Note that 255 is a valid insertion order for case (a) only if `self.vox` is
full and then no other group has the index 255. Therefore there's no
ambiguity.)

Rationale:

The index buffer should be small because:

* Small size increases the probability that it will always be in cache.
* The index buffer is allocated for every `Chunk` and an almost empty `Chunk`
    shall not consume too much memory.

The number of 256 groups is particularly nice because it means that the index
buffer can consist of `u8`s. This keeps the space requirement for the index
buffer as low as 4 cache lines.
2019-09-06 18:20:15 +02:00
haslersn
d322384bec common: Add benchmark for Chonk 2019-09-06 15:44:36 +02:00
haslersn
d99bef6803 voxygen: Make the Terrain struct generic 2019-09-06 15:43:31 +02:00
haslersn
1796c09ca1 common: Rework volume API
See the doc comments in `common/src/vol.rs` for more information on
the API itself.

The changes include:

* Consistent `Err`/`Error` naming.
  * Types are named `...Error`.
  * `enum` variants are named `...Err`.
* Rename `VolMap{2d, 3d}` -> `VolGrid{2d, 3d}`. This is in preparation
  to an upcoming change where a “map” in the game related sense will
  be added.
* Add volume iterators. There are two types of them:
  * _Position_ iterators obtained from the trait `IntoPosIterator`
    using the method
    `fn pos_iter(self, lower_bound: Vec3<i32>, upper_bound: Vec3<i32>) -> ...`
    which returns an iterator over `Vec3<i32>`.
  * _Volume_ iterators obtained from the trait `IntoVolIterator`
    using the method
    `fn vol_iter(self, lower_bound: Vec3<i32>, upper_bound: Vec3<i32>) -> ...`
    which returns an iterator over `(Vec3<i32>, &Self::Vox)`.
  Those traits will usually be implemented by references to volume
  types (i.e. `impl IntoVolIterator<'a> for &'a T` where `T` is some
  type which usually implements several volume traits, such as `Chunk`).
  * _Position_ iterators iterate over the positions valid for that
    volume.
  * _Volume_ iterators do the same but return not only the position
    but also the voxel at that position, in each iteration.
* Introduce trait `RectSizedVol` for the use case which we have with
  `Chonk`: A `Chonk` is sized only in x and y direction.
* Introduce traits `RasterableVol`, `RectRasterableVol`
  * `RasterableVol` represents a volume that is compile-time sized and has
    its lower bound at `(0, 0, 0)`. The name `RasterableVol` was chosen
    because such a volume can be used with `VolGrid3d`.
  * `RectRasterableVol` represents a volume that is compile-time sized at
    least in x and y direction and has its lower bound at `(0, 0, z)`.
    There's no requirement on he lower bound or size in z direction.
    The name `RectRasterableVol` was chosen because such a volume can be
    used with `VolGrid2d`.
2019-09-06 15:43:31 +02:00
haslersn
886d554f52 common: prepend/append multiple SubChunks in a batch 2019-09-06 15:33:36 +02:00
haslersn
963c5a7785 common: Calculate magic number in Chonk 2019-09-06 15:33:36 +02:00
haslersn
8451a06804 common: Set TerrainChunk::SIZE.z = std::i32::MAX 2019-09-06 15:33:36 +02:00
haslersn
57354fb062 common: For trait ReadVol remove get_unchecked() 2019-09-06 15:33:36 +02:00
Joshua Barretto
66c58840ef Merge branch 'scott-c/first-person-model' into 'master'
Add first person models

See merge request veloren/veloren!443
2019-09-06 13:02:03 +00:00
scott-c
37d9acedb0 cleanup comment 2019-09-06 20:22:17 +08:00
scott-c
fcdb0843fc Cleanup unused import 2019-09-06 19:35:47 +08:00
scott-c
930e075ad1 half camera height when rolling 2019-09-06 19:29:52 +08:00
Joshua Barretto
f574b1748a Merge branch 'desttinghim/sound-effects' into 'master'
Sound Effects

Closes #163 and #97

See merge request veloren/veloren!473
2019-09-06 11:19:32 +00:00
scott-c
645debe230 Hide player hands when rolling in first person 2019-09-06 19:12:46 +08:00
Louis Pearson
7f27385f95 Removed unescessary if statements 2019-09-06 05:02:29 -06:00
scott-c
836525c33a Simplify model cache key, fixes performance issue 2019-09-06 18:59:05 +08:00
Louis Pearson
02af86d2d6 Change ear pos to Vec3 2019-09-06 04:44:15 -06:00
Louis Pearson
059d968499 Cargo fmt 2019-09-06 04:38:02 -06:00
Louis Pearson
675d72a3ce Code cleanup 2019-09-06 04:36:42 -06:00
Louis Pearson
57fe89e5c8 Fix warnings 2019-09-06 04:25:17 -06:00