Wednesday 12 December 2012

OpenGL - Video

Here is a video showing my OpenGL application running. Make sure to watch in HD and put it to fullscreen as well.




The source code can be found here : https://github.com/7thsanctum/Intro_to_Graphics_Coursework

This includes the DLLs, Property Sheet and Libraries required to run the source code in Visual Studio 2010. It also includes an EXE in the Release.zip folder.

Monday 10 December 2012

Java - Game Submission

For my Software Development module this year we were tasked with producing a game in Java. The primary purpose of this was to demonstrate our knowledge of patterns as well as other techniques learned in the module such as multi-threading. From this I created a space game with trading elements, inspired by the likes of Elite and FTL.

Figure 1. Main Screen

The players ship is at the bottom of the screen, the player can move by clicking in any of the squares surrounding the ship. If they try and click on a space too far it won't let them. When the player successfully moves the rest of the ships will take their turns and subsequent conflicts will all get resolved.


Figure 2. The results of fighting a single enemy ship

The main things that can happen when the player is on another square as something is Fighting and Trading. The player can battle space pirates, the current system just compares the health value of the player to the cumulative health value of the enemy and whoever has the highest wins! If the player is on a planet when they are attacked, the planet will send reinforcements to assist. In future I intend to upgrade this system to be more detailed, to include things like weapons and shielding and health bars that are affected by each combat, allowing the players and enemies to run away.


Figure 3. The result after a player is attacked in orbit around a planet.

Trading is the other part that plays a key role in my game, when the player lands on the same spot as a civilian ship or a planet with no enemies on it they may trade with them.

Figure 4. The options to trade with either planet or civilian ships.

 If the player decides  to trade with either they will be shown the trading screen and their trade partners inventory. They can trade any item for any other item and the value will automatically be calculated and deducted. I intend to upgrade this system so it could include more resources and so that resources have some form of function for your ship, such as fuel and armour etc. I also plan to have a central economic manager, much like a universe trade centre in which buying and selling of goods affects their worth in different planets and sectors of space. This way you could visit a planet, buy the goods that are bountiful there and sell them at a profit on the other side of the universe.


Figure 5. The trade screen

Overall I feel my game was a good start in my foray into the world of Java and Eclipse. It took me a while of battle with the IDE but eventually I managed to get something functional out of it. It requires much more work and a few of the systems still require a lot of polish but hopefully with a bit of time I will be able to get that done.


Friday 7 December 2012

OpenGL - Report

Introduction

I was directed to create a 3D scene using OpenGL. This process began with early ideas, preparation and planning. I set out to create something vibrant and interesting, something that would give the user a unique experience. The way I went about trying to achieve this was through writing out and illustrating original ideas and thoughts.

As soon as I had a basis to work from I went on to research and create this scene. Along the way ideas changed due to various problems encountered over the course of the project and this influenced the final result.

Scene Design and Inspiration

During the process of coming up with ideas I used paper, I illustrated and made notes on everything I thought of and felt could be used in my final scene design.

My early ideas included the concept of using video as texture, for example, creating billboard-type objects and placing moving image on them. I enjoyed this idea because I thought it would create a new and interesting atmosphere for my scene, a change from the usual use of still image. I also liked the fact that it would perhaps give my scene a futuristic feel.

Another idea involved the use of multiple cameras; I liked this notion because it enables you to see from multiple angles at the same time (bottom left, figure 1). This is one of the ideas I put into my final design (figure 6).

I also thought of using a camera view as a texture for an object which could then be viewed by another camera. The moving image and camera texture ideas did not make it into the final design mainly due to time constraints but there are still fragments of code in the project where I attempted to achieve this. 


Figure 1 - Initial Plans 


The contents of my scene gradually changed to suit certain needs and many ideas didn’t come about until the later stages of the project.

My solar system idea did not come until I changed the skybox from the original to an outer space one that I had found online. Once I had this backdrop I naturally leant towards the inclusion of planets and creating an orbital system, it fit nicely with the setting and resulted in my final scene (figure 2). 


Figure 2 - Alternate Plans 


When I realised I could not include certain early ideas, I rethought and created something almost completely new and separate to my original notes. I did, however, manage to keep my multiple camera idea which made it into the final program (figure 3).

Figure 3 - Early Protoype with Multiple Cameras 

Background Research

For this project I investigated reading in AVI from files as well as other post-processing techniques. Whilst learning, I did an AVI tutorial by NeHe [1] which proved to be very useful, I managed to get the project reading in the video to a texture in memory but I could not get it to apply correctly to any particular objects.

Figure 4 - A frame of the video as seen in gDEBugger 

