Saturday, June 11, 2011

Caves caves caves!

Hello everyone I am very tired but I thought I should write an update of my game. I have been working feverishly on cave generation using a form of Cellular Automata and so far I have had decent results. I am still tweaking the algorithm to give more natural "cave-like" structures that connect to each other better, but for now I am pleased with my cave making skills.

I am also still working on using Perlin Noise to generate the shape of the terrain at the surface level, though this cave generation turned out to be easier (which is why I worked on it first). I am really excited with how this game is coming together and I believe a name needs to be created for this game (hopefully name chosen soon!).

I really appreciate everyone who reads this development blog and I try to provide updates as frequently as I can. Thanks for reading and check back soon for more news!

Thursday, June 9, 2011

Dynamic Block Texturing Is Up

Great success! After too many days of struggling with the code to get the blocks updating their textures based on what blocks are neighboring around them, I finally have a working build that looks really good. The main trouble I was originally having was that I was trying to test for too many cases, which overcomplicated the entire thing.

What I first tried to do was test a block's eight neighbors to determine which texture should be used for that block. This was over-complicating the process; not only did I have to have the six textures for the simple left, right, top, bottom scenarios, but I also had to have textures for all of the possible corner cases. This left me very frustrated and in need of something else to do.

The solution to my problem was very easy in fact. What I did was shrink the block size from 32 x 32 to 16 x 16 and dropped the corner cases / corner textures. Please note that when I say corner textures I'm referring to a piece that has a corner cutout of it. I also created new textures for the blocks with edges that seemingly run together. This makes the cases in which there is an L-shape still look good in the corner spot because the top and right textures almost run together.

Other things that I did include changing the resolution to classic 800 x 600, changing the player sprite from a square to a thinner, taller rectangle (to more closely resemble the final sprite's size), and am running an UpdateBlock() method every time the player removes and adds a block (which updates the surrounding blocks' textures based on which action the player made).

The game is coming along nicely in my opinion. Next things on the list include better terrain generation, more types of blocks, player inventory, and many more things that I don't want to list for fear of getting overwhelmed by it all.

For now, please enjoy a screenshot of my small (but big to me) victory.

Monday, June 6, 2011

Update on Terrain Generation

Hey guys, it's been a busy last few days. This weekend was fairly productive and even a little frustrating at times. However, after much digging on the internet and reading up on terrain generation techniques, I have decided (at least for now) to use a modified version of the Midpoint Displacement algorithm for my terrain generation.

So far, this seems to be working moderately well. The overall shape of the terrain (top layer, of course) is fairly randomized but not too chaotic. The issue I have yet to work out is my technique for putting the correct block (i.e. with the correct texture) with the correct sides, cutouts, corners, etc.

I have spent a fair amount of time tweaking my brute force if then else statements to handle the different cases, but am having difficulty when I get more than just a few cases to try. Anyway, here is a screen shot of my latest build in all it's glory.
Though I am having trouble at the moment, I am enlisting the help of the wonderful people on the Xna forums so I should except to have a better strategy for my blocks in the near future.

In the meantime, I will be working on either the player's inventory (which at this point would only include blocks he has 'mined') or fixing the map saving/loading which has no doubt suffered because of my new terrain generation procedures.

Check back often for updates!

Sunday, June 5, 2011

Terrain Generation using Midpoint Displacement

Well it's been a productive couple of days since my last post. I've been busy working on implementing a better random terrain generator for my game using some tiles that I made myself using Paint.net. I must say that I have never been a strong algorithmic programmer, but I have been reading up on the subject and from what I have found, an easier way to implement random terrain is to use the Midpoint Displacement Algorithm.

This algorithm repeatedly uses two points in space and places a midpoint between them. Then, one point on either side of the midpoint is created at a random height (or displacement) from the midpoint. This algorithm recursively calls itself and continues to create a rough terrain shape. The more times this is done, the smoother the effect.

I'm definitely not the expert on this subject, so if you would like to read more about it check out this post. In the meantime, here is a sample the results of my terrain generation code. Note that there is still much work to be done to clean it up and improve it. This is definitely the first time I've done this.

