2012-03-20 23:04:54 Posted by RetroZelda

Global Game Jam - After Thoughts


You may be wonder why there is an Ouroboros, and I will tell you! This picture was this years theme to Global Game Jam 2012! And oh what a jam it was! To sum up the past 48 hours is fairly simple, but Simple is not what I strive to do, sometimes... Upon first arriving at Full Sail's auditorium for the opening statements of the central Florida game Jam location, I thought that it would be me and a few friends making a small game in 48 hours in the weekend between classes. Boy was I in for a surprise when half of our expected team was unable to make the jam, but it worked out great! Me and my remaining team member join in on a team that was comprised of other friends and peers to create one of my most proudest works. And this is that story! Remember, I am a terrible writer, so don't expect a killer documentary! So, after forming our team we had a little less that 20 people on the team, and everyone was eager to create a new game. Our game that we have is a racer, called Yaotl Coatl Racing! As you can expect from the title, this game is a racing game, but the goal is not to be the first to finish the race, but to collect the most points. You collect points over time bases on how many 'Nodes' you have attached to your character. These nodes are represented by a chain of cylindrical objects that you gain over time. Since you need more nodes to get more points, it is your job as the player to steal nodes from other players. You do this dashing towards another players chain and stealing one of their nodes. Because the nodes are what tied our game with the picture of the Ouroboros, they make the racers resemble Coatl(Aztek for snake). By attacking a node, as stated before, you will steal that node and add to your tail, and if you steal a node in the middle, that players nodes behind the stolen node gets dropped, allowing other players that are lagging behind a chance to gain extra nodes. This was how our game achieved balance. And, like many of the top racing games like Mario Kart, balance is what keeps the game fun and interesting! And nothing can be more fun than playing games like this with friends, that is why we incorporated 4-player split screen multiplayer! But, for all of the forever alone players, a single player option is available where you go against 3 computers. I was one of 4 team members and friends to develop the AI that these computers had. The AI was one of the more daunting tasks I have had to deal with in the few projects I have dealt with. What we needed to have was the cpu(i realize the change in term) go around the track and dashing into other character's nodes. The simplest way we could get this done was to have simple path following. The first team member implemented this, but it was a very stupid cpu player, where it would build momentum and fly waaay off course! This is where my original team mate and I worked our magic. We spent all of the first night with markers on the white board figuring out the best algorithm to adjust the cpu's speed based on the way points. We accomplished this in about 5 different way, and each new way we implemented didnt work correctly. Why didnt it work, you ask? The answer to that question will come soon. Anyway, we accomplished this at first by simply using a linear equation with the angle of the character target node with the next node(this formed a triangle with the character and the next node being the hypotenuse) and we would plug this into an equation to get the speed the AI needed to adjust to in order to successfully complete this turn. This was the first way, and after filling up our entire board space(because we were in a lecture room, we had a board around 12ft wide and 10 ft tall as well as 2 sliding boards that were housed in the wall next to the current board that were about half the width but the same height) with linear equation, cubic equations, cubic equation based on sin and cos, and this eventually mutated into the current speed-detecting algorithm that implemented averaging 2 angles involving the player and fitting this ratio using a sin/cos wave being limited with our max speed. The code is beautiful, and after finally implemented the most perfect system, it didnt work. We had discovered that the movement-physics code was broken, so we decided to get a few hours of sleep because we were math-zombies, feeding off each others ideas until we died again. Upon waking up in a few hours, we were still dead, so we informed other team members/friends about the movement issues and we went home to sleep for 6 hours to get fully rested. For me, that didnt really happen, but when we got back, the movement was fixed and without anyone adjusting our perfect speed calculations, it was awesome! But the next part came to cleaning up the directional movements of the ai, and that is where the first AI guy went to work again, making the cpu's travel in the "e;general direction"e; of the next node on the map. This gave the AI a realistic look and feel, but it would miss certain nodes on steel convex angles. This is where I stepped in and too the angles from the object to 3 nodes ahead and used the algorithm just implemented to get the realistic motion, to average the angles and move the object based on the direction of the 3 nodes. The AI's movement was awesome! it was smooth, lifelike and it wasnt predictable(to an extent)! Around this time, other team members got the dashing functionality implemented, and this when when the 4th and final AI guy and I pair programmed this implementation. I wont go into details as I was the spotter, so I didnt implement directly, but rather helped with the code-base management. Either way, our AI was as good as it was ever going to get in 48 hours, and watching them in our testing levels and making them do their own thing was really fun to watch! Now, with all the programmers that we had, there wasnt much to do at some points, but I always tried to keep myself busy(... sometimes :) ) by helping the other pairs of programmers. Yes, i said pairs. Our game was simple enough that we didnt need everyone working on something, so pair programming was pretty much what everyone was doing, and this really helped people get used to the Unity3D tool and api. Because of Project Plunder, I am very familiar with this api, so I would always be one "e;Hey Erick..."e; away. Although, Unity does have its ugliness, and I think if it werent for these ugliness and the movement code(the MAIN SYSTEM) being horribly done(and broken, which made a lot of people waist time fixing their own perfectly working code that didnt work because of the poor quality). You may be thinking that I am ripping apart a team member, and I kind of am, but some things cannot be helped and I was there to have fun, so, in the end, it really was no big deal. Anyway, to conclude this longish-post, I have to say that I have learned a lot about my how sometimes you need another's insight to help figure out hard problems, and how good it feels to be working on a team where everyone cooperates and worked together. Despite the pitfalls, and the lack of QA testing, I am rather happy to have my name is this game. If you are interested in playing it, I am currently working on changing a few things in the codebase to ignore multiplayer and to have AI-only so you can go against the ai and see how the AI is working and that I had a big part in it, and I couldnt have done it alone! It really was great working with the people that I did(words cannot describe it, mainly for my lack of vocabulary), and I think we all learned a lot and are happy to have done this exilerating experience, even if my tiredness made my speach not make sense! RetroZelda out!

