Comments (2)
Some ideas to accomplish this:
- use bevy_reflect and reflection extensively
- provide some kind of macro to merge various ComponentProtocols or MessageProtocols into a single enum
- maybe make it possible for ComponentProtocol to be a struct containing enums (or other structs), and provide function to iterate through the different variants (should be doable)
from lightyear.
I read a bit more about reflection.
General idea:
- every
Message
is registered in theTypeRegistry
via Reflection. We also additional type metadata for each message via a TypeData
MessageMetadata {
frequency: usize
}
Maybe the type data can contain pointers to other useful type functions?
The reflected types might need to have ReflectSerialize
and ReflectDeserialize
as extra TypeData?
-
the frequency is how much we think we'll write this message. Higher frequency messages need to have their types serialized with fewer bytes.
-
the bevy::reflect
ReflectSerializer
reflects&dyn Reflect
as atype: value
value pair, which is not what we want. However it looks like we can use theTypedReflectSerializer
, which just serializes the value itself. -
When we call
Protocol::finalize
at some point, we go through the registry, get all the types that haveMessageMetadata
and order them by frequency. Then use Huffman coding to serialize the enum variant, in order to minimize the number of bits written. Maybe have aLightyearSerializer
which wraps aroundTypedReflectSerializer
(to have registry access), it starts by serializing the type (With huffman coding) and then serializes the value.
from lightyear.
Related Issues (20)
- PreSpawned object errors when doing remote-client prediction HOT 1
- Getting `ClientState` or `NetcodeClient` to display errors HOT 3
- Concepts from coherence
- Performance: use `insert_by_ids` to insert multiple components
- Improve benchmarks
- Improve benchmark performance HOT 8
- Interpolation looks very choppy on high tick rates HOT 1
- Multiple reconnections break client's ability to connect on WebTransport HOT 4
- Client entities do not re-replicate on reconnection
- Client -> server replication issues HOT 2
- `Visibility` should be renamed HOT 1
- Investigate channel receivers
- Large messages fail to deserialize / panic HOT 4
- VIsualInterpolation / Correction need to be ordered w.r.t transform propagation
- Serialization issue HOT 1
- Crash in build_packets
- ChannelDirection on the Channels is not used right now
- The trait `QueryData` is not implemented for `lightyear::prelude::server::Replicate` HOT 1
- Compatibility with Bevy's system ambiguity checker
- Issues with send_interval update
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lightyear.