Barb Camp Bug 3.3.4

MortalD

Warlord
Joined
Nov 22, 2011
Messages
212
Barbarians often spawn without encampments and just wonder off.
Makes my camp farming a bit tedious :crazyeye:

Update : When the game "fail" to spawn the camp ( barbarian unit do spawn however ) it will then make a second attempt the next turn.

This can be repeated several turns b4 the encampment finally get created, but by then there are 5+ barbarian units roaming around.
Whole northern part of my continent is infested with 1 big huge barbarian army of 20 + units oo

AI will get in seeeerious trouble if they decide to move...
 
How can you be sure they spawned without an encampment? I don't think this is ever supposed to happen.
 
How can you be sure they spawned without an encampment? I don't think this is ever supposed to happen.

A camp spawn near my scout - honor opener notify me. I go there the same turn and find lone archer.

Also used a mod that reveal whole map and I can see barbs poping up with no camp...

I wish someone can confirm that in his game non the less.

Side note: Upon upgrading scout to spearman , the "ignore terrain" promotion stay.
 
EDIT2: Wait it is referenced...

EDIT: Ignore what I wrote below, I don't think the code is referenced anywhere.

It looks like Thal added in code to automatically clear camps near AI players to help them. Located in \Gameplay\AI\CEAI_Events.lua:

Spoiler :
PHP:
--
-- Manually clear barbarian camps
--

function ClearCampsCity(city, player)
	if player:IsHuman() or player:IsMinorCiv() then
		return
	end
	
	local revealRadius = Game.GetWorldInfo().AIRevealRadius
	local campID = GameInfo.Improvements.IMPROVEMENT_BARBARIAN_CAMP.ID
	log:Debug("ClearCampsCity %s %s distance=%s", player:GetName(), city:GetName(), revealRadius)
	for nearPlot, distance in Plot_GetPlotsInCircle(city:Plot(), 2, revealRadius) do
		local impID = nearPlot:GetImprovementType()
		if impID ~= -1 then
			log:Trace("%s", GameInfo.Improvements[impID].Type)
		end
		if impID == campID then
			log:Debug("ClearCampsCity %s %s distance=%s", player:GetName(), city:GetName(), distance)
			if nearPlot:IsVisibleToWatchingHuman() then
				log:Info("ClearCampsCity aborting: visible to human", player:GetName(), city:GetName())
			else
				ClearCamp(player, nearPlot)
			end
		end
	end
end

It looks like the code clears the camps but not the unit inside the camp. Try modifying the following code to fix it:

Nevermind, it looks like there is code to clear the unit.

Actually, it's worth a try. The modified code below should kill the unit along with the camp:
PHP:
        if impID == campID then
            log:Debug("ClearCampsCity %s %s distance=%s", player:GetName(), city:GetName(), distance)
            if nearPlot:IsVisibleToWatchingHuman() then
                log:Info("ClearCampsCity aborting: visible to human", player:GetName(), city:GetName())
            else
				ClearCamp(player, nearPlot)
				nearPlot:GetUnit(0):Kill(true, -1) --kill unit
			end
        end
 
So basically, a barbarian camp is spawning in the fog of war. I move a warrior unit over to reveal it. And the camp disappears automatically, and usually the barbarian unit left behind has moved out of the vanishing camp. So seems like there's something causing new camps to automatically disappear when revealed.
 
Thal wrote in another thread that he planned on autoclearing barbarian camps around the AI since they do a bad job of it. The code I posted above suggests that he has introduced it. I suspect that while the camp is getting cleared, the unit inside the camp is not. If the camps do end up being generated and cleared every turn, this might be the source of large sums of gold that the AI seems to have, even when their GPT is negative.
 
I think the camp spawns, then gets cleared during the AIs' turn. any camp I can get sight on the same turn it spawns, stays. any camp I can't see until the next turn, the camp's gone but the barb is still there. So I think the camp is spawning, then getting deleted sometime before my next turn. This happened many times without any AI units anywhere in the area.
 
