WordPress is an awesome tool. It exceeds its CMS objective to be applied in many other things.
Thanks to the many features that it has. I am planning to implement it with Gamemaker Studio 2.
In this post, I will go through the logical aspects on implementing this feature.
On future posts, I will go into the technical aspects and share some code snippets.
Why a score system?
I am really a lover for retro games. I grew up on the late Atari 2600 Era and the Nintendo Era.
Most of the games, one of the features that it made it attractive. It was the score system especially on Arcade Systems.
Being on the top, it was one of the goals of the game.
Gordita and upcoming games are retro type games and it will benefit of this feature. We want to connect these results to the actual site.
So, players can try to be on the top of the Scoreboard and you can check yours against other players in all the games.
Gamemaker implementation
There are two parts on the logic regarding the Scoreboard. First, it is on Gamemaker.
Gordita and upcoming games are exported for HTML5 and upload it to the server.
So, players can play it out of their own browser. Instead of downloading it to their device.
We need to create a new room called “room_score” and set up an object to control the calls and gets the data from the site.
It also need to create the text with that information retrieved from the site.
Gamemaker 2 supports HTTP Request calls and JSON. When a player just finished a game.
The “room_score” will display a pop up with the option to enter the name. The score with the player’s name and the game’s name are sent to WordPress and it saves it.
WordPress implementation
On WordPress is where the most of coding happens. First, We need to see if we are going to implement it into the theme or create a plugin. I am still thinking about it.
- Advantages on the theme: it is faster to implement and compatibility is one of the issues that can be sorted quicker. Especially, Because this site has a custom made theme.
- Advantages of the plugin: It is easier to implement on other sites and themes. Just need to install it.
After that is sorted out. We need to evaluate the best solutions. We can save the data as an option. It is way easier to implement but, it will hard to upscale.
For example: if we are having 1000 scores. It is saved on the options value as an array. So, if we want to get the score of one particular player in all the games. It would be harder to get. Because we need to go through the whole array.
Another solution is to create a score post_type and save player’s name and game as a post meta. Also, we can separate with categories too. It will make easier to control the data.
Then, we need to create two ajax calls. One to save the data that it comes from the game and another to retrieve the data that it comes from the game into the game or the site.
Then, for displaying the score, we can create a shortcode and it will display all the information within a table with React. Also, we can add dropdown to pick the game and search feature to check players’ name.
This is a working in progress. So, I don’t know if it will be translated as it was described on this post.
0 Comments
Comments are closed.