Simulating moral code in NPCs

NPC groups will start out with certain (randomly generated) moral rules, which you can shift in a direction of your choosing by talking to people.

Value of life:

A. Every life is equally valuable.

B. The value of one’s life is based on their faction.
– For example, a master is worth more than a slave.
– Or one of us is worth more than one of them.

C. The value of one’s life is based on their actions.
– For example, heroes are worth more than cowards.
– Or those who heal are worth more than those who torture.

Attitude towards weakness:

A. Weakness is not tolerated.

B. The weak must be protected.

Team vs individualism:

A. Loyalty to the group comes first.

B. Self-preservation comes first.

Loyalty to the leader:

A. The leader is worth more than the fighters due to their knowledge and abilities.

B. The leader is just one of the guys.

Freedom vs health:

A. It’s better to be wounded and free.

B. It’s better to be a slave than dead.


In most cases, the majority of the group will follow a shared moral code. Peer pressure will ensure that very few will step out of line.

Wild cards – In any combat, there can be 0-5 wild cards that act opposite to the moral code in one way or another. They can be pacifists or cowards or ruthless killers.

Wild faction – When the fighting force is non-homogeneous, it’s possible that the moral codes of factions clash and cause a conflict between members on the same side. That’s why if a group is going to war with another one, the leader should hold speeches and rallies to unify the group so that the chance of a faction conflict breaking out in the middle of combat is decreased.

Combat and buildings

Ideally, it should be possible to move in and out of buildings automatically during a combat situation. Characters would hide in familiar buildings and gain an advantage to attacks on intruders. It should be possible to set buildings on fire, but fire shouldn’t spread insanely fast and shouldn’t be a guaranteed win against hiding people.

If the main group refrains from extreme violence, certain wild cards can engage in cruelties inside buildings when nobody is watching. Victims may be found after the fight is over and no one might know who was the culprit.

If the main group is very ruthless, wild cards may engage in protecting certain enemies, for example claiming that a building is empty when in fact someone is hiding there.

Maintaining and altering moral codes

Extreme moral codes are more likely to cause a backslash reaction. Maintaining an atmosphere of self-sacrifice or a preference to ruthless torture requires hosting events that reinforce the moral code. If your people are not exposed to frequent violence, they can’t become desensitized to it. That’s why if you want to maintain a culture of violence, you need to have things like public executions, floggings or bloody duels. Likewise if you want to maintain a society where the group matters more than the individual, you need to host events that boost a sense of unity and for example have everybody dress the same way or carry insignia that marks them as a member of the group.

If you are trying to change the status quo, you need to start small by talking to individuals, collect a sub-group of like-minded individuals and gradually increase your sphere of influence. If the moral code you are imposing is completely opposite to the reigning one, it will eventually cause a conflict and the group may split as a result. It’s better to start with a more subtle change and advance towards more radical views once you have a lot of followers. You can single out a sub-group based on a trait, such as gender or hair color, and convince the others that they are better than them while the others aren’t really even human. This makes the main group more prone to accept oppression on the targeted subfaction. If there is a reigning class, you can gather a subgroup of lower class people and rally them against the masters.

Even though I have previously said that all combat should be resolved instantly, actually it would make more sense to have a delay that depends on the size of the groups involved. An event like a single stabbing can happen instantly, but when there’s a whole battle taking place, it should last up to half a day game time. Status updates would be generated every 15 minutes and if the leader of one faction is online, they could call a retreat or surrender if necessary.


Reworking local map generation

As you might know, the current local map is visualized based on four 100×100 pngs where the red, green and blue channel stand for different things. However, this means that everything is grid-based and doesn’t look natural. This is why I’m working on a new map generator.

In the new map generator, each map has a base texture that is the most common ground covering thing. Currently there are only two, sand and grass, but it is likely that in the future that there will be 7 ground types: bedrock, loam, silt loam, clay loam, sandy loam, sandy clay and silt. Currently terrain types vary pixel by pixel and there is a high chance that the next pixel will inherit the type of the one above it or to the left of it, forming clusters.

