Kehom / GodotAddonPack

A collection of pure GDScript addons for Godot
http://kehomsforge.com
MIT License
183 stars 15 forks source link

[Network] Snapshot support for more custom data #24

Closed yuraj11 closed 3 years ago

yuraj11 commented 3 years ago

Is it possible to use arrays with SnapEntityBase? I would like to use PoolByteArray to synchronize array of bytes.

Kehom commented 3 years ago

Hey, I deliberately didn't add support for array types because I didn't think of a use case in which it would justify. Nevertheless, I'm open to add it if the use case do indeed require this kind of data.

yuraj11 commented 3 years ago

Example is when player can have effects on him - positive (extra jump, speed...) or negative (poison, slowness...) but dynamic size (because you can obtain them anytime) - it will be array of IDs (possibly bytes to save bandwidth) of every effect type. I have map Id = effect class and I can easily sync all effects between players. Byte array is versatile because you can combine it with your encdec addon and do custom serialization.

Kehom commented 3 years ago

Ohhh! For some (borked) reason whenever I thought about character effects I didn't think arrays would be necessary. Now, thinking about the case I believe PoolByteArray, PoolIntArray and PoolRealArray are possible good new types to be added into the supported list.

The only thing I have to think about is in how to perform the correct calculation of the deltas without completely killing performance while extracting data from the arrays (although I'm probably overthinking things here - again on that "half asleep mode").

Kehom commented 3 years ago

Forgot to tag this on commit 3e7d15d9b85f3d8cef8df721be373459500bcac7.