how far is drupal in pvp games?

Events happening in the community are now at Drupal community events on www.drupal.org.
ocamp's picture

I have a lot of experience with drupal, but none with creating online games.

Im looking to get into building online games, but im trying to give myself real targets.

So im here asking what I currently can acheive with drupal, pretty much out of the box.

Ive seen some modules, RPG, game, 5 second game.

5 second game gives an example of Rock-Scissors-Paper, great, now I have a player v player game on my site. The module also goes onto explain you can create classes, gain levels, exp, stats, etc.

Pretty much a good basis for a standard pvp.

But what can this be compared to?

Im not talking about games like final fantasy or wow.

Does anybody remember those bandai digimon battlers, where you would train a digimon, and battle it against other users, it would evolve into different types of digimon each one having diferent strngths and weeknesses, then you would battle it against another digimon, you wouldnt actually attck the other person, it was already pre determined but it would show up on your screen in 3 different steps. Would I be able to create something like this but for a drupal site?

How about something a little bit more complex, ever played pokemon, on like the gameboy? You would go around looking for other pokemon to play against, getting more experience gaining new skills and the battles would be turn based, and you could select which attack to use? Sometimes you could even equip pokemon with different items.

How about this? is this capable at the moment with current drupal modules?

How long do you think it would take to be able to create an online game, such as a site that mimics digimon, or pokemon? Im not to concerned about the whole world thing, just the battle pages, so like maybe have 3 links on my site saying battle a computer, battle a random user, or choose a player to battle against.

What else would I need to know about besides drupal, to be able to acheive this?

Comments

PHP

tpainton's picture

I have never played Pokeman or Digiman. (I am of the Quakeworld/wasteland era). I assume they are graphical interface. Theoretically you could use the Services Module and Flash together. However, then, why even add Drupal. Just make a flash game.

That said, if you remember the text based games such as Wasteland and Wizardry then Drupal is definitely ready and able to take the challenge.

I am currently months into a game. I would say the most valuable asset in making it is just PHP itself, then Jquery. CCK then allows use of other media to support the text.

Currently my modules are supporting Live chat using jquery. My geography engine has been established. Everything is object oriented DRUPALISH that is. Not real OOP as Drupal doesn't support it as such but rather NODE BASED. Every room is a node, every item is a node. Items then have instances created.. Not real instances like PHP OOP but.. well, virtual instances. That is, the node exists and carries all the information such as title, image, damage inflicted, special powers etc. but when a player carries the item, there is simply a record in the database that Player A, carries Object B. This way, I can have 1000 Pistols in the game, all represented by a single node. (pistol), In addition, a single node can represent a CLASS of items. For example, I have a node called Apparel that has a property of bodypart that signals what body part the clothing goes on.. ie A Hat uses $inventory->head. Inventory is an Object, that is held in the database (using queryable variables module). So now I can make a new node called, Backpack, which has the properties created in Apparel (using shared properties in CCK) AND I can use a new property ->Volume, that is taken from the "container" node. So now, my backpack, is worn on the back, AND can hold X cubic meters of items. (I also have weight allowances per character determined from other items). So essentially we have a nice way to use multiple inheritance. I can create an item, give it properties that the engine knows what to do with, then with once click, create 100 of these items and throw them into the game world.

So, yes, I would say that Drupal is an amazing platform for game development. I am having a hoot. I typically do ecommerce stuff, so this is a nice fun welcome change of pace for once.

Hi Todd, Sounds like you put

Aniara.io's picture

Hi Todd,

Sounds like you put a lot of planning into this. It's giving me a couple of ideas to implement in my own thing. I was wondering how do you actually handle the combat system in general.

Good luck and have fun! :)

Funny you should ask!!

tpainton's picture

Because I just started working on the combat system last week. My system uses ajax to update events. The node view represents the room view. So, when an event happens in the room, it is updated real time to the user as ajax updates to hook_view().

I have a jquery script that polls the server every X (I used 5) seconds to see "whats going on". I call this a game tick.

Basically, combat is one way. It is not two way as is traditionally the case. That is, I attack, you attack, I attack you attack. Instead, the flow goes as follows.

Check my State. (State is dead, unconscious, panic, etc)
If my state allows me to attack then attack.
If I hit, subtract hit points and change the target's state. (dead? Panic? Unconscious?)
If I miss, change my state (off balance? Slipped to floor?)
and repeat every time the game tick hits.

Meanwhile, my opponent is doing the same.. Maybe they are attacking back, maybe they are running from me like a scared chicken.. Maybe he is passed out cold.

Combat is done as follows.

Click on 'monster'. This is a link in the room, that is displayed via hook_view()

This link pulls up a popup that displays the monster, and a little information about it. (It is not a node.. it's a page. that takes info from the monster node and this page is an 'instance' of the monster.

The form has combat options.
The first is the action, such as "take cover", or maybe "bar fight". These are nodes with CCK fields.

depending on the action, it might have a tactic. So if you pick 'barfight' then you get new options via AHAH such as 'Tackle', or 'swing madly' These too are nodes linked to the action via node reference.. (off topic, as a player gets more experienced, he gets more actions and tactics.. So you might start with barfighting and swinging madly as a tactic, but with more experience, you can get actions such as 'Mixed Martial Arts' with a tactic such as 'Arm bar' or 'Submission hold' or something like that)

So now the user selects the action and possibly a tactic..

On submit, we create a conflict object that contains all the data we need.. target, attacker, starttime, tactic, and action.

Now, every time the game tick happens, it runs combat_execute() that goes through users set of conflict Objects and acts on them appropriately. Meanwhile other users are doing the same.

What happens when the user logs out? Not sure yet. Maybe on logout, the players involved in combat get a coin flip and their fate depends on that.. have not gotten that far yet. I do know, logging out is not a way to escape the monster. :)

interesting

csg's picture

This is very interesting. I plan to write a game too, so I'd like to know as much as I can about yours to get ideas, see good practices and learn from your mistakes.

I also plan to use a "game tick", but I think an ajax call is not a good idea. If I got it right, in your game the player chooses an action and tactic before the combat starts, and can not interfere later, so all the ajax calls are unneccessary, they can be perfectly predicted. The whole fight should be calculated at the beginning, sent to the player's browser, and only revealed to him step-by-step at the game ticks by jQuery. This would greatly improve the performance, lower the server load, and the logout of the player would make no difference. You could also add a button for impatient players to skip the combat and jump to the conclusion.

What do you think?

Your idea of inheritence with CCK fields is a good one thogh, I'd never have thought of that!

--
Gergely Csonka
http://cheppers.com

Well, player can adjust during combat.

tpainton's picture

Actually, the player can adjust tactics during combat. For instance, Player may start combat using "Flailing Punches", but find himself quickly overwhelmed. He has an opponent that is very quick and he can't hit him. so, the player switches tactics. Technically what happens is we drupal_write_record() and update the conflict object to contain a new tactic. Now the game tick finds the new tactic and acts on it.

It gets better though. If a user has several players, then we can combine tactics to achive 'combos'.

For instance. Player 1 performs tactic 'tackle'. He hits, and the opponent goes down. Player 2 performs tactic 'head stomp'. He hits. the outcome is now different that if either player had just performed the single tactic. It's like a wrestling tag team move. More Elaborate combos can be achieved by combining different tactics.

One fire team may suppress, while another fire team flanks. etc.

Meanwhile, the defender is also trying to apply combos on the enemy. It almost becomes arcade using text as the medium.

I was going to use the idea of combat fully evaluated and then passed back to player, but I got carried away. Mafia wars of course uses this technique and it works.

Games

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week