Friday, April 4, 2014

Tile Engine Part Deux

The tile engine will be an integral facet of the project so it's important that I make it as robust as
possible.  In today's update I will show off the progress that has been made to it and the engine itself.  Yesterday I showed off painting tiles with solid colors, today I'm going to show you how I've added sprite sheets (collections of tile images), layering, game saving, and game loading.


I've also done a significant amount of optimizing to the tile engine rendering but it's difficult to show that off in just screenshots so you'll have to take my word for it.  I'd just like to say that I've taken an extreme liberty by utilizing some tile images I don't personally own.  I have no plans on using these tiles for much longer but they are very useful right now to keep me working on important things and not having to spend time looking for even more temporary graphics.  I appreciate the effort put into creating these images and would like to give them all the credit where it is due.


You'll notice the palette is gone and now we have another menu which gives us access to the tiles available for painting.  This interface is obviously just temporary.  Here we see a basic map scene where we've painted half of the viewable area with grass tiles and the other have with dirt.  All of the tiles here are drawn on the base layer, essentially the ground.


Here we have the same scene but we've painted over the ground with rows of grassy patches.  Notice how the dirt is still visible below the patches of grass, the patches are drawn on the layer above the dirt.





Here we have a third version of the same scene and now we've painted over the grassy patches with flowers.
It's almost as if the flowers are growing out of the grass, oh boy!




Another view with some rocks strewn about on the grassy
area.






So let's put it all together and look at the very first scene created in engine:


I've also gone ahead and implemented saving and loading of the map files!  This is the foundation of the save game system that will be critical to enjoying the game.  Who wants to play a builder game where you can't even save what you build?  Let's take a quick peek at how it works:




On the left here we've got a quick look at the XML format which the map is saved into and then subsequently loaded into the engine by some of the code snippet you see on the right side.  The file stores (Width * Height * Layers) information now, a save file with information on all layers of around 2.5 megabytes writes and reads from a non-SSD harddrive in fractions of a second.  This is good because later we will obviously be storing and loading much more information as we have objects, people, and the entire game state to worry about.  

Now that I've made significant engine progress in the coming days I plan on revealing quite a bit more about the actual game project!  Thanks for all the support and help to everyone, stay tuned!



1 comment: