Giter VIP home page Giter VIP logo

throneteki's Introduction

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.

throneteki's People

Contributors

adkateki avatar atkeranov avatar cavnak avatar cerseisadvocate avatar cryogen avatar dependabot[bot] avatar dokempf avatar duketax avatar evadlhorg avatar fafranco82 avatar grugn0 avatar guntherwullaert avatar hrnciar avatar jbrz avatar khyinn avatar laransoft avatar luky92 avatar nikolb avatar patane97 avatar perley avatar petarpetkov avatar samuellinde avatar sarabertoncelj avatar saviouress avatar sotiriskantz avatar stopfstedt avatar weber-knecht avatar ystros avatar zacchiro 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  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

throneteki's Issues

House card kneel

House card needs to be able to be knelt to pay for various effects.

Allow for actions windows

Reason: there are multiple action windows that allow players to trigger various effects which can alter game elements in subsequent phases/steps.

action windows:

  1. plot phase, after plots are revealed
  2. draw phase, after cards are drawn
  3. marshalling phase, after collecting income
  4. challenges phase
    4.1. pre-challenge
    4.2. after challenge is initiated
    4.3. after defenders are declared and before challenge is resolved
  5. dominance phase, after dominance is resolved
  6. standing phase, after cards stand
  7. taxation phase, after discarding for reserve

Circumvention: many of them can be applied prior to taking actions in subsequent phases, but some of them come too late.

  1. skipped. Can be done only after drawing cards during marshalling.
  2. can be done before starting to marshall cards (but still after collecting income)
  3. ok,
    4.1. ok
    4.2. ok
    4.3. skipped. can be done post automatic challenge resolution only. Probably the most important one.
    5, 6, 7. not sure right now. If I remember correctly all of these can be done only at the end of round.

Stealth targeting

When choosing a character to target for stealth, currently you can choose another character that has stealth. Per the rules, characters that have stealth are immune to the effects of stealth.

Characters setting up on bottom row, locations on top

If a location is chosen first during setup, it correctly goes to the bottom row. If a character is chosen first, it incorrectly goes to the bottom row. So whichever is chosen first ends up on the bottom row and remains that way for the rest of the game (all characters get marshalled to bottom or vice versa).

Move card to bottom of deck

Reason: many cards instruct player to move a card to bottom of deck.
Example: Greenblood trader - look at the top 2 cards, take 1 in hand and move the other to the bottom of your deck.

Enhancement: notify players to apply reserve discards

It took me a long time during a game to figure out why my end turn button was stuck during dominance, my opponent didn't know either but as we figured out it was the lower reserve value on plot card.
Is there a way to add a notification box (or just text over end turn button) telling player to apply reserve discards? We thought for a few minutes it was a bug, I think this would clarify things.

Attachment kneel

Attachments like Beggar King or Seal of the Hand need to have ability to kneel.

Chat window reverts to top

When in a game, moving to the general front page, then back to the game causes the game chat window to be scrolled to the top.

Enhancement: join back to the game after connection failure

Quite often it happens that a player is disconnected because of a connection failure. Allow for him/her to join back to the game.

Keep the state of the game upon disconnection (other than through Leave button) while the opponent is still in the game. It is up to the player whether he wants to keep waiting for the disconnected player or leaves the game. It could be a new command (/rejoin, /reconnect) or a new button and the connection is then restored and the game can continue.

Attachments lost, moved to wrong discard or unable to move

  1. When a character with an attachment leaves play that attachment disappears from the game (happened with Crown of gold)
  2. Confiscation - when removing opponent's attachment from my character that attachment is moved to my discard pile instead of its owner's discard pile (happened with Milk of the poppy)
  3. Attachments once attached cannot be moved manually to other play areas, discard pile, hand, etc. (happened with Stinking drunk)

Enchantments

Here is a list of things we talked about

  1. Discard Random card Button
  2. Look at top X
  3. Action Windows:
    -Before Challenges
    -Before declare defenders
    -After declare defenders
  4. Take control effects: Ward, Taking the Black, The Night Gathers ...
  5. Faction Card Kneel

