2 leaders, 1 side

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
Natasiel
Moderator Emeritus
Posts: 60
Joined: February 28th, 2007, 7:43 pm

2 leaders, 1 side

Post by Natasiel »

Hello Forum,

I had a full description post written along some solutions; got disturbed; came back; submitted and lost all since I got logged out. :)

So, to briefly resume...

I can have an AI side with 2 leaders on 2 different keep/castle, The problem is: the second leader don't recruit until the first leader dies.

Any *elegant* way to circumvent this so both "leaders" recruit on their respective keep? (imagine a 8p coop game with only 1 slot left for AI)

So far, I have imagined an "[event] recruit" switching leaders so they can each recruit, but if a leader gets his castle full, the other wont be switched to recruit. An other ugly solution would be to take the AI by the hand, scripting manually it's recruits within WML.

Another more basic occurrence of the problem appears when AI don't fully recruit even with a single leader.

I hope I made my problem clear enough so WML and AI experts can either bring suggestions or points toward some working code.

Have a nice day,

Natasiel.
monochromatic
Posts: 1549
Joined: June 18th, 2009, 1:45 am

Re: 2 leaders, 1 side

Post by monochromatic »

The wiki says it's not possible at the moment, but it probably can be done somehow through some Lua I guess.

For now just use two sides.
Last edited by monochromatic on January 7th, 2011, 3:12 pm, edited 1 time in total.
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: 2 leaders, 1 side

Post by Crendgrim »

@elvish_sovereign:
The problem is that he has 8 human controlled sides, so there's only one slot left for an AI side...


Crend
UMC Story Images — Story images for your campaign!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: 2 leaders, 1 side

Post by zookeeper »

Crendgrim wrote:@elvish_sovereign:
The problem is that he has 8 human controlled sides, so there's only one slot left for an AI side...
The last time I checked you can have more than 9 sides just fine, you just can't have more than 9 starting locations on the map.
User avatar
bumbadadabum
Inactive Developer
Posts: 1005
Joined: March 20th, 2008, 5:54 pm
Location: Netherlands
Contact:

Re: 2 leaders, 1 side

Post by bumbadadabum »

zookeeper wrote:
Crendgrim wrote:@elvish_sovereign:
The problem is that he has 8 human controlled sides, so there's only one slot left for an AI side...
The last time I checked you can have more than 9 sides just fine, you just can't have more than 9 starting locations on the map.
Which could be undone with some .map file modification (IIRC).
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: 2 leaders, 1 side

Post by Gambit »

zookeeper wrote:
Crendgrim wrote:@elvish_sovereign:
The problem is that he has 8 human controlled sides, so there's only one slot left for an AI side...
The last time I checked you can have more than 9 sides just fine, you just can't have more than 9 starting locations on the map.
If it's a multiplayer add-on this won't work. The 1.8 server doesn't allow more than nine sides no matter how many are AI. Not sure if this has been "fixed" in trunk.
User avatar
Natasiel
Moderator Emeritus
Posts: 60
Joined: February 28th, 2007, 7:43 pm

Re: 2 leaders, 1 side

Post by Natasiel »

No problems dealing within the 9 starting locations boundary if more than 9 sides are available. Though, multiplayer is required. If 1.8 isn't enough, I'll try to get 1.9 and use it as test bed; anyway 1.10 should be out before the scenario is completed.

Thank you for your suggestions, this is already something interesting to try.

[edit after testing]
It works when playing locally, but as mentioned by Gambit, 1.8 MP server complains:
"<Server> This server does not support games with more than 9 sides."
I'll try later with trunk and post the results.
Last edited by Natasiel on January 7th, 2011, 4:45 pm, edited 1 time in total.
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: 2 leaders, 1 side

Post by Crendgrim »

zookeeper wrote:
Crendgrim wrote:@elvish_sovereign:
The problem is that he has 8 human controlled sides, so there's only one slot left for an AI side...
The last time I checked you can have more than 9 sides just fine, you just can't have more than 9 starting locations on the map.
If this is really the case, then the Wiki should be updated... there it's said that MP scenarios with more than 9 sides won't start: SideWML


Crend
UMC Story Images — Story images for your campaign!
User avatar
StDrake
Posts: 996
Joined: July 21st, 2009, 6:50 am

Re: 2 leaders, 1 side

