Thursday, May 23, 2013

The Late Postmortem of Nine Lives


Here it is folks, My Nine Lives sprint to prototype postmortem analysis.

I'd like to divide this assessment into three major sections, time management, art, code. I would have included a fourth 'design' category but this is a game that I had previously designed and so during this week I didn't do any design work. Check further down for my TL;DR section.

Time Management
When I first thought of doing this I had planned to give myself 48 hours and keep the schedule of a game jammer. Two of my three game jam experiences went over extremely well and I liked putting a game together before I could get bored with it. However, when I first sat down to write this dev blog I decided that I should instead give myself a week. I was, after all trying to achieve a few things I had never even attempted before and I would be doing both the asset creation and game implementation. Plus, I would have to have time to cook meals, shower, work out, and generally live life. I couldn't abandon all of my other responsibilities in order to indulge myself.
I started Tuesday night. I was confident at the outset that I could tackle the pixel art goal I had given myself. Designing a character and sketching it are my specialties and so that took all of 5 minutes to iterate through a few designs, settle on one I liked, sketch a walk cycle, and scan it in. I looked up a pixel art tutorial and got to work. I spent twice the amount of time I wanted to spend on pixeling and animating my avatar. I laid my first pixels the morning of the 15th and finished the night of the 16th. Two full days spent on a character animation the didn't even make it into the final prototype.
From a purely, 'did I reach my goal?' stand point making the pixel cat and animating it's walk cycle was a complete waste of time. However, from a, 'did I learn pixel art?' stand point it was a huge success. I can now definitively say that I understand more about pixel art and how to implement it than I ever have before. More of this will be covered in my art section later.
The 16th was a Thursday and the last day I worked on creating the art for Nine Lives. I spent most of Friday backing up files, renaming files, flipping my sprites so my avatar can walk left, and reading about Game Maker. I even completed a few tutorials but they were all drag and drop tutorials and left me feeling like I didn't really know what was going on. I hardly worked on anything again until Sunday when I sat down and really dug into the code.
I hadn't coded for a few weeks and certainly not in an environment like Game Maker so by the time Sunday was over I felt as if I really didn't have any chance of completing this game. I posted about how it was a learning experience and that I may have bit off more than I can chew. I was mad that I had to post that and so the next day, with two days left, I went for it. On Monday I was able to get my cat walking correctly and have it's other 8 lives follow it. Then, I got it jumping, kinda. I had a made a few mistakes in my movement code and I was getting stuck in the floor. Tuesday rolled around and I was able to work out the bugs. For all intents and purposes I emerged victorious.
Overall, I believe my time could have been managed much better. For one, when building a prototype, get the game play done first. The art wasn't as important to the game at this stage as the programming and design were. I'm happy that my prototype works and that my avatar is a pretty cool cat but I would rather have it working with no avatar than an avatar with a broken prototype. Also, learning new things takes time. I know that sounds obvious but what I actually mean is that in this project I not only tried to learn two new things but I tried to execute them as well. I went in cold and could have ended up coming out cold. Luckily for me that wasn't the case. However, if I had learned the tools before hand and then tried to prototype this game I think I could have done it much faster.

Artwork
I've always had an aversion to doing pixel art. It's time consuming and required that I not only be good at drawing, color theory, and be familiar with how certain digital image files work but it specifically required me to be good at working with pixels. This may seem incredibly obvious but pixels are an incredibly restrictive media. I believe that under tight restrictions true creativity can grow but damn is it hard.
I've practiced and worked most with traditional media. I have sketchbook after sketchbook filled and resting on the shelves around my desk. Last year I took a color theory class and expanded my work out of graphite, charcoal, and ink into colored media such as colored pencils, water soluble crayons, oil pastels, water colors, and digital media. Even after years and years of practicing and honing my art skills I was still feeling timid to try a new media. Going from an intermediate level to the very beginning level at something is daunting.
Wednesday morning I put down my first pixels. I made the canvas 256x256. It's a generous size when doing pixel art but the more room you have to work the easier it is to draw something and I thought I'd apply the same aspect to my cat avatar. I scanned my sketch in and sized it so that I could put it on a lower layer and use it as a guide. If you check my earlier posts I link to the tutorial I followed. By the end of the day I had created my avatar with some arms and legs.
The entirety of the next day was making the eight frames needed for a walking animation. By the end of the second day it was no longer difficult to get the shapes I wanted. I understood how to create curves a lot better and it was becoming more natural. However, when I went to put my avatar into the game I noticed something horrible. My avatar didn't take up the entire canvas. It's was actually 121x208. I didn't have time to fix it as I was a day behind my original deadline to start coding.
I think the next time I do pixel art it'll be much easier. Since I plan to take this game idea further out for a couple of weeks I'm sure I'll have plenty of practice. I'll have to remake my avatar in an acceptable and probably smaller size. Pixel art is tedious but it's extremely rewarding.

