06.26.09

About Me

Posted in About Me at 17:05 by markcampbellprogrammer

Mark

Hello! and welcome to my university blog where show all the projects I have been working on during my time at University. I am a BSC Honours computer games programming student at the University of Derby and so it really goes without saying that I love making, playing and talking about games of all kinds from all mediums. I really enjoy writing software and getting involved a little bit with design, both of which I do a lot of inside and outside of University.

After taking some time away from education and talking a whole lot about games with people that programming was what I wanted to do for a career. I have played and own hundreds of games spanning across all platforms and consoles right back to the first generation. I also share keen interest in mixed martial arts such as Muay Thai, boxing and Brazilian Ju-Jitsu as well as playing and writing music in 2 Derby based bands.

I am happy to answer any questions you may have so feel free to email me at mark_campbell_direct@hotmail.co.uk.

Mark

06.22.09

Module : Interactive 3D Graphics Part 1

Posted in Interactive Graphics at 19:54 by markcampbellprogrammer

The big brother module to introduction to 3D graphics, interactive took things to the next level. This module focused on implementing what we had learned in intro and advance on it theoretically and practically. Instead of writing our own Matrix and Vector classes, we now had the chance to use inbuilt ones. Using Microsoft’s DirectX, we were now looking at implementing more complex dynamic scenery. As well as focusing on the pipeline and the way graphical data is processed, I was also required to look at more efficient techniques for storing and loading resources.  

The Project

By far the most ambitious and certainly technically the most difficult, I was required to make a simplified version of the popular Nintendo Wii game De Blob. I was required to implement a simple menu system, music and full game mechanics used in the full version of the game. I was required to implement collision, a dynamic camera and a full environmental rendered scene. Additional features included Bounding volumes, A State system, UI components and Shader effects.

Module : Mobile Devices Part 1

Posted in Mobile Devices at 16:57 by markcampbellprogrammer

Introduced in the second semester of my computer games programming course at the University of Derby, Mobile Devices focused on writing applications and games for platforms such as mobile phones and PDAs. For this module we would be using J2ME and the Netbeans development environment to make our applications and so would be writing code in Java. This is the first time I have ever used Java but do have experience with C# which is very similar syntactically to Java. There are some slight differences when using Java as opposed to C# but nothing incredibly difficult to be concerned with.

The Projects

For this particular there was 2 pieces of work to comit as our final hand in to make up my final grade. The first assignment required me to write a paper constrasting and comparing the Java ME Netbeans platfrom to another one of my choice. The paper should compare and contrast these two platforms, specify appropriate strengths and weaknesses of both systems (this may include user interface issues, but should not focus intently on these), and propose a choice of platforms based on some specific intrinsic quality of one system (not a user interface feature, but some internal functionality that one system has over the other).

The other project required my to write a game or application suitable for a mobile device that supports J2ME. This required a full written proposal and a development log supporting the application.

Module : Applied Game Development Part 1

Posted in Applied Game Development at 15:46 by markcampbellprogrammer

Introduced in the second semester, applied game development was a group based project in which I was placed in a team with other programmers and an art team to create a prototype of game using Emergent’s Gamebryo engine. The game itself had to meet a set amount of requirements and demonstrate evidence of organization, planning and use of appropriate industry techniques.

The Project

The way this module works was slightly different to the other modules in the second semester as in was directly linked with the personal and professional development module. This meant that we were being graded for 2 different modules based on the work from this singular project. For the Applied Game Development side we were graded on a more technical spectrum such as code, design document, personal contribution as well as weekly tasks and set milestones where as it the Personal and ProfessionalDevelopment module we were being marked on how well we worked as a team and in what ways we overcame obstacles affecting development. Our final hand in was assessed by world re-noun Frontier programmer David Braben and some other members of his team.

Deliverables

Software development portfolio – Detailing the practices and research carried out by our studio.

Personal development report – Individual weekly development reports on my personal contribution to the development process.

A final playable demo – Complete with source code marked on stability, performance and code style.

As well as the final hand in, we had 3 milestones along the way in week 1, week 9 and the final demo in week 12.

My Team

Team++

Videos

Posted in Videos of projects at 14:46 by markcampbellprogrammer

Graphics Renderer

Unreal Total Conversion Walkthrough

Scorched Wings Trailer

Scorched Wings Gameplay

06.19.09

Module : Console Development Part 1

Posted in PSP Demo Scene Project at 20:22 by markcampbellprogrammer