I did not want to spend too much time trying to get this to work and so I instead focussed my attention on other things. After creating my scene I did some research into post-processing techniques, after managing to implement the Sobel Operator in the edge detection shader I read about the Scharr Operator and instead implemented that (figure 5).

Figure 5 - Scharr Operator (Left) vs the Sobel Operator (right), not the more vivid stars as well as being abl to see the terrain much clearer in the distance 

I also studied into the implementation of multiple cameras which was made easier by the use of glViewport() [2]. After successfully adding the camera views I realised I wanted to add in the ability to set custom resolutions, set the program to full screen and to hide the mouse which was made possible with the documentation that comes with GLFW [3].

My final research involved gathering general information about the solar system and the orbits of planets around others. I mainly referred to Wikipedia pages [4] and other science websites [5] for specific information before implementing it within my project, I wanted to make sure everything was accurate. Most of the textures I have used were found on Google Images [6]

Implementation

Figure 6 - Final Space Scene 

Figure 6 is my final space scene, for this scene I used the point sprite effect to model the stars shooting past. There is spotlight which is attached to whichever object is in current focus. The current object that is being looked at can be changed by using the numbers on the numpad. 

I created a piece of terrain using a heightmap which is the large bumpy panel on the floor. Also for this heightmap I used procedural texture generation to create a texture upon start up. The application will auto detect your monitors native resolution and set that as a default.
I offloaded the calculation for the procedural texture generation to a separate thread so that it didn’t interfere with the program as much and so that it could perform the calculations whilst the program ran. This significantly reduced load up times and allows the texture to be updated during runtime.My final implementation includes the Sepia Tone, Blur, Motion Blur, Sharpen, Sobel and Scharr edge detection post processing shaders. These can all be switched between during runtime. I have also used the dissolve effect to dissolve the entire scene. The orbits of the planets have been scaled down. The actual planets revolve around the sun in a fashion similar to their actual orbital revolutions. The sun has not been scaled but the rest of the planets as well as their moons should be close to their real life counterparts.

Performance Evaluation

Using gDebugger I analysed my program at different settings. Each of the following images (figures 7, 8 and 9) demonstrate the program at different resolutions with and without anti-aliasing enabled. For the test cases the same parts of the scene were looked at in each example, they were done multiple times to ensure that the final screenshot was of one that appeared to be the average.

Each column is labelled with (from left to right) Frames Per Second, OGLCalls/Frame, CPU Average Utilization, Texture Objects, Vertices/frame, Triangles/frame, Points/frame, Primitives/frame, texels and Used Virtual Memory in bytes.

Figure 7 - 1920*1080 with No Anti-Aliasing 


Figure 8 - 1280*720 with No Anti-Aliasing 


Figure 9 - 800*600 with No Anti-Aliasing 

After looking at these results we can see that the majority of the statistics have stayed the same regardless of the resolution. The main consistent changes are in texels and used virtual memory showing a 10byte difference between the resolutions.

I attempted to perform Anti-Aliasing at 4x, 8x and 16x. It did not function correctly below 16x and only at this level made a significant effect on the system, dropping the frame rate well below 20 FPS on all resolutions.

Test System 1 details :-

CPU – AMD Phenom X6 1055T at 2.8GHZ
GPU – GeForce GTX 460 1GB
RAM – 16GB – 1600MHZ

Overall Evaluation/Conclusion

Despite missing my primary goal of including the AVI and camera texture effects I still managed to use many different effects including terrain generation, skyboxes, procedural texture generation amongst many others. During the process of creating this scene I have learnt that there is much to take into consideration when embarking on a project of this nature. It is important to allocate myself sufficient time to learn and fix problems that are found throughout the project lifecycle. Had I managed my time better I would have done further research into how to implement my original ideas and expanded upon those that have already been completed. I feel that in the end I managed to create an interesting scene and overall have something that I am happy with. 

The program will be available on GitHub soon.

References


1. Jeff Molofee. (2012). Playing AVI Files In OpenGL. Available: http://nehe.gamedev.net/tutorial/playing_avi_files_in_opengl/23001/ . Last accessed 4th October 2012.


2. Jeff Molofee. (2012). Multiple Viewport. Available: http://nehe.gamedev.net/tutorial/multiple_viewports/20002/ . Last accessed October 2012.


3. Camilla Berglund. (2007). GLFW Reference Manual. Available: http://www.scribd.com/doc/56552343/GLFWReference26 . Last accessed 7th December 2012.


4. Multiple. (2012). Sobel Operator. Available: http://en.wikipedia.org/wiki/Sobel_operator . Last accessed 7th December 2012.


5. Multiple. (2012). Solar System. Available: http://en.wikipedia.org/wiki/Solar_System . Last accessed 7th December 2012.


6. James Hastings-Trew. (2006). Planets. Available: http://planetpixelemporium.com/planets.html . Last accessed 7th December 2012.