In the new map generation code, I have a function called “snake”. It causes slithering lines of pngs that overlap with each other. Large changes in direction are less likely than small ones, which prevents it from constantly flicking back and forth. My test maps are currently 1000×700 pixels, but the ones that will be used in the game will be bigger in the database. You will only be able to see a small area at a time, though. On the test map, it generates 1 to 10 snakes of sand or grass depending on which one of them is used as base material. Currently grass is the base and sand is on top, but it’s easy to swap these around.


Then it generates trees and bushes starting from the back and advancing in rows that are 20 pixels high. The tree density is selected at random. In the database, new trees can be added on any row because when the data is called, it will be arranged by y and x so that it always starts from the back.

I also have sprites drawn for rocks and boulders, but I haven’t added them to the simulation yet.

In the database, data will have element type, x, y and layer. The layers are ground, ground cover and objects that stick out.

It will be possible to click on trees and bushes to select them for cutting. I have also tested this. In the test, the outline of a tree is in the upper corner because aligning trigger areas with the actual trees would require knowing their coordinates and in the test, the outline is mapped out before the map itself is generated. In the future, each tree will be clickable.

Hover over the upper left corner to see the highlight shape in effect

This is utilizing a JQuery library called ImageMapster by James Treworgy.

It is a bit unclear how farming will work in the new system, but my idea is that you will be able to convert shapes your character is on top of into fields and they will look different. Then you can automate planting, weeding and harvesting. One problem is there can be overlapping tiles, so it should only take the combined covered area into account as farmland instead of overlap being counted twice. Another option would be to stamp farmland on top of the base ground and set a maximum overlap distance that is allowed. If each map only has one base soil type, it could be assumed that all fields also shared that when turned. An exception is clay, because it’s unrealistic that there would be whole maps that are entirely filled with clay. Clay should come in small clusters and once you dig it up, the underlying soil or bedrock is revealed and the clay is gone.

Certain resources will be bound to individual trees and bushes, so if you cut down a fruit tree, you get the ripened fruit as well as the wood, but after this you can no longer harvest from this tree. Trees will produce more fruit in a system that is bound to the seasons, so organic resources will be renewable. You will be able to select a harvesting radius and automate your gathering. NPC groups will consume food such as fruit and berries every day and also automatically gather it. If an NPC group runs out of food, it will migrate away, so it’s probably going to be up to you to ensure that they won’t exhaust the local resource deposits. You can teach NPCs to farm and farming will be more effective than foraging.

I haven’t yet decided how big the local maps will be. The new system will allow them to be of different sizes, but since the snake function can go to areas that were already previously explored, it shouldn’t be used after exploration has started. Trees and rocks can be generated on the fly, so it would be possible to generate local maps that are 10’000 by 10’000 pixels and only generate trees on the area that has been viewed. This would save space in the database. I’m just a bit concerned that even a single map could contain up to 300k objects, and how much space would this take to store. Currently saving the data for one location takes ~117kb. I suspect that if we generate the whole map every time someone explores a location, it will take even more than this. If I get 1000 players and each of them explores 100 local maps, this will be 100k local maps. Are this many necessary? Certainly not. But people will explore just because it’s possible. So it should make them forget about places no one has visited in ages. Speaking from experience, even 10k different local maps is a waste because nobody will be able to appreciate them. So local maps should be temporary unless settled, and if you forget about it, it won’t be the same when someone explores it the second time. Since the contents are affected by the world map, you would be unlikely to tell the difference. The tree density will be the same, the grassy areas will be in different spots but the ratios will remain the same. It’s fairly irrelevant where a single tree is located in a forest.


Honor system

Ryan suggested a honor system where people lose honor if they commit undesirable acts of violence. I think this idea has its merits, as long as it’s possible to fool the system by making yourself look more honorable than you actually are.

Things that would lower your honor:

  • Attacking an unarmed person
  • Killing a person who has surrendered
  • Attacking a child
  • Killing a child
  • Attacking your parent or guardian
  • Attacking a person who hasn’t set their defense settings
  • Attacking a disabled person
  • Perhaps also attacking a person who has highly positive honor

There should probably be things that raise your honor as well, to balance things out.

  • Attacking a person who has negative honor
  • Releasing people who have surrendered to you in combat
  • Protecting a child
  • Protecting a disabled person
  • Protecting an unarmed person

