At one of the reports I said that I was not interested in doing just websites. It is interesting for me to create projects that go beyond the site providing information about Abyrvalg + an Internet shop with socks. I am interested in doing projects in which there is an active user interaction. And so I got the idea to make a game. I say right away that I am (so far) not a professional game developer and therefore I could be wrong. I just share my experience.
Start
Based on the features of Drupal, the game should be browser-based. And not just a script or flash built into a node, but a full-fledged game that is built on Drupal. From the very beginning I didn’t really want to do anything complicated, it was interesting to implement the idea itself. I chose between economic strategy and fighting. The choice still fell on the latter, because it seemed to me that this is somewhat simpler.
We start to build
So, we will need:
- Player
- Things
- Market
- The implementation of the fight
Player
Man-made character I made using the
Profile2 module. Here, just everything is quite simple. I threw a pack of fields with the characteristics. Grouping fields is best done with the help of the
Field group , and fields whose values ​​need to be programmed using the
Computed fields . We need to close some of the fields from editing (for example, money, health, etc.).
Field permissions will help us do this. The “outfit” process is implemented using
Entity reference and
views . Although the site without views still need to search.
')
Things
With the player figured out. Let's deal with equipment. Here, oddly enough, there is also nothing particularly difficult. We turn to my article
about goods with attributes and make classes of goods "Weapon", "Armor", "Amulets" and so on. And yes, we still need
Ubercart .
Market
We will need the above-mentioned Ubercart for the realization of the market of things. I implemented the process of assigning a specific thing from the base to a specific player using the
Flag and
Rules module. Make a flag (not global!) "My" and when buying things we hang on this node
flag "my" on behalf of the buyer. Through the same implemented "equipment" player. Inventory is also displayed using Views. Just display all nodes with the flag "my" and grouping by the "class" of things.
The implementation of the fight
Here the most interesting. Implementing this, I, for the first time, in fact, became closely acquainted with Drupal programming. We will need to enable PHP Filter in modules. My main idea when thinking about the game was to counter that it was possible to attack a person only when he was ready for it. Therefore, in the "questionnaire" I made a field
“Readiness for a fight” and with the help of Views deduced all players ready for a fight. Next, we make the flag “attack the player” and assign the rule to the assignment of this flag, which considers:
- Weapon damage
- Armor efficiency
- Health amount
- Amendments to damage and health from amulets
Total
As a result, the game on Drupal is quite possible for yourself. Criticism in the comments is welcome. I would especially appreciate criticism from game developers.