Commit graph

16 commits

Author SHA1 Message Date
Terminator c73abacc98
Re-visit From impl for native data types found in NBT data format. (#169) 2022-12-15 18:38:52 -08:00
Ryan Johnson ae7eaf15fc
Big Optimizations (#164)
Closes #84

# Changes

- Implemented new algorithm for tracking loaded entities and chunks.
- The client does not need to maintain a list of loaded chunks and
entities anymore, as this information can be inferred using carefully
maintained data from the previous tick.
- Chunks are used as a spatial partition for entities. Entity visibility
is now based on chunk visibility rather than the euclidean distance to
clients.
- The BVH is no longer strictly necessary, so it has been moved to the
new `valence_spatial_index` crate.
- The API has been generalized to support things other than entities.
The crate does not have a dependency on the main `valence` crate.
- Chunk, entity, and player list packets are now aggressively cached to
increase performance.
- Chunk packets now include some filler light data. This makes the
vanilla client lag a lot less.
- Entities and chunks must now be marked as deleted before they are
removed.
- Improved `ChunkPos` interface.
- Added function to get the duration per tick.
- Added `Index` and `IndexMut` impls to collection types.

As a result of the above changes, performance under heavy load has
increased significantly. With the rust-mc-bot test on my machine, I went
from a max of ~1000 players to ~4000 players.
2022-12-11 02:37:02 -08:00
Ryan a20ed2ac21 Bump valence_nbt version 2022-10-30 15:26:47 -07:00
Terminator 03e89adeb8
(valence_nbt) Add reverse From<Value> for Option<T> (#122)
This way we can use generic bounds to specify the return type and get `None` if the value does not match the type.
2022-10-18 14:40:46 -07:00
Ryan Johnson d22f1edae1
Update valence_nbt to version 0.3.0 (#120)
Improves write performance and adds `binary_encoded_len` to compounds.
2022-10-17 21:11:20 -07:00
Ryan Johnson 85cc3a28ea
Add --workspace flag to commands in CI (#101) 2022-10-04 02:12:32 -07:00
Ryan f94c50bfd3 Change valence_nbt repository link 2022-10-01 15:38:14 -07:00
Ryan Johnson 2cd8bd2195
Replace HashMap with BTreeMap in valence_nbt (#98)
* Replace HashMap with BTreeMap in valence_nbt

Turns out that `BTreeMap`s are a bit faster when the element count is low.

This change also makes debugging compounds a bit easier since the elements are displayed in sorted order.

* Simplify read_list function slightly
2022-10-01 15:36:04 -07:00
Ryan Johnson 9c62bc1b90
Move valence_nbt to main Valence repo. (#97)
This also adds another check in CI
2022-10-01 14:18:42 -07:00
Ryan 5d8f7a49da Add documentation to serde_nbt 2022-09-01 20:19:42 -07:00
Ryan 8f3a46bccf Tweak tests 2022-08-29 19:26:18 -07:00
Ryan 794fa10153 Add support for Some and None 2022-08-29 19:18:23 -07:00
Ryan 8abe8b7ebf rename path to trace 2022-08-29 05:05:04 -07:00
Ryan 158eba1d15 Improve error type 2022-08-29 04:45:43 -07:00
Ryan 2a266fb091 Change rustfmt settings 2022-08-28 21:31:07 -07:00
Ryan c503e6eb78 NBT Value can now be round-trip encoded/decoded properly 2022-08-28 21:06:38 -07:00