Programming for Entertainment Systems


This module took me on a deep dive into DirectX 10 and C, neither of which I had used before so it was a risky module to pick. As we were introduced to certain aspects of the languages, we were attempting to code “a flying thing” which consisted of adding two wing meshes (sdkMeshes) to a tiger mesh, animating the wings and adding controls to it, allowing it to be controlled by a user. This task was quite easy after initially learning how the DirectX method calls work and the importance of ordering certain parts of the code. I also managed to create a new shader for this as well and added a skybox to the scene.

The main difficult part of this task was setting up the controls and camera to be part of one cohesive object (although technically it is still two objects). The linking between the character moving and the camera took quite some time.

After this initial task, we were asked to then create a game with what we had made so far. As I had no idea how to add to the lacklustre engine that was there already, I decided to translate my Unity skills (C#) into some simple code in C to create a basic game loop. We were given a range of sdkMeshes to use with this so I decided to change out the tiger model for a Parasaur and adjusted the wings accordingly for the model.

I then started to work on being able to pick up some objects so I knew I needed some sort of collision detection. As the engine didn’t already have one I decided to implement a simple point collision method that would be able to check the distance between two objects. This proved very effective for the problem I had so there was no need to implement a more complex collision detection. I added some teapots to the scene that the player would be able to pick up, and then decided it would be best to have some enemies that chase you down as you attempt to pick up the teapots.

I knew I could use the same point collision with the enemies for when they touch the player but I didn’t know how to instantiate enemies in a way that would allow me to have more than one at a time and allow me to remove them at run-time without crashing (I was having the same issue with more than one teapot). After some digging, into some API, I found a solution using lists. If I added to the list as I instantiated the enemies then I could remove them as needed without causing a crash at run-time.

I then wanted to have a way for the player to kill the enemies within the scene so that they didn’t die all the time to the dogs that were chasing them. I decided to allow the enemy to shoot bullets, but as there were not any bullet meshes that I could use I had to use a chess piece mesh, which for all intents and purposes worked as intended. I then used lists in the same manner but now had to instantiate the meshes at run-time whenever the player clicked the left mouse button and remove them from the list when they hit an enemy. I kept getting errors, but only sometimes, there seemed to be something linked with needing at least one bullet in the scene at all times.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s