Jack was complaining about how I haven’t updated in a long time, so here I am.
I haven’t written in a long time because I don’t really have much to say. Life is good, we still have the kitties and I started work. I still haven’t made a new layout. It’s getting rainy in Silicon Valley.
I want to start some new personal projects, but there are too many to choose from! For instance, making the layout for this site that I said I’d do a year ago. Oops. I also signed up for the Stanford online AI, databases, and machine learning classes, but I also recently decided I want to play around more with Arduinos and Processing, so those may take priority – if I ever start them!
I’ll write more once I have something interesting… but for now here are the kitties. They got so big!
It’s been a long time since I made post about this. I’ve been kind of lazy about updating this and uploading a video to youtube.
Sound
Surprisingly, sound was relatively easy to implement and did not produce as much of a strain on my app as I expected. There are two types of sounds: short, quick sound effects that are played frequently and long background clips. To play background clips, I use the default Android MediaPlayer, which takes an mp3 file and streams it. This allows for lower memory usages as opposed to bringing the entire mp3 into memory. For sound effects, I created a SoundPool for quick retrievaly. You essentially pre-load all your clips into memory and can play them immediately. This is more efficient than having to create a new MediaPlayer object for the hundreds of little beeps and blips that play while smashing Renoki.
The only thing to take note of is that you have to kill your mediaplayer every time you stop the app. Otherwise it wastes resources and also keeps playing in the background. That and making sure you take into account pausing and resuming your app in every possible method. I ran into quite a few points where I would turn the app off in the middle of something and resume with no sound.
Victory Screen
The victory screen now gives you the option to Continue, enter the shop, or return to menu. Originally, the shop was a random monster that appeared and when you hit it, it opened the shop. Although neat, this confused the hell out of people (I still don’t understand how it isn’t painfully obvious that it’s a shop when it opens) and didn’t really add any value to the game. So now you can enter the shop in between levels no matter what and buy what you need.
Shop
The shop is the same as the normal gameboard. Each item is a monster that never retreats and only dies if you have enough money to kill it. Had to add some logic to make certain items disappear or not show up depending on what the user already had. For example, if a user owns the gold hammer, the bronze and silver hammer should disappear.
Bosses
Bosses worked out incredibly well with my existing architecture. I merely had to add a boolean flag in the regular monster as to whether it’s a boss or not. In the event that it’s a boss, it draws an additional little health bar above it’s head that decreases in size as it’s health goes down. I have a special case in my levels at 5, 10, 15, 20 to insert the boss monster into the corresponding position and set the stay time to be huge. I then just had to change my level timer logic to make the player lose if the time ran out before they killed the boss, instead of winning.
Back Button
Unlike iPhone, Android has a back button that allows you to navigate between screens of the same app. I had to override the default action to prevent back from accidentally closing the game. Instead, if you are playing it pauses, if it’s paused you go to the menu, and if it is at the menu, it exits with a ghetto confirm box (art pending). The thing I need to decide on is whether pressing back in the confirm exit screen exits the app or just closes the confirm box. Some games (Angry Birds) pressing back twice will confirm and then exit. Other games (Cut the Rope) pressing back twice will open and close the confirm box.
Switching Number Monsters
I realized (quite late) that a Number Monster (the guy where you hit the corresponding number location and not the monster) didn’t need to have “health”. Instead, it would have a hit count, and each time it was hit the monster would rotate and switch to a new number. Once the hit count ran out, the monster would automatically be destroyed. Luckily, my architecture for monsters was flexible enough to allow this by just modifying the hit method in my NumberMonster class. I already had the spinning animation when the monster first appeared, so all I had to do was reset the monster so it would spin again, while subtracting the hit count. So now I have stronger number monsters that take 2 hits with 2 different numbers and also a boss that works the same way but with a lot more health.
Hearts
One enormous nested if/else shitfest that draws hearts depending on the life of the player. I considered making an algorithm that could scale for any number of hearts, but I realized it wasn’t worth the effort because a player can’t have more than 6 hearts (24 life).
Credits
I actually have a ghetto scrolling credits page right now. It looks really terrible though, so I’m thinking about just making a victory graphic with all the Renoki or something and have a credits button on the main menu.
Loading Screen
I have to run a separate thread that loads all the images and sounds. Meanwhile, my main game thread has to just loop and wait until the loading is complete.
My viewing of anime has been lacking recently, whether it be due to time constraints or general lack of interest in new series. I had a few non-redeye plane trips with nothing else to do, so I actually got some time to finish watching Katanagatari.
The original reason this anime caught my eye was that it is based off a light novel written by the author of Bakemonogatari. The story revolves around two main characters: the head of a sword style that doesn’t use swords and a girl trying to collect 12 legendary swords. The plot isn’t particularly deep or thought provoking, but that’s not he point. The way they deliver the story works and it is paced reasonably well.
Whenever you have some quest to gather a bunch of parts, it has to be a manageable goal. This can’t be Inuyasha where some power orb shatters and breaks into a million pieces, resulting in hundreds of episodes of collecting. Katanagatari has 12 swords and 12 episodes. They collect one sword in each episode (mostly) and don’t drag things on. Each episode you get to meet the original owner of each sword and they spend half the episode setting up that character’s personality and background. Meanwhile, you get to see development of the main two characters, how their outlooks on life change, and how their relationship gets closer.
When it comes to artstyles, I tend to like the two extreme ends of the spectrum. One is the shiny, stereotypical anime look where all the girls have shiny colorful hair and big eyes. The other is when the characters are clearly “drawn”, with jaggedly drawn lines and they almost look like paper cut-outs (e.g. Sayonara Zetsubou Sensei). I really dislike the “realistic” anime style that tends to be in those serious, award-winning or slice-of-life animes (Spirited Away, Girl Who Lept Through Time, Summer Wars, etc). I want my anime to be about as far from real life as possible. Katanagatari has the style where the backgrounds are realistic but the characters themselves look goofy and unreal.
The fight scenes are good. The 12 swords are interesting and unique. The series is extremely dialogue heavy, but I tend to like that about anime. The ending is a bit confusing but I think I was generally pleased by it. Overall, a good experience.
Added level functionality. Level is a preference (need to save the level when the app is closed) that is stored in the global application context, along with all the other saved player states (hammerType, gold, score, health, etc). I insert monsters and adjust speed based on the level. At the moment, there is a timer that runs for 10 seconds until the level ends and progresses to the next.
Something I wanted to implement that was missing from the iphone version was waiting for all monsters to retreat before ending the round. People were complaining that they would try to hit something only to have the LEVEL COMPLETE message pop up and block them. I basically just stop inserting monsters when the timer is past the limit (10 seconds right now) and don’t end the round until the entire gameboard is empty. I think this is a lot better.
I also added the money drops for monsters. Instead of creating a money object and replacing the monster with it, I merely change the monster bitmap to be the diamond. Then I reset the duration of the monster to make sure it doesn’t immediately run away. I also had to add an extra state isMoney to the monster to check if it’s been turned into a diamond. If isMoney is true, I can ignore all the features of the monsters and just immediately kill it.
The only main feature remaining is the store, which Allison is working on.
First of all, I didn’t watch this movie yet in it’s entirety. I’m not sure if I ever will, because it looks mind numbingly boring in all the non-fight scenes and I’m sure I’m not missing any Oscar-worthy acting. Anyway…
I saw a preview for Suckerpunch a while back and thought to myself, “I definitely fall into the target audience of this movie.” A movie about a hot chick in a school uniform and thigh highs killing monsters? Talk about a subject packed with great things. There is no way you could make a movie more like an Anime, short of having a Gundam flying around in the background.
I watched the first fight scene where the girl fights three giant samurai monsters. It was here I noticed something terribly wrong. Human beings cannot move in a way that makes fighting giant samurai look cool. The samurai monster is blitzing about the room at breakneck speeds. Meanwhile the girl is somehow able to keep up with his impossible speed by jogging around and daintily swinging her sword.
It just doesn’t work. When you watch fight scenes in Anime, everything flows smoothly and people move FAST. Maybe not DBZ fast where they stop showing the actual moves and just animate flashing lights to save on production costs, but fast enough that a human body could not endure the acceleration without bones splintering. There is literally a part of that fight where the girl dodges a strike with an elaborate flip and then jogs up to make a slash. You can’t have gravity defying acrobatics but still move like a slug.
Honestly, I think the problem is just that they make her walk around on her own. When you watch people fighting in Anime, do they run around on their legs? No, they fucking leap. If you want to get from point A to point B in the fastest possible time, you jump and fly through the air. So sure, you can have dramatic scenes of her walking slowly away from a collapsing building. But the moment the bullets fly, the only reason for your feet to touch the ground at any point is to push off for another jump.
And there are just so many other parts in this fight that just make me cringe. How can you get hit so hard to make a crater in the ground but look like you just landed on a pillow? Watch her walk out of the dojo in a dramatic fashion after killing the 2nd samurai, only to have the scene ruined as she fails to holster her gun smoothly. Was there really a DBZ power up moment followed by the goofiest looking single sword slash I’ve ever seen? This is about as good as watching the live action DBZ movie.
I’ve always wanted to see live action versions of Anime. You see such amazing fight scenes and think that it’s perfect for a big budget movie. Then you see Suckerpunch and realize that the American movie industry is never going to get it. Seriously, some random music video cosplayed the Tifa fight from Advent Children and made it look cooler than your entire movie. How does that make any sense?
I coded a good amount this past week and managed to complete a good chunk of work.
Re-organizing Bitmaps – Originally I just initialized bitmaps in the main view. I decided that was a bit too limiting and moved them into the global application context. I grouped bitmaps into arrays depending on the game state (menu, help pages, gameboard, monsters, items, etc). I realized when making monsters that I needed access to multiple bitmaps (different stages of the animation) and so having all the bitmaps be globally accessible makes things a lot simpler. This way, I can declare multiple NumberMonsters and they all share the same bitmap, without having to pass in 4-5 bitmaps per object.
Number Monsters – Number monsters are of course the monster that has a number on it which forces you to hit the corresponding number location instead of the monster itself. In the code, we refer to this as owning a spot. The problem we’ve always had with these guys is when you go to hit a normal monster and a number monster appears in another spot and takes ownership of the spot you’re about to hit. Then you tap down and the hammer is redirected to hit the number monster, instead of your intended target. Unless the user has fast reactions or is aware of this case, they become confused. Where did my hit go? Why is this monster still here? Why did another door open and immediately close with no monster in it?
To prevent this problem from happening, you have the number monster appear, but be un-hittable until the door has fully opened. At this point, it is blank and has no ownership. Once it is fully in view does it then take ownership. This eliminates the problem of doors opening and immediately closing with no monster (that looks like a bug). It also makes it much more obvious where the hammer is being redirected to, as you can see the full number. Of course, you are still going to have people not noticing that a number monster appeared but there’s only so much I can do without sacrificing the entire game mechanic.
Shield and Sword Monster – These were very similar. In certain states they play one animation and cannot be hit. In other states they act like normal monsters. Interestingly enough, once I had figured out how to do the spinning animation for the new NumberMonsters, I just leveraged this code for Shield and Sword. It was a simple state diagram where one state loaded a different bitmap sheet and reacted to hits differently.
So now the core set of monsters are done. The only things to add are higher levels (trivial, I just adjust the health/damage they do), money monster (trivial, I just make hitting it steal money), and bosses (somewhat trivial, just modify the stay time, health, and force the location). The next step is work on the framework for levels.
It’s been almost a year and I still haven’t made the PiggyFriedRice layout. I’m putting this here so I see this every time and maybe get the motivation to make it.
Edit: Jack, I finally figured out where the stupid extra “–>” was coming from!
I’ve been placed into my position now, and so far it’s been okay. I’m surprised how quickly I got placed into a project (as in, first day). It seems pretty interesting and I have to learn new stuff, so I’m pretty excited. I’m not excited about my work location though – I was kicked out of my first desk by two product managers, and now I’m in a temporary cube until next week. I’m looking forward to getting my permanent position so I can start personalizing it :D
I have 9:00am meetings every day though :( I can call in from home, but then I wouldn’t arrive at work until 10:30am because it’s until 10:00am… It’s at the exact wrong time – I think I would naturally get to work around 9:30am :(
Back to reading so that I can hopefully start coding soon!
We finished moving into our new apartment, which involved a large number of boxes. Along with those boxes was a lot of Ikea furniture that required assembly. As such, I didn’t have much time to work on Renoki.
I did a significant amount of code cleanup. I also added several new monsters. There is basic2, which is basic1 but with more health. This was trivial as I just changed the health of the basic monster. I added the bomb, which was also trivial. All monsters do damage to the user when you hit them, with regular monsters dealing 0 and bombs doing damage. Finally, I implemented the number monster. The number monster appears with a number on him, requiring you to hit the corresponding numpad location rather than the monster himself.
In order to do the number monster, I had to use two arrays. One array contains what each position owns. Thus, if a number four monster appeared in position one, I would put a 1 in index 4. The second array contains what each position is owned by. For the same situation, I would put a 4 in index 1. Then, when you touch a position, you first check these two arrays. In the event of ownership, you must change where the hammer animation appears and what position actually gets hit.
I made another decision to simplify code. Every X frames, you insert a monster at a random location. If that location is occupied, you just don’t insert for that turn. Similarly, since multiple number monsters cannot own or be owned by more than one number monster, duplicate ownership will just cause the insert to fail. I was considering making it keep generating random numbers until it finds a match, but I realized that this adds nothing to the game while simultaneously increasing the delay of calculation. Since everything is random anyway, having random failures to insert monsters are fine. I can always offset this by increasing the speed at which monsters are inserted.
In addition, Allison started to work on it as well. She wrote up the menus and buttons, as well as the start screen animations where the clouds scroll by and the monster blinks. She is going to start working on the shop soon.
For some unknown reason, Allison’s brother wanted to give Michael Bay $12 and waste 2 hours and 37 minutes of his life. I ended up having to go with them to watch it.
Now, when I went into the first Transformers movies I was thinking to myself “Wow, it’s like live action Gundam except with a HUGE budget!”. I expected awesome mecha battles with cool weapons. Instead what I got was a boring, teen angst story where most of the battle scenes involved humans running around on the floor like ants trying to attack the weak spot for maximum damage. Meanwhile, the shaky, irritating camera made viewing a headache. The only way it could have been better is if it pulled a Gundam Seed Destiny and repeated 50% of the explosion scenes to save animation costs.
The best scene of the first movie was a very unimportant, glossed over part. Optimus Prime engages some random Decepticon (I think he was a construction truck or something), while driving on the road. He jumps him, whips out a blade on his wrist, and just wrecks him. The camera focuses solely on this fight without jumping around all over the place. You get to actually see the carnage of mecha vs mecha, down to the fine details of him delivering the killing blow. This is what I came to see.
No prisoners. No mercy.
Now, to get back to the point. I actually thought Transformers 3 was OK. Michael Bay is finally figuring out how to do mecha battles. I can’t help but think that in between Transformers 2 and 3, he must have watched a ton of anime for inspiration. You could copy paste Sentinel Prime into some Gundam Series and I wouldn’t know the difference. They started using melee weapons instead of dicking around shooting volleys of bullets at each other. Heat blades, heat axes and shields were all present. I almost expected them to whip out (pun intended) the Epyon heat whip. Optimus Prime literally kills a guy as he begs for mercy, grabbing his innards and tearing them out (Neon Genesis Evangelion style). You can feel the tension in the cables as he rips them out and mecha “blood” spills everywhere. I actually enjoyed watching the mecha vs mecha scenes in this movie, and there were a lot of them scattered throughout to keep me somewhat interested.
Now of course, the storyline was terrible, the characters are unlikeable, the jokes are unfunny, and someone seems to still think watching humans running around on the floor fighting giant mecha is entertaining to watch. I fell asleep in the middle part because it was so boring. Release a Transformers movie with no humans and I will be there opening night to watch.