Friday, May 6, 2011

On to the Big Ships!

Logging on, I realized how log it's been since I've last written in this blog. I have three blogs to keep for my classes so I keep on bouncing back and forth between all of them, but it's easy to forget which one is updated and which isn't. After being out of commission last week due to being sick, I jumped back on the train but really focused my efforts on my Independent Study. I missed the deadline for PA4 Data Driven and kind of left it on the back burner, knowing that I would get to it when I had to progress on my final project. I normally don't miss deadlines, in fact this is the first in a very long time, but with everything crashing down on my head after falling behind a little, I needed to prioritize and pick my battles. Fortunately though, PA4 is now complete. 


To be honest, it was significantly easier than I expected. At first, I was really confused by the instructions in the PDF. The first issue that I had was in terms of doWork(). Initially, I thought that Keenan wanted us to implement a generic type function, like a template, to take in any data type. However, I did not see how I could call the necessary methods for that data if I didn't know what types I could be dealing with. After speaking to a classmate, I realized that we were meant to know the type we were using, the caveat was just that it had to be user defined. This cleared things up and really made things easier. 


As for Interleaved, the confusion arose when I compared the instructions to the function calls made in Tests.cs which didn't quite match up. I really did not understand why and how there were two separate queues that were then congealed into one. After reading forums though, I learned that it was not necessary to implement it exactly that way-- so long as the data was processed in the same way. Perhaps Keenan knows something about C# queues that I don't and has a better reasoning for using them the way he did but the way I implemented it is much easier for me to understand. 


I went back to the way I had done it last year for my Capstone game, creating a single Object queue since all of the objects go back to the Object base type. I then looped through the queue, dequeuing object by object, checking its type, casting it to that type, and calling the necessary methods on it.  


Now, I can start working on the final project. This is going to be a busy weekend with my hours spread out between the final project for this class, my Independent Study, and the animation converter for Engine. Time for another day (or lots of days) of hard work!

Friday, April 8, 2011

Packed and Serialized!

I just completed Assignment 2- Serialization and am very happy. It feels great to finish something so early and not have to worry about it hanging over your head. My goal this quarter is to really stay on top of my work, and this is a step in the right direction.


Overall, this assignment took me just under three hours to complete. At first, I wasn't quite sure about serialization in practice, because I didn't understand if we had to manually create "headers" and block the data off in the buffer, or if that was the larger picture used to describe it. In the first examples, with Dog and Cat, serialization was very straightforward and simple. Even though my tests for those passed, I thought that I was misunderstanding something because it seemed so easy, so I debugged and stepped through it, making sure that everything made sense. Then, I began working on Bird, and this is where things got ugly. A little.


I had to go back and look at the slides to make sure that we were indeed supposed to section off the data. Once I understood that we were allowed to, and in fact supposed to do that, I used placement new to create a temporary pointer to the buffer, and then incremented this pointer as I memcpy'd everything I needed in a step by step way. In Bird, the thing that gave me the most trouble was the char * because I knew how to serialize it, but when it came to deserializing it, I could not get a hold of its length. Then, I remembered the "header" suggestion, and in serializing, placed the strlen of the char * into the buffer at the very beginning. At that point, I could easily pull it out in my deserialize the same way and use it. After I had coded all of this, the test was still failing on the strncmp. I debugged and saw the string in my data field had extra junk on its end, so I went back and memset it to 0x00 in my constructors. This solved the problem and the test passed. I also added print statements to my constructors and destructors to print out the pointers, in order to check that everything was working correctly. 


Finally, in Fish, I realized that I could serialize the apple and orange structs as wholes, rather than going inside of them and individually blocking out all of their data. The serialize worked off the bat, but the deserialize caused a crash. It turned out that I had forgotten to actually initialize my apple and orange, was trying to write to them when they were null. Similarly to the previous situation in Bird, I went back to the constructor and initialized them which solved the problem. 


I like this class because it's teaching me something I've never even broached in other classes. I've done data alignment before but networking is literally a new world for me-- like a programming expansion pack. I'm really excited about learning more and applying to making an actual networked game, but I'm also glad to be done with this assignment. I'd say that having 4 teeth drilled and then completing this assignment makes for a good day's work. Tomorrow: Independent Study and Engine 2.

Sunday, April 3, 2011

Just Gave It a Go

I just finished playing Space War with myself. I tried to control both ships simultaneously, which did not work out very well strategically but demonstrated to me that everything works successfully! The initial controls are strange though. I had to press 'f' to get the control screen to pop up, and a 'g' to start the game. I could not figure out how to select "Retro" or "Modern" on my machine via keyboard, and based on what I played, it looks like it defaults to "Retro". When I start working on this, I'll use XBOX controllers to make my life easier, but beyond that, it looks great!


I finished the programming assignment shortly after writing my post, but as I just mapped the depot into a new workspace for this class, I submitted it tonight. Looks like everything is done, and I am ready to continue with learning about networking games! Sounds like fun, can't wait! In the meantime, I am off to work on my Engine 2 + Independent Study -- converting an FBX to binary and integrating this into my code to read in the model data and use the model. Wish me luck because I sure will need it!

Wednesday, March 30, 2011

My First Multipass Ride

My first post of the new quarter for a new class. There isn't much to write about yet but I'm sure that it won't take long for that to change. Once again, this quarter I have all Keenan classes. While stuck on a problem in my code for Independent Study, I thought that I would get started early here. I still haven't received an invite to the Wiki but in the meantime, I'll do the mini-program for Assignment 1. 


Cheers to a new quarter and best of luck to everyone!