3 ms·
Fantastic stuff. Can you give some more info on how it was created, what libraries it uses etc.?
by teamonkey 12y ago
Fantastic stuff. Can you give some more info on how it was created, what libraries it uses etc.?
- elisee 12y agoSure! (I made the source code public at https://bitbucket.org/sparklinlabs/gdevbot/src https://bitbucket.org/sparklinlabs/gdevbot/src btw) So basically it's a Node.js app built in CoffeeScript. I'm using node-twitter-api to subscribe to the bot's twitter notifications (https://bitbucket.org/sparklinlabs/gdevbot/src/tip/app.coffee?at=default#cl-276 https://bitbucket.org/sparklinlabs/gdevbot/src/tip/app.coffe...). Whenever a tweet arrives, I check various stuff (is it a retweet? are multiple people mentioned? more than one hashtag?) to decide whether it's a command or it should just be ignored. If all checks out, I parse the tweet's text (https://bitbucket.org/sparklinlabs/gdevbot/src/tip/app.coffee?at=default#cl-16 https://bitbucket.org/sparklinlabs/gdevbot/src/tip/app.coffe...) into a command and relay it to the backend for processing (https://bitbucket.org/sparklinlabs/gdevbot/src/tip/lib/backend.coffee#cl-142 https://bitbucket.org/sparklinlabs/gdevbot/src/tip/lib/backe...). Images are validated & their size clamped using a node graphics-magick module. Emoji scripts are parsed using a custom parser I cobbled together (https://bitbucket.org/sparklinlabs/gdevbot/src/tip/public/js/parseScript.coffee https://bitbucket.org/sparklinlabs/gdevbot/src/tip/public/js...) and JavaScript comes out on the other end. The tiny game engine works with actors (or game objects in Unity3D parlance, it's very similar except 2D-only), they can have components (an image, one or more scripts) on them and can be parented to one another. I've been building a cooperative game-making platform called CraftStudio (http://craftstud.io/ http://craftstud.io/) for the past 2-3 years and @gdevbot was just a kind of crazy "why the hell not" project inspired by all that work that I decided to build a couple weeks ago.