Tools

Custom Unity Library

Custom-Unity-Library

My custom library with extensions and tools for development with the Unity Game Engine. Coursework assessment for 2017 Profesional programming IMT3602.

Project Members: Daniel Fox

There are no other repositories connnected with this project.

Strengths And Weaknesses Of C# Language

The best strength of C# is that the language can be suited to any scenario. The flexibility and ease of maintenance means that developing some complex systems can be quite easy. Most of the stress and responsibly with garbage collection and handling memory efficiently is taken away from the programmer leaving them with more time and focus for increased productivity. Additionally the strong object-oriented model has given the language some strong and powerful tools available for use. An example of this is where I have used reflection in a extension generic list class:

Alongside these strengths, C# is one of the best chosen languages when it comes to innovative development as there is a large community offering plenty of advice and help online.

Weaknesses of C# rest in the “heavy weight” of the language. While there are many great things, there are also a lot of tools which never get used by the majority of developers because the range and extent of capability of the language is so large. A good programmer will know where to make their code relatively efficient but there is still a lot more overhead compared in the language compared to say C++. There is also discussion on C#'s cross platform capability with the .NET framework - although for development with the unity game engine, this is hardly noticeable.

Processes During Development

As this project was only undertaken by myself, I was able to control and review my progress at any point. Whenever I was looking for advice, I found my answers and help through online research or my peers and tutors.

  • Use of version control systems, ticket tracking, branching, version control

For simplicity I have been using source tree to manage the control of this repository and to show personal improvements with the techniques covered in the course such as semantic commit messages. There was no need to create separate branches for however in future development there may come the need if a certain task is large enough to warrant the project to have separate work-lines.

Programming Style And Commented Code

Over the years I have experimented and change my coding style dramatically. Now I believe to have found a reasonable and effective style which works well with C# and demonstrates appropriate discipline with the language.

  • Path Seeker 2D - Example of discipline to coding style with appropriate comments

For encapsulation, the standardised approach with C# is to drop the brackets below the implementation. For quality of code, another programmer should be able to read C# by following the encapsulation in a “wave-like” motion through complex functions. This opposes the standardised format for languages such as Java even though the languages have many similarities. An another note, I found an effective naming convention for localised variables with less than public access to be an underscore '’. This is a personal preference as many prefer to use the prefix of "m" or “m” to signify the term “member”. The underscore is simply another prefix one can use. The important part is to remain constant throughout the project in the decision of prefix that is used.

Briefly touched on, commenting style in C# is often better declared and readable when above the implementation. This is lingered through the language as supported summaries for methods and classes form in the same manner. Comments are not always necessary and should be used appropriately to explain complex sections of code or other inheritably abstract concepts which are not always clear to other programmers reading the code. The example I have linked to the Path Seeker 2D shows my comments while explaining an A* search implementation.

Use And Integration Of Libraries

With my project there are no other external libraries used other than the default systems library and the Unity Engine. In future work, different branches of my library may use other libraries which will be defined within the code. The most commonly used part of the systems library for tools and power of functionality is the LINQ extensions. These extensions have provided the functionality for some otherwise complex problems.

Enumerable extensions such as .Where() and .OrderBy() have made it possible to combine many complex tasks into more readable and satisfactory code.

Professionalism In Approach To Software Development

With the approach to this project, the focus was to build a library which can be used by myself and other developers or programmers. With this in mind, my emphasis was on the delivery of quality of code and making sure that I adhered to generalised standards within the language of C# so that my code may be included in other projects - for myself as well as others. Moreover I took approaches to this project in a professional manner to demonstrate aptitude of knowledge.

Code Review

Throughout the course there were several code reviews which took place warranting some work I had done previously, and in a separate project of which the AI system was included here. I took all advice and feedback in a constructive manner and was able to apply it to improve my code. One highlighted key point for me personally was the criticism of unorthodox approaches to structure and representation of created systems. I found that I was creating ways to represent my work in a more abstract path than normal. While object orientation lends itself towards this, I was taking it to another level which I needed to tone back. Finding the right balance of abstraction and using different data structures to represent my work for readability has definitely shown to be an area of improvement which I have gained. Needless to say, I was able to take feedback and rework areas of my project which were at risk.

  • Behaviour Tree - Custom Weighted Behaviour Tree was a discussed topic during code review session

My extension to a common behaviour tree brought about some interesting topics for discussion in my final code review. The strange approach I had taken to return instances of the tree after each stage of building was the point in question. As mentioned above, techniques such as this lend themselves towards C# as a language but can come across as fairly confusing concepts to programmers from a different background. My future solution for this is to create a visual scripting extension much like the blueprint system in Unreal Engine or uScript in Unity but for the purpose of the behaviour tree only. Aside from the representation, I had one issue with my behaviour tree and a mess of interfaces which was discussed. The problem was the addition of weights into the tree and how the inheritance hierarchy would be implemented in a professional manner. The conclusion was to give every node the option of having a weight and take the hit of complexity in the selection process of all the children of that node. I went about re-designing the architecture and was able to implement a new system using null able types to quarantine the weights before they are obtained.

  • Path Creation - Neighbouring system related to discussed topic during code review session

My first code review session was on an old project with a pathfinding system which was a complete mess. We discussed the ways in which a better model would be created for readability to other programmers. As I had taken this advice on board, I set about including a completely new system for pathfinding in this project; the navigation works by keeping a map relating to the direction of a node’s neighbour and the instance of the neighbour itself. I am very happy with how this section of the project turned out as I was able to generalise the code for future use in many different projects.

Individual Discussion

  • Path Creation - Utility for Path Creation (Consideration of good code)

Although this is the same link as previously put in the Code Review section above, I believe this code demonstrates a clear and effective way to communicate with other Programmers and anyone else who reads it. The methods have appropriate names and share similarities in how they function. The stages in creation of a node network are also well-structured in layout and well-commented to explain their complexity.

  • Consideration of bad code. (3 links are related)

While the re-designing of the behaviour tree was a success, it led to un-naturally complex base classes to generalise the behaviour of parent nodes. There is a lot of abstraction here between the base parent class, the weighted extension class, and then finally the weighted parent behaviour that gets put in the tree builder. It is hard to determine a common functionality for the parents as they can almost be completely different, but at the same time share all the same properties. There is potential here that exposing larger functionality to derived classes may improve the readability of code despite leading to retyping similar or the same implementation in multiple cases.

  • Personal Reflection About Professionalism In Programming

Before I started this course I only had some idea about the extent of being professional about my code. I knew it was important but I was happy to let code slip through the nets of any type of quality test. I used to switch how I would style my code from project to project - while this is good when you are learning to find what naturally feels best, I learned there is another level of professionalism that needs to be taken. Without professionalism, communities of programmers would fail to collaborate in an effective way. With the programming world changing as fast as it is currently, everyone must be on-board with general mannerisms, conventions and approaches to their work as a professional otherwise it simply can’t be taken seriously enough to be understood. As a result of this course, I personally now feel ready as an amateur programmer that I have understood the correct professional approach to begin working in an industry environment. Although I still have much to improve, my motives and thought processes towards my work now begin with the professionalism.