Cheers,
Ivan (uBaH)

P.S. Not everything needs to be automated. Dominance, Reserve prompt, Counting income are good beginning.

Enhancement: browser notification when player joins game

Right now the game has a small player base, that sets back the testing too. I have only played it when I found someone to join. The one time I got someone to join my game I was checking the tab every minute or so which became a little tedious. Is there a way you could add a notification so as to make it easier for people to start games, I think it would make it easier in the beginning for players to create games.

good job

i am a author of agotv2 octgn,your work is amazing!

Cannot remove attachments

Example: when Viserys leaves play, he can remove an attachment. You can't do it manually.
Also, When a character or leaves play, the non-terminal attachments disappear.

Infinite marching to the wall

On two separate occasions, marched to the wall kept triggering until almost every character on both sides of the board was discarded, followed by a game crash.

/show x

Feature: implement command /show x (x is the number of first x cards from the top of the deck)
Reason: many cards allow you to look at or search first x cards of your deck, for example:
Greenblood Trader: /show 2
Summons: /show 10
Upcoming Pyat Pree: /show x (x is variable based on challenge result)

Card information is leaked in setup

Locations and characters can be deduced from the placement on the board in the setup phase.

This is caused by the card information being sent to the client when the face is facedown and does not belong to the player

Putting cards into play outside of marshalling

At the moment you can manually put characters and locations into play during marshalling by dragging them onto the field. However, you can't do so during challenges. This is crucial for cards like Arianne or the new Moon Brothers. I would appreciate, if this could be fixed.

Also, you can kneel almost everything except for the faction card. This requires only a small fix, and would make cards like I Never Bet Against My Family usable... well, maybe not THAT card, but you get the idea.

Thank you for developing this software. It already looks very slick.

Allow manual resolution of When revealed abilities of plots (no auto resolution)

Feature: Stop resolving When revealed abilities of plots automatically when plots are chosen.

Reason: It is up to the first player who determines in what order plots are triggered. There are many situations when the order of When revealed abilities makes a difference.

Note: It is much easier to allow players handle different abilities manually, e.g. draw, kill, basically moving cards around. Implementing each plot ability automatically is time consuming, error prone and inflexible.

Shuffle card into deck

Reason: many cards instruct player to shuffle a card into his/her deck.
Examples:
Benjen Stark - after BS is killed, shuffle him into owner's deck
Rebuilding - choose 3 cards from discard pile and shuffle into your deck

add Rains (and all agendas) as a new class of cards

Agendas i believe are the final card type we have yet to get an example of. As most non banner agendas have some sort of ability (KoS needs to add the gold for summer plots, etc) these should be a top priority to add sooner rather than later.

General thoughts about automation vs manual control

At the moment there is a weird mix of automation and manual control which I believe hurts the playability. For example, after declaring defenders it goes straight to challenge resolution. This basically makes Targaryen an unplayable faction right now. If they want to burn a defender this would likely change the challenge winner, causing the need for lots of stuff to be rewound, which oftentimes can be hard to do. If you want to automate the challenges themselves (which would be cool but probably very hard) you would need to include steps for every action window (which both players would need to pass consecutively before moving on) as well as options for reacting to winning/losing, interrupting or replacing claim, reacting/interrupting to keywords etc. Also all the less-important phases like standing and taxation and their action phases would need to be included. Without that this will probably be useful/playable but won’t be a serious tool for playing the game which is needed if you want it to reach jinteki heights I think.

In the meantime it’s probably better (and easier) to at least make it possible to do everything manually. For example just kneeling a card, typing “mil” in the chatbox and handling the resolution yourself. There would need to be commands for drawing, looking at the top x cards of the top/bottom of the deck, putting any kind of tokens on cards, etc. Most of that is already implemented I believe but not all. It would more or less be like playing on OCTGN, except better because it's browser-based and has a much cleaner interface. Let me know what you think and if you need any help with game rules for example. :)

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.