Sunday, August 26, 2018

TOE week 62: Starting a Vertical Slice


Unity has two different functions basically built into it called OnTriggerEnter and OnTriggerExit. OnTriggerEnter sees if the edge of a collider is touching the edge of another collider and you can send a message. OnTiggerExit sends a message when two colliders stop touching. 

Last week I step up my Red Switches that activate when the Player Portal touches them. This works pretty well. EXCEPT when the Portal Collision contains the Red Switch entirely. The two objects are not touching because none of their edges meet. 

When I watched a Youtube video about how to be an indie dev it said that you don’t have to make all of your game objects to be completely 100% functional. The advice I received in my head basically said ‘you should probably move on to another thing’. However the fact that it wasn’t working was taunting me. I needed to solve this problem…. I am super bad about letting things go. 

So I decided to refine my red switch and make it function correctly because it should be activated when contained. However there is no function built in that does this I had to write my own. But that made me wonder why there isn’t a OnTiggerContained?

It really wasn’t that hard to build myself. It is basically just: PortalMeshCollider.bounds.Contains(redSwitch.transform.position). There is slightly more to it than that but after all of that was in my Red Switch was about a 100% better. Before I built my own version of this I tried making the Portal collision convex because I was under the impression that meant ‘not hollow’ BUT that didn’t work. 

After that I set up a Basic Switch. Very simply a switch that when struck by the player weapon it would move or rotate something. 

Most of this week was spent on making a vertical slice of the game. It isn’t anywhere close to completion. I was working on a vertical slice a while ago but I was building the level in blender and importing it into Unity but that was slow. Now I have switched over to probuilder. Much faster AND the editing is done in Unity so I do have to switch back and forth all of the time. I will probably have to use blender for the UVs when I get to the art portion of this but I’m not there yet still have to block this out. 

Also I made a video of what I made this week. 


Saturday, August 18, 2018

TOE week 61: the Hard Work that You Can't See


I have been feeling like working on this gargantuan project once again. Real talk I had been pretty depressed for a while and working on this just didn’t help with that. So I had been painting because that did help. Having a day job where people think your opinion matters and respect you for it DOES wonders for depression. Take two of that and call me in the morning. 

Also fighting with AI is still not something that I look forward to so working on THAT just didn’t feel worth it. With the time I’ve had on my two breaks though I could have probably put some of that to bed… That just makes me think about depressing thoughts all over again though so let’s stop talking about that. 

I only got to work on my game for about three days this week but the work that was done was still very productive. I wanted to make platforms that switch positions when the portal touched a switch object. I already had moving platforms but they didn’t have any code to stop moving so I kind of hacked them to do what I wanted with only a couple of bugs. Mainly that if the switch got hit too many times in a short period of time the start and end positions would basically flip.

I also had to make a switch manager that basically would flip its bool if any switch was hit and the switches would then all update. This was fairly easy once I remembered how to properly reference a script that wasn’t in the object. 

I finished it in about three hours and was pleased with myself.

Next day I created platforms that would rotate depending on if the player hit the switch. I had to ask for help on the Facebook Unity group I’m a member of to get this working. They didn’t actually help me but the interaction pointed me in the general vicinity of the problem. So I deleted everything a hacked in a crappy version that just added to the rotation value of the object every frame if the conditions were correct. It is a pretty crap solution to a problem that lerp should have addressed. Once it was working with my garbage fix I then deleted that fix and set up a solution using lerp and turns out I just needed to reset a variable for it to work correctly. 

I felt somewhat vindicated but silly that the result was almost exactly the same with just more control of the speed of rotation. 

Today I then looked back at my moving platforms and basically thought that I could make them work in the same way as the rotation I set up yesterday. Three or four hours later I basically had a bugless version of the thing I built two days ago. Again I redid work but the results are the same… 

Don’t get me wrong better code is always better but you would know it was different from looking at it.

This is what all of the work looks like. 


Friday, June 1, 2018

Temp Hiatus

So it is kind of a good news bad new kind of thing. The good news is that I got a new job. I just finished my first week. The bad news is that I don't have the time to work on this project because I'm working on bringing home the bacon. My job seems to want me to learn some Java Script and I've been looking into it. It seems a lot like C# except Java Script requires more equal signs. So will still get some programming in. It is a temp job so I will eventually be back working on this it just might be in July.

Friday, May 18, 2018

TOE week 60: The Actions of Associated Objects


Basically immediately after I wrote last week’s blog I un threw away all of the work that I did for my crappy version of bouncing a ray off of a reflector. This was the first attempt that worked but also didn’t. Fixed what wasn’t working except for the multiple hits problem and got line renderer to actually work. It was like I just had to write down all of the things that were making me frustrated and then I could move on. Here is a video of it working!


 The rest of the week was also pretty good. I drew up some temp artwork for my Lazer Projector and the Power Source Panel. I created a particle effect for my the flame jets that push the player around if the portal is open. I found a better way of dealing with rotation. Using transform.rotate instead of transform.rotation is good alternative according to me. What you don’t know the difference? Neither did I. #Learning. 

