Onedayitwillmake

NYC Programmer Mario Gonzalez's blog

BulletML running on iOS

BulletML is an XML like markup language created to describe bullet barrages seen in shooters. It allows you to describe complex bullet patterns in simple XML files, then parse them and let it run. Very easy to create nice boss patterns

In this video is my first working attempt at getting it to run on the iPhone. Currently bullets can not spawn other bullets, but once I get that i’ll share the source

It runs at 60FPS, but the screen recorder drops some frames.

Project:
https://github.com/onedayitwillmake/BulletHaven

I’ve managed to get BulletML and cocos2d to work together.
Most of the bulletml files work, except for when bullets need to spawn other bullets.

Does anyone have any experience with this, perhaps it’s a callback function that needs to be inside of bullet?

Video of 2.5D Javascript/WebGL PortalGun

I’m in the middle of adding a Portal gun to chuclone - There are still a few kinks in it, namely related to determining the side of the object the Portal gun hits, and converting the 3D position of your shot into 2D cordinates so that it shoots exactly where you aimed. However I have it far along enough to show a video of it in action!

Here you can see me messing around with the gun, as well as trying out a couple of simple level ideas that come with it.
Mostly the momentum based puzzles, as those were my favorite in Portal. However I kind of wonder if i should add switches as well – that might be kind of cool.

ChuClone Preview

UPDATE:
The game is now live at http://chuclone.com


ChuClone is an (about to be released) open-source HTML5 / WebGL / Box2D based game.
With a built in level editor to allow users to create as well as play each others levels.

This is me playing the SunsetMountain level

Creating Realtime Multiplayer Games using Node JS

A few months ago at work, we decided to build a realtime multiplayer game for the web, and we chose to go with Node.js for our multiplayer server.
It was a pretty strong success, and was up running for several months without a single crash or restart of the Node.js process.

We decided to write our game in Node.js because we had heard of this cool platform and had been itching to use it for a while. This turned out to be a blessing because it was very easy to get into, and many interesting Node.js libraries exist to help accomplish various task. A side benefit of using node is that javascript itself is very easy to use. This allowed us to focus on the problems all realtime network games face with less fussing with the constraints or compile times of less dynamic languages.

Node.js was also very lightweight on our servers even during peek usage. On our game the node.js process was using only 1 thread and ran at about 3-4% CPU usage running 8-10 simultaneous games each with their own collision engine instance.

Writing a realtime multiplayer game – the initial (naive) approach:

var info = {};
info.position = {x:10, y:15};
info.velocity = {x:0.5,y: 0.2};
info.currentWeapon = 1;
info.radius = 10;
this.netChannel.send( info );

Server re-broadcast that info to all other clients:

function broadcastInfo( sendingClient, messageInfo )
{
     for(var aClient in allClients) {
          if(aClient != sendingClient) {
               aClient.connection.send( messageInfo );
          }
     }
}

(more…)

A Finite State Machine implementation for use with Javascript games

Currently I’m working on a new Javascript/WebGL game called ChuClone. It’s been a lot of fun to work on so far. Having a good editor has been a key in that, as it allows you to write javascript in a more application like style, than strictly a series of DOM manipulation functions.

For this game I wanted to use a Finite State Machine to handle my gameplay states.

An example of such a system is if you think of your game as a connection of screens, for example:
StartScreen
GamePlayScreen
EndScreen

(more…)

Component based game entities in javascript

I’m creating a javascript/webgl based game and would like you guys to take a look at the current entity component system which I created for it, and perhaps weigh in some opinions.

On caveat I don’t like is that, sometimes a component needs to call the attachedEntities version of a function it has overridden. For example handleInput, it might call the attachedEntities handleInput functions and then with the new movementVector multiply them by negative 1 so now all input while this component is active is reversed.

When I intercept the properties, currently I wrap intercepted function calls into a closure ( see BaseComponent.intercept() ) so that the ‘this‘ object can refer to the component itself. Without that the ‘this’ object was still being referred to as the attachedEntity (from within the components version of that function), so to get the components properties I had to run a query.

So I’m curious what others think of this implementation.

Things I used as reference:
http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/
http://gameprogrammingpatterns.com/component.html
http://blog.bengarney.com/2010/06/12/composition-vs-inheritance/

(more…)