Day 5- Portin’

Day 5- Portin’

Quote of the Day- “You forgot the quote of the day” – Michael

Music of the Day- Quite a bit of Wolfmother and Green Day, With a touch of Scorpions thrown in to boot

Today it was dead silent (except for my music). I came in a little earlier than normal, but it was still 9:30, and the only other people here were the GrokTek employees we share the space with, who all sat in their offices with the doors closed. So I was pretty much alone for the firs 3 or so hours, which was fine by me. I finished up achievements, leaderboards, and stats, created the trackers on the steam API (Basically the Steam servers that track them for individual users and upload all the data to Steam), then asked Jeremy what I should work on next in the office Discord (Discord is a chat room program for text and voice, think Skype but wayyyyy more versatile). He asked me to start working on a teleporter that would move the player to a different level after they had accumulated a certain amount of points.

In a rare moment of coding brilliance, I got it on the first try. As in, I wrote the code, saved it, tested it, and it worked with no problems instantly. To give you some perspective, that’s like saying that in my first game of football ever I threw a perfect 50 yard pass. It almost never happens. So I was very happy… until Jeremy got here and asked me to change how it worked. The way I had done it was kind of a cobbled together trigger, where the teleporter was always in the level, it was just activated only after the point value was reached. This makes sense for a smaller point threshold, but for the large one we’re using it meant that the object would be sitting in the level, constantly looping to check if it could be enabled yet, eating up a ton of system performance. instead, I was asked to code it so that the teleporter was instantiated, or put in the level, only when that point threshold had been met.

It ended up being simpler than I thought it would, but it still required a lot of google searching and browsing of documentation to make sure I had everything being created correctly. The first dozen tries ended in null reference errors (the code was looking for something that didn’t exist), the next few got to the trigger point before breaking, and I was starting to become more and more confused at all of the documentation I was reading, because Unity updates frequently, so some of the information I was using was outdated and didn’t function properly anymore. A few more tries ended in failure, and I ended up resorting to quasi-similar code already in the game, improvising pieces here and there until I got it working.

This is the result of my first test of this new code:

oops

Oops. This probably doesn’t look like a lot, but those red things on the bottom are bad. Thankfully, those actually had nothing to do with my code! Something else in Unity had had a little tantrum and threw non-related errors. The second problem, and the one that actually pertains to me, is that in my code I had a conditional for the code threshold, as I should, but I had a >= (greater than or equal to) check rather than a straight == (equal to) check. Which meant, I had just spawned in approximately 5000 teleporter objects in the space of 1 second (The white cubes. I’m no artist). However, I did accidentally hit one (You can see me hitting it in the picture, I’m the little red robot with his body halfway into a robot-eating white cube), and success! I was moved to the next level. Then unity crashed. But hey, it worked! I fixed the check, and it worked as it should.

There are still issues though: first off I’m spawning teleporters in 4 separate locations around the level, when I want it to be randomized between one of those 4. That should be a pretty easy fix though. Second, none of the data from the previous level is carried over to the new level. My score, health,, and any active powerups are reset when the next level loads. So that’s the plan for tomorrow: fix all the still broken things. Today was the first day that I fully crashed out Unity though, so that was fun. Anyways, that’s it for me today. Tomorrow will be a bugfix day.

If you’ve made it this far, congratulations! You get one MiniBotz point (DISCLAIMER: MiniBotz points are entirely worthless. But you have one, so feel free to gloat over your MiniBotz-pointless friends).

Advertisements

3 thoughts on “Day 5- Portin’

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