We had a fairly productive week this time! Here a short list of things we did:
- Last polishments on GUI system with respect to mouse and gamepad input. Works fairly well now.
- Slightly improved controls of player – there are now less movement delays when switching in and out of aiming mode
- Continued working on path finding
- We refactored our game code to use GameAddons to extend the engine without hacking main.js too much.
- Some concept arts for future characters – just the faces though
- First steps toward a saving and loading the game state using local storage
A few details:
We managed to create the structure required to perform path finding search based on A*.
The Path Finding does not simply operate on a tile basis, as this would be too much of an overhead for this type of game.
However, we still use a tile map to create the way point structure of the map.
So for instance, for the following map…
..we’ll create this tile structure:
Each colored regions is a (more or less concave) area. Adjacent areas are connected. Areas without colors are not covered by the way-point-map. The arrows (lower part of the map) connect to way points of the upper layer.
When the map is loaded in the game, the tile map of the way points is compiled into a more simplified structure. Here, we simply connect each colored area with it’s neighbors, but also keep the precise edges on where the regions connect. Here a visualization of the final structure
On that structure, we plan to run the A* algorithm. And that’s the next step!
Now the following is mostly interesting for people familiar with impact.js
As you might know, impact.js is designed fairly low-level and encourages extending the engine by simply overloading and extending methods of the game object, e.g. update() or draw(). So far, we did exactly that. On the other hand, we have started structuring our game code into something we call features. Features are implemented in seperat folders, extending the game with additional entities or singleton objects. The idea is: you can simply add or remove a feature by linking it with the game (via requires()). However, whenever the feature had to change something inside the game loop, we still had to hack the main.js in our game, calling functions of global features objects etc. So you could not simply add/remove a feature, you often had to modify main.js as well. The plug & play idea didn’t really work perfectly.
Now we solved this issue by implementing GameAddons. Features can now provide a GameAddon, which is automatically connected to the game and called on different points of the game loop (e.g. preUpdate, postUpdate, preDraw or postDraw) and only if required. With this, we finally get our plug & play features, that simply work on connection without any further coding.
If you are further interested in any of the implemented features, write a comment or mail and we might tell you more about it.
That’s all for now.
Until next week!