Git Product home page Git Product logo

ludo-api's Introduction

Ludo API

API for a game of Ludo

How to use

Library

You need the following package to use this API.

npm install @aspnet/signalr@next

Connecting

The API is live on ludo.azurewebsites.net

Connect on subpath /game

Events

Lobbies

  • invoke lobby:create with lobbyName to create a new lobby
  • invoke lobby:join with lobbyName to join a created lobby
  • invoke lobby:leave to leave your currently joined lobby
  • invoke lobby:ready to inform your mates you're ready to roll
  • invoke lobby:get-players with lobbyName to get the players in said lobby
  • invoke lobby:get-lobbies to get the lobbies names
  • invoke lobby:exists with lobbyName to check whether a lobby with that name already exists

When you're in a lobby you can get events for said lobby

  • on lobby:player-join it returns the user details of the player that joined
  • on lobby:player-leave it returns the user identifier for the player that left
  • on lobby:player-ready it returns the player identifier of the player who is ready to start the game

Game

  • invoke game:start as admin (those who created the lobby) to start the game when everyone is ready
  • invoke game:roll-die to roll your dice if it's your turn
  • invoke game:advance with pieceIndex to move the piece

When you're in a started game you can get events for that game

  • on game:started the game has started
  • on game:die-roll a player has rolled the dice, it returns the player identifier of the player who rolled the die and the amount it rolled
  • on game:advanced a player has advanced his piece, it returns the player identifier of the player who advanced his piece and the index of said piece
  • on game:next-turn the next player or turn starts, it returns the player identifier of the player whose turn it is and the turn type (roll or advance)

ludo-api's People

Contributors

chrisru avatar pavelruzicka avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

pavelruzicka

ludo-api's Issues

Error message formatting mishap

Summary:

Lobby name in error message is prefixed with a dollar sign

Steps to reproduce:

Invoke lobby:create with an existing lobby name

Expected results:

Error message quotes lobby name in question without a prefix of any sort

Actual results:

Error message quotes lobby name in question prefixed with a dollar sign

Relevant output:

HubException: Lobby with the name '$test3' already exists

Incidental error on lobby creation

Summary:

API throws an unexpected error on lobby creation

Steps to reproduce:

Invoke lobby:create with a non-existent lobby name

Expected results:

Lobby gets created without an error being thrown

Actual results:

Lobby gets created, an error gets thrown simultaneously

Relevant output:

Error: An unexpected error occurred invoking 'lobby:create' on the server.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.