Console development stretched over both semesters in the second year as part of my degree and was by far the most challenging. The main focus of this module was to produce high performance code for an external fixed hardware platform. A huge part of this module was understanding the relationship between code performance and platform hardware architecture which meant looking much deeper into how computer systems work. The first semester was spent looking at low level programming and performance optimisation and really getting involved with machine level code whilst the second semester allowed me to test what I had learned and apply it to development on a PSP development kit. Having access to equipment and tools such as this once again shows Derby University’s amazing facilities for my course and demonstrates why it’s one of the best courses around for computer games programming.

The Project

The coursework for this module was not posted until the second semester and so the first semester was spend researching more theory based tasks and getting used to coding at a lower level than what we had been used using visual studios. Instead we worked through on-line MIPs tutorials on Mars’s Spin environment writing low level machine code working directly with registers.

In the second semester we were introduced to developing and profiling on the PSP platform before eventually being required to write a small 4kb raw data demo for the PSP. It is important to point out at this point that under no circumstances can I post or even discuss Sony’s code as it would be a breach of contract and could land myself and the University in trouble and so I will instead be discussing methods and approaches to solving problems I came across in my project.

For the first few weeks I spent most of my time re – looking at computer architecture and in particular binary operation, logic gates and computer pipeline structure. In the first year, computer architecture was one subject that I found really difficult to be interested in as I preferred coding and working in software rather than being involved with hardware. I understood most of the concepts and how hardware can play an important role in all manners of computing but if I’m truly honest, I just wasn’t interested in it. I knew that this module would be different as we would be working on the PSPs and so that changed my attitude towards hardware and eventually console development became my favorite module in the second semester.

06.17.09

Module : Game Development Techniques Part 1

Posted in Game Development Techniques at 17:33 by markcampbellprogrammer

Game development techniques was introduced in the first semester of the second year at Derby university. The focus of this module was on introducing us fundamental issues in game development and state of the art development technologies for modern game production.  Although formal teaching started from when we went back in September, we was given a heads up form our lecturers over the summer to start looking at the modding community and get some practice in using Epic game’s UT2004 editor. Later on in the summer we were sent a description on what we were going to be doing in terms of course work and what we should have done for when we start back.

The Project

The assignment for this module was to create a total conversion based on one of Enid Blyton’s Famous Five books. In 12 weeks we were required to have a full finished 10 minute demo based on what we had learned from the module playable via a Xbox 360 controller on the PC. We were required to make the level in the Unreal level editor and then using unreal script, make a new framework for which the new game code we wrote would work with. We was given certain assets but was required to create some of our own as part of the requirement such as at least one model made on 3DS max and include a picture of yourself somewhere in the game. The game itself was to be based around a chapter from one of the books which the player would then play out. Slight alterations to the story were allowed to an extend, however it had to follow the book with relative accuracy.  

Why the famous five? was the first thing I thought ” Because it’s my choice ” was the explination from my lecturer.

So the first thing to do was to start painfully reading some of the books and even whatching video adaptations on the Internet to decide which book and chapter I was going to base my game around. At this time I started to research the action/adventure genre to look for inspiration and ideas I could use as mechanics, as well as writing up a design document. My aim was to have a design document written before I went back as I knew this would be a time consuming module and I would need every minute to work on it. Once I had written up the document and decided on a book and chapter I started to get to grips with Unreal Ed by following on-line tutorials at www.3DBuzz.com and slowly building up a few maps of my own before I went back to university. I started by following the tutorials before branching off and trying to make my own levels including the Gaurdian level from Halo 3. At first I found the Editor to be really useful and had loads of fun toying around with levels and making little maps of my own but eventually I found some really, really odd bugs with it that absolutly drove me mad. For some unknown reasons Unreal Ed loves to crash and close itself on an almost regular basis often deleting or undoing hours of work. I know that saving work often does help, but as ever there comes a time when you forget. Luckily I found this out before starting my main project and so was prepared for it when starting my assignment (not to say it I didn’t loose any work because I did).

Module : Introduction to 3D Graphics – Part 2

Posted in 3D Graphics Renderer at 16:49 by markcampbellprogrammer

The Camera

The next stage required me to implement a virtual camera into my project so that I could view objects in my renderd scenes. For the time being however, I was just concerned with getting my camera’s methods and data fields implemented. Just to point out, these tasks were being assigned on a weekly basis meaning that there was little time to really take in what was being learned making this project took up a lot of time outside of class time. The camera implementation was one of the most difficult concepts for me to grasp and implement correctly. I fell behind during this stage as I tried various ways of trying to get a working camera but learned some important lessons on how to approach writing code and methodologies used to make coding easier.

