Giter VIP home page Giter VIP logo

discordmud's Introduction

For Current Development, see Discordia

DiscordMud

MUD game and server that uses discord as a player interface

Installation

Requires discord.py.

In order to run, you must set up and configure your own user bot. More info can be found here.

Once you get a token, create a new environmental variable called DISCORD_BOT_TOKEN, and set it to be your token.

Then, run main.py. Your bot should log in, and a world creation dialog should appear. Currently, the dialog only asks for a world name and grid size.

world creation window

Getting started

When you are done, some randomly generated terrain should appear.

grass window

Once your world is created, you need to add a starting town. Click on the button to enter Add Town mode. Click on a location on the grid to add your first town. A dialog will pop-up asking you for some more parameters.

town window

Now it is time to create a character. The prefix for the bot is * by default. In a valid chat channel, type *register. The bot will ask you if you want to join the server. Type yes. The bot will then prompt you to name your character. Once you have given your character a name, you should see it spawn on top of the starting town in the GUI.

character window

Player Controls

  • register
    • Create a new player character and spawn into the game world.
  • whereami
    • Get your grid location, and a picture of your surroundings, as far as your FOV can see.
  • whoami
    • Prints your "character sheet" in chat. Contains player name and equipment.
  • go [n, e, s, w]
    • Move your player character in the direction specified.
  • inventory
    • Displays a list of the items in the players inventory
    • equip [index]
      • Have your PC equip the item from your inventory with the specified index.
    • unequip [index]
      • Remove the item from your equipment and put it back into your inventory.
  • attack <n, e, s, w, ne, se, sw, nw>
    • Attack another player with your currently equipped weapon. If no direction is specified, the user will attack in the current position only. Otherwise, ranged weapons go in a single direction like a "beam", until they either a) hit another player and apply damage, or b) Miss, as the damage falloff, as each tile the projectile traverses removes % damage until it goes to 0.
  • town
    • Calling town with no parameters is a debug command to check if you're inside a town or not.
    • inn
      • Run the events of the town's inn. Usually restores health/resources.
    • build [base]
      • base
        • Build a personal base on an unoccupied square. Use this for health/ammo resupply. (Note: Currently does not require any resources to build; will change to be much more expensive in the future.)
    • store
      • Lists all the items (Name, Price, Quantity) in the Town's store.
      • buy [index]
        • Purchase the item at the given index, adding it to your inventory.
      • sell
        • Sell an item from your inventory, removing it and giving you some money.

discordmud's People

Contributors

samclane avatar

Stargazers

 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

Forkers

kazuyabr

discordmud's Issues

Middle Click to Pan

When working on the WorldFrame where I inherit from QGraphicsView to display a QGraphicsObject (WorldView). I have already implemented the image zoom functionality from this post, and I have tried using their implementation of pan, and have found that it works. However, I want to be able to do the pan without toggling, simply by holding down the middle mouse button and dragging from there.

I've written this code to switch between the two modes (normal and drag), and then call it on mouse(Press/Release)Events.

(in QGraphicsView)

def toggleDragMode(self):
    if self.dragMode() == QGraphicsView.ScrollHandDrag:
        self.setDragMode(QGraphicsView.NoDrag)
        self.pointerMode = PointerMode.Normal
    else:
        self.setDragMode(QGraphicsView.ScrollHandDrag)
        self.pointerMode = PointerMode.Drag

def mousePressEvent(self, event):
    if event.buttons() & Qt.MiddleButton:
        self.toggleDragMode()
    ...
    super().mousePressEvent(event)

def mouseReleaseEvent(self, event):
    if self.dragMode() == QGraphicsView.ScrollHandDrag:
        self.setDragMode(QGraphicsView.NoDrag)
        self.pointerMode = PointerMode.Normal
    super().mouseReleaseEvent(event)

(Sidenote: With the mouseReleaseEvent, I found that I couldn't use event.buttons() & Qt.MiddleButton to check if the middle button was released, so I always check and release in this case.)

However, whenever I try and middle-click and drag, no pan happens. However, I have confirmed this works correctly whenever I use the left mouse button as the binding (i.e. if event.buttons() & Qt.LeftButton: toggleDrag()). There has to be some code in QGraphicsView.mouseMoveEvent() that checks to see if the left button is held AND the cursor is in DragMode. Is there a way to change the keybinding on that deeper level?

EDIT: I just found this link and tried it by doing this (in QGraphicsView)

def __init__(*args, **kwargs):
  ...
  self.STOP_GLOBAL_SCROLLING = 1

But to no avail. Still, it's an interesting lead.


Here's the stackoverflow question

WorldView doesn't resize sprites when zooming in

Pixelizes like one was zooming into a static image; however original sprite images are of higher quality than currently represented on the WorldView when zoomed in. Can be "fixed" by factoring parent zoom into squareWidth/Height functions, however this causes mouse-anchored zoom to no longer work.

The images must be resampled on zooming.

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.