191 Commits

Author SHA1 Message Date
Imbris
bc8d49905b fix typo, replace u32 with Vec3<u8> in light propagation queue 2020-01-19 16:03:27 -05:00
timokoesters
c557dfeedf improvement: fog doesn't go back and forth anymore 2020-01-19 16:03:27 -05:00
Piotr Korgól
243263fecd Improvement: Replace all '..=b' with '..b + 1' 2020-01-12 15:46:53 +01:00
Monty Marz
178ad9479a Scrolling Combat Text (SCT) 2020-01-10 00:33:38 +00:00
Imbris
804e559e3a fix(char screen induced ghosts):
Adds removing extra components and deleting entities clientside when
going back to the character screen. Also, simplifies ClientState by
removing the Dead variant and removing ClientMsg::StateRequest in favor
of more specific ClientMsg variants.
2019-12-31 16:38:13 -05:00
Imbris
18aa4936b6 fix(player list): Show players not in range on the player list
fix(overflow): Stops including block updates that fail (since chunks
don't exist on the client) in `TerrainUpdates` (which would trigger
meshing of those nonexistent chunks). Furthermore, removes
remeshing of chunks with block updates if those chunks don't have all their
neighbours (since those wouldn't be meshed in the first place).
2019-12-29 20:51:05 -05:00
Imbris
0d763ab8ef Cutout unnecessary Resource syncing machinery and Tracker trait 2019-12-20 22:51:35 -05:00
Imbris
0d6a8b949f Upgrade to specs 0.15.1 2019-12-20 22:48:14 -05:00
Imbris
e2e642f5a5 Actually send deletion messages 2019-12-20 22:48:14 -05:00
Imbris
237532f7b1 Move sync code into common submodule 2019-12-20 22:37:12 -05:00
Imbris
470e52fbd0 Stop global syncing of entity creation 2019-12-20 22:37:12 -05:00
Songtronix
ccd2edf01b adjust logging level 2019-11-22 19:12:58 +01:00
Shane Handley
6ed33fa875
Add a TODO regarding the future plan for the connection timeout setting. 2019-11-06 21:34:19 +01:00
Shane Handley
2461318576
Address code review points:
- Clarify caffeine fueled comment
- Be better at comparing Instant's, and catch the 0 seconds case to say
Goodbye to the user
- Switch println for 'info!'
2019-11-06 21:34:18 +01:00
Shane Handley
7848944c17
Network timeout updates
- Bugfix: Check whether the server response (pong) is greater than the timeout period, rather than the ping (which will always fire regardless of connection status) This was causing the timeout error event to never fire.

- Feature: Send the player notifications to the chat window that they will be kicked due to disconnection for 6 seconds before kicking them back to the main menu.
2019-11-06 21:34:14 +01:00
soruh
94beb0fa33 Mitgated RUSTSEC-2019-0014 by updating noise and
disabling its default features, specifically `image`,
which had the vulnerability.
2019-11-05 11:14:39 +00:00
timokoesters
c426c1641c
feat: store items as RON files
When a new item is created, a ron file will be used as a template
2019-10-24 23:47:26 +02:00
Imbris
9cd42d1056 Move serverside client to a component and communications into server ecs systems 2019-10-23 23:50:06 -04:00
Imbris
4a8c87b4bf Actually fix region removal panic, update fuzzy chunk location, sync entity removal when unloading chunks, region size constant tweak 2019-10-23 22:43:02 -04:00
Imbris
45ca8d3a23 Make clients subscribed to nearby regions and only send physics updates from those regions. 2019-10-23 22:43:02 -04:00
Acrimon
d0e0b6de53 Drastically improved error messages in client and server. 2019-10-23 18:38:09 +02:00
Songtronix
eda188dc37 fix(crash): overflowing the stack 2019-10-18 14:19:02 +02:00
Songtronix
c9bf0ad875 change(githash): provide date and hash 2019-10-18 15:32:55 +02:00
Joshua Yanovski
663d535bd9 Allow canceling chunk generation.
Currently we only do this when no players are in range of the chunk.  We
also send the first client who posted the chunk a message indicating
that it's canceled, the hope being that this will be a performance win
in single player mode since you don't have to wait three seconds to
realize that the server won't generate the chunk for you.

We now check an atomic flag for every column sample in a chunk.  We
could probably do this less frequently, but since it's a relaxed load it
has essentially no performance impact on Intel architectures.
2019-10-16 11:39:41 +00:00
Marcel Märtens
5e0d7081ba Change the version number to 0.4 2019-10-10 15:48:01 +02:00
Nicolas
c6e66fb2e1 Add max chat message length
Fixes #115
Credit to @scorpion9979 for the previous implementation (https://gitlab.com/veloren/veloren/merge_requests/215)
2019-10-04 16:14:54 +02:00
Acrimon
6b87c25867 Updated toolchain version and a bunch of deps. 2019-10-03 17:19:22 -04:00
Joshua Barretto
07568eb0d2 Added block collection, improved controls for it 2019-09-26 00:15:07 +01:00
Joshua Yanovski
f5c4000b1b Allow canceling chunk generation.
Currently we only do this when no players are in range of the chunk.  We
also send the first client who posted the chunk a message indicating
that it's canceled, the hope being that this will be a performance win
in single player mode since you don't have to wait three seconds to
realize that the server won't generate the chunk for you.

We now check an atomic flag for every column sample in a chunk.  We
could probably do this less frequently, but since it's a relaxed load it
has essentially no performance impact on Intel architectures.
2019-09-16 03:41:33 +02:00
Joshua Barretto
e6d8b4b8d8 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
haslersn
db691b37d1 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 @ d322384becac | Morton Order @ ec8a7caf42ba | 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
351b8c91c7 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
Imbris
80d0884492 Remove all warnings 2019-09-04 19:03:49 -04:00
timokoesters
9fd258eaf6 Remove old code 2019-08-31 09:00:20 +02:00
timokoesters
702a4afd46 Move std::mem::discriminant into new method 2019-08-30 22:51:46 -04:00
timokoesters
f7f6fd98dd Make npcs roll correctly 2019-08-30 22:50:53 -04:00
timokoesters
8900a9e4f3 Fix rolling for the player 2019-08-30 22:50:53 -04:00
timokoesters
7099ef99b4 Split animations 2019-08-30 22:50:53 -04:00
timokoesters
2b0f6a1d9c
Rename activate_inventory_slot to use_inventory_slot 2019-08-30 22:46:45 +02:00
timokoesters
e4ca33de5b
Add debug mode item giving speed boost in look_dir on click 2019-08-29 19:44:28 +02:00
timokoesters
af780acc84
Use comp::Stats to store Equipment, make char weapon selection work 2019-08-29 19:44:28 +02:00
timokoesters
34c959bef0
Update to github vek repo 2019-08-26 13:12:45 +02:00
timokoesters
a27dfda5fb
Implement unstoppable rolling 2019-08-26 13:12:42 +02:00
timokoesters
019ce11d5d
Move from state components to single CharaterState struct
This makes split animations easy and improves overall code quality
2019-08-26 13:12:34 +02:00
Joshua Yanovski
608685ef36 Fixes to worldgen and adding a debug command.
Humidity and temperature are now indexed to uniform altitude *over land
chunks* (and water chunks adjacent to land) rather than over the whole
range of altitude.  This is necessary in order to satisfy the uniformity
conditions of the formula for weighted sum CDF.

Additionally, fixes the computation of whether a tree should be
generated or not.  Previously, it was using a source of randomness
scaled to use much less than the full 0-1 range; this has been resolved.
This makes for much nicer and more gradual transitions between densities
and reduces the amount of completely barren landscapes, while also
making forests larger.

Finally, this commit adds a server command, debug_column, which returns
some useful debug information about a column given an x and y
coordinate.  This is useful for debugging worldgen.
2019-08-26 11:52:25 +02:00
Acrimon
724d6dffb4 Disabled unsafe using lint level. 2019-08-19 14:39:23 +02:00
Acrimon
7c8487ed76 Finished switch to hashbrown. 2019-08-11 22:38:28 +02:00
Acrimon
9c0a6caafb Migrate client to hashbrown. 2019-08-11 21:54:20 +02:00
telastrus
35c89a5aaf fixed the silent kick, made it actually proper 2019-08-08 17:58:36 -04:00
telastrus
62df0d3503 actually removed printlns 2019-08-08 12:09:14 -04:00