October 2018 Week #5

He...he...(SNIFF!) HE LEARNED TO CROUCH, GO PRONE AND AIM AT STUFF!
OUR BABY!!!


And yeah, sorry for being a day late on posting this blog.

ADITYA CHANDRA (Lead Developer)

So the first thing I did this week was to continue with the PlayerController for the player. One thing I did was to clean code and optimize it, and a part of it was to convert the string values that control the animations of the character, 'acts', into enums. I was reading this Unity Manual article about optimization of scripts the other day, and they said strings are to be avoided wherever possible as using strings subsequently creates objects, which is definitely not the best way of doing things. And since it is essentially prudent that I should at least be able to understand my own code, I went ahead and renamed act1 to Pose, act2 to Movement and act3 to Action, and then moved some stuff around. I also added a lot of //comments to make my code easy-to-understand.

Next, I added functionality to the PlayerController for crouching and going prone, which required cleaning up the animation web a lot, creating new conditions and defining new transitions. You press the [Z] key to go prone and the [C] key to crouch, and yes you can go to the crouched position directly from the prone position. Their are a few bugs with this, but the core everything is all in, so yeah, you can enjoy eating pizza while hiding from enemies. We'll fix the bugs this week.


Then I created the basic aim mechanics. At first I just defined an offset for the camera, but that didn't work, so I had to transfer the CameraTPP script to a new empty GameObject, parent the third-person camera to that GameObject, and THEN define an offset for the CAMERA and not the empty GameObject. It may seem weird, but it works just fine.


Then at last I fixed some bugs with the animation transitions. Earlier if you walked while crouching, it was impossible to go into idle state again because turned out there was no damn transition defined for that.

Also I made a simple utility script thinking it's gonna come in handy, and that I'm gonna use it sooner or later. It's called TimeSince and it gets the time in seconds since something has happened. It is basically a float value, but it keeps changing. Also, its a struct so it does create crap:

using UnityEngine;

public struct TimeSince
{
  float time;
  public static implicit operator float (TimeSince ts)
  {
    return Time.time - ts.time;
  }
  public static implicit operator TimeSince (float ts)
  {
    return new TimeSince { time = Time.time - ts };
  }
}

So I can just declare a TimeSince value and set it to 0 in Start() or something and then use it in Update if I have have to do something about five seconds or something. You may use it too if you want... it's definitely not an original.

To some everything up, here's an internal playtest recording:



DIWANGSHU KAKOTY (3D Artist)

I couldn't get anything much done because of a school-funded trip to Guwahati. I did complete that blueprint system I told you guys about last week though. I'll tell you more next week once I fix some bugs. It's awesome but it needs to be easy-to-use.


From now on, we will keep posting commits at our all new Moonwalk Entertainment DISCORD SERVER! So you might wanna join.

Comments