phretaddin / schemapack

Create a schema object to encode/decode your JSON in to a compact byte buffer with no overhead.
MIT License
452 stars 33 forks source link

Optional field in the schema possible? #29

Open crazyyi opened 6 years ago

crazyyi commented 6 years ago

When using this in realtime games, sometimes delta compression is needed but current implementation doesn't support optional fields. So I always have to send everything defined in the schema. Possible to add support for optional field?

endel commented 5 years ago

I'm working on a similar approach to schemapack called @colyseus/schema. It supports optional fields!

miketromba commented 5 years ago

I had the same issue so I made a small API on top of schemapack which lets you give entities any combination of “fields.”

Sometimes you can send your entity as {x, y, r} sometimes as just {x, y} and it still works.

https://www.npmjs.com/package/netpack

udamir commented 3 years ago

Check out patchpack. It supports optional fields and dynamic fields (maps/arrays).

Taureon commented 5 months ago

I had the same issue so I made a small API on top of schemapack which lets you give entities any combination of “fields.”

Sometimes you can send your entity as {x, y, r} sometimes as just {x, y} and it still works.

https://www.npmjs.com/package/netpack

404 error :/