Usually I would just come up with a bit of pseudo code on paper and start whacking in all sorts of variables and parameters without really thinking about how code communicates with each other. What I started to do at this point was to use a system that would draw out how classes and object instances would communicate to each other (what would later be taught as case statements and UML diagrams). Although people may look at it as a way of wasting time by writing out code on paper, I find it helpful to be able to see how objects and methods should link together on paper. I really like being able to carry on thinking about how to solve a problem whilst being able to take a break away from starring at a computer screen and now use this approach whenever I’m writing code even if its only a small amount. Burn out is a killer when trying to meet deadlines and bang code out in the shortest amount of time and most of the time I end up re – writting naff code and not using the hundreds of floats I declared at the start of the night.  

So for writing the camera class I had to think about what sort of functionality and data I would be working with and ways of implementing them. I had the tools already implemented as I had full Matrix and Vector functionality from the classes I had written and tested in the previous 2 weeks and so it was just a case now of getting the camera to make use of them. I started with the header file and set up a default constructor and destructor and then thought about the matrices I would need. I needed matrices to represent the screen, perspective and camera transforms which would be used in the local methods for creating each one.  I would also need rotation methods for the X, Y, Z axis methods and later added a GetCamPos method which returned a Vector representing the position of the camera.

Camera transforms, rotations and references

When setting up a virtual camera there are a various important transformations that are required to correctly render images on screen. These transformations are based around moving from different co – ordinate spaces each being a different representation of my vertices data. The main four spaces I made use of were Modelling, World, View and Screen space and considered these when writing my renderer and constructing its pipeline. Modelling space was simply the co – ordinate system used local to the model and relative to the centre of the model i.e. the X, Y and Z at the centre of the model is 0, 0, 0. World space is responsible for translations scaling  and rotations and allows different models with the same Model space co – ordinates to be set up in a larger space. View space is what I was really interested in at this point as it represents where my camera will be and how models in world space will be relative to it. Finally Screen space is simply pixel space on the screen and the transformation from 3D to 2D also known as projection. These four spaces are controlled by 3 matrices the World, View and Projection matrix. These are the rights of passage from space to space and are responsible for controlling the vertices data for the models.  

So the first method I set up was to build my perspective transform which contained a matrix that took a float value and measured a field of view based on what was passed into it. This value was then passed along each axis to correctly set up the camera’s view in relation to the objects on screen. I then created a build screen transform method that simply created a screen based on an X and Y value passed in. The last transform method I needed was to build a camera transformwhich created me a view matrix. This was one of the hardest things for me to understand an get working correctly as I kept messing up the translation of the camera position and the order in which rotations were multiplied. It was also at this stage I realised I had a mistake in my matrix class that was responsible for screwing up my entire renders. In my Matrix multiplication method, I had copy and pasted lines of code and accidently changed a “x” to a “+” giving me some weird results and so learned another important lesson to avoid copy and paste when coding late at night! 

The parameters for the rotation methods were simple a float amount and a matrix reference. The float amount was simply the value passed into the matrix column to rotate by. The matrix reference simply stores the results that are then used later. Another new technique I learned at this point to was how to make use of references when referring to values or data types.

A reference provides another name for a variable. Whatever is done to the reference is done to the variable it refers to. The best description I was given was from a fellow class mate who suggested thinking about references as a nickname for a variable i.e. another name that a variable goes by. So in my parameters to my methods, I pass a reference to a matrix which I then define and save the working calculations in. Make sense? check out the code below -

void Camera ::RotateX(float rotX, Matrix & resultMat)

{

          // Create Matrix for X rotation a.k.a -roll

          resultMat = Matrix(  1,        0,          0,         0

                                      0, cos(rotX), -sin(rotX),  0

                                      0, sin(rotX), cos(rotX),   0

                                      0,        0,          0,        1 );

}

 

The variable reference resultMat then has the values saved into it and is recognised as a matrix. This makes things very easy and convenient when saving data and variables as well as not needing to copy large data types. References can be used in a variety of ways and have many advantages when deciding how to construct arguments. I had used References before but not in a way in which they were passed by parameter or as arguments.  This gave me a nice introduction to using them and taught me an important lesson for passing data chunks.

06.05.09

Contact Information

Posted in Contact me at 22:53 by markcampbellprogrammer

To contact me directly you can email me at mark_campbell_direct@hotmail.co.uk

Module : Introduction to 3D Graphics – Part 1

Posted in 3D Graphics Renderer at 22:31 by markcampbellprogrammer

This module was introduced in the first semester of the second year during my university course. The purpose of it was to learn about the fundamentals of 3D graphics at a foundational level and gain confidence using 3D APIs. The main focus of study was aimed at the practical and theoretical understanding of real time rendering and the role of the graphics pipeline.

