• Register

Instant racing fun in the vein of arcade classics with modernized mechanics and special skills to use intelligently. No random power-ups mess.

Post news RSS Communicating the game and the web

Good news everyone! This time we have a high-level programming freak publication. As already mentioned before, Formula Wincars is much more than just the gaming side. Its community is as important as the game itself, and this community exists online at our website, which, so far, you only know by the development blog. But below, there is much more stuff waiting to be released along with the game.

Posted by on


Good news everyone!

This time we have a high-level programming freak publication.


As already mentioned before, Formula Wincars is much more than just the gaming side. Its community is as important as the game itself, and this community exists online at our website, which, so far, you only know by the development blog. But below, there is much more stuff waiting to be released along with the game.

Then, without having to specify things by hand (just in case you did not know, computer maniacs automate absolutely everything we can), how do both systems, web and game, endure? Well, there are several answers to this question, step by step:

Riak from game’s side

Riak plays a key role as an interface of both systems. As NoSQL data base, Riak allows us to have a game that will have a furious Online, with a huge amount of requests. From the game side, it’s very easy to store information on Riak like progress data, rankings, tournament information, characters, circuits, etc, which will be read, filtered and displayed afterwards.

Riak from Drupal’s side

From the point of view of Drupal, this is not so trivial. We must install a system that allows us to execute PHP code and also satisfy the needs of each use case, since we will need to do quite different things with it. Like for example, writing in Riak information of a new user player’s* register, or update the fans when a player from the forum indicates that he likes another player’s post.

* Never use user, we make games, not boring management applications!
Here are multiple options (blessed be the customization capabilities of Drupal) but I narrowed it down to two already: making ​​an own custom module or using the existing Rules module.

Creating a custom module is a good choice but it’s a too time-consuming work, and it is also conditioned on many different use cases that will surely mutate exponentially. Taking this into account, we chose Rules, and also killed two birds with one stone, because it can be used for a thousand other things.


For those who do not know yet, Rules is a Drupal module that automates (automate again! Yeah Mr White! Yeah Science!!) certain events that trigger actions, which together with the PHP filter module allows to run custom PHP code. Now we have everything, what if a user registers a new player? A Rule giving him registry in Riak is triggered. What if a player gives a like in the forums? Another Rule that updates the social profile Riak is triggered.

Reading information from Riak

Once again, we have the same dilemma we had in writing, It is easy to solve it from game’s side since we have custom code there, but what happens with Drupal’ side? And here comes the same doubt one more time: Do we use a Custom module or an existing one?

This is where one of the most popular Drupal modules, Views , gains prominence. Particularly Views PHP module extension.


Views module is the query builder for Drupal that allows you to display data. With Views you can select the data source, the fields shown, the conditions for filtering, sorting, and many other things. In short, it is the alternative to manually writing queries in SQL and including them in PHP code.

If Drupal was a bakery, the Views module would be the tool you would use to place our bagels and baguettes in the window in an orderly and desirable way.


With Views PHP we can include a custom field with PHP code, with which we access to Riak in order to get the information we want and display it. Everything is data-driven, making it impossible to be more dynamic.

Rest API

Finally, I would like to remark on last thing. When publishing content from Drupal, like news of this development blog, nodes are stored in the Drupal database itself, SQL generally, in which the game does not have access to.

How do we fix this? Very easy, using the fully configurable Services module (we also have the Service Views module, which lets you to add all the power of Views to services), that allows to publish web services (REST in our case), both query and external query type, and we kill two birds with one stone once again. Not only do we publish content that can be read from the game, but also other external systems can use this API.

How does it sound to you if you were able to publish show your recent tournaments’ results in your profile page?

Interesting, isn’t it?

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Profile
Icon
Wincars Racer
Platforms
Windows
Developer & Publisher
DragonJam studios
Engine
Unity
Contact
Send Message
Homepage
Wincarsracer.com
Release date
Game watch
Follow
News
Browse
News
New
Post news
Share
Related Games
Wincars Racer
Wincars Racer Racing
Related Engines
Unity
Unity Commercial
Related Groups
DragonJam studios
DragonJam studios Developer