Comments (8)
Oops! I completely misinterpreted what was going on in src/serializer.ts. Thanks again, this is super helpful!
from planck.js.
Current serializer is optimized for saving/loading a world in a readable format, and is not optimized for fast and efficient networking.
For networking I recommend directly iterating over all objects and fields and write to and read from an efficient stream.
from planck.js.
Here's a list of things so far that seem like might be sufficient to sync a physics object's state:
- object id (does planck.js generate one for all objects/fixtures/etc. ?)
- angle
- angularVelocity
- position (vec)
- linear velocity (vec)
Are there any other things that might need to be sync'd? I'm not sure how I'd go about syncing a joint constraint for example
from planck.js.
Hey! There is a serializer in src/serializer
already. It isn't optimized for file size, but you can probably follow it for your implementation
from planck.js.
Ah, thanks for the pointer! So it seems this serializer is just enumerating all the object/array props, rather than a hardcoded list.
from planck.js.
I don't think it just enumerates all props, see for example _serialize
in Body.ts. Every class defines what properties are relevant this way (so it is hardcoded per class)
from planck.js.
For networking I recommend directly iterating over all objects and fields and write to and read from an efficient stream.
That's the plan, I just didn't have any list of the "important" fields that one might need to sync for different primitives (fixtures, joints, etc.)
from planck.js.
Hmm, I'm not quite sure, but happy to help with implementation.
We probably need to implement an interface like current serialize but write to a streaming interface (instead of json).
We also need to find out the answer to your question, probably we can see how this is implemented in C++ for Box2D.
from planck.js.
Related Issues (20)
- When will version 1 be released? HOT 5
- Feature Request: Implementation of b2Draw, SetDebugDraw and DebugDraw HOT 7
- Changing a circle collider's friction doesn't make it roll slower HOT 1
- Feature Request: Add the ESM button to jsDelivr
- How to change a collider's center? HOT 5
- Why does displacement cause multiple begin and end contact events? HOT 6
- Typo in the Wiki HOT 4
- setActive(true) throwing error in v1 beta 8
- ERROR changing a collider's mass cancels its linearVelocity HOT 5
- planck's npm package is quite large HOT 8
- World step error HOT 12
- possible testOverlap bug HOT 2
- Undefined Reading "x" error HOT 5
- Raycasts phasing through walls HOT 6
- clarification on the determinism limitation from docs HOT 1
- inconsistent Vec2 construction throughout examples
- DistanceJoint `getReactionForce` function not working HOT 4
- Script tag: Uncaught TypeError: t is null HOT 2
- Cannot read properties of undefined (reading "x") HOT 3
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 planck.js.