On Wednesday I was kind of stumped. I didn’t know how to implement something. I have two objects that are the Power Source Goal or the Laser Beam Goal. Each of these flip a flag when they are getting power or getting hit by a Laser. But I needed them to activate their associated object, like open a door or activate a particle effect. The trouble was that what the associated object IS, is variable. So in script you specify hey I’m looking for a MovingPlatform’s script and then tell it to do a thing but if you put a Particle Effect in there the script doesn’t know what to do.

So I cheated. I created a generic mediator script that basically is plopped on top of any object, MovingPlatform, particle effect, door. The Power Source is looking for that script and that script talks to the associated object. I don’t know if this is the RIGHT answer and further experimenting may be needed. Here is a video of that working!

 
With all of these cool new elements I might be able to start building a level again…. That means I may have to start working on AI again… FUN… Next week will be interesting!

.

Friday, May 11, 2018

TOE week 59: Arrow Heavy and Failing the City


This week was a banner week for failure. I just kept hearing Oliver Queen saying “You have failed this city.” I took an arrow to the knee and took a knee. Honestly the weight of this project is heavy and I am just one person. In industry if you have a bad week chances are that your co workers did not and the project moves forward. Working by yourself when you have a bad week the project just stands still. 

Last week I worked on getting a reflection system working in the game. This was unsuccessful until it was successful. OR so I thought. I may have mentioned that the way I had it working only showed up in the editor window and it did not show up in the game window. This is important because the player would be unable to see my lazer in game. Last week I thought it would be a simple task of figuring out how to use Linerender to draw my lazer using the existing system that I set up last week. Turns out I was very wrong about this.

If I learned anything this week it was that I kind of hate Linerender. It is a head ache to set up if you want anything more complicated than drawing a line between two points. Over the weekend I fought to get Linerender to work with my system. No avail. On Monday I fought with Lineredner. No avail. On Tuesday I tried to just get a Raycast to draw instead of a Gizmo. Because the raycast system drew every frame it slowed the game down to a crawl. No avail. On Wednesday I gave up on it because I was just spinning my wheels. And on Thursday I just wallowed in my own failure. The old system that I had last week with all of its faults might have been the better way to go even though it didn’t even do the reflection part correctly.

In less depressing news I did set up Pro Builder in my game. Pro Builder is pretty awesome and probably more powerful than what I need but it works great for quickly making geometry and is faster than saving in blender and waiting the 20 seconds that Unity needs to update the 3D file. This was the height of my accomplishments this week. That and I changed my desktop background to say CODE, DRAW, UDEMY, UNITY. Basically the things I should be working on. 

Oh and the results are in a pretty picture will add 10 hits to your blog.
.

Friday, May 4, 2018

TOE week 58: A couple of hitches.


What did I do this week? The better question is, what didn’t I do?



I colored this picture. Why, who is that lady? You might ask. I don’t know who she is I didn’t draw her, she is just the line art provided by the tutorial. I am trying to get better at making art as it seems to be one of the things that catch peoples’ attention. So I colored her for better future advertising purposes when I have my own line art.
.
I fought with programming. Like I created my own admittedly crappy bounce a ray off of collision system but for the life of me I could not figure out how to correctly use vector3.reflect. All of the documentation and tutorials I found basically say this vector3.reflect(angleOfIncoming , normalOfHit). I did that and boy did I get some weird results. So I keep looking for a better documentation or tutorial. I eventually found one after having fought with reflection for a day and a half. I throw away all of my old work and implemented a system that is arguably better than the one that existed prior. Mainly because my old system could only handle one incoming ray meaning that if a mirror was hit by two rays only one of them would draw the reflection. 



This is my reflection in the editor. The yellow lines are the path of the lazer the green boxes are the source of the lazer and the green rectangles are the mirror objects. It doesn’t show up in game as gizmos do not render in the game window. You have to use LineRender to get it in game and that is the hitch.

I can’t get LineRender for the life of me to draw a line where it is supposed to. The line just shows up a position 0 for reasons it decided, not me. Something for next week’s work list I suppose!

Then I took the show on the road and showed the game to two former co workers at lunch. One of them game me homework. Basically if you want your large design to be cohesive you have to always look at any new idea and ask does this support the mission statement of the game. The hitch here is that your mission statement is one sentence. 

Sounds easy but IT IS NOT. So far my sentence is: Electric exploration using time travel to fight the one percent. Something more to work on next week. 

This week was productive and eventful.