Project Zomboid

Project Zomboid

[B42/B41] Bandits NPC (v2)
This topic has been locked
Slayer  [developer] 20 Aug, 2024 @ 2:42am
GUIDEBOOK
Last edited by Slayer; 3 Feb @ 9:12am
< >
Showing 1-5 of 5 comments
Slayer  [developer] 20 Aug, 2024 @ 4:55am 
CHAPTER 1
Slayer  [developer] 20 Aug, 2024 @ 4:55am 
Compatibility
Bandits mod codebase is quite big and unusual. It introduces many hacks and workarounds to evade limits of the game. Incompatibilities may arise with other mods as side effects. If you run into problems, it's recommended to add this mod first and then gradually add others and test along the way.

Map Mods
This mod is compatible with all map addons. Also if the maps define zones properly such as towns, farms, forest etc, it will be correlated with spawn chances of bandits.

Weapons and Clothing Mods
This mod should be compatible with any mod that introduces new weapons of clothes. However, only the mods listed in the Enhancements will make Bandits carry weapons or wear new outfits.

Projectile mods such as Advanced Tracentory, Advanced Trajectory Realistic Overhaul and Improved Projectile will work to a degree, meaning, that players will be able to shoot using the aiming system and projectiles will be visible. But Bandits will use traditional ways of shooting. AT will probably generate harmless errors, IP was patched and should work without errors, ATRO will work without errors too.

Small Town First Responders - Main Mod is not compatible unless you turn off in options "overwrite zombies".

Zombie Mods
Generally mods that alter zombies in some way may be incompatible with Bandits mod. This is because Bandits are technically zombies. Some modders have already added compatibility with Bandits by explicitly excluding zombie bandits from alteration they would normally do to zombies.

Mods that were adapted to work with Bandits

If you are a modder and you wish to recognize bandits from other zombies, here is the proper way to do it:
local isBandit = zombie:getVariableBoolean("Bandit")
where zombie is an instance of IsoZombie class.

NPC Mods
Other NPC frameworks does not integrate in any way with Bandits. They may coexist together to some degree but some unexpected results will occur. Since bandits are technically zombies, the NPC survivors will treat all friendly and hostile bandits as zombies.Bandits on the other hand will not recognize NPC survivors in any way.

Recognized Incompatibilities
  • Tripping zombies - it works but the bandits trip too
  • Weapon Condition Indicator - works but will throw an irrelevant error. Use popular alternatives such as Item Condition or try this patch
  • Don't feed the corpses - bandits will eat zombies :)
  • Multiplayer Three Zones: PVE, PVPE, PVP - bandits melee attacks will not work
  • Betterfps - bandits will not spawn in a larger distance than 30 squares
  • True Crawl - Bandit mod will disable player stealth that is turned on while player is crawling.
  • Susceptible Trait - Bandits are immune to airborne virus and may infect the player like the zombies.
  • Barricade Hurt Zombies - may crash the game
Last edited by Slayer; 27 Apr @ 12:19pm
Slayer  [developer] 20 Aug, 2024 @ 4:56am 
Mod Performance
Contrary to popular belief that NPC are always laggy and janky, this mod offers very decent performance thanks to many factors.

Most importantly, the mod does not rely at all on the in-game NPC hidden / remnant code that is probably always used by other NPC mods. This in-game NPC code has proven to be slow and does not work in multiplayer games.

Secondly, the Bandits code introduces a lot of caching strategies that utilize more RAM in exchange of less CPU. Just to illustrate: all zombies and bandits positions reside in a light weight memory cache so that all distance calculations and final decisions about movement are ultra fast. And we are talking about the bandits' movement, but also zombies, who also receive many movement orders to attack bandits by this mod.

Thirdly, most of the computations are client-side, so that the server does not overload when the number of players and bandits increments. Each client handles its own bandits and if the bandit is shared between clients (players are together), they individually mirror bandit actions in a deterministic way so that no network bandwidth is consumed to synchronize bandits. Sometimes, however, both clients may observe slightly different actions. This is because zombie positions differ slightly between clients. For example, the first player sees a bandit close enough to the zombie so that the bandit initiates the melee attack, the second player sees a bandit that is still not close enough to the zombie and sees no attack. So "garbage-in, garbage-out" rule applies here and nothing can be done about it.

Overall, assuming you have a modern PC, this mod runs smoothly with even 30-40 moving NPC and hundreds of moving zombies. You will observe some slight FPS drop, but it will be completely playable.
Last edited by Slayer; 11 Sep, 2024 @ 5:14am
Slayer  [developer] 20 Aug, 2024 @ 8:24am 
Bandit Behavior
Some Bandit AI functions are universal and some are Program specific.

