1.0.10 • Published 1 year ago

squishjs v1.0.10

Weekly downloads
21
License
ISC
Repository
github
Last release
1 year ago

Squish

This repo contains the game library used by homegames-core and homegames-web to efficiently serialize & deserialize game data.

squish/unsquish

This is just serialization/deserialization. Conceptually similar to protobufs, squish contains schema definitions shared by the server and client that lets us transmit game data as efficiently as possible.

const { squish, unsquish, Colors, GameNode, Shapes, ShapeUtils } = require('squish-1006');
const node = new GameNode.Shape({
  shapeType: Shapes.POLYGON,
  fill: Colors.COLORS.RED,
  coordinates2d: ShapeUtils.rectangle(20, 20, 10, 10)
});

const squished = squish(node);
[
  3,           0,            0,            53,
  2,           43,           0,            11,
  [Number: 0], [Number: 0],  [Number: 32], [Number: 61],
  [Number: 3], [Number: 90], [Number: 63], [Number: 44],
  44,          0,            3,            53,
  0,           7,            255,          0,
  0,           255,          55,           0,
  4,           3,            52,           0,
  23,          20,           0,            20,
  0,           30,           0,            20,
  0,           30,           0,            30,
  0,           20,           0,            30,
  0,           20,           0,            20,
  0
]

const unsquished = unsquish(squished);
Shape {
  node: InternalGameNode {
    id: [Number: 326103906344],
    children: [],
    color: undefined,
    handleClick: undefined,
    coordinates2d: [ [Array], [Array], [Array], [Array], [Array] ],
    border: undefined,
    fill: [ 255, 0, 0, 255 ],
    text: undefined,
    asset: undefined,
    effects: null,
    input: null,
    listeners: Set(0) {},
    playerIds: [],
    subType: 3
  },
  id: [Number: 326103906344]
}

Game

The Game class is a base class that allows external components (eg. a Squisher) to listen to state updates. All games in Homegames extend the Game class.

Versioning

Homegames core & web use multiple versions of squish. This allows games using older versions of squish to remain compatible with newer versions of Homegames.

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

0.7.67

2 years ago

0.7.66

3 years ago

0.7.65

3 years ago

0.7.62

3 years ago

0.7.61

3 years ago

0.7.55

3 years ago

0.7.54

3 years ago

0.7.56

3 years ago

0.7.51

3 years ago

0.7.5

3 years ago

0.7.53

3 years ago

0.7.52

3 years ago

0.7.60

3 years ago

0.7.4

3 years ago

0.7.2

3 years ago

0.7.3

3 years ago

0.7.1

3 years ago

0.6.43

4 years ago

0.6.42

4 years ago

0.6.41

4 years ago

0.6.40

4 years ago

0.6.33

4 years ago

0.6.32

4 years ago

0.6.31

4 years ago

0.6.3

4 years ago

0.6.2

5 years ago

0.6.1

5 years ago

0.5.3

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.9

5 years ago

0.4.24

5 years ago

0.4.23

5 years ago

0.4.21

5 years ago

0.4.20

5 years ago