# jellyfish.js

> Multiplayer game development made easy.

Latest version **0.0.4** (published 2021-04-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install jellyfish.js
pnpm add jellyfish.js
yarn add jellyfish.js
bun add jellyfish.js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2021-04-17 |
| First published | 2020-08-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 187.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | nicholasthrom, quantum5, mikeyaworski |

## Links

- npm: https://www.npmjs.com/package/jellyfish.js
- Repository: https://github.com/JellyfishJS/jellyfishjs
- Homepage: https://github.com/JellyfishJS/jellyfishjs#readme
- Issues: https://github.com/JellyfishJS/jellyfishjs/issues
- npm.io page: https://npm.io/package/jellyfish.js

## Dependencies (9)

- [uuid](https://npm.io/package/uuid.md) ^3.3.3
- [pixi.js](https://npm.io/package/pixi.js.md) ^5.1.3
- [typedoc](https://npm.io/package/typedoc.md) ^0.20.35
- [socket.io](https://npm.io/package/socket.io.md) ^2.4.0
- [@types/uuid](https://npm.io/package/@types/uuid.md) ^3.4.5
- [@types/socket.io](https://npm.io/package/@types/socket.io.md) ^2.1.4
- [socket.io-client](https://npm.io/package/socket.io-client.md) ^2.4.0
- [@types/serve-handler](https://npm.io/package/@types/serve-handler.md) ^6.1.0
- [@types/socket.io-client](https://npm.io/package/@types/socket.io-client.md) ^1.4.32

## Recent versions

- 0.0.4 (latest) — 2021-04-17
- 0.0.4-beta2 — 2021-03-22
- 0.0.4-beta — 2021-03-21
- 0.0.3 — 2021-02-25
- 0.0.2 — 2020-08-18
- 0.0.1 — 2020-08-18
- 0.0.0 — 2020-08-18

## README

# Jellyfish

Multiplayer game development made easy.

<div align="center">
    <img src="./docs/assets/jellyfish.png" width=150 />
</div>

Jellyfish is a game engine designed around multiplayer.
We handle networking, sending packets, and updating state,
so you can focus on what you care about —
designing your game.

## Features

- Write your code once,
run the same bundle on the server and the client,
and we take care of the rest.
State is automatically synchronized between clients.

- Supports WebGL rendering
(thanks to [PIXI.js](https://www.pixijs.com/))
and optionally, physics
(thanks to [matter.js](https://brm.io/matter-js/)).

- Supports JavaScript and [TypeScript](https://www.typescriptlang.org/).

- No IDE. You already like your editor,
and we could never compete with it.
Use what you're comfortable with.

- Easy to learn, but powerful.
Jellyfish isn't magic
— it does things automatically when you want,
but let's you control the details when you need.

## Simple Multiplayer Game

```js
const { GameObject, ImageSprite, Vector, Server, Client, isServer, game, serve } = require('jellyfish.js');

class Player extends GameObject {
    onCreate() {
        this.position = Vector.xy(100, 300);
        this.sprite = this.createSprite(ImageSprite, '/assets/player.png');
        this.sprite.following = this;
    }

    keyHeld(keycode) {
        if (!this.isOwnedByCurrentUser()) { return; }

        let movement = Vector.zero;
        switch (keycode) {
            case 40: movement = Vector.up; break;
            case 38: movement = Vector.down; break;
            case 37: movement = Vector.left; break;
            case 39: movement = Vector.right; break;
        }

        this.position = this.position.plus(movement);
    }
}
game.registerClass(Player);

class GameServer extends Server {
    onCreate() { this.start(); }
}

class GameClient extends Client {
    onCreate() { this.connect(); }
    onRegistered() {
        const player = this.createObject(Player);
        player.setOwner(this.user());
    }
}

if (isServer) { game.createObject(GameServer); }
else { game.createObject(GameClient); }

game.setCanvasByID("game");
game.start();
serve();
```

## Getting Started

To get started quickly, check out the [first game guide](./docs/use/articles/making-your-first-game.md).

For more information,
see the rest of [the documentation](https://docs.jellyfishjs.org/).

## Contributing

Ideas? Want to help out? Great!
Make a [new issue](https://github.com/JellyfishJS/jellyfishjs/issues)
or a new [pull request](https://github.com/JellyfishJS/jellyfishjs/pulls).

Check out the [development docs](./docs/development/development.md)
for more information.

## Contact Us

If you have a question,
have general feedback,
want to insult us,
or want to help out,
join our [Discord](https://discord.gg/NYBxGRJfNn)!

---
_Source: https://npm.io/package/jellyfish.js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