Bandit Program controls Bandit's purpose, behavior and capabilities. There are separate programs for enemy Bandits and for Friendlies. Programs are set during the spawn, but programs may also switch later depending on the situation. Programs are clan independent.

Independent Features
Here is the complete list:
Movement
All Bandits are able to jump over low and high fences and climb through windows. Sometimes, Bandits will prefer to go around a high fence instead of climbing over it. All Bandits can climb sheet ropes, but they often fall down during the process. Bandits can open unlocked doors.

Bandits will choose different movement speed depend on many variables. For example some bandits may prefer to sneak at night. Hurt bandit may limp etc.

Bandits cannot drive cars. Friendlies will enter the car as passengers if the player is inside. They will exit the vehicle with the player.

Destruction
Bandits will break closed windows if they want go climb through them. If the window is barricaded they will remove the barricade. If the door is locked they will also start destroying them. If the door is barricaded... yes you guessed it.

If there are objects blocking their way, like furniture, they will destroy it. If they have contact with player made structures, they will start destroying them too.

Combat
Recognizing the enemy: Zombies are always enemies to Bandits, other Bandits are enemies if they belong to another clan, Friendlies are enemies to non-Friendlies. Friendlies from different clans are not enemies.

Sight: Bandits visibility can be reduced by various means: distance, intensity of light falling on the player, fog. Additionally player may increase his stealth by using a sneaking position, not moving and being on a square with a bush. All these can sum up together.

Shooting: Bandits with guns (and ammo) will always shoot to the closest enemy. They will reload their guns like Players, but will drop empty magazines on the ground. Currently Bandits can use rifles and pistols. No shotguns nor revolvers. Their ammo is limited. Player can collect the remaining ammunition it he kills the Bandit. Shooting accuracy depends solely on the distance, between the shooter and the target. Shooting frequency depends on the weapon time. Shooting reflex is random. Accuracy and reflex can be tuned in sandbox settings.

Cover: Objects such as low fences or barrels do not provide any cover. Windows provide some cover assuming they are not broken.

Cars provide defense to some extent. The better the condition of windows and doors the better the cover. Note, that bullets hitting the car will damage the doors and windows and gradually lower the defense. Non vanilla cars with extra armor or tanks do not provide extra cover. Also a car that is moving has a lower chance of being hit.

Melee: If the enemy is close, or the Bandit has no gun nor ammo, it will use a melee weapon.[/b]

Throwables: Bandits do not use any throwables.

Healing and Surrender
Sometimes hurt bandit will try to run away from you. A badly hurt Bandit will start limping and bleeding, which will decrease his health rapidly. If the Bandit's health is very low, the Bandit may attempt to bandage the wound. If he manages that, his health is immediately fully restored. If his health is extremely low, he will drop his weapon, raise his hands up or knee and will not be able to fight anymore. This is critical condition and he cannot heal no more. The bandit will simply die.

Additional capabilities
Endurance Bandit endurance drops when running or using a melee weapon. If endurance is depleted a resting animation will be triggered during which the Bandit will regain his endurance.

Torches Bandits will use torches (flashlights) during night but only if they do not carry a two hand weapon.

Enemy Bandit Programs
Bandit AI is a set program that the Bandit follows. It controls Bandit's purpose, behavior and capabilities. There are separate programs for enemy Bandits and for Friendlies. Programs are set during the spawn, but programs may also switch later depending on the situation. Programs are clan independent.

Raiders
Raiders' primary objective is to move to your location and kill you. Raiders will always know where you are. They have the following additional capabilities: they can sabotage Players' cars, meaning removing battery and tires. Also they can disabling a working generator to cut off the power.

Wanderers
Wanderers will naturally travel the world taking care of their business. They are initially unaware of players positions. Once they spot a player they switch their Raider program.


Thieves
Thieves will not attack you unless you start the fight. They will steal random items from your base and escape. Thieves will not appear if your are far away from your base.

Guards
Guards will remain stationary, may be standing, sitting or sleeping. They will activate when they spot the player.

Defenders
Defenders spawn in buildings to protect them. These bandits do not belong to any Clan but their appearance, equipment and number will vary depending on the building they occupy. So you can expect generic citizens in houses, or security guards in malls for example. The number of bandits depend on the building size, but it's capped by the sandbox setting.

The house that they occupy will be powered by generator, and there will be valuable loot inside. This type of Bandits is dangerous especially in the early part of the game, because players may encounter strong, armed defenders. If a Defender Bandit leaves the building, it switches to Raider AI. Defender Bandits may sleep during the night.

