I was bored with the way the game's sky looked. I wanted the buildings to appear out of a fog in the distance so you didn't just see them "pop" into existance as you moved. I was greatly influenced by the way Battlefield 1942 done their 3D. It looks very good, yet they used some simple techniques. They use coloured fog combined with a skybox that has the same colour as the fog near the horizon so that it blends in nicely and you see building, terrain etc... gradually appear in the distance, seeminly out of nowhere. I implemented the fog, just a normal grey fog, so my sky needed to be grey as well, either that or have a night time city so my fog colour could be black. Very boring. I finally decided to implement my skybox. I used Terragen to create the sky, this is a very nice program, it's also free and I am 99% certain this is what the people used in Battlefield 1942 to create their skies. For a skybox it's actually a very simple technique to give a realistic sky. You basically have a 3D Cube and you're point of view is in the center of this cube. The cube then rotates when you turn, but you always stay at the center of it. The terrain, buildings etc... are all then rendered inside this cube. To create textures for the cube so you don't look like you're inside a cube, but outdoors, you need to generate a view for each side of the cube that has a 90 degree field of view. Just do your math, you have 4 sides, 90 x 4 = 360... you end up with a panoramic 360 degree view. This is the same technique that was first used in games like Myst 3: Exile, it's also the reason why 3D acceleration actually improved the look of Exile. In exile the entire game you see is all just textures rendered on the inside of a cube! Really ingenious if you ask me, so simple, yet the effect was very nice, you could use your mouse to turn and look in all directions smoothly for the first time in a game ever. They took it a step further in Exile, they animated the textures on the cube's wall so you seen water shimmering, animals swim away when you got too close etc. I'm just going to have a normal texture with a nice blue sky with clouds. A simple idea, but very effective when you see the end result.
While working on my game I have text that is rendered on the screen displaying various variable values (say that 10 times fast! ;)). OpenGL has no option to display text (strange, but true) so text has to be rendered in special way. I won't go into details, but I got it done. I had it displaying red text, mainly because that colour seemed to stand out on the screen against the background but it was still not quite right so I made the game render black text behind it so it stands out better. The text looks a little aliased at the moment so I may look into other techniques to display text. At the moment you can choose from any font you wish, which is kind of nice, but it isn't really all that nessecary. I may look into rendering text from premade characters rendered on a bitmap. This way various colours and antialiasing can be added to them and whatever other effects you can add to an image. Will make for nice looking text for actual game text. Perhaps I can reserve the current method just for programming information.
I'm honestly not sure where I want to go next. I have the functions already created, in a seperate program, to import 3D models, which will make for some nice looking buildings, and even roads etc. But I don't know if I want to do that in game. I may save model importing for a level editor. This way models can be imported into a level, and then when the level is completed, the polygons can be all saved together for the level, allowing the entire level to be divided up in game, into a quad tree so I can use frustum culling and other speed optimizations as well as proper collision detection. I currently use 2D collision detection. I basically check your position on the 2D map and if you're inside a square that is supposed to be a building or other item, you stop. You can see how this is 2D by trying to fly over a building. It can't be done. Not that flying will be in the final version, this is meant to be a driving/tank game anyhow. I plan on working on a full 3D space game (already started!) seperately. You can download the current build here: City3D.zip (about 5.6megs).
Monday, June 22, 2009
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment