Thursday 31 May 2012

OpenGL: Terrain Colouring, Fog and more Terrain

Managed to make some good progress over the past day or two. I shall start off by showing what I am currently rendering with the latest version of my code:
Larger terrain! Now with multiple colours! Fog!
This features a lot of major improvements over the previous version, most of which should be immediately obvious. I am now using fog to slowly blend the far away terrain into the background colour, which is useful for culling distant polygons discreetly. 

Wednesday 30 May 2012

OpenGL Terrain: Now with Vertex Normals

Just a quick update on the progress I have made today. This morning I added some much more useful camera controls, which support keyboard and mouse, making it much easier to navigate the small piece of world I am currently generating. The second major change has been the inclusion of vertex normals. Previously, the lighting looked like this:


Here you can clearly see the individual quads that make up the terrain. This is due to the fact that the normals (which are used in lighting calculations) are made on per surface basis. To improve the lighting, these can be calculated for each vertex, e.g. for each of the four corners of the quad. This is a pretty simple operation which takes the average of the surface normals from the quads that share a vertex. To write the code for this took far longer than I expected, but that was mostly because I also ended up tidying up and refactoring previous work as well. The end result is that the terrain now looks like this:


Much nicer, don't you think?

Monday 28 May 2012

OpenGL First Steps: Terrain

Good news! I have finally managed to get around to producing something with my noise function that I discussed last week. I have wanted to play around with some graphics programming after doing my final year graphics coursework, so I decided to learn the basics of OpenGL, as well as refresh my memory on C++. This has also been somewhat inspired by Shamus Young's various similar projects which he has posted many updates on.

I'm not planning to be anywhere near as ambitious as these projects, nor do I have any specific goals for what I want to achieve, but I did want to do some procedural terrain generation, hence why I started by creating 2D height-maps procedurally. This was then followed up with large amounts of shouting at the Internet while trying to understand the basics of OpenGL. Most of the resources with regards to OpenGL are pretty undecipherable at first, but I found that looking at some small open source examples (most notably the SDL implementation of the OpenGL gears) and reading through this helped a lot.

This is where I am currently at:

Almost looks like some kind of terrain I guess?
Currently my program can generate a single segment of terrain of arbitrary size, using terrain quads of arbitrary size as well. There are also some very rudimentary controls for controlling the camera. I am planning to expand this to allow the dynamic creation of new terrain sections while moving around the world, textured terrain,  improved lighting and anything else I think of as I go along.

Saturday 26 May 2012

Gaming Archives: Battlezone (1998)

Today I will be delving into a historic video game, which many people may have missed out on back in its day. I am planning to do a fair number of these, as there are plenty of forgotten gems out there. For our first look into gaming past, I will be taking a look at Activision's 1998 title Battlezone.

The game itself did not have a huge amount in common with the classic arcade game Battlezone, but it did feature a nice homage in this box art as well as the introductory sequence.
This game blew my mind back when it came out. This is one my very early gaming memories, and it featured one of my favourite high-concepts that I have ever seen. In this alternate history, the race to the moon in the 1960's resulted in the discovery of a new "bio-metal," which has lead to huge advances in technology. In this universe, the Cold War became very hot, but it also moved from the Earth to the rest of the solar system. Any game which has me fighting the Soviets on the friggin moon gets my vote.

Sunday 20 May 2012

Playing around with Brownian Noise

Now that I have acquired large amounts of free time, I am going to be spending my time developing all sorts of things. As part of this, I decided to create this blog as an outlet to write about what I am doing, as well as to show things off which are pretty neat. Some of this will be fairly technical, as I discuss some of the more grognardy parts of what I am currently working on. Hopefully this might be interesting to some of you, and someone might even learn something. First time for everything!

Today I have been looking at techniques for creating natural looking randomness. This comes in the form of various kinds of procedural noise. There are various techniques for procedurally generating noise available and I eventually ended up implementing Fractional Brownian Motion (fBm).
A Brownian Surface. From Wikipedia 

Upsetting the Balance: Diablo III Auction House

Yesterday I completed Diablo III and the entire last two acts were completely trivially easy. While I was not expecting the game to be particularly challenging until reaching the higher difficulty levels, this was a bit much. Boss fights lasted an average of about ten seconds, and there was nothing resembling a challenge at all. Dramatic moments such as the final boss fights were ruined by the fact they were so trivially easy.

The cause of this is Blizzard's decision to introduce an auction house to the game. When Blizzard first announced that they were introducing an auction house to the game, I thought it was probably a good idea. This sort of trading goes on all of the time outside of the game, this just legitimises it and makes it more convenient for users. However the way it is currently implemented, what it really means is that items are consistently available for cheap that will overpower your character almost instantly.