Jump to content

Bearger sometimes howls indefinitely without ever spawning

  • Fixed

It sometimes happens that beargerspawner will start emitting warning growls without ever spawning bearger. This is apparently due to the beargerspawner component receiving updates despite the bearger_timetospawn timer remaining paused.

Comparing with the deerclopspawner suggests a potential fix: add an equivalent of `TryStartAttacks` in the beargerspawner:OnPlayerJoined method. These files have diverged quite a bit, and no such method actually exists for bearger. Nonetheless, something like


local function OnPlayerJoined(src,player)
    for i, v in ipairs(_activeplayers) do
        if v == player then
    table.insert(_activeplayers, player)

    -- new code:
    if CanSpawnBearger() then

resolves the issue (verified in my own testing)

Complementary code is needed in OnPlayerLeft to stop the spawn timer. The deerclops spawner has a handy method TargetLost() for stopping the timer and component updates in this case. The bearger implementation doesn't reassign a target player at this time; nor does it check if there are any players left. The following snippet adds that functionality, and it also stops the timer if no player remain.

local function OnPlayerLeft(src,player)
	--print("Player ", player, "left, targetplayer is ", _targetplayer or "nil")
    for i, v in ipairs(_activeplayers) do
        if v == player then
            table.remove(_activeplayers, i)
            if player == _targetplayer then
            	_targetplayer = nil

            -- begin new code
            if _targetplayer == nil then
                _worldsettingstimer:PauseTimer(BEARGER_TIMERNAME, true)
            -- end new code


Steps to Reproduce

I don't have a reliable reproduction method at this time. I've noticed this generally occurs on secondary forest shards in larger dedicated servers. From the code, I would imagine it's possible on even a more standard dedicated server setup with only one forest shard. This likely isn't an issue for non-dedicated servers since the LoadPostPass hook tries to start the time (side note, this behavior seems wrong since there may not be any players). 

If I had to guess at a repro method, I would try something like:

  1. Have a dedicated server with at least 2 forest shards
  2. Skip 70 days to spawn bearger on main shard
  3. Restart the cluster
  4. Take portal to secondary forest shard and observe that the beargerspawner is receiving updates but the timer is not running
  • Like 1

User Feedback

A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.

Any idea how to reproduce the bug in that setting? Although my secondary forest shard use case may not be particularly high priority for Klei, your scenario sounds much more game breaking.

Share this comment

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...