Friday, April 27, 2018

TOE week 57: The Department of Super Weapons


For me coding doesn’t seem to be like riding a bike. I have to code everyday in order for it to stick around. Some parts of coding stick around like I still know what a bool is and when to use it. The part of coding that doesn’t stick around seems to be the part where you are staring a blank page and the amount of time it takes for you to know what to do is basically near zero. I haven’t yet got that part back yet.

This week I decided to work on something easier. I made super weapons. These super weapons function similar to sub weapons that I made earlier but you can only fire off a super weapon if you have a large amount of ammo, they fire off of a different button and you can only fire one of them at a time. Turns out super weapons are very much like sub weapons except in some places they are very different. 

After two days of work I had four new super weapons that work well enough for a version 1.0 of functionality. After having finished I thought ‘man that took a while’! I basically chided myself for doing the work but not fast enough. I mean am probably just being impatient with myself. I want everything NOW. When I should just be happy that it got done.

I spent the other few days of the week being sick and that resulted in getting mostly nothing done aside from binge watching the new Lost in Space. I don't know what I'm working on next week but I think it involves raycasts and reflective objects. Keep in mind that I have to make said objects reflective. Wish me luck!

Friday, April 20, 2018

TOE week 56: Like a Dragoon I have returned!


I did a THING!

Not having touched this mammoth of a project in about 4 months and not have really worked on it 4 months before that, this week I decided to open it back up and try to do the most difficult coding task I have ever attempted. What is that you ask? It is an AI enemy that make different random decisions based on player actions. How did it go? Not good. Not because of the reason that you’re thinking.
AI was really grinding my gears before I stopped working on this but opening Unity and Visual Studio after VS had been dormant for months basically meant that it was broken upon opening. Like My project solution was no longer connected to my Unity project. Why did this happen you ask? TFIIK. Let us just say ‘because computers’ and be done with it. Long and short is that I had to NUKE VS 2015 and install VS 2017 and then coding could continue. But hey VS 2017 had a checkbox for Unity specifically so that is cool. 

On Tuesday I tried to make an enemy ray cast two different rays, high and low. If both hit do a thing if only low hit do a different thing and that was a swing and a miss. Basically wasted time. Monday and Wednesday both were spent drawing with some success. Thursday was the day I gave up on fighting with AI and I decided to make collision objects that simulate power conduction. I did this because I thought it would be easier than fighting AI the results are fifty fifty. 

I created a square that was the power source it is simply a box with the tag PowerSource. Then I have a different square tagged with Conductor. If a Conductor is OnTriggerStay (touching) an object that is PowerSource then the Flag on the Conductor flips to true for IsPowered. Sounds simple right? Wrong. One of my struggles in Unity is with objects that don’t know about each other talking to each other.

Simply in Unity you can send a message to two objects that are colliding but you can’t directly access the object. (Or if you can I don’t know about it.) Meaning that the Power Source knows nothing about the Conductor and vice versa. Let’s talk about a Conductor. If a Conductor is touching a Power Source on its left and it is ALSO touching a Conductor on its right. The Conductor in the middle sends a message to the Conductor on its right to flip IsPowered to true. Where it breaks down is when the power source is removed the Conductor loses power BUT the Conductor next to it then sends a message ‘hey buddy you are powered’ even though both are no longer connected. 

It should be noted that if there is only one Conductor object this all works correctly but a Conductor next to another Conductor has a bug. I will try fighting with it more after this update. So why have I done all of this? Because I wanted to create some power puzzles where the Player uses the portal to bridge a gap between Conductors. That works pictured below. Yellow blocks are Conductors, light Blue is Power Source, and Dark Blue is a Power Destination. 

 

Like pretty much now I guess. Oh and this is the picture of my main Character.