2012-03-20 23:05:33 Posted by RetroZelda

Maya Ranting

So yeah, this lab using the Maya API is really really really really really really really really really really awful. The Maya API is messy, and its documentation is less interesting than trying to read the bible in Hebrew. And then the instructions for the lab are like reading hieroglyphics while hanging hanging upside down while poking your eyes with a Cricket bat handle smothered in hot candle wax. It is painful on the head and I really wish i could spend the money for some kind of explanation of how to use the monstrosity of an API. Oh wait... WEll, my ranting is over, it is time to get back to this peice of Taco Bell mushy shit that comes out of the body of terrible, cheese eating, asparagus-juice chugging, computer scientists who have no idea how to make things understandable to weak minded people, like myself! RetroZelda out. RAAAAAAAAAGGGGGGGGGGGGEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE!!!!!!!!!!!!!!!!!

2012-03-20 23:05:53 Posted by RetroZelda

Global Game Jam - Thoughts

So it is official... I have signed up to participate in this year's Global Game Jam! For anyone who isn't familiar to what the Global Game jam is, it's basically a time where groups of artists, designers, programmers, noise makers(Audio engineers?), etc, all get together in designated host spots that can be found all around the world and they make a game. Doesn't sound hard, right? Wrong! You have only 48 hours to produce said game and you must have it fit into a specific theme! This is exciting for me because I get to compare mine and my team's creativity with millions of other teams from all over the world! Japan, China, New Zealand, Canada, Mexico, Germany, France, EVERYWHERE! It also gives me a chance to put my programming skills to the test to produce the best code and algorithms i can to make debugging and QA testing easier for me and my team, as well as something i can check off my ever-expanding bucket list(Coming Soon). Now, you may be thinking "e;How will you be able todo that with school, Plunder, FIRE, and a half-completed web site"e;, and if you weren't thinking that, you are now, but my answer to that is "e;I don't know until I try!"e;, even though I do know, but now you are satisfied and we can move on! Anyway, I started ranting, so i think its time to conclude this post. Oh, dont worry, I do plan to post again about my experience with the Global Game jam, and if you are interested in signing up, or you just want to know more, you can go to their site, here to do so. RetroZelda out!

2012-03-20 23:06:15 Posted by RetroZelda

Old mans junk = My new Toy

