Challenges and solutions
We started the project with the semi-finished MVP, built by the client, therefore we had to recode and refactor it substantially. Our experienced team-lead offered a viable solution to make the system more flexible and stable in terms of loading.
We wrote reliable scoring algorithms, paying attention to proper input and output data analysis. There will be a couple of game modes differentiating in the game process. But evaluations should be the same across each of the game modes in order to keep the data integrity and valid format for analysis. As we have to manipulate the data between users and store statistics according to data selected by users, we decided to implement WebSockets technology and use it in each game room by creating a channel for each pair of users and trigger actions according to the data they send. This approach proved itself to be much more effective than the alternatives, like long-polling.
For scores and game process calculations, we had to use advanced algorithms according to the client’s specification.
There are often situations in a game when a user leaves the game room unexpectedly, and in such cases, we needed to inform another user accordingly and prompt him to start another game. The current game session should be destroyed, as the data can not be used for further analysis. We solved this problem successfully.
Another challenge was to make the application as scalable as possible in order to maintain at least 500 game rooms, which results in 1000 players online, and playing simultaneously. During the stage of project planning, we noticed that this project requires proper and complex DB structure for storing relations between users and computer users, games statistics, and for making the analysis and results export as simple as possible. Therefore, we produced a highly organized DB with complex relations and dependencies. After that, the platform passed load-testing successfully.
For exporting and importing data, we decided to apply two approaches. First, we used ActiveAdmin as the admin side view. Second, we used CSV to batch import images. We developed a powerful, highly customized and detailed admin panel that not only has usual features, like downloading pictures of goods, but gives the administrators and researchers unlimited possibilities to create a game with practically any desired parameters, like playing only against AI agents, or people, and setting the skills of AI Agents. Indeed, as previously stated, the admin environment makes the platform a controlled environment for the research.
Working with the project that uses algorithms so heavily, we also faced integration challenges. We had to integrate the AQ algorithm for AI Agents into our Ruby project. We also integrated the Elo rating system known from chess. The ready-made module did not process player’ inputs properly on our platform, as initially, it used the Gem library. The integration of this standard module would require a cumbersome architecture. We therefore ultimately customized the existing module to ensure its smooth integration into our game platform.