Wearing certain clothing would make you seem more honorable than you actually are. This could make people lose honor by attacking you even if you were a bad person.

It can be pointed out that you could balance your honor by protecting children of your own village while slaughtering ones from a rivaling town. You wouldn’t get very high honor but not very low either.

The system should be tweaked so that it’s not possible to exploit it by doing trivial things to raise your honor to create a buffer for making lives miserable for other players.


Draft for a new combat system

Edit: Since writing this, I have decided to break offense into accuracy and danger. Accuracy defines how likely you are to hit, while danger defines how much damage you do if you do hit.

Combat graph

Teams can decide their hitting order. Every other round, the order is reversed.

People can choose from different attack strategies: Attack the strongest, attack the weakest, attack the best defender, attack the worst defender, attack the fastest, attack the slowest, attack at random or attack the person who attacked me last. If two people are equally qualified as targets, the target is picked at random out of the qualified options. They can also set a person as a primary target. You can have a different strategy for if you are sufficiently wounded.

Defense strategies: If you are attacked, you automatically use your blocks to defend yourself. If you are not targeted, you can use your blocks to defend another person, or choose to use their block in temporarily boosting their defense for the next round. In this case defense is increased by half of offense.

People can sacrifice an attack to boost their defense, upon which half of their attack is added into their defense. They can use this on a hit against themselves or someone else. This only works if your team attacks first and defends second. If your team defends first and you choose to convert your attack, it will count on the next round.

People can also boost their attack by giving up their defense. If they boost their attack and their team is going second, their defense will be lower on the next round.

People can wear equipment that makes their stats seem higher or lower than what they actually are. This can fool people’s strategies.

Array of attacks

Team 1

Matt SP100 OF200 DEF80
Jim SP200 OF120 DEF120
Bob SP150 OF140 DEF105

Team 2

Greg SP105 OF80 DEF100
Tim SP80 OF130 DEF110
July SP110 OF150 DEF90

Round 1:

Matt goes first. He targets who ever looks strongest, which is July. July blocks with 90. Since Matt has higher offense, he gets a pending hit through.

Jim attacks who ever looks fastest. This is also July. Since July is bad in defending, Jim’s hits also go through. Jim is faster than July, so Jim gets two hits through. July now has 3 pending hits on her.

Bob attacks at random. He hits Tim. Gets a pending hit through.

Situation after first offense: 3 hits on July, 1 on Tim, 0 on Greg. Since Greg wasn’t attacked, he can use his blocks to protect either July or Tim. He chooses to protect July because she is threatened worse. He chooses to block Jim since he seems like he’s easiest to block. He manages to block one of Jim’s attacks but is too slow for the second one.

Team 2 offense:

Greg attacks at random and targets Matt. The chances are about 50-50. Let’s say he gets through.

Tim attacks who ever looks like the easiest target. This is Matt. Tim gets a hit through. Now there’s 2 pending hits on Matt.

July attacks who ever is slowest. This is also Matt. July gets a hit through. Now there are 3 pending attacks on Matt. Matt has used all his defenses.

Jim and Bob are not targeted and are free to defend Matt. Jim feels threatened and decides to move his block into raising his defense for the next round instead of defending Matt. Bob uses his block to protect Matt. He blocks against Tim because Tim looks more dangerous. He fails to block.

July takes 2 damage, Tim takes 1 damage, Matt takes 3 damage. Now July’s stats are SP100, OF130, DEF80, Tim’s SP75, OF120, DEF105, Matt SP85, OF185, DEF65.
Round 2:

Now team 2 goes first. July decides to convert her attack into a defense since she is wounded. This allows her to use her offense to boost defense.

Tim hasn’t changed his strategy and is still targeting Matt. Since Matt is wounded, his defense is even lower. Tim gets one pending hit on Matt.

Greg still attacks Matt. Greg isn’t much of a fighter but since Matt is wounded, Greg gets a pending hit through.

Since Jim and Bob aren’t threatened, they have unused blocks. Jim gets 2 blocks, he uses one against Greg and manages to block. Now he has one block left over, which he uses against Tim. He fails to block.

Now it’s Bob’s turn to block. He uses his block against Tim. He fails to block. So Matt is getting wounded for sure.

Team 1 offense:

