Dylan Smith

Nugget – A JavaScript Entity System

leave a comment »

I have been interested in building a web-based game for some time now, and have been thinking for some time about how to make it work. After reading a number of articles about software patterns and architecture used in game development, I happened upon what appear to be a series of fairly widely-read articles on Entity Systems.

I think the best way to describe how this differs to traditional OO would be to say that it is a form of mass mixin/multiple inheritance. Entities have no properties or methods. Instead they are decorated with components that describe their characteristics. These components contain the properties that pertain to that characteristic: for example, a Health component will need to have a “hitpoints” property. By adding multiple component instances to an entity, you can imbue it with characteristics in a very dynamic way that would be clumsy to do with classical inheritance.

And so I created Nugget, an entity system implementation in JavaScript. It’s early days, but the core building blocks are there and I have a roadmap of features I’d like to add.

Check it out on GitHub.

Advertisement

Written by Dylan

Oct 12, 2011 at 9:27 pm

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.