Giter Site home page Giter Site logo

tearitco / node-cli-game-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from polltery/node-cli-game-example

0.0 0.0 0.0 445 KB

A CLI game made using node.js that makes use of a map and a battle system that players use to navigate and complete objectives.

License: GNU General Public License v3.0

JavaScript 100.00%

node-cli-game-example's Introduction

Node CLI game example

About the project

There is a 4x4 map laid out with with each tile unexplored, players are required to explore the map and encounter beasts, friends, bosses and blockages.

The concept is called "Finding Ciri", where you are Geralt of Rivia, Ciri has ran away and you have to find her! You can also play this with Gwent cards.

Basic Rules

  • Main objective is to find Ciri 'tile'.
  • You can move 1 step per turn and you have 15 POWER
  • The map is laid out randomly based on the cards in the lib folder, player can move in a given direction at once.
  • When you move to a tile, it could be a monster, boss, weather/special or a friend, based on that you will enter the interaction screen.
  • When in a fight, the winner is decided by taking your power into consideration, more power = more chance of winning.
    • take your POWER and the monster/boss POWER
    • Chance formula of you winning the fight is : YOUR-POWER/(MOSTER/BOSS-POWER + YOUR-POWER)%
      • Example, you encounter 4 POWER monster, so your chance of winning would be (15/4+15)% that is 79%, so take a random number generator, and hit the generate button, if the number is lower than or equal to 79 then you win, else the monster wins.
  • When a friend joins your party, thier POWER is added to your power for next fights.
  • If you encounter a boss, you fight them in a set of best of 3. After defating the boss you may gain a reward or complete an objective.

How to run?

Before you run, make sure you have node.js (includes NPM).

  1. clone repo
  2. npm install
  3. npm run serve or node src/app.js

Preview

About the development

This is a hobby project inspired by Gwent cards and was supposed to be played using those until I decided to make this CLI game. I will add more info here as the development continues. Currently the game does have some on going bugs e.g. player indicator on the map not in sync, game closes on move when character is not in sync with map display, etc. ¯\_(ツ)_/¯ However, it still gives a good idea on how to make a CLI application.

  • lib/ : Contains data about all the cards and player.
  • battle-engine.js : Mainly responsible for battle stages.
  • app.js : entry point of the game, does everything possible cause why not.
  • config.js : Used for default values and map size initalization.
  • debug.js : Used for pretty printing stuff on the console.
  • map-engine.js : Mainly responsible for drawing map array, movement, etc.

Debugging (using VSCode)

  • Go to preferences and search for node debug
  • Set auto attach to on
  • Toggle a breakpoint
  • On terminal you can run node --inspect src/app.js

License

GNU GPLv3

Note: Only the names have been referenced from The Witcher Universe. I don't own any of the characters, this project is not releated in any way to CD Projekt Red or The Witcher Universe.

node-cli-game-example's People

Contributors

polltery avatar ufko avatar christianroper avatar pedramp avatar sbab avatar ggangix avatar brandonarmand avatar dependabot[bot] avatar

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.