Saturday, August 5, 2017

TOE week 48: AttackTheProblem();



It was a whirlwind week this week. I talk to computers I am not a coder, yet. I mean most of my methods for getting the programming done is basically dragging my face along a cheese grater until one of us gives up. This is how I attack the problem. It is an ugly method and one with various flaws but the work gets done. A task that I have had on my ToDo list for some time was simply to show my work to an actual programmer and have them look over the things that I have been doing that could be improved. 

Similar to the tabs and spaces argument there is this:

if(!thing){

}

Vs

if(!thing)
{

}

I was so inconsistent about this. You have to pick one. Honestly I like that top version but Visual Studio is default to the lower version. So fighting with it every time was not something I was willing to do. My programmer friend he told me how to set my rules and then format the document so that all of the existing code gets this treatment. My code is much more consistent in this regard now!
When I talk about cheese grading my face in how I work when I program that is probably also how I work with art and design as well. If I were to write it in code it would like something like this:

if (workToBeDone){

AttackTheProblem();

}

This method has some disadvantages. Mainly frustration tends to build up over time. For example I was working on my player death function. When the player health is zero make the player start to fade away. The strange thing was that I could get them to fade in from nothing but not fade out. I kicked the proverbial tire of this problem until I was just so frustrated that my wife thought I should work on something else. Not being cool headed at the time I chose to continue with cheese grading my face against this problem.

Turns out my code was actually working but the fade speed was too low. I would make a change in code run the game look at the player not fading be sad. Stop the game edit code and process would repeat. AttackTheProblem(); It is really hard to fix something that is actually working! I only realized that it was working when I pulled the slider in the inspector and the player disappeared a bit. I spent a day on this death function and some of that time was wasted.

The next day I was fighting with the UI again. I was trying to make my Player Health UI populate a Grid instead of populate a single column. Then I needed to flip the graphic if the population was above 10. Getting the grid to populate with my objects was easy BUT getting them to be the right scale was not. Again I cheese graded my face on this problem. It eventually worked but it took a whole day fighting with it. It wasn’t because this was difficult, it was because scale and parented objects are weird in Unity sometimes. It wound up looking like this: 



Then I didn’t work for two days because I was AttackingTheProblem(); IRL because one Government agency said that another Government agency lost all of my paper work. And a completely different Government agency wanted a bunch of different paper work so my car is in fact still a car. 

I got a ton of little things done after IRL was over. Player raycast while ducking now adjusts allowing the player to duck and slide under things. I got an enemy working who moves around similar to the player using the raycast controller. I fixed my melee attack problem 97% of the time. The last 3% still is bugged but it now works much better. I fixed a bug my friend found last week where the player would get stuck at the end of the ducking attack animation if the duck input is released during the attack. I made artwork for the primary attack finally. 



So much AttackingTheProblem();.

Then the next day I was just burned out. I tried to work but I couldn’t get anything done. My wife asked me when was the last time I played a game? I didn’t know. Being cool headed at the time I chose to continue working and managed to get a render texture to appear on an object through script. This is helpful because you can’t prefab a render texture. WELL you can BUT instead of using the camera at your new camera’s location it will use the camera from the prefab. Not helpful. So creating it in code allows you to build it into the prefab. This mostly worked with some caveats.
I probably just need to take my wife’s advice. 

If(workToBeDone && burnout <= 10){

PlayAGame();

}


No comments:

Post a Comment