Programming
This isn't the first game that I've coded. I recently completed all of the coursework necessary to graduate with an associate of science in game development. The degree program is mostly a computer science degree with a bunch of multimedia sprinkled in. I have experience in Java, C++, C# in XNA Studio, Action Script 3.0, and Unity's Javascript. I've never attempted to learn a language on my own. I've dug deeper into a language than my coursework would have lead me but that's it. I know GML isn't supposed to be a difficult language and for the most part it wasn't.
The first hurdle I had to overcome was how variables and objects were made. Variables can be assigned value without any conventional declaration. There's no variable keyword needed. You can simply type, “cats = 9,” and a variable called cats will be created that stores the integer 9. At first I wanted my cats to have certain member variables and in any other language I would include that in the cat object. However, in Game Maker I had to include that in the creation event so that when it was instantiated all the variable were created at certain values.
The second hurdle was movement. From C# I'm used to the top left corner being the origin. In Game Maker I'm not entirely sure. When checking if a spot 6 pixels to the right is free you don't have to add the sprite’s width to the x coordinate and then add 6 you just add 6 to x. I don't know why but that's how it's done. Same with the y coordinate. That tripped me up more than I'd like to admit. It caused me so many problems with getting stuck in the floor, thinking my place_free(x,y) function was returning the opposite values it was supposed to, and just generally causing mayhem. Thankfully, I spotted the problem fairly quickly.
The third hurdle was a data structure hurdle. A class I'm sad to say I didn't do very well in. My cats were governed by an invisible cat manager object. I wanted the manager to dictate how they interacted with each other while the cats controlled themselves individually. This ended up giving me a lot of head aches. At the start of the room the cat manager would instantiate a number of cats equal to the number of lives the player had and designate one as the active cat. I put all of the cats into an array and then gave them a member variable called index that reflected there spot in line. The active cat would be index 0 and the last cat would be index 9. I did this because originally I wanted each ghost cat to follow the one in front of it. They could ask the manager for the cat in front of them by there index. However, that created a huge mess.
The index didn't correspond to there index in the array. So when each cat was asking for the index in front of them they were actually asking for that spot in the array which wouldn't necessarily be the next cat in line. So then I tried doing it a different way. When I switched cats I wouldn't assign a new value to a member variable but would rather temporarily store the cat elsewhere and then shift all the cats forward eventually ending up with the first cat put in the last position. As I was implementing this I realized what I was actually creating was a queue. I quickly googled to see if there was a built in queue and luckily for me Game Maker had one.
My code instantly became easier to read and all around more elegant. I simply de-queued the head and the en-queued it. The biggest problem now was the code to get the cats to follow the cat in front of them. Queues don't have indices. I couldn't access each cat in the queue unless it was at the head or the tail. Fortunately for me it came to me at the gym. I just had to give each cat a member variable of index again. Then, when I de-queue it I add the number of lives to it and then en-queue it. Basically, if I de-queue the first cat (index 0) and then en-queue it and add 9 (the number of starting lives) it's index becomes 10. Now, instead of having indices of 0-8 I have 1-9. This way each cat could ask itself how far it's index is from the head and follow from a certain distance. Using this formula the relative distance would never change. Even if I lost a life and ended up with 2-9 (8 lives). When I switch again I'll have to add 8 (the number of current lives) to 2 and end up with 3-10. Their indices would climb and climb and climb but I could always check and make sure they never went too high and if they did I could simultaneously set them back down.
My last piece of coding was the inventory. This was exceptionally easy thanks to Game Maker. I just had to specify what would happen if the active cat collided with my powerup object. One of the events that is collision and then you choose the object. It's fantastic. When the cat collided I executed a code. Basically, destroy the object, set the powerup variable to “powerup” or literally any other variable. Done. Now that cat has a powerup in it's inventory. When I press certain keys I just need to test what that powerup variable reads and boom, I've got special powers.
I'd have to say that Game Maker, although limiting, does make things super easy. I learned the language and prototyped a game in a week. It has it's quirks but I think it's worth working in. I'd say it's a great tool for anyone that wants to make games rapidly.

