Wednesday, 31 October 2012

Week 8 – Creating an accurate and scaled solar system using the Ogre3D engine



            It is good to be back in school again after a short absence, due to funeral preparations. For this week, I had spent most of my programming time working on the first medium question, which is to create a solar system with planets and moons. We also had to add information about each planet and moon whenever the player clicks the planet or moon. This appeared to be very difficult at first, but once I began to work on it, it was pretty easy to do, as it was just a lot of copy and pasting and getting the information for each planet and moon from the web. Programming-wise, it wasn’t too difficult, as the majority of the code was derived from the sample projects, and pretty much required a combination of them. 
The solar system layout

The sun
I had to add code that allows the user to click on any planet or moon, and it would display the name of that planet or moon and 8 pieces of information about that planet or moon. This was done using some of the code from one of the sample projects as a basis and foundation, and I had to add the all the tool tip information for each planet and moon, using information from the web. The clicking function was also taken from another sample project, which was modified to create a bounding box around the planet or moon when clicked on. Once a planet or moon is clicked on, the information about that particular planet or moon will appear in the top left corner, which I had programmed in. The parenting sample project contained all the code that I needed to create all the planets and moons, and to make them orbit around the sun or the planet, as well as to spin while in orbit. I searched online for accurate information about the orbital and spin speed of each planet and moon, in order to make this program as accurate as possible. 
Earth


Stay tuned for more updates on my game engines progression!

Jupiter's moon Europa


Tuesday, 30 October 2012

Week 4, 5, 6, 7 – Creating a robotic arm, a sky dome, and billboard/imposter trees using the Ogre3D engine

                Finally back after several weeks of absence due to a family emergency. For the past few weeks, I had spent the majority of my programming time working on 3 easy questions: number 2 the robotic arm, number 4 the billboard and imposter trees, and number 6 the sky dome.


Robotic Arm
                The robotic arm was by far the most tedious assignment that I have done so far, as it took a lot of trial and error getting the exact position of each node and each block correct. If the position was off even by a little bit, the rotation would be incorrect and I would have to try another position for both the blocks and the nodes. After creating and positioning all the blocks and nodes, the arm was finally complete. I also added keyboard functions to allow the use to press the keys 1-9 to move a specific joint in the robotic arm.
Sky Dome
The sky dome was much easier to do, as you only need 2 lines of code for the sky dome to work. The first line creates the sky dome, and initializes the size and position, and the second line of code rotates the sky dome using a quaternion.
Imposter tree (left) and Billboard tree (right)
The billboard and imposter trees were also slightly challenging to create, as I could not figure out how to swap the textures of the trees at first. After successfully creating an imposter tree using 2 intersecting planes and a billboard tree using the built in Ogre3D function, I decided to move the part of the code that sets the texture of the trees into the update function. This would allow the textures of the trees to be changed at any time, depending on the keyboard functions. Then I created keyboard functions that allowed the user to press the 1-3 keys and then change the texture of each tree.

Stay tuned for more updates on my game engines progression!