Bob decides to convert his attack into a defense against the attack on Matt because Matt is wounded. However moved defenses only take turn on the next round.

Jim still attacks who ever looks fastest. Since July is slowed down by her wounds, Greg is now fastest. Greg manages to block one of Jim’s attacks. However, Jim is so fast that he gets two attacks. So now there is one pending hit on Greg.

Matt changes his strategy since he is wounded. He decides to attack who ever looks like the easiest target. This is July. Because July has extra defense on this round, she manages to block.

So now there is only a pending hit on Greg. Since they are both slow, July and Greg have already used their blocks and don’t get extra moves.

Tim uses his defense against Jim to protect Greg. He has about 50-50 chance to block. Since Tim is slightly wounded, he fails to protect Greg.

Matt and July continue to bleed and weaken.
Matt is now SP80, OF180, DEF60(+50 from Bob on next round).
July is SP95, OF125, DEF75.
Tim and Greg bleed slightly and are still pretty strong.
Greg SP100 OF75 DEF95
Tim SP75 OF125 DEF105

Round 3:

Now team 1 goes first again. Matt is still targeting who ever looks like the easiest target. This is still July. They are both wounded, but since Matt is stronger, he gets a pending hit on July.

Jim attacks who looks the fastest. Because July is so wounded, she takes a penalty to speed and thus the fastest is Greg. Greg is weakened slightly by his existing wound, so Jim gets a pending hit on Greg.

Bob still decides to protect Matt for the next round.

Tim hasn’t been attacked, so he can use his block against either Matt or Jim. He decides to protect July since she is more at risk. However, he fails to protect July since Matt is still strong in spite of his wounds.

Now team 2 attacks.

Greg still attacks at random and targets Bob. Since Greg is such a crap fighter and slightly wounded to boot, he fails to get a hit in.

Tim is still attacking Matt. He gets lucky and gets a pending hit through despite Bob boosting Matt.

July again converts her attack into a defense on herself.

Since Jim hasn’t been targeted, he has unused blocks. He gets two blocks since he’s so fast. He primarily blocks against Matt. He fails the first block but succeeds on the second.

Matt continues to bleed and falls unconscious. July continues to bleed but still conscious. Tim is feeling weaker. Greg gets hurt again and is now weak.

(Matt SP75, OF175, DEF55) His stats wouldn’t count if someone attacked him.
July is SP90, OF120, DEF70
Tim SP70 OF120 DEF100
Greg SP95 OF70 DEF90

Round 4:

Team 2 goes first.

July again defends herself, no surprise there. Her defense is temporarily 140.

Tim leaves Matt alone since Matt is unconscious and targets the next weakest target, which is Bob. Tim gets a pending hit on Bob.

Greg still attacks at random and hits Jim. Greg decides to drop his defenses in order to boost his attack. Now Greg’s attack is temporarily 115. Jim gets two blocks since he’s so fast. He fails his first block but succeeds on the second.

Since both Jim and Bob have used their blocks, they can’t defend anybody.

Now it’s team 1’s turn to attack.

Bob gives up on protecting Matt since Matt is unconscious and might die anyway. He goes back to his strategy of attacking at random. He happens to hit Greg, who only has 45 defense this round since he used his defenses to boost his attack. Bob gets a pending hit through.

Jim gets two attacks. He attacks who ever looks the fastest. This is again Greg. Again Greg has 45 defense and fails to block both times.

Matt is unconscious and doesn’t get a hit.

Tim and July haven’t been attacked this round, so they have extra blocks. Because July has boosted her defense, she uses her 140 to defend Greg and manages to block one of the attacks on him.

Tim only has 100 defense and doesn’t manage to block any additional hits. So Greg takes two damage. Also Greg continues to bleed from his earlier wound.

(Matt SP70, OF170, DEF50)
July is SP85, OF115, DEF65
Tim SP65 OF115 DEF95
Greg SP80 OF45 DEF75

Round 5:

Team 1 goes first.

Matt is unconscious and doesn’t get a move.

Jim attacks who looks the fastest, which is July. He gets two pending hits on July.

Bob attacks at random and hits Tim. Because Tim is slowed down by his wound, Bob gets two hits on Tim.

