Week 10 Development (Devlog)


Tasks Undertaken:

- The primary tasks for the week involved tidying and refractoring the developed Inventory System from the previous week for concision and runtime efficiency that allows for faster memory processes alongside the continuation of the Inventory System to allow for Weapons to be equipped on runtime for the player and feed weapon attribute data to the Player when certain items are equipped for Player buffs that could be built upon later in the games development lifecycle. A variety of Sprite concepts for the Inventory UI were developed alongside a test Pickup Item with a complementary RotateandBob script to make the visual information more engaging and overt for all Team Members.

- The predominance of refractoring completed during the course of the week was concatenation of long code strings into smaller more understandable ones by removing redundant code that could be coupled with the refined code in conditional statements for Array checks with the Inventory System. This allowed for memory preservation as the process was no longer called on the update function every proposed frame but rather when the respective Interface was being Serialized or Deserialized with Event Trigger interaction, using the ISerializableCallbackReciever.  Within the UserInterface parent abstract class, a series of static variables were created within a static class holding all of the Mouse interactive data which can relay the same static information infinitely during runtime of the game with no changes. Using these new static variables, the code could be make more concise and readable for all Team Members lowering the necessity for extensive commenting throughout the scripts.

- The transference of Buff information from Weapons to the Player coincided with the equipping code which was defined within the already created StaticInterface that displays equipped items alongside some changes made to the ItemObject and InventoryObject classes. The InventoryObject classes most notable change was the integration of a type enumerator that assigns the Inventory Type (Inventory, Equipment, or Chest) this is used for the combined functionality of Buff feedback and Weapon Equipping by setting up a Switch Statement that alters functionality between the different Inventory Types that are defined. This code accesses a  Game Object that is assigned to all of the different scriptable objects and if equipped  should instantiate the object. The Buff information also derives from the ItemObject Code enumerator types which is then accessed by the IModifier Interface. This transferred information should then be printed in the Debug log for testing purposes as the process is defined within the PlayerInventoryBase with a check in each equipment slot and calculate the sum of the defined 'Agility, Intelligence, Stamina, and Strength' attributes. These attributes currently have no impact on the player however act as a framework to easily modify and update players stats once integrated later including Player Health, Movement Speed, Accuracy and many other variables. The finalised equipping of items had to be integrated via the Weapon Switching Transforms rather than bones for the Player due to currently using a placeholder cube for the Player Controller. This still functions as intended with full control of the Weapons as equipped by the Player.

- An additional script that was developed for the Weapon and Munitions pickups was the RotateandBob script which was simple. A set of Vector3 variables are used to assign a beginning and end position for the object alongside two floats that control the respective Rotation and Bob speed. The use of the Vector3.Lerp function is what stands out from previous scripts that have been worked on with similar functionality. A Lerp is a Linear Interpolation between two points which is a mathematical application for calculating the mid point between two values and providing a complete range between those two points. This allows for a constant flowing movement between two points which then the movement is further modified by the implementation of a Mathf.Sin function for trigonometry that normally calculates the opposite angle of a triangle. Applying this to the RotateandBob script, the minimum and maximum peaks for the Sin value are startBobPos and endBobPos which is then displayed using the Time.time function which gives us a slow ease in and ease out effect at the two peaks of the Sin Vectors.

- The development of the test Sprites for a variety of Weapons and Consumable items was quite simple, taking renders of 3D assets that I've have designed prior and applying Glow Effects and colour overlays within Photoshop CC to lay the foundation of the Rarity system that would coincide with the Loot Crate system that can be developed in the future. These sprites were then imported into Unity and assigned to the Scriptable objects allowing them to be displayed within the Inventory Slots as items when picked up.

Obstacles:

- The continued process of development was completed using the previous tutorial series by 'Coding with Unity' so minimal complications arose from experimental developments. One error that did occur that was remedied near the end of the code process was the firing of the Buff Values code within the OnBeforeUpdate and OnAfterUpdate functions within the PlayerInventoryBase which wasn't being displayed in runtime. The fix was relatively simplistic and pointed out with assistance with a conditional statement check for if the Inventory slots were empty that was in the OnBeforeUpdate but not within the OnAfterUpdate.

Links to the Tutorial Series videos are listed below:

1. https://www.youtube.com/watch?v=Yp5ADg0dFiQ&list=PLJWSdH2kAe_Ij7d7ZFR2NIW8QCJE74CyT&index=7 (Code Review)

2. https://www.youtube.com/watch?v=c2MUa6a9QXw&list=PLJWSdH2kAe_Ij7d7ZFR2NIW8QCJE74CyT&index=8 (Pass stats from item to Player)

3. https://www.youtube.com/watch?v=RESuTNMdqqQ&list=PLJWSdH2kAe_Ij7d7ZFR2NIW8QCJE74CyT&index=9 (3D Model Equipping)

Solution Reasoning:

- Predominance of the work for the Inventory System involved following the final Tutorial System videos to allow for consistency and finalisation of the structures which was found quite suitable for the project.e The use of this series as previously explained created an advanced framework for the Inventory System with a variety of useful functions to the Player that is highly modifiable and can be part of Player advancements such as more Inventory Slots being unlocked as they level up, alongside buffs applied to the Player in accordance with particular weapons or equipment. These aspects would be foundational for later developments within the game that could be developed in to higher order game processes that are notable within a large number of modern FPS RPG hyrbids.

- After conducting some minor research and approaches for the bobbing movement for the RotateandBob script, the implementation and testing of the combined Lerp and Sin curve allowed for a flowing movement which was considered superior to the jumpy and mechanical movement provided by alternative tests with the Ping Pong mathematical function. Whilst the functionality is currently suitable, the use of the endBobPos requiring to be manually input within the editor is meticulous and unnecessary. A future plan to have it be set as the transform  of an empty game object position would allow the bob to move to great lengths still which may be useful for alternative game objects using the script such as platforms whilst removing the necessity of manually inputting the Vector values. This provides a far more modular design catering to a plethora of other objects that require this form of movement.

Leave a comment

Log in with itch.io to leave a comment.