Yes, I have found a new toy. The Wii motion plus of course! For my optimization's class, we have a project to improve an algorithm, function, workload, etc on an older project and because I LOVE working with peripherals, Optimization is really important to make code run faster and faster, so I decided to check out my algorithm for detecting/guessing a wii remote's off-screen dot using the IR sensors. Now, because the wii remote's normal accelerometers cannot calculate YAW, I had to come up with something else that I could work with. So I used the accelerometer in conjunction with the IR dots for the off-screen dot placement. I accomplished this by first getting the distance from the two dots as they were last seen. This required a buffer of previous locations of the dots that I could use to later compare too. I then needed to get the angle between those two dots. A few dot products and other math fun stuff later, I had my angle. At this same point, I need to capture the ROLL of the accelerometer, and then get the difference between the ROLL and the angle between the two dots. Then with the saved old data, I could compare the current ROLL of the wii remote with that old data in conjunction with the single remaining dot on the screen to get the angle to the new, off-screen, dot. Now, by doing 1 of two things, I am able to directly place the off screen dot. I could use the distance between the last two dots, or I can use that distance and the accelerometers change in its Z axis to determine if the wii remote is now closer to the sensor bar(dots closer together). And Wha-lah! I have the position of an IR dot that doesnít really exist! Sounds simple, right? WRONG! Games now a days need to run fast fast fast, and with DMD (the project the wii remote is doing this on) being done [mostly] on a single thread, doing that kind of math is fairly pointless. Plus, my algorithm will not work if both dots are off screen, and thatís no fun! So, what could I possibly do to improve the accuracy of the in game cursor, as well as decrease the pointless workload that I am doing on a frame by frame basis? Well, for starters, I needed a way to calculate an angle between two points faster and easier. And then I need to calculate the off screen point faster! Then it hit me, I should completely forget about doing these calculations, and just use raw data to move the cursor. Well, having recently played (and highly enjoyed) The Legend of Zelda: Skyward Sword, I thought that using the Wii motion plus like Nintendo used on their menus to control the on screen cursor would be a lot easier, and it would greatly improve the wii remote's accuracy while trying to move the cursor around when the screen is so much closer to the player than on a normal wii game where the TV is, at least, about 10 feet away. So, by mimicking Nintendo's approach to how the on screen cursor will give me, the programmer, a lot more accurate data to work with, and give anyone who plays this game optimized control that are much simpler, and cleaner to use. So, I first enabled the wii remote to read extensions in the extension port, and I enabled the wii motion plus and I would poll the data from the motion plus along with the data from the wii remote itself. Doing this worked well, but the data I was reading in was reading fairly slowly, and I speculate this because that the wii remote gets pulled once per frame, grabbing all the data from the hardware and bringing them into memory. But when an extension is plugged in, unplugged, or even just changed, the sizes of data could possibly change, and if something gets removed that I am still setup to read from, I will crash. So to fix this, I wrote a callback function (basically a functor that the wiiyourself library takes in that will get called [asynchronously] when specified events happen). I have the callback function looking mainly for event with the wii motion plus to handle the plugging in and unplugging of the peripheral. Not only can I easily handle what data I read from the remote, but if the remote gets disconnected, or the entire game crashes, I can now handle it so the wii remote can properly shutdown which will in turn prevent the remote from leaking memory. Now that is all and good, but back to the fun stuff! The motion plus connects, and I can read its values, and they sure do look beautiful, and now itís time to get the cursor to move with this new data. So, I simply set the cursors position(x and y) to equal the motion pluses roll and pitch respectively. I run the game and I do not see anything. So then I go back into code and I enable the pressing of the Down button on the remote after B is being held to center the cursor on screen. I run the program again. I hold B and press down, and zoom, the cursor snaps to the center of the screen and then hastily moves towards the top right corner. I realized why Nintendo has a calibration time in every game that uses the motion plus, so now it is time for me to incorporate my own calibration state. But first things first, I know that I need to hold these values in memory so I can modify them with my calibration data. So, I make a structure of 3 floats (roll, pitch, and yaw), and I read in the motion pluses roll, pitch, and yaw, and I store them inside an instance of the structure. (Note, the wiiyourself library read both raw data and relative data, I am using the relative data). I then read about 20 of these in an array of these structures and add them all together as I read them in, and then I divide by the amount I read in. This took way too long, and made the function call take almost 3 seconds! So, I decided to split each read into one read per frame. Then, after reading in all the data into the array, I added each array member into a master object (of the structure), going one object at a time. Then, when all the objects of the arrays were done, I divided like I did before and I moved on with my life. This made the actual state last slightly longer, but It allowed the wii remote to have time between data reads(the time to run everything else each frame needed) to get more realistic results, and it also helped to reduce dependencies, which greatly improved the speed of the function, making its total time around a second. Now, I take the calibrated data and every frame I subtract it from the data read in by the motion plus and then ran the game. The cursor moves so smooth and fast that I need to slow it down a bit to help reduce the sensitivity that the motion plus has, and I simply divide the change in direction by 2, and the results are beautiful. I then use QueryPerformanceCounter() to time the new method of moving the screen cursor, and it is about half a second each frame. This is unacceptable! I then go to where ever I read from the motion plus into a structure, and I simply use memcopy to move the data over. I then take all my divide by 2ís and turns them into multiplies by 0.5s. I run it again, and I am getting around 0.0004 seconds each frame. That is more like it. The wii remote's input is not optimized to not need to do any kind of calculation for off-screen IR dots, as well as optimized for each player, to give them faster reads from the wii remote, and giving the cpu more time to work on other things that I think using the wii remote with wii motion plus is a lot more enjoyable! Happy Holidays, RetroZelda

2012-03-20 23:06:52 Posted by RetroZelda

No.. no.. no... Why YES!

So much to do, and yet no time to do them! What a bother it is to want to try doing an entire list of stuff including ffmepg, dll Injection(hehe), Plunder, RZEngine2D, Play Video games, classes, the journey to and from each class, blah blah blah more stuff more stuff. This doesn't make for any productivity when productivity is inflating me like a balloon, and I am ready to burst onto a single project; a single thing that I can look forward to do every day. Yes, a new project with new people in a new place and continue my Journey of Awesomeness with a fresh coat of paint! Although I havnt updated much of my doing on here, I can say that i am rather tired now, and wanted to type something before going to bed. Good night! I wont see you later, because i am merely text on a screen! -- RetroZelda

<--Prev 0 1 2 3 4 Next-->