Coder Social home page Coder Social logo

serpents's Introduction

Serpents

Multi-Player Game on top of HDP protocol or REST+SSE

Introduction

Serpents is the classic snakes game where each player controls a serpent that moves around a board. When the serpent eats a fruit it grows according to how much food the fruit provides. If the serpent hits anything but a fruit (being that a wall, another serpent or even its own body) the serpent dies.

The Server

This repo provides the game server. Players should write their clients on their own (and that is part of the game). To do that they can use one of two protocols:

  • HTTP: A RESTful API with an additional SSE endpoint for updates
  • HDP: An UDP based protocol

To start the server, run

$ rebar3 compile && rebar3 shell

Or you can generate a release with rebar3 release and then start it

$ ./_build/default/rel/serpents/bin/serpents start

The Website

Once the server is started you can open http://localhost:8585 and start creating and watching games.

Player Examples

If you don't know where to start in order to write your serpents client, you can check the sample clients provided in the src/clients folder. There are 2 clients there:

  • ai: An collection of automatic clients that connect to a game and automatically move the serpents according to their algorithms
  • wx: An interactive client built on top of wx

Contact Us

If you find any bugs or have a problem while using this project, please open an issue in this repo (or a pull request :)).

And you can check all of our open-source projects at inaka.github.io

serpents's People

Contributors

elbrujohalcon avatar euen avatar hernanrivasacosta avatar jfacorro avatar sildur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serpents's Issues

Unique SerpentIds

Make sure that serpent numeric_ids always include the game numeric_id

Website

A static HTML file that, given the game provided in the url will connect to GET /game/:game_id/news and listen for SSE messages using EventSource and render the corresponding changes on screen.
It should only work on localhost and you get to choose your favourite browser.

Fulfil the open-source checklist

General Items

Exhibition

  • There is a blog post about it
  • It's shared on social networks
  • It's shared on reddit
  • It's shared on hacker news with a title like Show HN: description
  • It has a landing page built in github pages

For Erlang Projects

Improve Game Info on HDP

  • Add game state
  • Swap MaxPlayers and CurrentPlayers
  • Verify that all static info is returned
  • Move the binary construction to spts_games:to_binary

HDP Client

  • Define the HDP protocol and then implement
  • Supervisors and workers to talk HDP protocol with clients and then communicate with the server
    • calling the functions defined on #2
    • listening for the events defined on #17

HDP Connection Timeout

If clients fall behind a certain (configurable) number of ticktimes from the server… it should be considered disconnected and it should no longer receive events until it sends its next client update

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.