5.0.0 • Published 1 year ago

@gd-com/utils v5.0.0

Weekly downloads
16
License
MIT
Repository
github
Last release
1 year ago

GM-Com @gd-com/utils

Binary serialization helper godot and nodejs !

Written with this api

Requirements

  • Godot 4.0 or greater
  • NodeJS 16 LTS or greater

For Godot 3 go @gd-com/utils v3

How to install

npm install --save @gd-com/utils

Examples

What is certs-generator ?

This is a Godot project which is just used to generate SSL certificates to test TCP UDP and Websocket in "secure" mode

Basic vs Advanced

  • Basic is a simple example who explain how to send variant
  • Advanced is a more complex example who explain how to send custom packets

Available from gdCom

Helpers

MethodDescriptionReturn
prefixWithLength(buffer)Prefix the buffer passed in parameter by its size (required only for TCP)Buffer
StreamTcpTo optimize Godot send from time to time several packets in the same packet (only for TCP), to deserialize well it is necessary to use thisClass

Encode and Decode

- getX

MethodReturn
getVar(buffer, offset = 0)Object { value, length }
get8(buffer, offset = 0)Object { value, length }
get16(buffer, offset = 0)Object { value, length }
get32(buffer, offset = 0)Object { value, length }
get64(buffer, offset = 0)Object { value, length }
getU8(buffer, offset = 0)Object { value, length }
getU16(buffer, offset = 0)Object { value, length }
getU32(buffer, offset = 0)Object { value, length }
getU64(buffer, offset = 0)Object { value, length }
getFloat(buffer, offset = 0)Object { value, length }
getDouble(buffer, offset = 0)Object { value, length }
getString(buffer, offset = 0)Object { value, length }

- putX

MethodReturn
putVar(value, type)Buffer
put8(value)Buffer
put16(value)Buffer
put32(value)Buffer
put64(value)Buffer
putU8(value)Buffer
putU16(value)Buffer
putU32(value)Buffer
putU64(value)Buffer
putFloat(value)Buffer
putDouble(value)Buffer
putString(value)Buffer

TYPE

NameValue
NULL0
BOOL1
INTEGER2
FLOAT3
STRING4
VECTOR25
RECT26
VECTOR37
TRANSFORM2D8
PLANE9
QUATERNION10
AABB11
BASIS12
TRANSFORM13
COLOR14
NODE_PATH15
RID // unsupported16
OBJECT // unsupported17
DICTIONARY18
ARRAY19
RAW_ARRAY20
INT_32_ARRAY21
INT_64_ARRAY22
FLOAT_32_ARRAY23
FLOAT_64_ARRAY24
STRING_ARRAY25
VECTOR2_ARRAY26
VECTOR3_ARRAY27
COLOR_ARRAY28
MAX29

Test

git clone git@github.com:gd-com/utils.git gd-com-utils
cd gd-com-utils
npm install or yarn install
npm run lint && npm run test

Contributing

Please read CONTRIBUTING for details on our code of conduct, and the process for submitting pull requests to us.

TODO & CHANGELOG

CHANGELOG TODO

License

This project is licensed under the MIT License - see the LICENSE file for details

Thanks

5.0.0

1 year ago

4.1.5

1 year ago

4.1.4

2 years ago

4.1.3

2 years ago

4.1.2

2 years ago

4.1.1

4 years ago

4.1.0

4 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.0.0

5 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.0.0

5 years ago

0.0.3

5 years ago