Advertisement

Need Ideas for a Combat System for a Browser-Based RPG/Sim-style Game

Started by February 26, 2009 08:56 PM
14 comments, last by reykjavik 15 years, 11 months ago
Hopefully my subject made you double-take. It is, however, fairly accurate. I am working on a browser-based game. In playing some MORPGs (I mean what I wrote - not necessarily 'massive'), it struck me that players are generally unable to significantly impact the game-state. One of my core design principles is the notion of environment-player interaction. I've chosen a vaguely pioneering/wilderness/ecological theme, and so it tends to come down to choosing between carefully managing natural resources or exploiting them now for short-term gain. Right now, I have nothing like a combat system, and it's frankly not a high priority at present, but I intend to implement one in the future. It seems to me that the introduction of a combat system would provide a medium in which player organizations can grow. I say this because, without a means for enforcement, rules and agreements become basically meaningless. More than anything else, I'm curious as to what would happen if I gave my players the ability to attack each other - I'd love to see gangs and de-facto governments spontaneously develop. I don't know if they will or not. A few potentially important details: -The game world is roughly a 10 x 10 grid. You can see other people that are on your square, but you can only see basic terrain/building info for squares you aren't in. -The fundamental unit of doing stuff is stamina. Players gain more stamina every ten minutes. It represents both effort spent and time spent. Moving does not cost stamina, but most of the economic/environmental activities do. -I am working with very few types of objects. Most objects are 'commodities' in the sense that every instance of them is identical. Basically, instead of treating each piece of lumber you have as a separate object, I store the amount of generic lumber you have as an integer. The one exception I have to this right now is tools - hatchets, pickaxes, etc. - each tool is unique and has its own database row. The only real distinguishing characteristic is 'quality' - a higher quality tool breaks less frequently and helps you work more efficiently. At the same time, every hatchet works functionally the same way, every chisel works functionally the same way, etc. -The game is skill-based. There are no levels. If you want to be a better builder, go build a few buildings. Here are the requirements for any combat system I implement: 1) It has to work with a client-pull architecture. I'm doing this on budget hosting in PHP. I frankly don't feel like learning any fancy Comet or AJAX stuff. 2) It should strongly favor the defender. I want it to take 3-5 attackers to subdue a player. No lone griefers pillaging the countryside. 3) It should be very expensive in terms of stamina to engage in combat (e.g., 6-12 hours worth of accumulated stamina). 4) Skills or items or whatever gets used for combat should provide bonuses, but not too many bonuses. The best-skilled, best-equipped character should still need a buddy or two to take down someone else. One idea I have so far is to give the player a set of combat preferences that they can set from their options page - instructions for how their character should behave if attacked (e.g. offensive posture = takes and receives more damage; defensive posture = takes and receives less damage; run away = run away). I don't think this is especially interesting, and I also don't see how it could serve as the basis for something interesting. The nice thing is that it meets criteria 1, as the server can figure out the results and spit them out to both players afterward. If anyone has any thoughts, I'd love to hear them. It seems like this is probably something of a unique problem. [Edited by - reykjavik on February 26, 2009 9:38:00 PM]
Using ajax techniques is fairly easy, and will really enrich any system that you implement in the interaction sense. I have played some MMOs that have the attack resolution in a single computer determined result page, and they leave me disappointed.
Advertisement
The new 4th ed D&D has the concept of Skill challenges. these are non combat encounters that require several tests of skills to complete. You have to succeed at a certain number of times before you fail a certain number of times. Different skills can be used for different tests within a skill challenge.

Now this is not new stuff, but it is a formalisation of something that has been used informally since role playing was first invented, but the interesting thing is, is that it doesn't only have to be used for role playing.

If you used this idea as part of the combat system, you could off load the tactical aspects of the combat to a contested skill challenge between the two AI generals in charge of the battle.

Each battle would have some NPC in charge of its deployment. This might be a specific NPC Unit the player could train and field, but it could also be an average of the total units tactics stats.

