Day 6- White Cubes

Day 6- White Cubes

Quote of the day- “SOMEONE MOVED THE ROUTER!!!” – Someone from inside the warehouse, no idea who.

Music of the day- The Thunder from Down under (AC/DC. It’s AC/DC)

The first part of today was great. I came in and got right to work fixing up my teleporter, and after about an hour and a half of small edits I had an amazing working teleporter that moves the player through each level after they reach 500,000 points in the previous one. After consulting with Jeremy on the Discord, we decided it was better to have a predetermined location for each, rather than putting them on top of the location that the player is spawned, as it previously was (Because if you died/fell off the level and respawned, you were instantly teleported to the next level.). So I set about choosing where to put them on each level.

This was the process: make a random cube in the level, put it where I think the teleporter should go, write down its location, put that location into the code, and then delete the original cube. it was tedious, but on the plus side I got to mess around in the levels and find the best place to put something. This was my first true experience with level design, and I learned a lot about where and where not things should go. After that, it was time to test! And, in true playtest fashion, everything broke. Instantly. Turns out when I had edited the code, I had accidentally changed one of the conditionals so that anything could trigger the teleporter, not just the player. I was also still spawning thousands of teleporters on the same location, because there was no check to see if one was already active.

So basically, I created a teleporter on the level, then another right on top of it that would trigger the first, then another on top of the first two that would trigger both, and so on and so forth. That process happened about 2,000 times in the space of 3 seconds. Needless to say my computer no-likey. Unity crashed very, very quickly (I may even have broken my record from yesterday!). A couple of quick edits later, and everything now works exactly as it should. And, even though I’m turning 18 in two weeks, the inner 9 year old couldn’t resist putting a teleporter in the toilet (It’s the big ugly white cube because I can’t model at all):

teleportertoilet

I then had a discussion with Alex about quantum physics and special relativity for about half an hour (You think I’m joking. Nope). He’s a physics major, so we (somehow) got to talking about all that fun stuff. I still only understand about half of it, but it was cool that because of Modern Physics, I at least understood some of it. Thanks Greenfield.

Next I was asked to streamline the powerup code. As it was, the code for every different type of powerup was in one piece of code, inside a massive switch statement (A thing that lets you execute a specific block of code based on what the input parameter is). It looked like this:

massiveswitch

And that’s only half of it. This is super inefficient because it means that the code has to check all of these parameters, find which ones it needs to execute, execute them and then do anything else they say to do. instead, I am now condensing each powerup to its own individual class so that hitting a powerup is handled solely by that specific powerup, not a massive group of all of them. This turned out to be pretty tricky, since I now had to basically recreate one-eighth of the original class, but copying and pasting specific code over wouldn’t work (because variables and triggeres needed to be set up differently). I started with the shield powerup, which gives players a … well a shield… that stops all damage for a few seconds. I have typed the word shield so many times, both in the code and on here, that the word has lost all meaning to me now.

However, in the middle of my shield coding, I was asked to make some changes to how the teleporter works. Instead of just moving to the player to the next level linearly, I was asked to make it so the player moves to a random new level, without being able to go back to any they previously played on. The code for that was actually pretty simple, with one exception: making sure they can’t go back. If the scenes weren’t split up, this would be a piece of cake. but, since they are stored in different locations and accessed at different points, it mean that I had an object called a “TeleporterManager” in every level, that controlled all of the logic for the teleporter in that specific level. The problem is that the data of what level(s) you have previously played on is not carried over between levels, so if you get the right random roll, you can go right back to a level you previously played on.

It is incredibly frustrating to fix. I am sitting here screwing around with everything I can think of, eating my sandwich, but I cannot for the life of me figure out how to fix it. I’m profoundly annoyed, and personally this is not the way I would design the progression, BUT it’s not my game, so today I learned a lesson about differences in opinion: there’s nothing wrong with them (and i did share my opinion on how it should work), but ultimately it isn’t my decision, so I will work on what I am asked to work on and make it as functional as I can, even if it is not what I think should be done.

If you’ve made it this far, I hope you have a wonderful Valentine’s day! As for me, I have a hot, sweaty date with the YMCA treadmill. See you tomorrow!

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