Sunday, September 18, 2011

0x0001 Dev Diaries - Entities, Events, Rendering

I've been tinkering on a small Javascript and Canvas engine for the last few weeks, and I'm mostly happy with the results, if not as happy with the progress. Still, it has been steady, so I'll focus on being happy for that part.

I'm starting to split the codebase into two parts: a javascript utility library, very similar to backbone.js, and the game engine on top of it.

At the core is an event and entity system. The entities are component based, and access named components via get() and set() methods, which is not great but allows for nice behavior by triggering events on property set, allowing other code to subscribe to changes on entities. For example, the render binds to the "setposition" event and will mark any entity for re-rendering when it has moved.

Entities don't get any logic or behavior. Separately, Behavior types are defined and serve two purposes. Firstly, they get a tick() method called, given a time delta since the last call, and are allowed to do any updating to the entity states. This is where I'm integrating Box2Djs, for example. Secondly, behaviors can subscribe to any events in entities they are applied on, so a Draggable behavior watching an object has an "entity.mouse.click" event fired when any of its entities "mouse.click" event triggers, allowing the behavior to response in whatever way is appropriate.

I am also happy to have, so far, kept the rendering component completely isolated. When I get around to writing a WebGL renderer, it should be able to do so without any changes to entities, behaviors, or anything else.

I'll be posting up a version of both the core JS library and the engine some time this week.

Saturday, August 13, 2011

0x0000 Dev Diaries - Back on the Game Dev Cart

I was drawn to software and programming because I wanted to make games, when I was a kid. I got books from family members and from the library, and I learned whatever I could. This was not before the internet, but it was before I had access to it. Still, I powered on and I progressed. At some point, I found other areas of software interesting. Today, I like to think I'm enjoying success in my career as a Python and Javascript developer, almost entirely on web products. I enjoy my work, and I'm good at it. And, I'm still learning. But, something is always missing, no matter what I learn or what I realized I've been failing at, or what amazing new development I discover from my colleagues in all the wonderful programming communities I'm a part of.

I never followed through with the reason I got into programming in the first place!

I'm determined to fix this. I've been making some attempts, on and off over the past year. Increasingly often I've hacked on this little game project or that. But, I have not gotten serious. I'm ready to get serious. I am starting, today, Pantechnoco Games.

My first project is a game inspired by ideas from my son, who is helping me with a bit of art and a few ideas. His involvement is minor, being five and all.

I'm developing this as a web-based game, learning my way around the <canvas> tag as I go. I spent some time trying DOM-based sprites, and a little while experimenting with WebGL. I'm very excited for WebGL in the future, but right now the support outside of NVidia hardware is really not ready, and I'm not interested in building something that only owners of specific hardware can enjoy. Maybe in six months, when ATI leaves the blacklist and some of the bugs on Intel GPUs are resolved, then audience will be wide enough, with or without IE support for WebGL. I had a lot of difficulty deciding on exactly what to pursue, until I finally just ran with the canvas efforts and decided to stop wasting so much time trying to decide how to be productive.

Our efforts so far are here. They aren't much, but the point is to stop neglecting the interest. To stop procrastinating.

https://github.com/pantechnoco/Imagination-Adventure