Tuesday 27 November 2012

Unity Web Player | WebPlayer
FPS and Cloth
Unity Web Player | WebPlayer
Attraction

Friday 9 November 2012

Collaborative Map Making in Minecraft

So today I decided to do some experimentation with Minecraft, using it as a tool to create objects and analyzing it's potential to be used as a multiplayer map maker for games other than itself.

The building we are going to export

JMC2OBJ allows you to export segments of a Minecraft map as an .obj file. For this test I created a simple building (see above) and will attempt to export that into Blender.

Blenders Rendition of the Exported Building
Once the building has been imported to blender we can see a fairly accurate rendition of the building. Minus the correct textures. After adding normals and putting this into a format that my OpenGL program understands we can then try and run it!

OpenGL with SDL

My current application for reading in .obj files for OpenGl sucks and has no camera controls but we can see here that the building itself has rendered correctly. It doesn't have the correct shading but it is a start at least! Also, the .obj can be successfully imported into other programs such as Unity with ease.

.obj with Unity
Although this only gives us simple shapes and basic objects. using this allows us to create simple version of our 3D levels that we can explore and interact with firsts, we can then test the game without the use of artists. At a later stage we can forward these to map artists for texturing and to redo in our own visual style. 

The use of Minecraft as the tool for map creation also allows the team to collaborate on a single level whilst being at many different computers, making edits in real time and seeing the changes immediately.

Friday 26 October 2012

Let's Play - Sleeping Dogs

What is it?
Sleeping Dogs is a single player open-world action game developed by United Front Games along with Square Enix London Studios. You play as Wei Shen, an undercover police officer in the Hong Kong Police Department who is trying to infiltrate a Triad Gang, the Sun On Yee.


And doing a damn good job too
What is it about?

The game is a third-person, action/adventure with some minor role-play. It is similar to other big games of the same genre such as GTA, L.A. Noire and Assassins Creed but instead tries to make it's own mark by combining several different elements. Instead of playing a straight up Cop or Crook, you play as an Undercover detective. This gives you plenty of freedom to break the rules to maintain your cover which puts a focus on the criminal acts you perform as a means to get things done rather than blindly murdering everyone.

There's a reason for this violance so that makes it ok
Another interesting focus is the martial arts in the game. You don't get to use your first gun until much later on and even then they are sluggish and awkward to use. The combat flows very much like Rocksteady's 'FreeFlow' system from their Batman games, it is however not as refined being quite repetitive and sluggish at times. This is dwarfed however by the games use of Hong Kong as a setting, beautiful lights are contrasted against a city with a rich cultural heritage and mass urban sprawl.


Sleeping Dogs has a few pretty amazing "WOW" moments, the scenary and a few cinematic scenes will still surprise. Lighting effects are top notch and with the high-resolution texture pack installed, many characters look extremely detailed (dare I say, beautiful?). Flashlights occasionally appear on guns which demonstrate this even further.

I like shadows and lights ok?
One major drawback though is the stiff facial animations. This causes many cutscenes to be a let down which is exacerbated by the voice acting. Despite being set in Hong Kong and being influenced by many Hong Kong action films, the majority of the cast speak English in a distinctly american accent. Occasionally people will speak in Cantonese which is great, they even represented a few British and Indian characters too, but sadly this is not often enough.

As pretty as it is I don't expect it to win any wet t-shirt contests.
Where can I get it?
 Sleeping Dogs is available for PC via Steam and OnLive, PS3 and Xbox 360 for around £30.

Winston is pissed because he missed the steam sales...
What do you think?
Sleeping Dogs took a while to grow on me, I was hoping for a more "Hong Kong" experience  It's a step in the right direction though and has a few fun and quirky mechanics. Sadly the game is let down by awkward cameras, overly sensitive driving and poor facial animations. Gunplay pays a distinct homage to John Woo's action films but even this somehow feels wrong. The game acknowledges it's strong points, mainly the martial arts system and keeps that the main focus for much of it. If the designers made everything Cantonese I would've felt a bit better.

Not all of the games ideas miss their target
A good alternative to classics such as GTA but not quite matching it's impact on the genre. A fresh blend of elements, mechanics and an captivating story line keep this game original and fun.

I rate this 7.2/10

Check out the video below for some action packed footage of me playing Sleeping Dogs!


Friday 12 October 2012

Let's Play : PAYDAY : The Heist

What is it?
PAYDAY : The Heist is a four-player cooperative shooter developed by Overkill Software. You play as one of four robbers (Dallas, Hoxton, Chains and Wolf) who work together on a series of daring heists which range from robbing a bank to breaching a hospital secure wing to steal a blood sample.


