Monday 29 October 2012

A Brief Reprieve, and Moving Forward

I took a little, I feel, well deserved break after the last few weeks I've had slogging through my engine work to relax a tiny bit and catch up on other far less anguishing school work. After that I planned out my next couple of weeks so that hopefully I can meet the medium question deadline as well as have enough time to take a crack at a hard question in time for the exam.

For the medium question I'll be attempting morphing, wherein the user will be able to select two objects through a simple graphical user interface and have them morph together into one object. I assume this involves approximating a third object based on the vertices of the selected two, but after working with the engine I know that my initial assumptions are usually wrong. So, we'll see how that turns out.

From there I'll be trying to do the leveled-up AI medium question for my hard experience points. It simply involves doing more behaviours than the medium question would call for. I figure that once I get a handle on the general way of making one behaviour I should be able to suss out enough to turn the question in for 15 points. With that, I'll have just enough to do the exam, so right now I'm content with this plan.

Monday 22 October 2012

An Astronomical Step Forward

                This week I managed to get the entirety of medium question 1, the solar system with clickable planets and moons that displayed information about them, completed. It took four days of non-stop work, but I managed to pull it off, and subsequently earned enough XP to write the midterm in the next hour. However, the experience was not easy. Even “medium” is a stretch.
                I initially encountered a problem when trying to load the texture onto my sun. I’ve run into this problem for practically every single assignment I’ve attempted, so I wasn’t surprised. Frustration set in when I realised that I’d done everything that in previous instances had solved my issue. After an hour or so of looking through past assignments, googling, and swearing at my computer, I realised that I’d been working out of the folder for Easy Question 1, not Medium Question 1.
                After that, I was able to get all of my planets loaded in and textured appropriately. To calculate the distance of each planet to the sun I went off of the Parenting example. In that example Earth is five units away from the Sun, so I looked up how far away the Earth is from the sun and divided by five. I then looked up all of the other planets’ distances and divided them by that resultant to determine how many units away each planet was from the Sun.
                Rotations were also a huge problem. The provided equation wasn’t working for me, so I ended up devising my own math for the planets’ orbital and rotation periods. I divided the degrees of a full circle (360) by the frames per second that the engine was running at (60). Then I divided that number by a ratio of the planet’s orbital or rotation period by the degrees of a circle. Finally, I divided that number by a variable called “choke”, which when increased would slow own the simulation in order to make it easier to click on some of the celestial bodies with shorter orbital periods. In the end, this equation worked for the orbits and rotations of every celestial body and the rest was a matter of copy and paste.
mPlanetOrbit = ((360/60)/(Orbital Period/360))/choke
mPlanetSpin = ((360/60)/(Rotation Period/360))/choke
                What this does is tell Ogre how many degrees to rotate each object per frame, and provided me with a system that was accurate to reality.
                Selecting the objects were done via the Ray Picking example and differentiating objects was done via a simple string compare function based on each node’s name. After I’d figured out that all I had to do was fill in information pertaining to each celestial body and the ordeal was over.
                Two successful weeks in a row. Scary stuff.


Monday 15 October 2012

Week 5 - The Longest Week Ever

Well, after seven of the longest days of my life, I'm happy to say that I was able to figure out three of the easy questions and get them handed in for marks. The first question wasn't too bad, the real challenge there was getting the model loaded in. After that the lights weren't too difficult as it was just a simple implementation of scene graph elements mostly.

But it was only easy because of all the scene graph practice I got while doing easy question two. After the excruciating experience of getting the procedural libraries to function correctly, actually implementing the question was fairly easy, if not long and tedious. I worked out a solution to getting everything parented, positioned, and rotated correctly and I'm actually kind of proud of how it turned out. I did however struggle for a long time with getting ogre to render the primitives with a material though, which I later found out had been working all along...there were just no lights in the scene. Whoops.

For the life of me, I couldn't get the billboards to function correctly, but I did manage to get easy question six done, which was the skydome with a texture animated on it. Turns out it was only about four lines of code to get working properly. I wish more things could be done in four lines. Sigh.

All I have to do now in order to qualify for the midterm is get the solar system medium question done for Friday. Yay(?).

Monday 8 October 2012

Week 4: Spinning My Wheels

Since my last post I've been trying and failing miserably just to get a homework question done in time for the cut-off date. I've never been so aggrivated in my entire life. Today I said to hell with it and spent time on a business assignment due tomorrow and a neglected essay due next Monday.

In terms of what I've learned in this period of time, I will now question every textbook buying decision I ever make. I'm currently staring at a shelf full of them, about $3,000.00 worth, a couple of which I opened only once or twice and ended up with high 80s at the end of the term. Then there's the book in my hand, for this course, which I've been pouring through, and have nothing to show for it.

Here's hoping next week's post will be more than just a sadder, angrier version of this.