TL;DR
  • I should've spent less time on art
  • Postmortems take a long time to write
  • Learning new skills as you go is time consuming
  • Pixel art is tedious, limiting, and rewarding
  • GML variables are weird
  • Data structures are important
  • Where's the origin of my object?
  • I'm continuing development for a few more weeks to see where it takes me

Wednesday, May 22, 2013

Postmortem Delays

I've written a bunch in my postmortem but as I write I find I have more and more to say. I'll be posting it tomorrow as I haven't finished it yet. It's a lot longer than I had expected but it will include a bullet pointed TL;DR section.

Tuesday, May 21, 2013

Small Bugs and the Inventory System

While having fun playing with my creation I noticed that I encountered a small bug. If I switch to another life while in midair it stops following me and then eventually disappears altogether. Switching while on the ground is fine but midair is a problem. As of yet I haven't solved the issue and instead decided I'd get the inventory system down which I did. The inventory system was actually extremely easy to implement.
It's midnight here and I'm pretty tired so I'm gonna write that postmortem up tomorrow. I can hint at one thing though, I think I'm gonna continue this project for a few more weeks. I'm super happy about my progress and I like this game so I think it deserves more attention.
Here are two screenshots. One before I pick up the powerup and one after.


My Queue Works!

I implemented my queue successfully. I can switch between lives and they all follow the avatar. The last piece of this crazy prototype left is powerup pickup. I'll see you all later tonight. Here's a screenshot. All the lives are mixed up because I was switching between them.

Restructuring

Moving? Check. Jumping? Check. Trail of lives following the avatar? Check. Switching between lives? Check... ish.
I am on a roll. GML continues to get easier and I solved a lot of the bugs I was having. I got the avatar moving and jumping without a hitch. I got the other lives to follow the avatar. I solved my jumping and getting stuck in the floor issues. So today I wanted to tackle switching between lives and picking up powerups. On my first try I thought I got it. I was able to switch between lives. However, the more I switched the more the other lives couldn't follow the avatar. I put a bunch of print statements in and found what was wrong. I structured the cats into an array. They stored their indices in an internal variable that way they could reference each other. However, their internal indices were completely different from their array indices and that started to cause major trouble with how I had them following each other.
I realized what I really wanted was to make a queue. So right now, I'm restructuring my code in order to have my manager object control how all the inactive lives are moving as well as how they switch. I'll see you all tonight.

Monday, May 20, 2013

Jumping... Kinda

It's 2:13 am here and I'm too tired to go on tonight. I've got the avatar kind of jumping. Well, he jumps and his other lives follow nicely but they sometimes don't touch the ground and they sometimes won't follow unless the avatar is jumping. I have more work to do on the movement of the character but I think tomorrow I'm just going to focus on picking up powerups and assigning it to the active life as well as being able to switch between lives. I'm proud of what I've accomplished so far given my lack of experience with Game Maker and with my lack of experience with pixel art. I hope I can accomplish the powerup/inventory system tomorrow. It'd make my day. See you all tomorrow. Here's a screen shot.

Good News!

Good news everyone! I've picked up GML pretty easily. When I started coding a day or two ago I was having a lot of trouble with things like instantiating objects, declaring variables, and having to place invisible manager objects in the room. It was throwing me for a loop. Since this morning I've got an avatar in a square room that moves and has a trail of semi-transparent lives following it. To make this a protoype of the mechanic I'm trying to employ I need to make the avatar able to pick up powerups, store them in it's lives, and switch between lives. I've still got my work cut out for me but by Tuesday night I may actaully have a gameplay demo/prototype. A little short of what I was shooting for but definitely better than I thought I was going to do yesterday. Here's a screen shot so far.

Sunday, May 19, 2013

Learning Experience

I may have bit off more than I can chew. I'm currently trying to learn how to code in GML and I'm not sure I can get what I want done by Tuesday. I'm gonna try my best but I'll probably have to go into overtime with this one. I've still got 2 solid days left so we'll see what happens but even if I go over my time I'm well on my way to creating my first ever solo game project. So, all in all I'm proud of myself. Whether I make the deadline I originally set for myself or not I will upload a little postmortem/self reflection post at the deadline.

