Giter Club home page Giter Club logo

Throneteki

A web based implementation of A Game of Thrones LCG 2nd Edition.

About

This is the one of the respositories for the code internally known as throneteki which is running on theironthrone.net allowing people to play AGoT 2nd edition online using only their browser.

Throneteki is split into two repositories:

  • throneteki (this) contains changes for the client, lobby server, and game node server.
  • throneteki-json-data contains changes for official data for the AGoT 2nd edition card game, and is usable by other websites (such as ThronesDB).

Issues

If you encounter any issues on the site or while playing games, please submit an issue with as much detail as possible; try to provide what happened, if you can reproduce it & how, what cards were involved, what the last action was that was made.

Contributing

Throneteki is written in node.js (server) and react.js (client). Feel free to make suggestions, implement new cards, refactor bits of the code that aren't behaving properly, raise pull requests or submit bug reports.

We appreicate all who are willing to contribute code to this project; the card implementation guide should prove useful in understanding how to implement new cards or how existing ones work. For additional questions or queries, our development discord server is a useful place to find help.

Following linting guidelines and passing unit tests is a requirement for contributing, with more details on how to do so in "Testing" below. Both will be enforces on all pull requests; those with failed checks will not be merged.

If you have any major changes you'd like to implement, we would recommend mentioning this within our discord first to ensure it aligns with the websites intent.

Development

Docker (Dev Container)

Required Software:

  • Docker
  • Visual Studio Code

If you have docker installed & use VS Code, you can utilize Dev Containers for development.

Clone the repository, open in VS Code, install the Dev Containers extension and click the "Remote Status" icon in the bottom left. Choosing to Reopen in Container will initialise & open your dev container, and you should be able to jump straight into debugging after initialisation completes.

If you need to re-compile your container (eg. after an update involving dev-containers), simply choose Rebuild Container on the Remote Status menu whilst in your dev-container.

Run and Debug configurations are available to debug the client, lobby & game node, and there are tasks available to run individual components (such as client & lobby) without debugging, or for useful scripts (such as fetching data).

Non-Docker

Required Software:

  • Git
  • Node.js 20.x
  • MongoDB 4.0 or higher
  • Redis 7.2.x or higher

Clone the repository, then run the following commands in your repo folder:

git submodule update --init
npm install

Create config/local.json5 by copying config/default.json5 and change the following values to match your configured mongodb & redis ports:

dbPath: 'mongodb://localhost:{MONGODB_PORT}/throneteki',
redisUrl: "redis://localhost:{REDIS_PORT}/",

Run the following commands to fetch data:

node server\scripts\fetchdata.js
node server\scripts\importstandalonedecks.js

Run the following command to start the lobby & client *:

NODE_ENV=development PORT=4000 node .

Run the following command to start a gamenode *:

PORT=5000 SERVER=node1 node server\gamenode

*Note that non-linux operating systems will need to set the environmental variables (such as PORT) differently.

Running

Once the lobby is running, it should be accessible by browsing to localhost:4000.

On first start, you will need to create yourself an account, and a second one if you need to test against an opponent. Any emails in development can be fake, and in order to test against yourself, you will need to open at least one browser incognito.

If there are any changes to card data, make sure your throneteki-json-data submodule is up to date, and make sure to run the fetch data scripts again.

Testing

Throneteki uses ESLint for lint tests, and should pass without error or warning for approval. Extensions exist to help with this (eg. ESLint for VS Code), otherwise run the following to install ESLint globally:

npm -g i eslint-cli

And the following to test the appropriate directories:

eslint server/ test/

Unit tests are conducted using Jasmine, and must pass without errors or warnings to be accepted. Run the following to perform tests locally before committing:

npm test

If you are implementing any game engine changes, they will not be accepted without appropriate unit tests to cover them. If you wish to understand how to create unit tests, the Jasmine website has suiteable documentation, and existing tests can be used as guides. Additionally, we would also encourage updating the card implementation guide if your changes affect any details within that document.

The Iron Throne (Throneteki)'s Projects

throneteki icon throneteki

Browser based A Game of Thrones LCG 2nd Edition

throneteki-client icon throneteki-client

The client code for Throneteki, a browser based implementation of the A Game Of Thrones LCG

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.