Communicating with your user base

Just wanted to write a quick post about this. I recently read an article about a large company hiring a programmer off hackernews, and how programmers want to be engaged more with what they're producing.

While I work a full time job at Mosaic and I enjoy it, I also have had a Shopify application in a beta state for the past month or two. More recently, I've been in touch with a couple shopify users that are interested in my app.

They have been emailing questions, asking me about the application, can it do this, can it do that? Somethings so far I've looked at implementing, as it's something that's a good idea, not overly challenging, and something I just did not realize. The fact that I can send them an email to keep them up date, and communicate with them directly is such a great feeling. I know exactly what the writeer of that blog post was talking about.

For a shameless plug, here's my shopify app page: http://apps.shopify.com/clearcharity

Some learnings i've had so far

  • With feature requests, definitely evaluate what they're asking and see if it's doable, and if it's a feature many would want.
  • If you are not going to move forward with the feature, be honest and tell them why.
  • Keep them up to date when you post changes or potential implementations. This is likely an obvious point, but it keeps them engaged.

Rendering shapes and drawings via the canvas in MelonJS

I've been using Melon JS for some months now to cure my various HTML5 itches. Messing around with it, I needed to render a health bar above an enemy. Libraries like LibGDX give you a shape renderer. Where you specify what kind of shape you wish to draw, you configure the colour, etc. It's a very similar structure to that of the canvas API.

Due to how MelonJS manages your objects on the screen, you can't just get the canvas context and draw as you like. Chances are your objects will be drawn on top of that. This is a pretty big issue if you use things like Tiledmap and so forth, where the background will get drawn on top of your shapes.

Luckily there's a pretty simple solution. As I said, this was to draw enemy health bars. So preferably, I'd like to keep the health bar drawing with the logic of my ObjectEntity. The ObjectEntity class has a draw function available. Normally it's not used, as when you setup animations and a sprite, it's usually not needed.

Here's the code to set it up:

Game.Enemy = me.ObjectEntity.extend({
init:function() {
var settings = {
spritewidth: 128,
spriteheight: 128,
image: "enemy"
};
this.updateColRect(40, 46, -1);
this.parent(100, 100, settings);
this.health = 10;
this.maxHealth = 10;
},

draw: function(context, rect) {
this.parent(context, rect);
this.drawHealth(context);
},
drawHealth: function(context) {
var percent = this.health / this.maxHealth;
var width = this.getCollisionBox().width;
context.fillStyle = 'green';
context.fillRect(this.getCollisionBox().x, this.pos.y - 12, width, 10);
},
getCollisionBox: function() {
return {
x: this.pos.x + this.collisionBox.colPos.x,
y: this.pos.y + this.collisionBox.colPos.y,
width: this.collisionBox.width,
height: this.collisionBox.height
};
},
});

To explain this code, the init function is just showing the bare minimum, but essentially im updating the collision rectangle to just surround the visible enemy.

The draw function is passed two parameters when invoked, so they must be forwarded to the super class draw. I then call my drawHealth method which uses the canvas api to draw a rectangle. I use my custom method to get the collision box positioning so I can position the rectangle accordingly.

And that is basically it. This might change over time due to MelonJS still being in its early stages. But as of now, it's a relatively simple way to draw shapes rather than render bitmaps.

A break from creating

Taking a break this month from creating games. I'll start thinking about ideas for the up coming Ludum Dare of course. But for April, I'm going to try and focus on messing with different tools and frameworks. I've been making stuff in Libgdx and Java, but I want to see what else is out there.

Html5 wise, I've done the most with MelonJS, which I like for many many reasons. It feels familiar, I find I can navigate around the source code quite easily. It has great tiled map support. What I do want to look into though (and already have begun) is Cocos2d. Just how the API is structured reminds me a lot of some 3d libraries I used to mess around with years ago.

I also want to look at C++ and SFML 2 for some reason. Not sure if I'll stick with it, but it's nice to see what is out there. Java definitely serves my purposes as far as performance is concerned.

To go much more high level, I have some bookmarks for learning unity, and I feel it's worth a few hours at least. While the cost of unity to get the extra features is quite high, one can make some pretty decent games for free.

Aside from that, I might toy with LWJGL a bit, and see what that is like.

My main focus here for sure is HTML5. While I do have concerns, it's hard to ignore the amazing feet that Mozilla and Unreal brought forward. If you're not sure what I'm referring to, install a nightly build of firefox, and check out: https://developer.mozilla.org/en/demos/detail/bananabread