Day 4-The Dynamic Duo

Day 4-The Dynamic Duo

Quote of the day: “Thanks Alex” – Me, about once every 5 minutes

Music Song of the day: Wolfmother-Victorious

I did it. Or, to be more precise, Alex pointed out everything I had done incorrectly and helped me fix it. I came in at lunchtime, expecting to come in to a full office (We share our space with the other members of Proper Villains LLC, so there are almost always people in the offices surrounding our area), but instead it was only Alex. He was messing around with a unity tutorial on jump animations, and we worked on how to make it adaptable to MiniBotz for about half an hour. Then it was time to go back to my oh-so-dreaded achievement code.

This time, though, I had been able to think about what I wanted the logic to do beforehand, and I also had a ton of assistance in the form of Alex. I asked him for help on one of the more difficult pieces of code, and in the process he managed to point out almost every single issue with my code (In hindsight, they were all super easy to notice and fix, as is often the case). With all of those fixes in mind, I set out editing the already finished achievements and adding in the new ones. The final code (or rather, the interesting, non-variable creation part) looks like this (Split in three parts because it’s too long to screenshot all at once):achfinal1achfinal2achfinal3

I’m sure that means almost nothing to most people not familiar with coding, but allow me to break it down just a bit (This won’t be long, I promise). Each of those “if” statements are a conditional check. They look every frame (think like a movie frame) to see if their conditions are met, and if they are they execute the indented code underneath. The green parts above are comments so that we know which bit of code is for which achievement. Here’s a much more readable and descriptive list of the achievements I programmed (today):

  • Pest Control- Kill 5000 roaches
  • Sweet Tooth- Kill 5000 Gummy Bears
  • Not Alone- Play Multiplayer
  • I’m the Juggernaut!- Survive 10 seconds without taking damage
  • Well, You Tried- Die in less than a minute
  • Don’t Feed the Gremlins after Midnight- Play as Gizmo for the first time
  • The Dynamic Duo- Kill 10000 enemies in 2-player survival
  • The Tenacious Trio- Kill 15000 enemies in 3-player survival
  • The Quintessential Quartet- Kill 20000 enemies in 4-player survival
  • Millionaire- Score 1,000,000 points in solo survival

Overall the actual code for unlocking achievements is repetitive and straightforward, the trick is the conditionals. You have to access data from parts all over the game to make sure that when you get just the right number of points or enemies killed you trigger the achievement. Variables and trackers of the data are split up between multiple scripts (Pieces of code) attached to different parts of the game. For example, you have to access the “Score” script to track the score, whereas you need the “PlayerHealth” script to check if the player has lost health. These are on different objects in the game, so you have to call the correct object and script in order to access the data you need.

With the Achievements finally done, I moved on to Leaderboards. These are pretty self-explanatory: all we wanted was a global leaderboard of the highest scores players have..well..scored. This happened to be a lot simpler, especially since StackOverflow already had an entire working leader board class Chunk of code). All I had to do was change the variables to fit MiniBotz, and all was well. I also got to be on the Angry Skull stream for a few minutes today, it was pretty uneventful and I didn’t do a whole lot, but it was fun nonetheless.

That was it for me today, unfortunately no lunch pictures (Sorry Winkelman) because I ate before I came in. I’m looking forward to the weekend and the For Honor open beta, which I may play with some of the guys here.

If you’ve made it this far, congratulations! You get the special reward of the link to the MiniBotz Steam page, which I realized I haven’t linked before now: http://store.steampowered.com/app/508520/. Hope you have a great weekend, thanks for reading and see you Monday!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s