I want to share with you some details of a small tool that was created to analyze patterns in the release of games for consoles. The motivation was to find a reliable source of information to design strategies for releasing Cosmos Defenders on the Nintendo Switch.
Understanding how the market flows, helps a lot to decide when is the best time to set a release date. In addition, I found many useful articles that provide information about things to consider when deciding a release date, paricularly this article has valuable information, it’s short and well explained.
The idea was to find information about game releases or announcements, take that data and organize it so it would be easy to see trends or patterns from it.
Wikipedia has detailed information about game releases for consoles, including Microsoft, Sony and Nintendo devices. Usually data is organized in tables and contains details such as game’s name, release date, genre, etc.
Using the numbers that Wikipedia provides, would help to automatically keep the results up to date, accurate and reliable.
The next step was finding a way to retrieve the data from Wikipedia, clean all the unnecessary stuff and organize the numbers that mattered.
The amazing people that created Wikipedia, provided an API that enables developers to get data from the encyclopedia using a web service, you can read details about it here.
I wrote a script in PHP to query the database using cURL , with the result of this query, we can just count all the desired elements and achieve our goal. There is a good explanation about using Wikipedia’s API in this post.
// Initiate curl
$ch = curl_init();
// Disable SSL verification
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// Will return the response, if false it print the response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Set the url
$result = curl_exec($ch);
The result is stored in the variable $result and that’s the data what will be cleaned and used in the final chart.
This is the most annoying part and also the reason why I still haven’t added all the features that I want for the tool. Cleaning the data involves getting rid of all the unnecessary things and getting only the specific values that we want.
Display the Results
For displaying the final results on the browser, I used Chart.js a great and easy to use tool to create dynamic and animated charts. Data is obtained using Ajax and with that, used to create the charts that you see as the final result.
To avoid calling the Wikipedia API every time that we display the results on the browser, a file is stored on the server with the latest results and, instead of directly calling the API, the information is taking from this file. Every 15 days, the file is updated with new data and with it, the results are more or less up to date.
- Add information such as: game genres, developer, etc.
- Include more consoles’ stats, specifically Xbox and PlayStation
- Let me know if you have ideas for more features
For game developers working on Nintendo Switch titles out there, this could support you to decide the right time to release your game, of course there are more things to take into account when deciding but at least you have one less to worry about. I hope this helps!