Socket
Book a DemoInstallSign in
Socket

zoo-adventures

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zoo-adventures

Hang out with the other animals in the zoo

1.1.0
latest
Source
npmnpm
Version published
Maintainers
2
Created
Source

zoo-adventures

Play with the other animals in the zoo.

There is no real winner, but you get some extra attention in the zoo when finishing a complete line! You can make one move, then you have to wait for someone else to go ahead before you can make another one.

The game is an experimental demo of p2panda showing how you can build collaborative applications with custom schemas on the network. You can play with it on our website!

Installation

npm i zoo-adventures

Usage

Zoo Adventures is a React component you can embed in your website. It will connect to a p2panda node and allow you to collaboratively play the game in the p2panda network.

import { ZooAdventures } from 'zoo-adventures';

const App = () => {
  return (
    <ZooAdventures />
  );
}

To configure the component you can pass in the following arguments:

  • boardSize: number Dimensions of the board, set to 4 when it is a 4x4 board (defaults to 4)
  • winSize: number Required number of pieces in horizontal, vertical, diagonal row to win (defaults to 3)
  • documentId: string All players play on the same board, this is the document id of it (defaults to 0020823a...)
  • endpoint: string URL of the p2panda node (defaults to http://localhost:2020/graphql)
  • schemaId: string ID of the game board schema, make sure the board size matches the fields (defaults to zoo_adventures_0020da64...)
  • updateIntervalMs: number Interval to fetch latest board game state from node in milliseconds (defaults to 2000)

Development

Setup

# Install NodeJS dependencies
npm install

Register schema

The used schema for this game is already deployed in the p2panda network. If you want to to deploy it on your local node, you can run:

$ npm run schema

Usage: --privateKey [path] --boardSize [num] --endpoint [url]

Options:
      --help        Show help
      --version     Show version number
  -k, --privateKey  Path to file holding private key [default: Demo key]
  -s, --boardSize   Size of the game board, use 4 for "4x4" for example [default: 4]
  -e, --endpoint    Endpoint of p2panda node [default: "http://localhost:2020/graphql"]

It will deploy the schema and create the game board document on your node hosted at http://localhost:2020.

Component

# Check linter errors
npm run lint

# Build library and demo
npm run build

# Watch for changes and automatically run `build`
npm run watch

# Start server to host demo (needs building first)
npm run serve

License

MIT

Supported by



This project has received funding from the European Union’s Horizon 2020 research and innovation programme within the framework of the NGI-POINTER Project funded under grant agreement No 871528 and NGI-ASSURE No 957073

FAQs

Package last updated on 11 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.