Skip to main content


Showing posts from February, 2018

C# Intermediate - Threads, Part 1

Threads A thread is defined as a path of execution of a program. Each thread has a unique flow of control.
Threads are most useful in applications where complicated and time consuming operations are performed. These operations can be split up into smaller chunks and each chunk is operated by a single thread. So multiple chunks can be operated upon by a series of threads.
One common example of use of thread is implementation of concurrent programming by modern operating systems. Good usage of threads can lead to better utilization of CPU cycles as well as creation of highly efficient applications.
If you have been following the blog, we have been working with programs that only execute on a single thread ( main thread ). However, this way the application can perform only one job at a time. To make it execute more than one task at a time, it could be divided into smaller tasks and each of those tasks given to different threads.
Thread Life Cycle Unstarted State : Instance of thread …

C# Fundamentals - Operator Overloading

C# Fundamentals - Operator Overloading Operator overloading is often times a really handy way of conveying a message as to how the code works.
You most of the built-in operators available in C# can be overloaded / re-defined. Thereby allowing a programmer to use operators with user-defined types as well. Overloaded operators are functions with the keyword operator followed by the symbol for the operator being defined.
Just like any other function, an overloaded operator has a return type and a parameter list.
There are operators than can be overloaded and those that can not.
Can be overloaded : All Unary, All Binary (that take one operand), All Comparison operators.
Can not be overloaded : All Conditional - Logical Operators, All Assignment Operators as well as : ?:, new, sizeof, .(dot) & typeof.

Let us take the example of a Position class, it consists of 3 float variables.
We will first go over overloading the '+' operator to add two positions.
public class Position …

What Are Fractals & How To Make Them In Unity [With Unity Package]

What Is A Fractal? Fractals are non-regular geometric shapes that are self similar. Self-similar means that a smaller section of it resembles the larger whole. These fractals can also be described as never ending patterns, as the smaller the scale we go the same patterns keep emerging. These fractal  patterns are one of the few things that is easy to explain & to understand but very difficult to implement in such a way that the end result doesn't look like it was made by your 6 month old nephew. Some famous fractal are the Mandelbrot Set & the Sierpinski Triangle. A lot of things in nature display fractal like properties. How To Make Them In Unity? There are several approaches that we an take to make a Fractal, Here we will generate them recursively.
So each time a new object is created it creates it's own children which then generate their own children... so on and so forth.
This is what we will end up with:
We will look at the source code and then later break down rea…

Assets Worth Checking Out