Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement independent stance from every tribe to every other tribe #2119

Closed
bunnybot opened this issue Sep 9, 2019 · 13 comments
Closed

Implement independent stance from every tribe to every other tribe #2119

bunnybot opened this issue Sep 9, 2019 · 13 comments
Labels
enhancement New feature or request lua Lua scripts and scripting interface
Milestone

Comments

@bunnybot
Copy link

bunnybot commented Sep 9, 2019

It should be possible to set via scripting that player x may/mustn't attack player y.
This will be necessary to fix an issue in the second frisian scenario (see also bug 1792478, #28).


Imported from Launchpad using lp2gh.

@bunnybot bunnybot added Fix Committed lua Lua scripts and scripting interface labels Sep 9, 2019
@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by tiborb95)
This was discussed some time ago - perhaps putting the players into teams would do the trick... Might be available via LUA interface...

@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by nordfriese)
I´ve been using teams as a workaround in fri02, but they can´t work as desired there. It is necessary there that two players are enemies (different teams or teamless) while still unable to attack each other, and that p3 can attack p2 but p2 can´t attack p3. This can´t be implemented with the current team system.

@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by tiborb95)
Well if you look at:

https://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/ai/defaultai_warfare.cc#L167

you see that AI gets the information if building is attackable from the "core". If the response was "false" it would do the trick, though I am not sure how would AI cope with changed status of such building (when you decide to change it with LUA)...

But the bottom line is where your new information (who is attackable for whom) should be stored...

@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by tiborb95)
Well I can imagine new variable for Player class like: std::set no_attack_players and then AI (and UI for human player) could read and follow this... should not be complicated on AI's side

@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by gunchleoc)
We could have 3 states: enemy, ally, neutral. Neutral won't attack, but also not share the other player's vision.

@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by tiborb95)
But it would interfere with current team stuff.

What about new "pacifist" flag? He would never attack and would not interfere with team stuff.

But I am afraid, next request will be like: I want player A to be able to attack B who is in the same member, but not attack C who is in different team...

@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by gunchleoc)
Why would it interfere with the current team stuff? team = ally. What I'm proposing is that we keep teams and enemies as they are and add a 3rd state.

@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by nordfriese)
Implementing this as a third state would go both ways, wouldn´t it? If the "neutral" state was set so p2 can´t attack p3, then p3 won´t be able to attack p2.
IMHO the best way to solve this would be to have for each player individually a list of players he mustn´t attack. p1 can then attack p2 if and only if they are on different teams (or teamless) AND p2 is not on p1´s ban list.
So, all team-related stuff would be unchanged and the new feature is merely a way to override the ''attackable==true'' state between enemies.
Also, this would provide a way to account for every imaginable constellation of player relations, so there won´t be need to implement something again for other very special cases…

@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by franku)
In the scenario i am working on i have implemented a prevent_attack function. This uses just the field_action window and checks if the attack button is there. Whenever a player clicks on an attackable building a warning is shown:

function prevent_attack()
local warn_level = 1
while true do
local w = wl.ui.MapView().windows.field_action
if w and w.buttons.attack then
print("Attacking not allowed!")
if warn_level < 2 then
campaign_message_box(no_attack_01)
warn_level = warn_level + 1
elseif warn_level < 3 then
campaign_message_box(no_attack_02)
warn_level = warn_level + 1
elseif warn_level < 5 then
campaign_message_box(no_attack_03)
warn_level = 1
end
w:close()
end
sleep(100)
end
end

This works just nicely and shows a dialog to the player which covers the field_action window. I use three warning levels here: On first show warning1 on second click warning2 and so on. I think such thing could also be adapted to show the warning when clicking on an attackable building of a specific player.

@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by gunchleoc)
So, you want the player to be able to attack the enemy, and the enemy can never retaliate, because the settings forbid it? Or would the other player automatically change their state after being attacked? The latter case sounds like a war declaration, in which case we would not need individual states, but some diplomacy UI instead.

@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by nordfriese)
@kaputtnik: That´s an elegant fix! Unfortunately it works only for human player, right? Since AI doesn´t use UI elements.
@gunchleoc: Yes, I want the Barbarians to be able to attack the Empire, but the Empire must be helpless unless I explicitly allow them to strike back, which would be the case if and only of the barbarians have conquered a sizeable number of buildings. (Checking that is as easy as checking for the number of "empire_*" militarysites the barbarians own.). I want to allow the Empire to reconquer buildings they have lost, but not much more than that; especially they must not defeat the barbarians.

@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by ypopezios)
The tested (in other strategy games) solution is to have an independent stance from every tribe to every other tribe. Everything else is suboptimal.

@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by gunchleoc)
OK, independent stance it is, those are valid reasons :)

@bunnybot bunnybot added this to the build21-rc1 milestone Sep 9, 2019
@gunchleoc gunchleoc added enhancement New feature or request launchpad_done and removed Wishlist labels Sep 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lua Lua scripts and scripting interface
Projects
None yet
Development

No branches or pull requests

2 participants