1.0.10 • Published 17 days ago

squishjs v1.0.10

Weekly downloads
21
License
ISC
Repository
github
Last release
17 days 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

17 days ago

1.0.9

21 days ago

1.0.8

23 days ago

1.0.7

2 months ago

1.0.6

4 months ago

1.0.5

8 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

11 months ago

1.0.4

9 months ago

1.0.3

9 months ago

0.7.67

11 months ago

0.7.66

1 year ago

0.7.65

1 year ago

0.7.62

2 years ago

0.7.61

2 years ago

0.7.55

2 years ago

0.7.54

2 years ago

0.7.56

2 years ago

0.7.51

2 years ago

0.7.5

2 years ago

0.7.53

2 years ago

0.7.52

2 years ago

0.7.60

2 years ago

0.7.4

2 years ago

0.7.2

2 years ago

0.7.3

2 years ago

0.7.1

2 years ago

0.6.43

3 years ago

0.6.42

3 years ago

0.6.41

3 years ago

0.6.40

3 years ago

0.6.33

3 years ago

0.6.32

3 years ago

0.6.31

3 years ago

0.6.3

3 years ago

0.6.2

3 years ago

0.6.1

3 years ago

0.5.3

3 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.9

4 years ago

0.4.24

4 years ago

0.4.23

4 years ago

0.4.21

4 years ago

0.4.20

4 years ago