Giter Site home page Giter Site logo

anvil's Introduction

Anvil.js

This is the node script that runs my minecraft server on peticol.as. Slowly building out into a framework called anvil that will allow scripting for minecraft servers usuing javascript. Actual scripting is taking place in app.js.

Currently the server

  • says a welcome message

In the future I'd like to

  • create an assasins game, reward players for killing other players assigned
  • reward players with gold, diamond, weapons on correct kills

This needs lots of work so feel free to pull request

How does it work?

anvil.js

This is the main controller. It's job is to start the minecraft server as a child process and wrap stdio. It also iterates through game events on input and actions defined in app.js as a response.

TODO:

  • Kill the child process when the parent dies

gameEvents.js

This is an object literal of potential game events. The key, is the name of the function that will be available to the end user in app.js. The value is a function thats passed data (the most recent line of output logged) and a call back function. The functions job is to identify if it's the data is describing the desired event, parse that line of data for relevant data, and pass it in an object literal to the callback.

This file was designed to be easily extensible with additional and custom events by people who are better at regex than myself.

TODO:

  • player kills another player
  • player killed by some enemy
  • player burns in lava
  • player falls to death
  • player drowns

server.js

Similar to gameEvent.js, this module is an instantiable object of responses that the end user can use in app.js. The mc object passed in is the chils minecraft server process. ```mc.stdin.write`` will write to the stdin of the minecraft server and speak on behalf of the server. Thus it can do anything the server can do.

TODO:

  • kill a player
  • change the weather
  • change the time of day
  • give an item
  • give experience
  • change game mode of a player

app.js

Look at the sample to get a good idea of this. Basically it's Express style. On some event defined in gameEvents, do something with an anonymous function passed the data that parsed in gameEvent.js and respond with the server object defined in server.js.

anvil's People

Contributors

x avatar

Watchers

James Cloos avatar  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.