What's a "ChimpFrameWork"?
The ChimpFrameWork is the project I worked on during my graduation internship at ChimpWorks Games. It is a framework built in Unity to support the integration of several features (modules) to shorten the development time of a project. The framework consists of several features designed to provide a basis for modules to function within a project, such as an event system that decouples the sender and receivers of a function call. The framework was used to create, among other things, a challenge module that allows a designer to easily define challenges in Unity's inspector interface. These challenges can then be made fully functional simply by adding a few event calls.
The event system handles communication between modules and other scripts that cannot have dependencies on each other (modules should not assume that other modules will always be present). The event system has several functions top accomplish this task; Subscribe, Notify, Enqueue and Dequeue.
In the video below I will use the event system for a few simple tasks. First I will use the Notify function to update the UI when the player collects a score point or a currency point. Then I will use the Enqueue function to store a "ReviveOffer" notification in the event queue and use it when the player is "killed" with the Dequeue function.
The stats system is where the productivity advantage of the ChimpFrameWork starts to become apparent. The stats system allows designers to define player statistics from the Unity inspector. The way these statistics are calculated is selected from a dropdown menu, containing the four types of player statistics found in ChimpWorks' games (Average, Average Top 10, Top/Highest and Total). Each statistic is updated by calling an event, which can be selected from a dropdown menu. Persistence of these statistics is done automatically on startup and shutdown of the game and the value of a statistic can be retrieved very easily.
In the video below I will add four player statistics dealing with two different resources (score and currency). These stats are updated at the end of each "run" with the amount of currency and score acquired during that run. The updated stats are then shown on a stats panel.
Like the stats system, the challenge module was designed to improve workflow for both developer and designer. The module allows designers to easily define challenges in the Unity inspector. These challenges respond to a set of events that are called from other scripts, to update a challenge's progress or trigger a challenge's conditions. In code, the challenge module was developed according to the Model-View-Controller pattern, which separates the UI from the internal logic. This makes it easier to swap out the existing UI for something else, while also making the internal logic more expandable.
In the video below I will create two challenges dealing with currency and score. Because these challenges make use of existing event calls, only a single new line of code is required to make these challenges operational.
How I worked on the project
Naturally, I did not simply start programming right away. Before I got to work on creating the stats system and challenge module interfaces, I made wireframe mock-ups to ensure that what my employers had envisioned corresponded with what I had in mind. This also gave me the opportunity to expand upon their vision with suggestions for improvements. Before getting to work on the code, I would create drafts of (UML) class diagrams and see if and where design patterns could be applied to make the code easier to expand upon. I was pleased to note that creating wireframe mock-ups of custom Unity interfaces was integrated into the company's workflow as a result of my approach to the project.
My thoughts on the project
This internship taught me a lot about working with the Unity engine in ways I hadn't done before. I learned a lot about editor scripting and creating custom inspector intefaces. While determining how to best create the various functionalities I learned a lot about applying design patterns in Unity and about the component-based programming paradigm that ties in so well with the engine.