Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.

Archive for February, 2011

Audio and polygons!

We have been working on an audio manager for our engine, a process which has not been entirely painless. Not only do various browsers support different types of audio formats, they handle the audio tag differently, especially when trying to retrieve the file from a server. The way we have implemented it now however seems to work pretty well. When loading an audio file, the audio manager is supplied the file name without the suffix and then it proceeds to query the server about a file that is suitable for the users current browser until it finds one. This means that for the audio to work in all browsers the server has to supply the same audio file in the formats ogg, wav and mp3.

Not everything has been pain though, a cool new feature in the physics editor that was quite fun to implement is shown in the picture above, namely the ability to draw polygons! When drawing polygons, vertices are added one at a time by clicking somewhere on the drawing area. Because the polygon has to be convex in the physics engine, every time a new vertex is added we go through the shape to make sure everything still looks OK. If any point would make the shape concave as a result of adding a new vertex, that point is removed from the shape. This makes closely fitting a physics shape to the entity much easier.

Floose: Flying Moose on the Loose!

We are proud to present Venison Engine’s first game (click here to play!) (only tested in Chrome on Windows 7 and Ubuntu):


You now know the truth. The crazy scientist bent on world domination who planned on spreading terror across the earth through brain wash and genetic manipulation of cute and harmless animals – who seemed so nice – was really evil all along. So now you and your fellow flying moose must compete in order to eventually be able to stop this madness in an ending cut-scene or a sequel maybe.

Instructions: Avoid the walls, the floor and the ceiling. Click the canvas to make your floose fly up, release to make it fall.
Tip: Small movements are easier to control than large ones.

Floose utilizes real-time multiplayer capabilities implemented with powered by node.JS on the server side. Any other players connecting to the server will show up in your browser window, and will be updated in real time. Try this by opening multiple tabs in your browser and navigate to the page.

Please note that this implementation of Floose is merely a simple tech demo to show what possibilities might exist in the final release of the Venison Engine.  As such it is not intended to be a full-fledged, robust and enjoyable game. As a result, we haven’t had all that much time to put on the design and polishing of the game . For example, the other players moose do not look particularly good. Also, there is no way to win or lose, and the level is very boring since the obstacles are constantly reappearing in exactly the same pattern. Furthermore, we have not spent any time on designing any cheat-prohibiting mechanisms – take a look at the code (by showing the source of the page) and you will see that the full responsibility of every player lies with the client; the server more or less only acts as a forwarder of messages between the clients.

Physics Editor

Shown in the picture above is a sub-editor to the main one, and it is used for editing the physics shapes of entities. To edit shapes for multiple entities their textures have to be the same and only the shapes that they have in common will be shown.

The main drawing area shows a scaled version of the texture of the selected entities and their physics shapes. To add new shapes to the entity, first select a draw mode in the upper right (currently box and circle) and then draw the shape on the canvas. If you instead choose the ‘select’ option from the radio buttons, you can click on entities to select them.  The currently selected shape is drawn in red color and shape specific information is shown on the right side of the screen. In this area it is possible to fine tune the values of the shape, set its collision categories and also remove the shape from all selected entities. There is also a button for clearing all the shapes that the selected entities have in common and, of course, a button to exit the editor.

More Editor Features

The screenshot shows the new camera controls (bottom left of the main area) and the game area reference controls (bottom right of the main area). They are both transparent, and their visibilities are toggled via the buttons in the main menu on left. The game area reference controls are used to show what area of the world will be initially visible in a canvas of a certain size, representing it as a black rectangle in the main view.

In the top right of the screen is the minimap which shows a bigger part of the (theoretically infinite) world. On the minimap, the black rectangle represents the area of the world that is shown on the main drawing area (note that the camera is rotated in the screenshot, resulting in a rotated rectangle on the minimap). The minimap camera automatically moves to always fully contain the area that the main camera is showing.

The screenshot also shows the ability to drag and select multiple entities at once: the green rectangle is the selection area.

Viewport Culling

Recently we discovered that it would actually save some time if we could figure out which entities that were outside of the visible area and not draw them. So we made a hierarchical grid data structure (hgrid) and some very coarse ‘collision detection’ to do so. The hgrid uses hashing to store the entities, allowing for an infinite number of grid cells, theoretically, maintaining the needlessness of specifying world boundaries when using the engine, since the box2dweb physics engine also allows for infinite world sizes. The hashing combined with a double linked list structure within the hgrid allows for a time complexity of O(1) for insertion and deletion, making it straightforward to keep the hgrid up to date – an entity that is moved is simply removed from the grid and then inserted again.

However, the first implementation of the hgrid contained a fatal bug: when removing an object from the double linked list, it’s pointers to the previous and next objects weren’t nullified, resulting in circular chains within the list, in turn resulting in infinite loops when checking the viewport against the grid. It was a very hard bug to track down, since the program seemed to work fine until one entity sharing a grid cell with at least one other entity was moved out of that cell and then back into it. The program would then freeze due to the infinite loop as mentioned above, causing confusion among the testers.

Unfortunately, the results of culling are rarely something to show, mainly because the fundamental purpose is to figure out what NOT to show. Nevertheless, appended below is a screenshot showing the successful culling of approximately 2000 entities outside the visible area of the canvas. Enjoy.

Venison Editor

For the past week we have been hard at work creating an editor for our game engine. As can be seen on the picture, the main view has a few different areas defined. In the top left corner of the screen is an image view where users can place images that they want to use while working in the editor. By dragging a picture from this area and dropping it onto the big area in the middle, a game entity is created and inserted into the level.

The middle area is a canvas element that displays the current state of the level and you can move focused entities around by dragging them (or use the arrow keys). To make an entity focused, you simply click on it. This will also display information about its properties in the lower left corner that users are free to edit as they see fit. It’s also possible to add new properties to entities in this area by selecting a property in the drop-down menu and then clicking the “add” button. Focus is not limited to a single entity, by holding the Ctrl key multiple entities can be selected at the same time. The properties displayed in the lower left will then be the ones that all entities have in common. In the top right corner of the screen is a small mini-map. While working in the editor, only the graphics are updated as we don’t want objects to start bouncing around or whatnot while trying to position them correctly. =P

When all is said and done and you would like to test your newly created level, click the “save level” button (or use the Ctrl+s command) to generate an XML file representing the level that you can then load up and play.

More Physics

Today we integrated box2Dweb ( into our game engine. It is based on version 2.1a of box2DFlash and is more up to date with the original box2D engine compared to box2Djs. We also added the option of using our own physics. Unfortunately we only have support for circle shaped objects so it’s not quite as exciting.

Say hello to Box2DJS!

Yesterday we realized that implementing a physics engine of our own had been a bad idea. It would have required a huge effort, and it would still not have been comparable to the big names out there. So, we thought to ourselves, why not smoothly integrate a free solution into our game engine, taking something good and making it better? Well, we couldn’t really think of any particular reason, so we spent today on integrating Box2DJS ( into our engine, and so far it has been going very well, as the screenshot implies.