Sunday, October 21, 2012

Back to work!

I've had barely any time to work over the last week. The last thing I did was implement right-click context menu items that you could toggle by right clicking (this was surprisingly annoying and not directly supported by the WinForms API). To make the editor interface a bit slicker, I removed the right-side 'selected item' editor--all actions are currently performed via the context menu (just right click a tile or entity to modify its properties).

Next I'm going to implement some basic animation for the character.

Wednesday, October 10, 2012

Tile Models

When I implemented my basic collision detection algorithm, I had no good way of determining which tiles were blocked and which were free. So, as a temporary hack, I used the existence of one of the layers being marked 'on' to indicate that the player should not be able to move through the tile.  Of course, this is a bad idea because it couples layer configuration to model configuration--it doesn't let me put anything in that layer without that tile becoming blocked.

An alternate solution would be to instead figure out the model based on the graphics used for the tiles. For example, grass would be marked as non-blocking while rock walls would be 'blocking'. However, this is still too much coupling, since it makes things like invisible barriers--or perhaps walls you can walk through--impossible.

So, I decided to completely decouple tile models from graphics. I added a separate Model property to Tiles, which is controlled via a context menu (and copy-paste) in the editor. Currently there are only 3 model types--Empty, Solid, and Triangle (any of which can be rotated, but currently it only makes sense for Triangle).



The following video shows me walking around with no models, running the editor and adding some models, and finally walking around with the models properly set for the rock structure on the left.





Monday, October 8, 2012

Collision Detection Fix, Editor Tile Preview Update

Updated the collision detection algorithm to fix the bug I mentioned before. Now the player can freely slide across tiles without getting stuck. Also, a video preview!





Also fixed a bug in the editor where tile previews weren't using their proper texture coordinates, so any tile/entity that was specified as a sub-section of a sprite sheet would be rendered incorrectly in GDI. Here's a video of my playing around with the editor.


Sunday, October 7, 2012

Character, Camera, Collision

Added a character that moves around with keyboard input. Soon I'll figure out how to hook up gamepad input since that's what the game is being designed for, but for now arrows will suffice. Here's a screenshot of the temp art for the character. 



I guess I'll need to start using some sort of video capture since screenshots can't really display movement. Anyway, I've also implemented very basic camera functionality that automatically moves around when the character is a certain distance from the center of the screen.

Finally, I added the most rudimentary collision detection. Since I have no data representation of a Tile's physical model (just the graphics), I used the existence of a certain layer ('Ground Layer 3', which the rocks in the screenshot are on) as a temporary indication that the tile is 'filled'. It is a very simple collision resolution algorithm, and as such has the ever-so-common bug of the player getting 'stick' at tile creases. I'll fix it shortly!