Campers
There are tent camps that will spawn in the world. The base will provide with valuable loot and will be guarded by clan-less type of Bandits. These bandits will guard the base in a stationary position until they spot you. If you are spotted, they switch to Raiders. Campers may sleep during the night. Campers are indicated with a purple icon.

Friendlies' Programs
Friendlies may become hostile when attacked by the player, along with other friendlies who witnessed the situation. Other friendlies who did not see what happened will remain friendly towards the player, but will not help him to defend against new hostile friendlies.

Companion
This a standard program for every spawned Friendly. Companions will always know where you are, and they will simply follow you. They can enter cars if that option is turned on. If they don't have a gun, they can collect it from a dead body or a containers inside a house. Friendlies are indicated by a green icon.

Guards
Guards are friendlies that will always remain stationary in the Guard Post. To designate a Guard Post, Player needs to press G button and click on a free square. The post will be marked as a yellow square. Companion will move then to a Guard Post and switch the program to Guard. If you press G, and click on existing Guard Post, it will be removed and a Guard will switch to Companion program. If the friendly continue to follow you try to force him to step into the post.

Indifferent
They are not hostile towards enemy but they will not follow the player. They might be recruited as companions.

Friendlies at Players's Base
Friendlies will automatically recognize player's base. If there is are no enemies, friendlies may chose to perform some tasks automatically without giving them any orders. NPCs will know your base and where items that they need to perform tasks are located. Here is a list of possible actions. More actions will be successively added.

  • If there is trash, they will collect it and place it in a trashcan.
  • If the floor is blooded, they will clean it provided they can find broom and bleach in the base.
  • If the generator is low on fuel or in bad condition, they will refuel or fix it provided they can find gas can and electronics scrap.
  • If it is fishing time, and there is a lake, they will go fishing and return the fish to the fridge.
  • If there is a farm that needs watering, and it is not raining, they will water the crops provided they can find a watering can and a source of water
  • If they are corpses, they will collect them and put to graves, provided there are empty graves dug by the player. They will fill the graves when necessary provided they can find the shovel.
  • They will wash themselves if they are dirty, provided there is water source and soap
Last edited by Slayer; 27 Feb @ 9:16am
Slayer  [developer] 11 Sep, 2024 @ 4:33am 
Survival Guide
Be aware that Bandits are extremely dangerous, and provide an extent of challenges. Even most experienced players with 1000+ hours will need to relearn how to survive. Don't get angry when they kill you at first, this is part of the learning process.

Rule #1 Learn how to detect enemies
React to notification icons, listen for sounds.

Unlike zombies, the Bandits can shoot. Also bandits with melee weapons can surprise you because they can move quite fast. That is why you need to pan around and scan your surroundings regularly. During the night, look for light from their flashlights.

Use distance to your advantage. Invest in aiming skill. Always carry a long range weapon. Unless modified in the settings, your weapon range is higher than the Bandits. Do not worry too much about ammunition though; once you have killed an armed bandits, you will collect plenty of ammo.

When visiting buildings, assume that the enemy is inside. Some of them can silently wait there for you. They can hide even in the previously visited buildings.

Rule #2 Protect yourself
Wear a bulletproof vest or other bullet protective clothing.

Carry bullet wound treatment equipment. You will need tweezers and suture needles. If you manage to stitch your wounds in time, you will be ok. However it is probable that some time soon you will get sick from the lead from the bullets. If that happens, eat and sleep a lot.

Do not enter melee combat if the enemy weapon has a longer range.

When you get shot or hit by a melee weapon your character will be stunned for a short period of time. In this time you cannot fire back or attack with your melee weapon. Your intuition may guide you wrongly to return the attack immediately, but this is impossible until you regain control of your character. A good tactic is to move away until you restore you ability to strike back. Also know, that running fast makes you a very hard target for shooters, however, the faster you run, the higher the chance that if you are hit you may trip.

Rule #3 Create a safe place
You probably already know how to organize your base that defends well against zombies. When it comes to bandits, understand that they can open, unlock doors, smash windows, doors, remove obstacles, hop over low and high fences and climb up the sheet ropes. That is why you will need to be more creative when it comes to your base design. Protect your car from being sabotaged by bandits. Protect your power generator from being turned off.

Use the beginning of the game, when there are not so many bandits, to gather all necessary equipment and secure your basic base. If you die, don't worry, it only gives you more time to prepare your base.

Very important, choose the right place when you intend to log out from a multiplayer server. When you come back, you may find yourself in the company of bandits.

As the game progresses, more heavily armed bandits will appear. Utilize friendlies with weapons as a first line of defense. Build guard posts for them to buy yourself some time when things start to get nasty.
< >
Showing 1-5 of 5 comments
Per page: 1530 50