Post by StDrake »

Wiki is outdated, check out the code in the Legend of Wesmere campaign(singleplayer) - two leaders, same side, tried it on 1.8 and it's there working, but note that it concerns the player side, no idea how it would work for ai..hmm..*runs off to LoW to droid side 1*

edit: experiment result - AI gets confused and doesn't recruit on the other keep

I'm thinking of a little cheaty way of an event that fires off when the ai finishes its turn..that switches the leaders and somehow cancels the turn ending/gives it back to the same AI
Like cats? I've made a whole faction of them to kick ass with!
Don't like cats? I've made a whole faction of them to kick their asses! So everyone's happy :)
Felinian faction is part of the Beyond Southern Hells era
kitties need sprites! art topic here
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: 2 leaders, 1 side

Post by zookeeper »

Natasiel wrote:[edit after testing]
It works when playing locally, but as mentioned by Gambit, 1.8 MP server complains:
"<Server> This server does not support games with more than 9 sides."
I'll try later with trunk and post the results.
Right, I didn't realize it was different in MP.

A workaround you could try is to switch the leader, instead of having two at a time during the recruiting phase. For starters you could try switching the leader between every recruit: when leader 1 recruits a unit, set canrecruit=no for it and set canrecruit=yes for leader 2, and when leader 2 recruits a unit, do the same the other way around. Or only switch when the currently recruiting leader's castle is full and the other leader's castle still has room.
Tet
Posts: 391
Joined: February 18th, 2009, 5:11 am

Re: 2 leaders, 1 side

Post by Tet »

Have a look at Galuldurs journey. In the last scenario side 1 has two leaders. It is the user made campaign I am recommending in my signiture.
My Temple Project: http://forums.wesnoth.org/viewtopic.php?f=23&t=29800
This is "must-play" campaign! Don´t read the thread, unless you need help. http://forums.wesnoth.org/viewtopic.php?f=8&t=31895
monochromatic
Posts: 1549
Joined: June 18th, 2009, 1:45 am

Re: 2 leaders, 1 side

Post by monochromatic »

Tet wrote:Have a look at Galuldurs journey. In the last scenario side 1 has two leaders. It is the user made campaign I am recommending in my signiture.
Sure, look at LoW as well, but the AI can't handle two leaders properly.
Tet
Posts: 391
Joined: February 18th, 2009, 5:11 am

Re: 2 leaders, 1 side

Post by Tet »

Ups it is for a computer player?

I would consider an event thing after the first leader is disposed. Like a second leader appears. It is more a work around. You could have a leader in waiting with an overlay. But I think having a leader replaced whern he died maybe even at a diffrent location would be quit a surprise.
My Temple Project: http://forums.wesnoth.org/viewtopic.php?f=23&t=29800
This is "must-play" campaign! Don´t read the thread, unless you need help. http://forums.wesnoth.org/viewtopic.php?f=8&t=31895
User avatar
Crab
Inactive Developer
Posts: 200
Joined: March 18th, 2009, 9:42 pm

Re: 2 leaders, 1 side

Post by Crab »

I'll try to fix this for 1.9/trunk; for earlier versions, use the already mentioned workarounds.
User avatar
Natasiel
Moderator Emeritus
Posts: 60
Joined: February 28th, 2007, 7:43 pm

Re: 2 leaders, 1 side

Post by Natasiel »

Weekend investigations showed that 9 sides is still the maximum on trunk's server.

For a starter, switching between recruits works funnily, as predicted, when you block castle's hex to prevent an AI from recruiting, the other AI keeps his castle empty too. Maybe an additional "leader switch" on "[event] moveto" could further skirmish the problem.

Allowing 2 leaders that way was harder than seems on first sight. To keep the swapping around endless leaders, role and canrecruit has been used. But then, everybody has to get back to his canrecruit status and get back his golden crown to act as leaders on player's turn.

On an other approach (of course I tried many =) I've been perusing through the mechanism of the AI. My poor RCA AI attempt has been a failure on 1.8 and it has been wiped out before I realized that 1.9 would have been a better candidate to try on. I have also met the archaic fai, but that's an other story.

Let's hope to loose side ceiling before players discover and exploit the glitch. Anyway, swapping on recruit just works. While players might have been pissed off by such a behavior, AI can live with it just fine. :)
Post Reply