I think the camp spawns, then gets cleared during the AIs' turn. any camp I can get sight on the same turn it spawns, stays. any camp I can't see until the next turn, the camp's gone but the barb is still there. So I think the camp is spawning, then getting deleted sometime before my next turn. This happened many times without any AI units anywhere in the area.

Yes, the code suggests that's exactly what's happening. If the player or AI has vision on the camp then it won't be autocleared.
 
Thal wrote in another thread that he planned on autoclearing barbarian camps around the AI since they do a bad job of it. The code I posted above suggests that he has introduced it. I suspect that while the camp is getting cleared, the unit inside the camp is not. If the camps do end up being generated and cleared every turn, this might be the source of large sums of gold that the AI seems to have, even when their GPT is negative.

w8, how clearing the camp via a script give gold to AI?

Regardless hate to say that I don't like the way things look atm. Whole map full of fake camps, every turn spamed with "found a camp" notifications + this seem to generate a huge amount of barb units making things actually worse for the AI.

Just saying...
 
w8, how clearing the camp via a script give gold to AI?

The gold comment is in reference in the barbarian clearing code:

PHP:
function ClearCamp(player, plot)
	local campGold = Game.GetHandicapInfo().BarbCampGold
	plot:SetImprovementType(-1)
	player:ChangeGold(campGold)
	log:Info("Cleared camp for %s +%s gold", player:GetName(), campGold)
end


Regardless hate to say that I don't like the way things look atm. Whole map full of fake camps, every turn spamed with "found a camp" notifications + this seem to generate a huge amount of barb units making things actually worse for the AI.

Just saying...

The barbarian units just need to be killed along with the camp and should be relatively simple to fix. My suggested fix above may work in the interim. The false camp notifications might require a little bit more work but should still be manageable.

EDIT: Check your lua.log in the Logs folder and you'll see something like this:

Spoiler :
MT_Initialize: INFO Turn 100 Cleared camp for Shaka +50 gold
MT_Initialize: INFO Turn 100 Cleared camp for Ahmad al-Mansur +50 gold
MT_Initialize: INFO Turn 100 Cleared camp for Ahmad al-Mansur +50 gold
MT_Initialize: INFO Turn 100 Cleared camp for Oda Nobunaga +50 gold
MT_Initialize: INFO Turn 100 Cleared camp for Gustavus Adolphus +50 gold
MT_Initialize: INFO Turn 100 Cleared camp for Gustavus Adolphus +50 gold
MT_Initialize: INFO Turn 100 Cleared camp for Pachacuti +50 gold
MT_Initialize: INFO Turn 100 Cleared camp for Pachacuti +50 gold
MT_Initialize: INFO Turn 100 Cleared camp for Washington +50 gold
MT_Initialize: INFO Turn 100 Cleared camp for Elizabeth +50 gold
 