That's all for now...

Thursday, June 2, 2011

Mouse input is now a reality

I'm happy to say that last night's dev session resulted in the game now having a decent mouse input handler in which the player can remove blocks and place blocks in the map. For now, the player can only place 'ground' blocks because I don't have any inventory system in place (yet) for the player.

I have also started making simple artwork for the different types of blocks found in the game. This is a very exciting game for me to make because I feel like I'm making great progress on it and these little successful additions really make the development process more fun and rewarding. This also gives me motivation to continue my efforts in making this game.

Also, I'm going to need a title for the game (maybe not right now, but soon). I don't want to keep calling it 'the game' or 'my Minecraft clone'. So if you have a suggestion for a name that would go along the lines of a 2D Resource gathering Rpg, please leave it in the comments :)

I'm really looking forward to the weekend because I'm going to work on changing over from the simple red and green tiles to some actual artwork. This is more of a challenge than it might seem because I will need to change my current map generation system. Basically, I will need to take it from a purely random generation to a more structured generation system that looks at the blocks next to the one it is currently generating in order to decide which block to place.

Check back and see how I do.

Wednesday, June 1, 2011

A New 2D Resource Game

Over the past few days I have begun creating a new XNA game that I am quite excited about. This game is a resource gathering game with rpg elements. I have found a new love for Minecraft and have discovered how much fun 2D resource games like Terraria can be. Truth be told, the fact that Terraria is written in C# using XNA Game Studio gave me new inspiration and motivation to create my own game.

The problem I usually face when creating a game is finding the motivation to finish it. It's true, I've only finished one game really (a space shmup) and have dozens of unfinished games lying around. I am determined to make sure this new game will be different though and I'm using this blog to help me accomplish that.

The basic premise of the game is to survive by gathering resources and building things (i.e. crafting weapons, constructing buildings, etc.) while monsters try and attack you. Later on there will be a day/night cycle and monsters will only come out at night, but that's for later. As for now I will focus on building the game in small increments. This will allow me to focus on the pieces of the puzzle as opposed to looking at the whole (and incomplete) picture itself, thereby keeping me more focused on the features in the game. One element of the game that will make it different from other games like Minecraft and Terraria is that the player will have skills that they must level-up in order to (for example) craft better tools, cook better food, make better potions, gather rarer resources, etc.

So far the things I have in the game are:
  • Random world generation
  • Platformer-style physics (modeled after the Platformer Starter Kit on the XNA site)
  • 2D camera that follows the player and does not allow him to leave the map (modeled after Nick Gravelyn's camera in his Tile Engine Tutorial)
  • Map saving and loading with the player's position saved as well (modeled after Nick Gravelyn's saving/loading in his Tile Engine Tutorial)
Other things that I will implement may include:
  • Items, gatherable and creatable
  • Enemies with basic AI
  • Block gathering / placing
  • Basic inventory
  • Menus
  • Crafting
  • And more...
Like I said before, I am only focusing on one or two features at a time to keep my spirits up and my mind focused...

Please check back for updates about the game and feel free to offer any comments about my game. Oh, and here is a screeny for your viewing pleasure.

Update 1.0 "Where have I been?"

Well after a long time I finally have something to write about. I apologize for being away for so long but I have been very busy with real life, family, and work. The truth is, I'm not especially skilled at blogging (although I nearly have a Bachelor's in English with a writing concentration) and, consequently, I find it very easy to neglect this blog.

I would like to say 'Thank You' to the people who have read the meager posts I have created up to this point. I would also like to say that I am working on a new XNA game that will give me much more to write about (hopefully) and should be a fun experience.

I plan on treating this blog as a quazi-journal of sorts for the development of this game. For me, this has a couple of benefits. First, it will help me keep track of the game's progress as I create it. Second, it will help me order my thoughts and ideas about the game in a somewhat structured manner. My hope is that this development journal will also be at least mildly interesting for the people who read it. At this point I intend to only add in things that I want to, things that I think would make the game more fun...but I will divulge more in the next post.

Thanks for everyone who reads this.
Jeff