Greg hasn’t been targeted so he has one block left. By this point he figures that they’re going to lose anyway and chooses to surrender.

Team 2:

Greg has surrendered and refrains from hostilities.

Tim still attacks Bob. He gets a pending hit in.

July decides to get reckless and uses her defense to boost her offense. She attacks Bob with 145 offense and gets a hit through.

Since Jim hasn’t been targeted, he has two blocks. He uses them to protect Bob. He manages to block Tim but not July.

(Matt SP65, OF165, DEF45)
July is SP80, OF110, DEF60
Tim SP60 OF110 DEF90
(Greg SP70 OF40 DEF70)
Bob SP145 OF135 DEF100

Round 6:

Team 2 goes first.

July again targets Bob. Gets a pending hit.

Tim also attacks Bob. He misses.

Greg has surrendered and is sitting this one out.

Jim hasn’t been targeted and uses his blocks to protect Bob. He manages to block the hit on first attempt but his unused defense doesn’t carry over.

Team 1:

Bob attacks July and gets two hits because his speed is so high compared to hers.

Jim also attacks July. He gets two hits and gets through on both.

Tim hasn’t been targeted, so he gets one block to protect July. He decides to try blocking Jim since he seems easier to block. However her fails.

(Matt SP60, OF160, DEF40)
July is SP35, OF85, DEF35
Tim SP55 OF105 DEF85
(Greg SP65 OF35 DEF65)
Bob SP140 OF130 DEF95

Matt and July are now both in critical condition and Greg isn’t feeling too shabby either. Tim decides to surrender. The fight ends with Team 1 winning.


Mold, yeast and bacteria

One of the ideas for the game is that things on the ground and in containers can become infected with micro-organisms and these micro-organisms can spread to other things in the same container. Here is how it’s going to work:

Once a day, the game will select a limited amount of organic resources to get infected. It is assumed that there are spores in the air, so it doesn’t require a source in the same location or container. The game will also check which things are in the same containers with previously infected materials, and the higher the level of infection, the more likely it will spread. Infections start out small and are invisible in the beginning, but may become visible once the level gets high enough. Some bacteria, yeast and mold may be picky and only infect specific subtypes such as fruit, vegetables, grain products, meat or dairy.

a slice of rye bread spotted with green mold

Bacteria will cause things to decompose and eventually get purged from the game. Before that it will turn into nasty slimy goop and may attract insects, which in turn can potentially carry disease. Some molds and bacteria may cause vomiting, diarrhea or other health issues. However, there is also useful bacteria that can be used to make yogurt and buttermilk, and useful molds which can be used to make blue and white cheese.

a spoonful of yogurt being lifted from a cup


Delicious results

Delicious results

Yeast can be used to ferment alcoholic beverages and raise dough. There’s probably going to be about a 10% chance of gaining a useful strain, but you can keep it alive by putting host materials in the same container. It’s yet undecided if a single pile can have more than one type of bacteria at a time. Increasing sugar and salt content protects mixtures against bacteria and mold.

Molds can be identified by color, but the catch is there will be visual twins to the useful molds, so you can mistakenly eat a harmful mold thinking it’s a good one. Some molds will be fuzzy while others have a dense structure.



Evolving plants

The current idea is that only ancestral wild forms of plants will exist in the beginning, and people will have to hybridize them to create optimal crops.

Corn originally came from a wild plant called teosinte

Corn originally came from a wild plant called teosinte

The original idea was to have plants in neighboring squares crosspollinate at random, then you would gather the seeds and see what grows out of them. However, making evolution totally random doesn’t sound very fun. You couldn’t guarantee that your plants would develop in the direction you want them to take. You would basically have to grow plants without knowing which mutations the seeds carry, then rip off the ones you don’t want to pollinate anything.

What sounds like a better idea to me is having a system where a player can choose an aspect to boost knowingly. If other plants in the location already possess this aspect to some extent, you have a higher chance of succeeding than if you are trying to mutate it.

Rough draft of an interface design

Rough draft of an interface design

You would click on a feature and if you are lucky, it gets a boost in the next generation. However, things have their consequences, so for example if you boost fruit size enough without boosting stalk strength, the stalk will eventually bend or snap under the weight, causing the fruit to touch the ground and be exposed to rotting. Likewise, there might be a cap to fruit sugar content before you have first improved the root and leaves. To me, this seems much more game-like and entertaining than merely deciding which plant is next to which.