Ty Stackpointer. I have pretty good image of the situation thx to you ( even tho coding isn't my thing ).

Yes in general it is indeed a good idea and will boost early AI expansion and gold issues by a lot.
I suppose there could be an "on/off" switch in options.sql anyway - may be usefull.

Side note : off topic but I noticed that Arabia seems to be doing very well gold wise in all my games. Perhaps all AI civs should - if not already - get a gold bonus to trade rounts AND a 50% discount on Cargo Ships? That could help the AI even more.

Actually will repost that idea in another topic - hopefully more suited for it ;p
 
I think the idea was that camps would only be cleared if there were no barbarian units nearby. If the camp is being cleared from underneath the barb, that is a significant problem.
 
Small suggestion that the gold that the AI gets from autoclearing camps be reduced, see logs for the first 50 turns:

Spoiler :
Code:
[20510.481] MT_Initialize: INFO   Turn 1   Cleared camp for Gustavus Adolphus +50 gold
[20510.481] MT_Initialize: INFO   Turn 1   Cleared camp for Gustavus Adolphus +50 gold
[20510.481] MT_Initialize: INFO   Turn 1   Cleared camp for Gustavus Adolphus +50 gold
[20510.481] MT_Initialize: INFO   Turn 1   Cleared camp for Bismarck +50 gold
[20510.481] MT_Initialize: INFO   Turn 1   Cleared camp for Bismarck +50 gold
[20510.481] MT_Initialize: INFO   Turn 1   Cleared camp for Alexander +50 gold
[20510.481] MT_Initialize: INFO   Turn 1   Cleared camp for Alexander +50 gold
[20510.496] MT_Initialize: INFO   Turn 1   Cleared camp for Enrico Dandolo +50 gold
[20510.496] MT_Initialize: INFO   Turn 1   Cleared camp for Catherine +50 gold
[20510.496] MT_Initialize: INFO   Turn 1   Cleared camp for Augustus Caesar +50 gold
[20510.496] MT_Initialize: INFO   Turn 1   Cleared camp for Augustus Caesar +50 gold
[20510.496] MT_Initialize: INFO   Turn 1   Cleared camp for Augustus Caesar +50 gold
[20510.496] MT_Initialize: INFO   Turn 1   Cleared camp for Kamehameha +50 gold
[20515.504] MT_Initialize: INFO   Turn 2   Cleared camp for Bismarck +50 gold
[20521.338] MT_Initialize: INFO   Turn 3   Cleared camp for Alexander +50 gold
[20532.149] MT_Initialize: INFO   Turn 5   Cleared camp for Enrico Dandolo +50 gold
[20537.266] MT_Initialize: INFO   Turn 6   Cleared camp for Enrico Dandolo +50 gold
[20543.085] MT_Initialize: INFO   Turn 7   Cleared camp for Alexander +50 gold
[20548.248] MT_Initialize: INFO   Turn 8   Cleared camp for Augustus Caesar +50 gold
[20554.910] MT_Initialize: INFO   Turn 9   Cleared camp for Bismarck +50 gold
[20559.870] MT_Initialize: INFO   Turn 10  Cleared camp for Kamehameha +50 gold
[20560.541] MT_Initialize: INFO   Turn 10  Cleared camp for Bismarck +50 gold
[20572.600] MT_Initialize: INFO   Turn 12  Cleared camp for Catherine +50 gold
[20577.779] MT_Initialize: INFO   Turn 13  Cleared camp for Alexander +50 gold
[20584.955] MT_Initialize: INFO   Turn 14  Cleared camp for Alexander +50 gold
[20596.515] MT_Initialize: INFO   Turn 16  Cleared camp for Bismarck +50 gold
[20610.758] MT_Initialize: INFO   Turn 18  Cleared camp for Kamehameha +50 gold
[20617.622] MT_Initialize: INFO   Turn 19  Cleared camp for Alexander +50 gold
[20623.550] MT_Initialize: INFO   Turn 20  Cleared camp for Bismarck +50 gold
[20628.807] MT_Initialize: INFO   Turn 21  Cleared camp for Gustavus Adolphus +50 gold
[20630.305] MT_Initialize: INFO   Turn 21  Cleared camp for Bismarck +50 gold
[20636.186] MT_Initialize: INFO   Turn 22  Cleared camp for Gustavus Adolphus +50 gold
[20647.761] MT_Initialize: INFO   Turn 24  Cleared camp for Alexander +50 gold
[20649.228] MT_Initialize: INFO   Turn 24  Cleared camp for Catherine +50 gold
[20666.388] MT_Initialize: INFO   Turn 26  Cleared camp for Kamehameha +50 gold
[20673.814] MT_Initialize: INFO   Turn 27  Cleared camp for Catherine +50 gold
[20680.303] MT_Initialize: INFO   Turn 28  Cleared camp for Kamehameha +50 gold
[20687.448] MT_Initialize: INFO   Turn 29  Cleared camp for Alexander +50 gold
[20693.922] MT_Initialize: INFO   Turn 30  Cleared camp for Gustavus Adolphus +50 gold
[20693.922] MT_Initialize: INFO   Turn 30  Cleared camp for Alexander +50 gold
[20701.691] MT_Initialize: INFO   Turn 31  Cleared camp for Augustus Caesar +50 gold
[20710.053] MT_Initialize: INFO   Turn 32  Cleared camp for Alexander +50 gold
[20720.957] MT_Initialize: INFO   Turn 33  Cleared camp for Alexander +50 gold
[20720.957] MT_Initialize: INFO   Turn 33  Cleared camp for Catherine +50 gold
[20728.710] MT_Initialize: INFO   Turn 34  Cleared camp for Kamehameha +50 gold
[20738.554] MT_Initialize: INFO   Turn 35  Cleared camp for Enrico Dandolo +50 gold
[20746.541] MT_Initialize: INFO   Turn 36  Cleared camp for Bismarck +50 gold
[20756.588] MT_Initialize: INFO   Turn 37  Cleared camp for Catherine +50 gold
[20764.341] MT_Initialize: INFO   Turn 38  Cleared camp for Kamehameha +50 gold
[20774.840] MT_Initialize: INFO   Turn 39  Cleared camp for Bismarck +50 gold
[20783.592] MT_Initialize: INFO   Turn 40  Cleared camp for Catherine +50 gold
[20795.260] MT_Initialize: INFO   Turn 41  Cleared camp for Kamehameha +50 gold
[20805.978] MT_Initialize: INFO   Turn 42  Cleared camp for Enrico Dandolo +50 gold
[20805.978] MT_Initialize: INFO   Turn 42  Cleared camp for Catherine +50 gold
[20817.366] MT_Initialize: INFO   Turn 43  Cleared camp for Enrico Dandolo +50 gold
[20856.116] MT_Initialize: INFO   Turn 45  Cleared camp for Alexander +50 gold
[20867.473] MT_Initialize: INFO   Turn 46  Cleared camp for Gustavus Adolphus +50 gold
[20880.250] MT_Initialize: INFO   Turn 47  Cleared camp for Kamehameha +50 gold
[20889.969] MT_Initialize: INFO   Turn 48  Cleared camp for Alexander +50 gold
[20920.358] MT_Initialize: INFO   Turn 50  Cleared camp for Bismarck +50 gold
 
Yeah, I don't like this whole auto-clearing camps thing. I want to see a camp spawn with Honor, go over to reveal it with my warrior and find its captured an AI worker that I can set free... creates more interesting situations at the start. I think its more that the AI units aren't aggressive enough towards barbarian camps, and this auto-clearing seems like a strange way to band-aid it.
 
Yeah, I don't like this whole auto-clearing camps thing. I want to see a camp spawn with Honor, go over to reveal it with my warrior and find its captured an AI worker that I can set free... creates more interesting situations at the start. I think its more that the AI units aren't aggressive enough towards barbarian camps, and this auto-clearing seems like a strange way to band-aid it.

There aren't too many ways to handle it at all. I don't think it's possible to change how the AI handles barbarian camps but if you have a suggestion I'm sure Thal would be happy to hear it.

I'm actually okay with autoclearing barbarian camps. As long as the issues brought up in the thread are addressed; and the radius at which the camps are cleared from the city is reduced to a flat value (to maybe 4-6 from the 8 tiles on standard map size), and the notifications from the honor opener are handled (may not be possible without a DLL mod).
 
If the issue is that the AI can't be corrected to handle Barbarians well, you might as well just play with the "No Barbarians" advanced option checked - that's essentially what this is doing, except it gives the AIs massive amounts of gold in the process.
 
I'm not liking the change to the Barbarians if this is in fact working as intentional. I like playing with Raging Barbarians so I can work my way around the map clearing camps for early gold and now camps are spawning all over the place but most are already gone by the time I get there with just the Barbarians running around. This is giving the AI way too much gold since they're not actually having to kill the Barbarians first to take the camp and with the reduced cost of buying buildings gives them too much of an advantage on the higher difficulty levels. It also nerfs the advantages of playing as Civ's that rely on clearing camps for their UA.

Also, what about the camps that the City-States target? Is this happening to them as well making it so the AI is getting easy alliances? If so that's just another reason this change needs to be taken out.
 
I really dislike this change. The range is huge, so it often affects barbs in my territory... and it makes exploration / discovery (one of my favorite parts of the game) boring, since it cuts out a large chunk of the rewards. I want to fight large barbarian hordes, dammit; and I like fighting through them to get the rewards from their camps. If barbarians are basically being turned into 'random free gold for the AI', then that's a huge chunk of my gameplay cut out.

If the problem is 'the AI can't handle barbarians in the current implementation', then either revert the barbarians buffs that caused the problem, or give the AI some kind of anti-barbarian buff, or maybe find out a way to fix the AI issues. But don't just randomly change barbarians into free AI gold; that alone would basically amount to a deal-breaker, which would stop me from using the mod at all.
 
I'm not liking the change to the Barbarians if this is in fact working as intentional. I like playing with Raging Barbarians so I can work my way around the map clearing camps for early gold and now camps are spawning all over the place but most are already gone by the time I get there with just the Barbarians running around. This is giving the AI way too much gold since they're not actually having to kill the Barbarians first to take the camp and with the reduced cost of buying buildings gives them too much of an advantage on the higher difficulty levels. It also nerfs the advantages of playing as Civ's that rely on clearing camps for their UA.

Also, what about the camps that the City-States target? Is this happening to them as well making it so the AI is getting easy alliances? If so that's just another reason this change needs to be taken out.

Actually, the AI does not (rush) buy buildings. Or anything really. The AI has a huge problem with spending it's gold effectively and the only reason the AI bought buildings in GEM was because Thal wrote code for it to do so and that code has not been introduced into CEP yet. Also, with the AI currently have trouble (?) with gold generation, you should not be noticing the AI spiraling out of control in the late game.

I agree that the civs that rely on barbarians will be getting a nerf but they probably need a re-balance as seen in the leader's thread.

For the most part, the encampments should be deleted the same turn they are generated and city states should not be giving any rewards for them being cleared. Keep in mind that the clearing code only applies to AI players so camps by the city states should not be affected.

I really dislike this change. The range is huge, so it often affects barbs in my territory... and it makes exploration / discovery (one of my favorite parts of the game) boring, since it cuts out a large chunk of the rewards. I want to fight large barbarian hordes, dammit; and I like fighting through them to get the rewards from their camps. If barbarians are basically being turned into 'random free gold for the AI', then that's a huge chunk of my gameplay cut out.

If the problem is 'the AI can't handle barbarians in the current implementation', then either revert the barbarians buffs that caused the problem, or give the AI some kind of anti-barbarian buff, or maybe find out a way to fix the AI issues. But don't just randomly change barbarians into free AI gold; that alone would basically amount to a deal-breaker, which would stop me from using the mod at all.

As far as I know, the only buffs the barbarians get over BNW is that they can upgrade in camps and heal. There were complaints earlier that the barbarians were too easy for the human players without these traits before Thal reintroduced them from GEM. And I believe that Thal lowered the spawn rate back down to BNW rates and that the AI actually do get higher combat buffs against barbarians.

Also, you can try lowering the clearing radius (8 on a standard sized map) would involve changing the following line of code:

PHP:
    local revealRadius = Game.GetWorldInfo().AIRevealRadius

to a lower constant:

PHP:
    local revealRadius = 5

And see if that is more to your liking.
 
Top Bottom