UnofficialCrusaderPatch / UnofficialCrusaderPatch2

Unofficial balancing patch installer for Stronghold Crusader 1
MIT License
430 stars 59 forks source link

sharing gold with Allies #743

Open Monsterfisch opened 3 years ago

Monsterfisch commented 3 years ago

Add a chance for ai that has reached a certain threshold of gold, let's say 20000, to send out that gold to the weakest of their allies to help them out.

The threshold could be individualized per character or generalized to get started.

This could lay the groundwork for ai sending each other goods maybe since they already seem to request help from one another although it's not clear whether or not they respond to it. maybe it's worth investigating if it can be made feasible and potentially expanded with sending goods to one another.

LordHansCapon commented 3 years ago

I have already made a CE script that allows gold trading, however, it is prone to abuse and hard to balance.

Monsterfisch commented 3 years ago

Mind sharing more details so that I can contribute with ideas to maybe help balance it out/prevent abuse? =)

LordHansCapon commented 3 years ago

It is hardcoded for the AI to decline gold requests immediately, so there is nothing in place... we can implement anything there really. If you think you can come up with a good system for it, go ahead.

Monsterfisch commented 3 years ago

I was more thinking in the line of the ai sends you pity gold instead of reacting to a request similar to how ai can send you gold right before it dies and has gold leftover, it would send you to gold if they have reached a certain threshold of money in their bank and feels "generous". When that happens the ai checks for either a random ally or the poorest and sends them a set amount of gold or a % of their own current money let's say 5% to the ally to help them up on their feet or support them in their war effort. these values could even be added to the aic to have them character-specific since some ais lend themselves more to being a bit generous than others.

If you want to make it happen on a request basis you could try and see if it could be done like the following. When you request gold the ai would check if you have at least a certain amount of gold before it agrees to your request lets say you got to have at least 10% of the gold that the ai currently owns otherwise it won't consider sending gold (sort of like the ai checks whether or not you are a wasteful spender or not ;) ) this calculation could also be expanded to take into account the troop amount the player has meaning if he has more troops than the ally the ai would be more inclined to follow the request.

granted these are hypotheticals but gotta start somewhere and test how it works out ^^

Monsterfisch commented 3 years ago

btw is there an indication of ai aiding other ai allies when they send out help requests? and if not would it be possible to make it so that ai can go and assists their ai allies with troops?

Truetobi91 commented 3 years ago

Check for own gold level. If gold > 25.000 --> check for active team members. If team member count > 0 --> check for lowest gold team member. If gold < 2.500 --> send gold = ((own gold)-(ally gold))x0.1

I'd also limit this check in in-game ticks to only ever make this check once per in-game year.

GRhin commented 3 years ago

If this is happening every tick, it would limit AIs gold to 25,000. I think adding a probability for him to do it that could be included in the aic. Also a time limit, so the ai would only do it every 1,000 ticks or something.

LordHansCapon commented 3 years ago

I would also incorporate a weighting method to give it depth. Certain allies such as Caliph should not really send you any money, but Sultan and Saladin should be generous. Adding a check for "Bad buildings" should also benefit the change. AI could also keep in mind how helpful you are when it comes to aiding them (simple counter for whenever you said yes to help them) and how many times you refused/accepted their goods requests. These could all be weighted in to make a decision about sending money.

Monsterfisch commented 3 years ago

if the weighting is in there it could also be added to the aiding and attack enemy function tbh but I think having the basic mechanics in there first to test would be a great start

check every year if the requirements are met (threshold/poor ally) and then make it so that the ai character will send its money to an ally. making it character specific would be step 2 here we could make it so that caliph etc could be convinced by sending him alot of stuff before so that weighting aspect would take effect(this would be a variable that can be added to the aic potentially or as suggested is based on the fearfactor buildings (i personally would rather have it in the aic as its more predictable but either is fine in the end. for the weighted method it could also reset after some time so you cant just get to a point and than keep requesting gold or requesting gold/support and recieving it will reset/reduce it .

Russianstory commented 3 years ago

t's a pity that bots don't want to share gold)))))

ByBurton commented 3 years ago

I don't like the idea of an AI just sending gold. It should depend on the personality. E.g. a caliph would never send you gold, even if he had more than enough.

But I like the idea of the AI sending out gold, or trading with other AIs and stuff like that.