Quality Improvements for Light And Shadow - GSoC 2021 Final Report
Overview:
Throughout the summer I first worked on refactoring LightAndShadow, fixing a couple of bugs and adding some gameplay features. During the second phase of the project I integrated parts of some of the existing modules (Economy and GooeyDefence, MultiBlock and StructureTemplates) to get more general purpose features that can be easily used by any module (used in LightAndShadow as a part of this project).
Refactor:
I started off the project by deciding on a suitable structure the module could use to make it easier to understand how things work. But as some of the logic corresponding to particular topics weren't fully consolidated or properly separated, a couple of changes were made before the package's structure could be changed. Along with that some unused code was removed, documentation was added and dependency issues due to components used specifically in LightAndShadowResources were fixed.
PR's:
- Removes unused dialogs and the AttackMinionSystem and everything it required - PR
- Fixes dependency issues - PR1, PR2
- Consolidates Flag logic - PR
- Merge duplicated usage of flag components - PR1, PR2
- Removes unused actions and UI Initialization - PR
- Removes unused components from prefabs - PR
- Add documentation - PR
- Clean up ScoreSystem - PR
- Remove usage of cc - PR
- Split RestartSystem - PR
- Merge Packages - PR (Will be updated once all the pending PR's are merged to avoid merge conflicts)
Gameplay Fixes and Improvements:
- While working on some of the smaller tasks from above, I moved on to fixing some bugs and making some improvements to the gameplay mode. I started off by fixing the non-deterministic inventory which was caused by two separate event handlers modifying the inventory of a player. Modifying the priorities of the event handler's made sure that the necessary event handler (which removed items in the lobby) was used last and thus only it's effects are always seen rather than the effects being random. Once this was done some changes were made so that we could add item's to a players inventory from a prefab using the RequestInventoryEvent (previously this was done only on player spawn). This addition allowed items to be given whenever needed which in our case is necessary when a player spawns at the base and when the player dies (previously player death meant that they would respawn without items).
- I then fixed an issue which was caused due to tree's obstructing the generation of certain regions. This involved updating the surfacesFacet in regions where we wouldn't want any tree's (then there would be no surface in those regions to place the tree's on).
- Following this I fixed another issue which prevented players from picking up weapons in certain situations. This was due to the OwnerCollisionState of certain weapons being disabled causing CollisionExceptions due to which CollideEvents were consumed preventing the weapon from being picked up.
- The next task I took up was to add a pregame phase which would isolate the teams, allowing them to buy and setup the necessary items. This involved tweaking the MagicDomeSystem to isolate players during the pregame phase , making players invulnerable (by consuming damage causing events) and adding notifications along with a timer to indicate when the actual game would start.
- After this I added an in-game statistics screen which allows players to keep track of their statistics throughout the game (previously this could only be accessed once the game was over) and along with this a notification was added to help players access the Statistics Screen incase it is the first time they are using it.
- While working on my PR's I stumbled upon the system which was handling the orientation of the players and added an event handler to set the orientation of a player allowing for consistent teleportation of a player to the base.
- I also modified how the CardSystem worked (based on the suggestion from my mentors to use them as defenses) allowing players to place cards and use them as cover.
PR's:
- Fixing non-deterministic inventory and empty respawn inventory - PR1, PR2
- Picking up weapons - PR
- Pregame Phase - PR1, PR2, PR3
- Using card's for defense - PR
- In-game Statistics Screen - PR
- Make players face opponent's base on spawn - PR1, PR2
Economy:
To add certain gameplay features an economy based framework becomes important. Most of the required components are available in GooeyDefence (ShopScreen) and the Economy module. To make use of them in LightAndShadow the ShopScreen and everything it requires was moved to the Economy module and it was integrated with the existing economy framework in the Economy module. This allows the ShopScreen to be easily added to any game mode by adding the Economy module as a dependency and overriding the inventory screen with the necessary shop screen. Along with this some changes were made to get it working for multiplayer.
PR's:
- Adding the assets required for the Shop Screen to LightAndShadow - PR
- Integrating the Shop Screen's functionality with the Economy module - PR
- Extracting the Shop Screen's functionality from GooeyDefence - PR
- Testing the Shop Screen - PR
Multiblock Structures:
As LightAndShadow is meant to be a fast paced gameplay mode any feature that is added should be easily usable. To add defense mechanisms to the gameplay mode we would need a simple way to add them and destroy them. These features exist separately within StructureTemplates (creates Structures) and MultiBlock (creates a multi-block entity corresponding to a structure). MultiBlock currently automatically detects the region taken up by a structure using a recipe and creates a MultiBlock entity corresponding to that , but making a suitable general purpose recipe for StructureTemplates doesn't make sense when the necessary region itself is already created in parts by StructureTemplates. So by using the regions calculated in StructureTemplates we can create the corresponding multi-block entity and use this entity to damage and destroy all block's within the structure.
PR's:
- Sending the region of a StructureTemplate to an event handler in MultiBlock - PR
- Using the region of a StructureTemplate to create a multi-block entity - PR
- Using a multi-block entity to damage all blocks within a multi-block structure - PR
Effects:
To convert the multi-block towers we created above to defense mechanisms which deal damage we would need to integrate some effect based systems into the towers. Luckily GooeyDefence has the necessary systems and initially I was hoping to use it alongside the multi-block towers towards the end of the project, but I missed out on some of the more specific details as the towers part of GooeyDefence has a lot of things it depends on than is necessary for our implementation of Towers (in LightAndShadow). Furthermore the effects are made to act on the gooey enemies whereas in our case we need the effects to work on players. Although I was able to get a working implementation that had the necessary systems for the multi-block towers to act as defense mechanisms (on players) there was a lot of duplication as I wasn't able to extract the Tower implementation from GooeyDefence. After discussing this with my mentors we decided to leave this out for the time being as using duplicated code is generally not a good idea. (Instead due to the time constraint, after GSoC I will be looking into overhauling parts of GooeyDefence and then extracting the Tower part from it so that the Tower module will work with multi-block towers that target players (LightAndShadow) and dynamic towers which target gooey enemies (GooeyDefence).)
PR's (Changes required to make this work for GooeyDefence too):
- Adding effects to Towers - PR
- Testing towers - PR
Pending/Blocked:
I still haven't figured out why a player does not teleport back to the base on death due to fall damage. There are several systems interacting with the player right before the player die's but I haven't been able to figure out the system that is causing the problem. Also as I have mentioned above the effect's haven't been integrated into the Towers module yet and will require an overhaul of GooeyDefence before it can be integrated. I will be working on this after GSoC .
Conclusion:
I had a great time this summer and learnt a lot throughout this project. Although I was hoping to complete the project, I believe I have gained the knowledge necessary to continue working on LightAndShadow and add some more interesting features to the gameplay mode. I really appreciate the constant guidance and advice from my mentors and the community which made this an amazing experience.