Thursday, May 16, 2013

Walk Cycle Complete

I got the walking animation done. Is it perfect? No. Is it good? I think so. My first pixel art animation and I'm proud of it. I need to add whiskers and maybe a tail, I haven't decided yet. Anyway, tomorrow I can spend some time coding and putting together a generic world to walk around in. Maybe I'll work on some other asset sketches as well. We'll see what gets done over the weekend. So here it is, my walking cat.







Walk Cycle Update

Getting the walk cycle done by last night was unrealistic. I have never made any pixel art and certainly never animated any. I underestimated the time I would need to create a walking avatar. However, I am halfway and I didn't really get to work at all today. Tonight I will finish it and have a walking avatar. Here's my progress so far. As I see it I have to make the same four frames with the limbs from the far side of the character and the limbs from the near side switching places. That shouldn't take too long. Hopefully by tomorrow I will have him walking across platforms.




Wednesday, May 15, 2013

Final Color and One Frame

I added selectively colored outlines but I chose to not add any dithering. I feel like this pixel animation is going to take long enough that I don't need to complicate what I would think is a pretty good sprite. I also added arms to fit this stage of the walk cycle. I only have about 3 more frames to go and then by reversing the frames I have already completed I can shorten the next 4 frames development time giving me an 8 frame walk cycle. I'm shooting for getting it done by tonight but that's becoming more unrealistic as I realize having to learn how to create pixel art as I create it is more time consuming than I previously estimated.


Colorization

I got bored making legs and decided to color my avatar. Here's how it stands so far.
This is after Step 4: Highlights in that pixel art tutorial I linked to earlier. Here's the link again for the lazy. I think it's coming along quite nicely. Once I have the body done I plan to make the legs and arms in various positions for a walk cycle and place them on this body as needed instead of trying to iterate a body for each part of the cycle.

First Pixels

Woke up this morning and got back to work. I've outlined my sketch in graphics gale and have a defined body for my avatar. I've just created the legs for the first part of the walk cycle. I'm learning a lot about pixel art along the way such as how to create lines and certain angles. I feel like by the time I'm done animating my avatar I'll be able to do it faster and easier next time. It's funny, I've been avoiding pixel art in lieu of learning other skills and because after attaining a certain level of skill in sketching I dread becoming a beginner again, however, I've been enjoying this process. It's boring and tedious but rewarding.
It may not be the best piece of pixel art around but for a total noob I'm proud of it. I hope to complete the character's color and walk cycle by the end of the day. That way I can take a break from asset creation and try to start putting together my game in Game Maker.

Tuesday, May 14, 2013

Character

I knew what I wanted out of the character already and so I quickly settled on a design. I wanted a cartoon cat that was fat and easily replicated, something based on an oval and very simple. I sketched a couple of ideas and found one that worked relatively easily. Here's a scan of my design as part of a walk cycle.
I've never done pixel art before but I downloaded graphics gale and I'm having some success with it. Right now I'm using this tutorial. It's time to sleep. No need to keep an actual 48 hour game jam schedule if I'm giving myself a week, right?

Ready, Set, Go!

Recently, I finished my associates in Game Design and realized I've only ever made four games. Not for lack of skill but rather for lack of time after the necessary skills were acquired. In order to bolster my portfolio and because I'd like to rapidly prototype a game idea I've had knocking around for a while I've decided that I will constrain myself to a game jam like time table. At first I thought 48 hours but since I will be a one person team doing art and programming and since this isn't actually a contest in which I have to follow rules I've decided that I will give myself at most one week.
I've decided that I'll be using two unfamiliar tools/styles. Firstly, I will try my hand at pixel art. I've never been good at it but I attribute that to a lack of practice. Secondly, I will be using/learning Game Maker.

The game I've decided to make is called Nine Lives. It's a platformer in which you play as a cat jumping, running, and moving yourself through a surreal landscape filled with all sorts of nonsense. Just as you can set your computer mouse to have a trail, you will also have a trail of your other nine lives following you. Ideally, these will also be inventory spaces for special suits that will help you complete certain sections of the game.

That's it. One week, one game. Ready, Set, Go.