Wolf - Chains - Dallas - Hoxton
What is it about?
The game is a first-person shooter in a similar vain to Left 4 Dead but as a group of robbers you must work together to break through each missions security systems, whether that be blowing through walls or using thermite to melt through a safe. You start each heist with your weapons holstered, giving you a short while to scope out the area and set up your first objectives before you accidentally end up alerting the police. Hopefully you can guess what happens after.


My oh my, FBI! 
So far PAYDAY is a pretty fun game for four players. I have yet to work out how to unlock weapons or to change classes but the gameplay is simple enough to be grasped quickly yet complex enough to provide a deeper playthrough. As Overkills first title it is a good sign of things to come, with a good work ethic and team bonding come good games.


Waiting for the cops with a hostage
Where can I get it?
PAYDAY is available for the PC on Steam and Playstation 3 on the PSN store for around £15. Although in PC Gamer 245 they give out a free code for PC users, so get buying! Find out more from Steam here now!

The game allows you to take cops hostage too!
What do you think?
Overall I think that PAYDAY is a very good game, with a nice twist on the four player co-op genre it brings a few interesting features. It's gunplay is fast and intense and although with only 7 missions, each one is wildly different from the last, offering countless hours of replayability. Overkill is set to churn out more DLC in the future though. (Infact they already have one out plus a free mission set at No Mercy from L4D) I have to say that this game has its faults, silly AI, repetitive drilling and sawing sections which could be shortened, but even taking these into account it is great game. Not quite as refined as Left 4 Dead but definitely a welcome alternative.

The entrance to the First World Bank
Well thought out missions, excellent voice acting and a fun, fast experiance make this stand out. A few unexplained elements, too few new gameplay elements as well as dodgy AI drag it's score down.

I rate this 7.8/10. 

Check out the video below for some action packed footage of Craig, Scott and myself kicking butt!

Saturday 6 October 2012

OpenGL - Sierpinski Gaskets

As part of our learning of OpenGL we had to create several different iterations of the Sierpinski Gasket which is a fractal. The pattern itself it created when you divide a triangle down into smaller versions of itself.
Original Triangle followed by 1 subdivision
As we can see here each individual triangle create can then be subdivided again and the same process can be applied to each of the triangles created from that process.

The first Gasket I produced was one using individual pixels and randomly assigning points to render.
500000 Pixel based gasket
The second one used triangles instead to render.
5 Subdivisions
The final gasket on the other hand proved a little more difficult. For a long time we got problem after problem.

Strange...
Finally though! I cracked the problem, and here you can see the actual gasket fully rendered and spinning about!

Monday 1 October 2012

OpenGL - Phong

Today I was feeling pretty sick so stayed home from going to uni and instead continued with more graphics work.

Here we have a combination of all the different shading techniques I've learned so far and created what is known as Phong shading! You can  read more here

Phong shaded Torus

As you can see the Phong shading gives, overall, a much better shaded effect. Cool stuff!

Sunday 30 September 2012

OpenGL

Added a specular shader to the graphics engine for coursework.

That's no moon...
As we can see it looks similar to the previous ones but it has an added "shininess" property which, if you poke about with it too much, causes this to happen ...

Oh dear ...

OpenGL - Torus

After getting the diffuse lighting working for a simple cube the next objective was the getting it working for the rest of my geometry! So here we have my current progress, a Torus or Donut Ring shape with more accurate lighting effects.

Mmm look at those tasty shaders!
One step closer to my goal of having an interesting scene for my coursework...

Saturday 29 September 2012

First Post

Welcome, my children. Welcome!

How you have ended up here, no one knows but here you shall remain, forever more. Have no fear. All manner of madness shall be brought to you at no extra effort on your part so sit back, relax and scroll down the page.

Enjoy!

Mark M. Miller

OpenGL

Currently working on OpenGL for my Introduction to Graphics Programming module. I finally got my Diffuse Lighting to work after realising I put in a 1 instead of a 0 in some obscure part of the code ...


MemOK!

Got around to giving my computer a good dusting out today and finally installed those new memory modules that I got yesterday.

16GB of unforgettable memory!
So far everything has gone smoothly. Not much of a noticeable difference between 16GB and 4GB but I'm sure things will become more evident in time. 


Thursday 27 September 2012

Back to Blogging

So, now that third year of game development has begun it is finally time to start this blog!

Well, let's get down to business.

Tech
Bought 16GB of memory to add to the rig tomorrow. Hopefully this new addition will mean I can run everything I need to at the same time! Pics tomorrow...

OpenGL
Currently learning about Shaders and Lighting, trying to build a magical wonderful scene from scratch for coursework.

Movie Madness
Watched "Moon" not too long ago. Amazing film. You should check it out when you get chance to...