Friday, August 24, 2012

I made a game!

For the past few weeks I've been given the opportunity to spend my time on whatever I want to so long as it's shippable by the end of the month. So I decided to make a game using gladiusjs!

I have two reasons for doing so, the first being that making a game would allow me to see flaws/missing features in the engine that you really can't see unless you are forced to use it. This is called eating your own dogfood, and is a very important process for anyone shipping software that is going to be used by other people. The second reason is that it would provide a great example that other people can hack on or build off of to make their own game- anyone can just copy it and then skip whatever setup steps are required to make the engine work properly. I feel that this would make creating your own game as a new developer a much easier process.

You can see the game on the gallery page at dperit.github.com. Just click on the tank example to play it, or go directly to http://dperit.github.com/gladius/examples/tank/index.html

I found a number of ways to improve the engine while I was working with it. Here is a little change log detailing the enhancements I've made. It is rather jargon-y

Transform
  • Added a directionToLocal function that takes a vector3 direction in the world frame and returns that vector3 direction in the local transform's frame of reference
  • Added a transformToLocal function that takes a transform and returns the vector3 location of that transform in the current transform's frame of reference
  • Added a toWorldPoint function that returns the vector3 location of this transform in the world's frame of reference
 Box2D
  • Exposed the setAngularVelocity and setLinearVelocity functions of bodies
  • Added a dimension mapping feature where you can specify the dimensions that you want box2D to map to in a 3D world. So you can have it map to XY (default), XZ, or ZY. This is done by giving arguments to the resolver when you are initializing the extension-there is code near the top of the tank example that maps the physics to the XZ plane
  • Exposed the bullet property of the body definition, which indicates that this dynamic body is expected to collide with other dynamic bodies and should be monitored more closely for collisions as a result
  • Exposed the friction, restitution (bounciness), and collision filter options for fixture definition. Collision filtering allows you to set, through bitmasks, the categories of objects that a given fixture will and will not collide with. There's an example of this being used in tank.js on line 286
  • Changed boxshape so that the size you give it will match up exactly to size in transform
  • Added a circleshape which makes a circle
General
  •   Added a procedural sphere loader which allows you to put spheres in your game. Goes well with circleshape in Box2D
At the moment these changes can only be seen in various branches on my forks of gladius, gladius-core, and gladius-box2d.

No comments:

Post a Comment