Also, if you manage to create a seedless hybrid, you either need to figure out a way to breed it asexually or keep the parent strains alive and continue crossbreeding them, hoping to get another seedless child.

Did you know that watermelons used to look like this in the past?

Did you know that watermelons used to look like this in the past?


Fleshing out the new combat system

Even though Otherworld isn’t primarily a fighting game, it is unavoidable that people are going to have conflicts and those conflicts are more likely to be solved through violence than diplomacy. One person has suggested not to have PvP combat at all in the beginning, but I think this would cause more issues than it would prevent. It has been established from the start that it should be possible to hit anybody, including children and newbies, and societal structures and ingame protective services should be what prevents vulnerable people from getting hurt, not some invisible boundaries added by the creator.

Some core concepts of the fighting system on a general level:

  • everybody is potentially vulnerable
  • even the strongest and most skilled person in the world can still suffer a critical failure, even if the chance of that happening was less than 1%
  • fighting should be relatively fast paced, even if not all participants are online
  • people who are online shouldn’t have a strategic advantage over those who are offline
  • if loopholes that make fighting unfair towards people who are offline are found, they should be addressed swiftly
  • artificial waiting times should not be imposed on players (exeption allowed to prevent using scripts and bots that are faster than an average human)
  • the effects of violence should be recognizable on a physical and emotional level, even if the victims were NPCs (if you kill all the children of a village, the parents will mourn their deaths and won’t easily forgive)

The history of the fighting system

When Otherworld first started, it included a failed idea of so-called flexitime. This meant that everybody advances at their own pace within a game month, and things can happen relatively in the past or future. As a result, it was necessary to give people 18 hours to react to any attacks instead of resolving them immediately. The early system only involved hunting, but it was possible to join an existing combat, and due to an oversight, it was possible to attack another person (the other hunter), but because only animals had programmed counter-attacks, the victim couldn’t retaliate in any way. They couldn’t even see the other person, because they were later on on their own timeline, so from the victim’s perspective, the attacker hadn’t even arrived. What a clusterfuck!

Visualization of individual timelines

Visualization of individual timelines

After flexitime was scrapped, a new PvP system hasn’t yet been implemented. In fact, there was no PvP system, just an accidental oversight of the hunting system. The current hunting system involves selecting a weapon, clicking hit, then the animal retaliates. Yawn, boring! Combat can last like 20 rounds and even after the animal has passed out from blood loss, you can’t finish them off in one hit but have to keep repeatedly hitting them until they finally die. This is why a rewrite is direly needed.

Behind the scenes, which body part is hit is currently defined by coordinates on a two-dimensional plane. Human, and animal bodies are simulated by simple blocky shapes (see pictures below), each combat style targets certain areas and hits have a certain stray that is applied both on x and y axis.

How a human is simulated for hitting

How a human is simulated for hitting