Although I had been introduced to C++ in the first semester, this was the first time I was expected to use full object orientation using inheritance and understand how important its power is in complex programming. As well as the programming element, this module gave me an understanding of how to represent 3D rendering using mathematical techniques and equations. A lot of this module focused on understanding the maths first, then implementing what was learned week by week into the final project. 

The Project  

Each weekly task required me to learn the mathematical theory then implement that into a small program. As the semester progressed, I was then required to combine each weeks work into one big project being a 3D graphics renderer. The focus was on implementing a range of techniques and presenting them as a demo showing technical ability and personal style similar to that of the demo scene for rendering in the early 1990’s i.e. the pre –  hardware accelerated graphics era.

This was without a doubt going to be the most difficult project of my semester due to the volume of work and understanding of the theory behind it. I was excited and nervous at the same time about how the renderer would turn out as I felt that my understanding of programming at the time was not of a good enough standard and would require a lot of additional private study gain a better understanding. Although the programming and mathematical side of this module was important, understanding and getting a full grasp of how the rendering pipeline works and considering what order function calls and transformations are done in was the main objective. The rendering pipeline is ultimately the factory part of the program. It is feed all this data and then is forced to deal with it in constructive and logical way to produce the desired results. There are various considerations which I will discuss later that can affect the pipeline and make rendering slow and inefficient.

During the first few weeks the main focus was on getting a vector and matrix class written to express mathematical calculations used to describe transformations. Vectors and matrices have a wide range of uses in 3D rendering and although in graphics based programs such as OpenGL and DirectXyou can simply create a variable using the functionality within the libraries, we instead had to write our own including simpler mathematical methods such as addition, subtraction, multiplication and divide. However to make full use of our own written classes I also wrote methods such as dot and cross product for the Vector class, and Matrix based transforms such as transpose, transform and axis based rotations.

At this point everything seemed a little murky as the only way of testing what I had wrote was to write a console out method to test what I had done. From calling this method in main I was able to check manual if my methods was working correctly. For the time being I simply hard-coded 2 vectors and 2 matrices and worked out on paper if the answers i had matched that of my program. To be honest I didn’t do enough testing at this point as I should have as there was a problem with my matrix multiplication function which delayed progress later on which I should really have spotted at this point. Below are a code snippets from the Vector and Matrix classes -

Cross product from my Vector class

Vector Vector::CrossProduct(Vector v)

{

         float crossP_x = ((_y * v._z) – (_z * v._y));

         float crossP_y = ((_z * v._x) – (_x * v._z));

         float crossP_z = ((_x * v._y) – (_y * v._x));

         float crossP_w = ((_w * v._w) – (_w * v._w));

        // Returns new vector

        return Vector(crossP_x, crossP_y, crossP_z, crossP_y);

}

 Rotate X method from my matrix class

void Martrix :: RotateX(Matrix &resultMat, const float rotation)

{

          resultMat.m[1] [1] = cos(rotation);

          resultMat.m[2] [1] = -sin(rotation);

          resultMat.m[1] [2] = sin(rotation);

          resultMat.m[2] [2] = cos(rotation);

}

Constructors, Destructors, Static and Const

Using classes and header files in C++ was new to me and I had to quickly understand the difference between using them in C++ compared to C# which I had used in the first year. Using constructors and destructors was something I understood to a degree but didn’t understand the full usability of. Making use of a constructor is useful because multiple versions for the same class can be defined with different parameters to distinguish them. This was something I found useful by using assignment and copy constructors when creating instances of objects. Using parameterised constructors means that I can pass specific parameters to an objects base constructor when creating specific objects. Getting used to how these differ and each work individually  gave me more power and freedom when creating objects and gave me a nice introduction to object orientation.

Destructors are simply the matching partner to the constructor and just de-allocated memory when a class object passes out of scope or is explicitly deleted. It is always important to include these whenever a constructor is used and usually is where pointer variables are freed. Using the key word static simply means when declaring varaibles as being static, that varaible’s value is shared between each instance of each class i.e. it is passed down through different blocks of code. This was useful mainly due to the fact that it reduced the chance of values being changed without me wanting them to be. Const simply means that a variable is constant and therefore can’t be modified however it was a key word which I had had not encountered before and was unsure of how to use.

At this point my programming skills had been tested but I didn’t really understand the full picture of what it was I was doing. It wasn’t until I could see the effects of what I had written that I could really see what was going on and be able to look at ways to improve or comprehend what was actually being done by my code and why it was so important to make sure these calculations were correct.

Next page