Giter VIP home page Giter VIP logo

discord-rogue's Introduction

discord-rogue

The following is a tiny Berlin-lite Rogue like game for Discord.

Features

  • Procedural map generation and population
    • Unlimited dungeons
  • Polynomial-counter based stair navigation (unique rooms retain layout)
  • Day and night cycle
    • Werewolves come out at night
  • Shop and inventory system
    • Items that affect gameplay
  • Breadth first search path finding
  • Pixel accurate line of sight
  • Realtime lighting
  • Save, load and resume
  • Macro movement
  • Turn based combat

Bug reports

You may file any bugs on the issue tracker

Single source file

Yes everything is a single source file, this turns out to be much easier to embed and use with your bot and easier to update. Do not submit bug reports about splitting up the source code into multiple files, they will be closed on sight.

Failed to load game assets

The game searches for three text files containing a 30x28 characters describing splash screens for start, resume and gameover. These are not provided and you must supply your own.

Optimizations

The code isn't as optimal as it can be, we do a lot of O(n) runs through lists of entities and some O(n^2) stuff for generation of dungeons, however simplicity was chosen over performance for the first iteration.

Technical challenges

The way this is to be used is with discord.js's codeblock and edit functionality. game.update() is meant to be called on every channel message, with the contents of the message. This means the entire game is turn based in nature and limited in area. In particular, the ascii framebuffer used to represent the game cannot exceed 32x30 characters in size otherwise the code block would be too wide or too tall for the smallest Discord supported device: the iPhone.

The game supports an infinite variety of dungeons in each direction from the starting floor. Coming back to a floor you've been to before it will have the same layout as when you first discovered it. This required that map generation be completely deterministic based on a custom configurable PRNG.

Since every game move is based on a coarse cell-grid, certain pixel space operations like ray casting for line of sight and trigonometric operations for realtime light radius calculation doesn't work to establish which cells are influenced, instead rasterization techniques were used like Bresenham line and Midpoint circle.

Javascript only supports double precision IEEE-754 numeric operations, however the game operates exclusively in integer domain for the grid, this means lots of calculations involving divisions require the use of Math.floor to keep things integer-discrete. For example, the rasterization techniques require numerical stability for calculating integer error otherwise they don't work.

Feature requests

You may request features on the issue tracker but they may be closed if deemed too difficult or outside the scope of what this game is used for

discord-rogue's People

Contributors

eternalmc avatar graphitemaster avatar

Watchers

 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.