how do raids work - ASharpPen/Valheim.CustomRaids GitHub Wiki
Raid initialization:
Basically, the host/server will make a check every once in a while. When the check happens, it then rolls a die to check if it should start an event. A list of what it believes are "possible" raids is calculated, and a random one is picked.
These raids are based off the host/server instances configurations, meaning it needs to know about a raid to even to any checks. Any clients are then notified that the raid should be started.
Raid spawning:
When a client receives a start event message, and is in charge of the area, its world spawners (see Spawning) will then start attempting to spawn in mobs.
It does this by finding the raid event it has loaded itself, based on the name received from the host.
If the event is found, the world spawners will try to spawn in the mobs in the event. For each mob they will check if spawn conditions are right. THIS is what usually makes most raids stumble. If the raid starts, but nothing spawns in, it is usually because the spawners can't get the conditions right.