The CP Social services are build upon the SOLID principles, these principles were used to make sure CP Social was understandable, maintanable and flexible.
CP Social is build up from 3 main services:
- Authentication service
- Achievement service
- Cloudsave service
All these services have their own responsibility.
The authenication service in CP Social is responsible for authenticating the player with a third party provider that maintained all the users personal data. Furhtermore the authentication services would, when authenicating the player, request the required access to the resources needed by CP Social to operate.
If the player would decline access to any of these resources needed by CP Social, the authenication services would signal CP Social, it had to fall back to the ‘unsupported’ platform to make sure nothing would break in the game that relied on CP Social.
One of the requirements was the support for achievements. In short achievements are small tasks within a game that players can complete to gain a reward. Usually this reward is some sort of badge on the players profile, but they could also be rewards in game like item, levels, etc.
Every platform (except unsupported) had a third party provider that would manage the achievements in game. The task for the achievement service in CP Social was to translate this implementation to a single overarching implementation that could be used by a developer independent from the platform CP Social was running on.
The cloudsave service in CP social is responsible for implementing saving functionalities within CP Social. This service is able to, when available, save and load game data to and from the cloud.
If their are no external cloud services available, because the player didn’t give access to it or it just doesn’t exists, the save service will use the local storage of the device it’s is running on to save all game data.
If an external cloud service would become available the cloud service would synchronize the local saved data to the cloud service automatically as soon as this service would become avaiable.