Netcode

Netcode

new Netcode()

Work in Progress! Not ready for public use yet. A `netcode` object is created automatically when p5play loads. "Netcode is a blanket term most commonly used by gamers relating to networking in online games, often referring to synchronization issues between clients and servers. Players often infer "bad netcodes" when they experience lag or when their inputs are dropped." - Wikipedia The methods of this class will help p5play developers create online multiplayer games and servers.
Source:

Methods

binaryToSprite(binary, offsetopt) → {Sprite}

Converts binary data, assigning the values to a sprite.
Source:
Parameters:
Name Type Attributes Description
binary Uint8Array binary data
offset number <optional>
byte offset
Returns:
Type:
Sprite
the sprite

spriteToBinary(sprite)

Converts a sprite to a binary representation, which is smaller than serializing the data with JSON.stringify. This function is intended to be used to send sprite data over a network.
Source:
Parameters:
Name Type Description
sprite Sprite to binary. Defaults to all sprite properties.