Left to right: A large four-legged animal such as a deer, a small four-legged animal that is hit from above, and a large bird such as an ostrich (out of laziness, this is just a copy of the large quadruped with wings instead of hind legs

Left to right: A large four-legged animal such as a deer, a small four-legged animal that is hit from above, and a large bird such as an ostrich (out of laziness, this is just a copy of the large quadruped with wings instead of hind legs

In a way, this is not such a bad system. It could have some merits. The problem is defining which areas each combat style targets and writing out the limits of each area in an extensive clusterfuck of “if ($x > number &&  $x < number2 && $y > number3 && $y <  number4)”, which even nest in the case of things being inside other body parts, such as the heart. Another flaw is, it doesn’t take into account that things could block access to internal organs, so a three-dimensional model might be better.


A draft for possible combat scenarios

The plan is that combat will be completely automated and will be resolved in one click. You can tweak your settings and select reactions to different possible scenarios, such as yourself getting hurt, your party member getting hurt, party member getting killed, enemy surrendering, enemy trying to run and also different combat styles, such as training mode, defensive, cause extra pain, and quick kill. Once combat starts, all human interaction is out of the picture and everything is defined by the user-predefined settings, weapons, armor, shields, group sizes, defenders and random chance. Also if the enemy runs away successfully, they will go into hiding and will be protected from another attack until the player logs in. This is unless the enemy has people they are loyal to or protecting, who are not running.

There will also be group combat. Weapons work in a way that if you have a good weapon, you count as multiple people (usually fractional people, like 2.5). If you have a crappy weapon, you might even count as less than a person. In the future, skills will also affect this, so that if you are a crappy fighter, you are less than one person, and if you are very good, you can be worth like 5 or maybe even 10 average people. All these things affect your chances of winning. Both the physical number of people on the team, and the boosted number. Now optimally, combat between two people should be the same thing as a group combat, only scaled down. Mechanically it should work pretty much the same.

The current idea is that people will have variable attack speed, which is affected by their weapon. Some weapons like a dagger are fast, while others like a crossbow are slow. A person’s speed defines how many attacks they get in a round of processing. If your speed is low enough, you might get 0 attempts per round – but there is a catch: Each person has a chance of getting one extra attack regardless of how many they had in advance. If the numbers are small, this doesn’t matter much, but as the numbers grow, a lot of random variance comes to play.

First the game rolls how many potential attacks your team gets. Then it rolls how many blocks the enemy gets. If the number of blocks is equal to or larger than the number of attacks, no attacks go through. If some hits get in, it calculates the damage and divides it between one or more receivers. If a receiver gets enough damage, they die. Ideally, both attacks take place at once instead of one side going first while the other one just stands and blocks. So it should count the successful hits for both parties, then apply the wounds and kills on both sides at once. This can potentially lead into everybody dying, but it’s a risk you have to take. Or you don’t necessarily have to, you can set to surrender if the situation looks dire. Basically if the number of deaths exceeds someone’s comfort range after a round, they surrender and combat ends. If neither side runs away, surrenders, gets knocked unconscious or gets wiped out, a new round is calculated.

Back to that extra hit that some group members may get. This adds chaos into large combats. By default, the larger group has a higher chance of winning, but if the lower group rolls high on their number of extra attacks, they might be able to get hits through despite having less numbers. Because the number of extra attacks is only rolled once per round per team, instead of one per person, it can range anything from 0 to everybody, whereas if each person rolled individually, it would default to what ever the percentage was. But if the team has bad skills and weapons, it doesn’t really matter how many hit attempts they get, because the number of successful hits is lower. This is why you have to balance between speed and accuracy.

One thing that hasn’t been explored much yet, is the possibility of setting an order of priority for which people to hit first in combat, and which ones to protect. People with a lot of enemies are more likely to get wounded, whereas ones with a lot of defense are less likely to get hurt (but the defenders might be more likely to get hurt instead, because everybody just defends each other in a circle so it shouldn’t be free). In fact, this is a very simple idea, so I’m surprised I didn’t think of it before.

At first I was going to use an average of everybody’s weapon stats to calculate hit chance, but it makes more sense if different people will have different hit chances and speeds. Only if there are multiple fighters who are basically identical (usually NPCs), they can be stacked.

It is yet to be decided in which order the attack attempts and block attempts will go. I mean, are they in order of power, randomness or initiative. One thing is clear, though, if you run out of blocks before the other party has ran out of attacks, you’re going to get hurt. So if the player gets to decide the order of attacks, it would make sense to place the heavy hitters in the end of the flow, so that if the enemy runs out of blocks, you will maximize your damage! But in this case, the defender is likely to place their best defenders in the end, so if they get extra defenses, they might be able to block everything. It’s like a game of baseball, you could decide the order of your batters and play strategically. You might place heavy hitters in the first wave, where they are least expected. The problem is managing large groups of NPCs. If you have 1000 fighters, it would be hard to manually put them in order.

I want them organized like this: tough tough soft tough

I want them organized like this: tough tough soft tough

One thing to consider in group combat is that once you get wounded people, some of the capable fighters are going to re-delegate themselves into taking care of the wounded, unless the army has designated nurses from the start. This reduces the number of people who can keep on fighting. This should be taken into account on the following rounds.

Division of capable fighters and others in the beginning of the fight compared to the middle and end

Division of capable fighters and others in the beginning of the fight compared to the middle and end

More later, at least maybe.