Although a specific NPC (especially if they can learn - increase stats - as the game progresses) could lead to interesting consequences where by they might become captured by the enemy and then ransomed back to the player.

Now the two "generals" would have a contested skill challenge between them for various tactical advantages (eg high ground, fortifications, etc). Generals would favour various advantages based on their history and current army composition. Certain advantages would be offered to the generals, and the advantages for each general would not have to be the same either.

Each general would in turn be offered one advantage and the other would contest it. IF the general that was offered the advantage wins, then they get that advantage, if they loose then no one gets it (but then it could be up for grabs in another offering).

Depending on the General's stats and the situation, they would get a certain number of offerings, but can still contest any of the offers to the opponents.

This way defenders could be given more offers, and so have a potential advantage against an attacker (but a good attacker and a poor defender might still allow the attackers to have a final advantage against the defenders).

The players would ahve a certain level of influence depending on the training they give to their armies and the generals, and the improvements they can make to the areas (ie if they build a fort, then the defenders get the option of the fort - but as an attacker might just ravage the surrounding areas, lay siege or attempt to bypass the fort, the defender's use of the fort is not guaranteed).

You could also have prerequisites for various offers. For instance if the defenders get a fort, then they might unlock the ability to use various defences of the fort like boiling oil, etc). It might also unlock offers for the other side too, so the attackers might then get assault ladders to attack the fort as an offer (loosing this would mean that the general decides that assaulting the fort with ladders would be too costly, or that they don't have the wood necessary to build them on hand).

You could make this part of the combat system be as simple or complex as you like. You could even have the actual combat take place as this by using attacks and counter attacks as offers.

Attack and counter attack offers would depend on the troops each general has available, and could even be influenced by the player by having them specify their preferences for various actions.

Each side would have a limited pool of attacks and counter attacks based on the number of troops. Each squad would get to act once in either an attack or a counter attack. A Battle would consist of many skirmishes (attack plus counter attack).

You could use a simple counter system: Cavalry beats Archers beats Pikemen beat Cavalry.

So if one general sent in cavalry, then the other could try to send in pikemen as a counter. These would also be subject to the tests between generals and the winning general picks the troops to be sent in (even if it is the other generals troops).

An attack might go like this:
General 1 Army: Cavalry, Pikemen, Archers, Archers
General 2 Army: Cavalry, Pikemen, Archers

General 1 chooses to send in his Cavalry. He makes a contested test again the appropriate stat of the opposing general (General 2) and wins. So he is able to send in his cavalry.

General 2 now has a chance to counter attack and so chooses his pikemen. They make a contested check against appropriate stats and General 1 wins again. So he sends General 2's Archers against his cavalry because he has an advantage against them with the cavalry.

General 2 now has an opportunity to make an attack and chooses to send his cavalry at General 1 and wins this check.

General 1 counter attacks with his pikemen and wins the check. As the pikemen have an advantage against cavalry, then General 2's cavalry are going to take a lot of damage.

Finally, General 1 sends his archers against General 2, and the only unit left is his pikemen so these units must fight.

As General 2 has no units left, he can not make any more attacks or counter attacks and it then passes onto General 1 again.

General 1 has one unit left, a second lot of Archers. so he send them to join one of the skirmishes as a support unit.

A support unit will give a slight advantage to the skirmish it is involved in which would be dependent on the abilities of that unit as a support unit.

Now, because there is an uncertain determination of whether or not the General succeeds in its assignment of units, you can use a perfect algorithm to determine which units are attempted to be sent in and when, so a simple Scissors/Paper/Rock like relationship between the units is acceptable.
Edtharan - I appreciate the thought-out and constructive response. I should clarify that my game works on the level of individual players, not generals and armies, so what you've written doesn't directly apply.

ID Merlin - I only have a couple of hours worth of free time to spend on this project per week, and I don't really want to learn AJAX. If you can point me to some friendly tutorials, I might give it a chance. I use one of the low-end dreamhosts plans, though, and I'm concerned that AJAX would be too resource-intensive for the server.


I'm still thinking about combat styles, and I don't think it's a viable way to go for the following reasons:
Either the combat styles are all roughly equivalent or one is better than the rest. If one is better than the rest, there's no reason for other styles to exist. If they're all roughly equivalent, then we can have some sort of rock-paper-scissors setup or we can have random chance determine the victor (there may be other possibilities I'm missing here). I don't think there are meaningful choices in either case there.

I think that the simplified strategies are my best option so far (offensive + defensive).
I think you might have misunderstood what I intended by the "General".

A General would be an AI in charge of running a battle (as the player could not be on line all the time). They might just be a unit included in an army that only gives bonuses to the varous checks and doesn't directly influence the combats (only indirectly threough the setup and skirmish assignments).

Many games use a similar concept in that the "General" just gives a direct stat bonus to the combat stats of the unitsd in the battle. I am just proposing a more complex version of this, one that tries to impliment a series of tactics that have more subttle effects than a raw bonus to combat stats on units.

The "General" could even be a sorted list of orders the player wants to give their army. They could list, in order, the actions they want the army to attempt to undertake. This offers a more fine grained set of orders other than just "Offence", "Defense", etc orders that has been suggested.

The problem with just a simple Attack/Defence orde3r system is that often, unless very carfully designed (which negates the whole simplification in the first place), Attack and Defence are not really that different.

In standard combat, you can estimate the results of combat by subtracting the attacker's strength from the defender's strength and this give a result as to the number of units left alive at the end of the battle.

In ranged combat though, you use the square law, which is that you square the strength of the sides, subtract one form the other andget the square root of that to detemine the number of units left.

Remember though, this is just an estimate, not a hard and fast rule (for more information about this look up: Lanchester's Laws - wikipedia is good enough).

This meaqns that increasing a defenders ability to take damage but reduce their ability to deal damage, and decreasing an attakers ability to take damage and increase their ability to deal damage are virtually equivelent and offe3r no real game play (as each choice is virtually identical).

What you need is a system where by the decision to defend offers something other than just a straight bonus to take damage at the cost of dealing damage.

In the board game of Starcraft, an attacker gets all sorts of advantages when attacking, but they have one big drawback, they have to completely kill all the defenders. If just 1 defender survives, they essentually loos the battle and can not take over the area they are attacking. However, if all you do is defend, then you will never increase your holdings.

So, this system has other effecs for defending and attacking than just bonuses to stats. Attackers have the opertunity to increase their holdings, but defenders are hard to dislodge.

This makes the decision to attack or defend a more interesting decision than just stat juggling (one of the strategies to deal with an attacker is to leave a small defending force that can deal sufficient damage to the attackers, but withdraw the rest of your units, then counter attack the weakened opponent and reclaim the area before they can reenfiorce their untis and consolidate their hold on it).

So the idea I was proposing was to automate (although you could give these decisions to the player) the selections of the opertunities that an army would have to defend or attack a position (as well as how the units are assigned in combat to each other).

So, if the player selects a Defensive stance, in stead of just giving the army a bonus to take damage at the cost of dealing damage, they would instead have the "General" AI of the combat attempt to gain offers which wiould increase the survivability of the units. For example they would choose offers that allowed them to use their units as support rather than as direct combats. This owuld mean that they could avoid direct damage form the enemy and more likely be able to deny the enemy from taking that position. Attacckers would take offers that allowed them to attempt to bypass these kinds of defences. The better general would end up with more abilities they could use in the actual combats and that would allow them to achieve their goals (attacking or defending) better.

You vcould also use this to give more interesting reports to the player. Instead of just a "This army defended the area successfully", you could have:
- The attckers attempted to storm the walls with pikemen and scalling ladders, but the defender's archers managed to repell them.
- Next a cavalry charge sorty by the defeneders was met with a successfull defence from the attackers pikemen.
- The attackers archers raked the walls of the keep with arrows causing significant casulaties from the defending pikemen units.
- Although losses were had on both sides, the defenders managed to repell the attacks on the fort.

What occurred there were 3 skirmishes with the defender haivng a setup advantage of Foritifications and the attacker having a set up advantage of scaling ladders.

Now the player could do this themselves, but if this had to be done for every combat in a large game then it could easly become too complex. This is why I suggested that a "General" handle these decisions, which is essentially an AI system designed to automate these choices along with a contest between the sides so as to create a bit of variation.
I think keeping attack power low and defense high will satisfy #2. If the average player has 300 HP and weapons only do 1 point of damage, it makes a lot more sense to get 10 people than go it alone. If every defender naturally does 10 points of damage while attackers do 1, it makes even MORE sense to get more people.

Of course the problem with this system is what happens when both sides get 10 people?

Also a possible irony for a non-combat game is that by favoring the defender you may actually end up with lots of combat, as one theory of conflict asserts that when this is the case, war will occur more often because the cost of an attack is relatively low (siege warfare in Europe for example); alternately when combat costs are very catastrophic, peace is more likely (as with war among super powers in the nuclear age).

For #3, what about the idea of personal or squad strategies which costs varying amounts of stamina? A light raid, for example, shouldn't cost as much as a clear and hold action. In theory you could have chains of strategies which are necessary to take a particular square, especially if it's nuanced enough to be a region with differentiated properties. Clearing a camp might first require reconnaissance, which costs a certain amount of stamina based on how you want to do it (quick and dirty, carefully where it takes all night and you miss sleep, etc.)

--------------------Just waiting for the mothership...
Advertisement
Edtharan - In my game thus far, I haven't really done NPCs. Also, as combat is not a primary focus, I don't know that I want to create so many combat-related roles, structures, and items. I will think about it.


Wavinator - I've been thinking about it a lot, and I really like your idea about squad strategies. I don't have any sort of code for grouping at present, but it should be trivial to create some sort of squad system. I imagine it'll work like this: if you're on the same square as another player, you can elect to 'follow' them, in which case all of your movement and combat decisions will simply mimic theirs. I think I would still have individual players set combat preferences (e.g., fight or stand ground), but the interesting part of combat would arise from different squad formations.

I should mention that, at present, no one can 'own' or 'control' a square, but you can build (and subsequently own) a building on a square.

I would appreciate ideas for types of squads, their names, and their effects on one another. Note that I don't intend for the characters to be professional soldiers, by and large, so extremely complex strategies and specialized tools should be kept to a minimum (maybe one or two, to reward players who decide to focus heavily on combat). My PCs are mostly woodsmen, miners, smiths, carpenters, etc. (the idea being that this is a frontier region being settled and exploited for chiefly commercial gain).

A few quick squad ideas that probably need reworking:

*Torch mob - a bunch of people with destructive implements who excel at damaging buildings, but are weaker offensively and defensively. Min: 2 PCs
*Roving mob - a loose, mobile formation, focusing on guerilla-style strikes. Very effective offensively and defensively, but very stamina-intensive. Min: 2 PCs
*Hold the line - a close, linear formation with poor mobility. Primarily effective at defense and at preventing other PCs from passing through the square. Min: 5 PCs
*Back-to-back - a tight formation with moderate mobility. Extremely effective at defense. Min: 2 PCs

Normally, I don't charge stamina to move around the map, but I might for squads, just to enforce the differences in mobility (e.g., 'hold the line' would require a bunch of stamina to move). I don't want to put a timer on the number of moves per minute or whatever, because I don't like the feel of that. I'm open to other ideas, though - maybe create a separate pool of movement points for squads, which replenish every ten minutes like stamina (problem: either squads would have to start with 0 movement points, or players could just break and remake their squads over and over to get unlimited movement. this would suck because you'd have to wait ten minutes to do anything interesting once you've grouped... actually, that could make sense, on the basis of having to organize yourselves. possible alternatives: put a cooldown on squads, so that you have to wait ten or twenty minutes between breaking a squad and forming a new one.)


The Generals are not NPCs, they are an aspect of a collection of 1 or more squads. It is a routine designed to give the game the ability to have groups of squads enter combat without having to constantly have the player specify how they go about it.

You don't need to make any new building, tools, units or NPCs. It is simply part of the combat system, no more no less.

I understand that combat is not a major part of the game, but as it stands it appears that this is the most common way that players (even computer players) will interact, so it needs a fair amount of detail and work if it will maintain the players interest. And, as the thread is labeled "Need Ideas for a Combat System for a Browser-Based RPG/Sim-style Game", then I just focused on what the thread was about.

The biggest problem with browser based games is that when attacked, a player might not be at their computer to respond to it. SO you need a system that give an appearance of being complex and detailed, but without much effort on the players, but still let them have some control. This means that the computer will need to be the one that creates and handles the complexity. The easiest way is to use a random generator for the result of a combat and have the player set a stance (aggressive/defensive) for their troops.

However, players will quickly learn that the reports are just random and the results stated in the report do not contain any information (other than win loss). My idea was to create a system that no only uses all of this, but actually allows the report to contain actual information.

You can set a stance for the group, and this influences choices the part of the combat system that determines the results of combat (what I called the General) will try to take. Things like tactical advantages (really just numbers, but reported to the player as words)

These choices then have an influence on the outcomes of the combat, and can learn (or not) from past encounters.

I suggested that you might have a "General" troop type only because it added another layer of interaction between players as they can form attachments to a particular "general" unit (and if they can develop, encourage a successful one) and desire to get them back after it is defeated badly. Its not a core part of the idea I was presenting, but it was something I thought would make an interesting piece of gameplay.

Quote:
I would appreciate ideas for types of squads, their names, and their effects on one another.

I would start with a simple, core set of unit types and then build from there.

The simplest fair relationship between such things would be based on Scissors/Paper/Rock. What you would ahve is one unit type good against another unit type, but poor against the third unit type (you can do more than 3, but 3 is the smallest).

A simple relationship is:
Speed
Range
Defence

Speed beats Range
Range beats Defence
Defence beats Speed

So the troop types could be:

Hunters (hunters): These are hunters that use Short Bow, Thrown Spears or Slings to attack enemies. Being able to attack at a distance means the enemy, unless ranged units themselves, can not attack them back easily.

Riders (speed): Riders are lightly armoured troops mounted on horses (or other riding animals) that move quickly around the battle field. Because of their speed, they can run down any unit quickly which means ranged attackers don't get many attacks in before they are engaged in melee.

Clansmen (defence): Clansmen are tough and equipped with a melee weapon and a shield, this makes them good at defending, but can not run-down swiftly moving troops like Hunters.

So, the Hunters ability makes them good at taking out Clansmen, but the Clansmen can take the damage from Riders and the Riders can get into combat with the Hunters.

This forms a S/P/R relationship. If you want some numbers:

Unit Name: Hunters
Range: 2 square
Movement: 1 Square
Number of Attacks: 1
Damage per attack: 6
Health: 20
Armour: 0

Unit Name: Riders
Range: 0 square
Movement: 2 Square
Number of Attacks: 2
Damage per attack: 4
Health: 20
Armour: 1

Unit Name: Clansmen
Range: 0 square
Movement: 1 Square
Number of Attacks: 1
Damage per attack: 6
Health: 20
Armour: 2
Quote:
Original post by Edtharan
The Generals are not NPCs, they are an aspect of a collection of 1 or more squads. It is a routine designed to give the game the ability to have groups of squads enter combat without having to constantly have the player specify how they go about it.


So a general just represents a specific strategy choice?

Quote:
You don't need to make any new building, tools, units or NPCs. It is simply part of the combat system, no more no less.


Okay.

Quote:
I understand that combat is not a major part of the game, but as it stands it appears that this is the most common way that players (even computer players) will interact, so it needs a fair amount of detail and work if it will maintain the players interest. And, as the thread is labeled "Need Ideas for a Combat System for a Browser-Based RPG/Sim-style Game", then I just focused on what the thread was about.


I appreciate that you took the time to respond. I don't envision combat as the primary form of interaction between players, though (and, again, there are no computer players). Commerce is the primary form of interaction between players - buying and selling goods and services. I intend combat only as a way for groups of PCs to enforce their will/norms/mores/rules/laws/whatever on individuals.

Quote:
The biggest problem with browser based games is that when attacked, a player might not be at their computer to respond to it. SO you need a system that give an appearance of being complex and detailed, but without much effort on the players, but still let them have some control. This means that the computer will need to be the one that creates and handles the complexity. The easiest way is to use a random generator for the result of a combat and have the player set a stance (aggressive/defensive) for their troops.


I agree that asynchronous combat does pose a challenge. That's why I came here for ideas.

I don't necessarily need a complex or detailed system, but I do want something with meaningful choice.

I should mention again that there aren't really "troops" in so far as this game is played at the level of individuals - one player controls exactly one character. The only exception to this would be if a group of PCs banded together under the leadership of one PC, in which case some of their decisions might be subordinated to that leader.

Quote:
However, players will quickly learn that the reports are just random and the results stated in the report do not contain any information (other than win loss). My idea was to create a system that no only uses all of this, but actually allows the report to contain actual information.


Sounds good.

Quote:
You can set a stance for the group, and this influences choices the part of the combat system that determines the results of combat (what I called the General) will try to take. Things like tactical advantages (really just numbers, but reported to the player as words)


Different stances is a good idea. How to make them meaningfully different is a challenge.

Quote:
I suggested that you might have a "General" troop type only because it added another layer of interaction between players as they can form attachments to a particular "general" unit (and if they can develop, encourage a successful one) and desire to get them back after it is defeated badly. Its not a core part of the idea I was presenting, but it was something I thought would make an interesting piece of gameplay.


It is an interesting idea, but it doesn't really fit my game, again, because there are no "units."

Quote:
I would start with a simple, core set of unit types and then build from there.


It is an interesting idea, but it doesn't really fit my game, again, because there are no "units." The only way to attain something like different units would be if PCs equipped themselves differently, which would require new items. This is an avenue I may consider.

Quote:
The simplest fair relationship between such things would be based on Scissors/Paper/Rock. What you would ahve is one unit type good against another unit type, but poor against the third unit type (you can do more than 3, but 3 is the smallest).


I'm not happy with the RPS model because I feel like there's very little actual skill there. The optimal RPS strategy (from a game theory perspective) is playing randomly. I don't want a system where the best possible outcomes result from choosing a random "unit type"/"stance"/"formation"/whatever - this is not meaningful choice. This is a dice game and adds almost no depth.




On an unrelated point:
As I mentioned in my original post, there is no stamina cost associated with individual movement. This means that, if combat formations have some limitation on movement, then it will be very hard for them to pin down individuals. I'm not sure if this is a good thing or a bad thing.



I'm not sure if I can develop a combat system that does what I want. At the very least, it's going to be woefully unrealistic (... but that's true for most RPGs).

Maybe I will skip the squad thing and instead go with individual stances, but try to pick out more varied stances than offensive/defensive. The variables that I think I want to play around with will be mobility, offensiveness, defensiveness, and stamina cost. Thoughts?
Quote:
Original post by reykjavik
ID Merlin - I only have a couple of hours worth of free time to spend on this project per week, and I don't really want to learn AJAX. If you can point me to some friendly tutorials, I might give it a chance. I use one of the low-end dreamhosts plans, though, and I'm concerned that AJAX would be too resource-intensive for the server.

Ajax isn't that hard, but it probably does take more time to learn than a couple hours a week. It is likely that it uses fewer resources than generating a full page of HTML, so it still may be worthwhile checking into. Sorry, I don't have any links -- I probably read 15 different sources found by googling before I began.

This topic is closed to new replies.

Advertisement