Multiplayer Campaigns HOWTO

Discussion of all aspects of multiplayer development: unit balancing, map development, server development, and so forth.

Moderator: Forum Moderators

NeoPhile
Posts: 155
Joined: July 22nd, 2004, 4:33 am
Location: Halifax, NS, Canada
Contact:

Post by NeoPhile »

I just added a page on multiplayer campaigns to the wiki, using the information from here, along with stuff I gleaned from Elf War and An Unnatural Winter. If anyone wants to proofread it, it could probably use some fine tuning.
Rhuvaen
Inactive Developer
Posts: 1272
Joined: August 27th, 2004, 8:05 am
Location: Berlin, Germany

Post by Rhuvaen »

Excellent! I'll promise to read and edit it from time to time.

We could also add a section for WML that's useful for MP Campaign purposes, such as: difficulty settings, campaign-specific factions/leaders, victory conditions etc.

Also it should probably link to MP campaign content - but how? I'll have to get more familiar with the wiki structure for campaigns to get an idea.
NeoPhile
Posts: 155
Joined: July 22nd, 2004, 4:33 am
Location: Halifax, NS, Canada
Contact:

Post by NeoPhile »

Rhuvaen wrote:We could also add a section for WML that's useful for MP Campaign purposes, such as: difficulty settings, campaign-specific factions/leaders, victory conditions etc.
I put in a replace-the-leader macro, and everything else (except for difficulty) is pretty self-explanatory.

As far as difficulty settings go, I haven't found a solution that I like. I don't think [if] goes in a [side] tag (it didn't work in [message]), so I'd have to move everything to prestart for all scenarios. And then the number of [if]/[then]/[else] I'd have to use would be ridiculous. I tried tinkering with macros, but they're really not suited to that kind of thing (does that ENDIF need a [/then] or a [/else], etc). I suppose I could ignore [else], and just use 3 separate [if]s.

It just occurred to me that I might use seperate include files to make life easier. I could put something like this in my scenario:

Code: Select all

{@campaigns/My_Campaign/scenarios/scen2.$difficulty}
And then I could fill the included files with stuff like:

Code: Select all

#Something with gold[0]
{VARIABLE gold[1] 150}
{VARIABLE gold[2] 200}
...

[side]
type=Draug
recruit=Deathblade,Revenant,Bone Shooter
...
[/side]
I'll post something if I can make it work. I don't like splitting up scenario files, but I don't much like the alternatives either.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

I could put something like this in my scenario:
No, you can't. You can't mess preprocessor commands (like include WML, macros, and definitions) and normal WML.
First read, then think. Read again, think again. And then post!
Rhuvaen
Inactive Developer
Posts: 1272
Joined: August 27th, 2004, 8:05 am
Location: Berlin, Germany

Post by Rhuvaen »

NeoPhile wrote:I put in a replace-the-leader macro, and everything else (except for difficulty) is pretty self-explanatory.
Mind if I expand it a bit? For instance, in Unnatural Winter I have a macro that replaces the leader type if it doesn't match the race and alignment (so the human players can choose any non-chaotic human leaders). It also keeps the player's names (which I think is fun in MP).

Also I could see some typical difficulty settings (like setting an XP modifier for all units, or changing terrain in some places), and the side adjustment stuff. I'm not sure if everything is self-explanatory :).

Also, we need to have a whole section on ideas on what MP Campaigns are... they sort of breach the scope of single-player (cooperative, competitive, tournament-style, rpg?).
NeoPhile wrote:As far as difficulty settings go, I haven't found a solution that I like. I don't think [if] goes in a [side] tag (it didn't work in [message]), so I'd have to move everything to prestart for all scenarios. And then the number of [if]/[then]/[else] I'd have to use would be ridiculous. I tried tinkering with macros, but they're really not suited to that kind of thing (does that ENDIF need a [/then] or a [/else], etc). I suppose I could ignore [else], and just use 3 separate [if]s.
I wanted to have three separate but cummulative ifs for four difficulty levels (pseudocode):

Code: Select all

if diff > easy then ... (change some things)
if diff > normal then ... (change some more)
if diff > challenging then ... (the ultimate change)
I think that'd be neat enough really. It just somehow didn't work out like that (because I was changing units the ifs ended up being mutually exclusive)
NeoPhile wrote:It just occurred to me that I might use seperate include files to make life easier. I could put something like this in my scenario:

Code: Select all

{@campaigns/My_Campaign/scenarios/scen2.$difficulty}
You couldn't use it like that, instead you would adjust the next_scenario in the preceding one:

Code: Select all

[endlevel]
  result=victory
  next_scenario=scen2_$difficulty
[/endlevel]
I believe I won't make many adjustments after the first scenario for difficulty, so I'll stick to the [if] version - the XP modifier is a strong one in the long run :wink:.
NeoPhile
Posts: 155
Joined: July 22nd, 2004, 4:33 am
Location: Halifax, NS, Canada
Contact:

Post by NeoPhile »

Rhuvaen wrote:Mind if I expand it a bit? For instance, in Unnatural Winter I have a macro that replaces the leader type if it doesn't match the race and alignment (so the human players can choose any non-chaotic human leaders). It also keeps the player's names (which I think is fun in MP).
Knock yourself out! It's a wiki, it'd be stupid for me to claim ownership or control over it. I like the changes you made already, BTW.

My initial thought was to keep things basic. If anyone wanted to do something fancy, like conditional leader replacement, or difficulty levels, they could browse the WML pages to figure it out, or ask on the forum. That's how scenario/campaign/multiplayer seems to be set up, and it makes sense to me.
Rhuvaen wrote:I wanted to have three separate but cummulative ifs for four difficulty levels (pseudocode):

Code: Select all

if diff > easy then ... (change some things)
if diff > normal then ... (change some more)
if diff > challenging then ... (the ultimate change)
I think that'd be neat enough really. It just somehow didn't work out like that (because I was changing units the ifs ended up being mutually exclusive)
Yeah, I figured as much. If diff = easy makes more sense than if diff > easy to me. Your if's are guaranteed to not interfere with each other that way, even without elseif's.
Rhuvaen wrote:You couldn't use it like that, instead you would adjust the next_scenario in the preceding one:

Code: Select all

[endlevel]
  result=victory
  next_scenario=scen2_$difficulty
[/endlevel]
That's disappointing. Most of the WML will not change between difficulties, so you have to worry about keeping multiple files in sync with that route. Unless scen2_$difficulty actually worked something like this:

Code: Select all

{@campaigns/My_Campaign/scenarios/scen2_header}

[event]
name=prestart
   {@campaigns/My_Campaign/scenarios/scen2_prestart}
   (possible setup here)
[/event]

{@campaigns/My_Campaign/scenarios/scen2_events}

[side]...[/side]
[side]...[/side]
...

{@campaigns/My_Campaign/scenarios/scen2_footer}
And that's uglier than HTML's <blink> tag. The other option is to set some variables in the victory event, which is much nicer, but still annoying, especially when you think about clearing them.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

Code: Select all

[endlevel] 
  result=victory 
  next_scenario=scen2_$difficulty 
[/endlevel]
This might work, but I recommend this:

Code: Select all

{VARIABLE_OP scen_2 format scen2_$difficulty}
[endlevel] 
  result=victory 
  next_scenario=$scen_2 
[/endlevel]
First read, then think. Read again, think again. And then post!
Sombra
Posts: 273
Joined: August 11th, 2006, 6:38 pm

Post by Sombra »

hi for the lazy and uncreative ones . Are there any MP finished campaigns right now?
NeoPhile
Posts: 155
Joined: July 22nd, 2004, 4:33 am
Location: Halifax, NS, Canada
Contact:

Post by NeoPhile »

Sombra wrote:hi for the lazy and uncreative ones . Are there any MP finished campaigns right now?
Not really, no. MP campaigns are a new feature, so there hasn't been much time to make them. That said, you could try my version of Elf War, which has 10 playable scenarios (which is all of them). I've made some updates since then, and I plan to throw it on the campaign server sometime. I need to playtest it once more, and try to contact the original creator first though.
Rhuvaen
Inactive Developer
Posts: 1272
Joined: August 27th, 2004, 8:05 am
Location: Berlin, Germany

Post by Rhuvaen »

Just for the record, the [story] tag has been proved not to work in network games - only the host will see the story parts. :(
sergi34
Posts: 12
Joined: September 26th, 2006, 8:53 pm

problem with experience/gold

Post by sergi34 »

Hi!

I've been playing with my wife with your Elf War MP and I have a problem.
When we finish the first scenario, on the second one only the first player retains the experienced soldiers for recall and also the money from the first scenario. But the other player begins the second scenario with 100 gold and no experienced elfs at all.

Is this a bug of the campaign or it's a bug of the wesnoth itself?

thanks in advance and congratulations for the campaign and for the game to all developers or campaign makers.

Sergi
Rhuvaen
Inactive Developer
Posts: 1272
Joined: August 27th, 2004, 8:05 am
Location: Berlin, Germany

Re: problem with experience/gold

Post by Rhuvaen »

sergi34 wrote:I've been playing with my wife with your Elf War MP and I have a problem.
Hi, this is the MP Campaigns HOWTO thread. Your post would fit better in the Elf War Conversion thread.

I don't know if neophile is still around, if not I might have a look at Elf War and see if I can fix this. Where did you download Elf War from (forum/campaign server...)?

Thanks for reporting this. :)
sergi34
Posts: 12
Joined: September 26th, 2006, 8:53 pm

Post by sergi34 »

I post this message on reply to this on the other forum:

http://www.wesnoth.org/forum/posting.ph ... ly&t=11349

I've managed to fix the problem with the second player on the second scenario that he cannot recall units. The problem was with the save_id that was not the same.

But the problem with the gold is not solved. I've been surfing with source code and trying to recompile again with some changes and I've seen the problem.

it's on the file playsingle_controller.cpp

on the function play_scenario, the code:

for(std::vector<team>::iterator i=teams_.begin(); i!=teams_.end(); ++i) {
if (!i->is_persistent())
continue;
//stuff for carry gold to next scenario
........
}
I've seen that it considers the second player as not being persistent, so the gold and bonus gold is not carried to the next scenario.

But I haven't managed to know why does this happen.

I downloaded the multiplayer campagin EW_multi from this same forum as a zip file EW.zip

thanks!

Sergi
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

sergi34 wrote:But the problem with the gold is not solved. I've been surfing with source code and trying to recompile again with some changes and I've seen the problem.

it's on the file playsingle_controller.cpp

on the function play_scenario, the code:

for(std::vector<team>::iterator i=teams_.begin(); i!=teams_.end(); ++i) {
if (!i->is_persistent())
continue;
//stuff for carry gold to next scenario
........
}
I've seen that it considers the second player as not being persistent, so the gold and bonus gold is not carried to the next scenario.

But I haven't managed to know why does this happen.
I'm not sure, but it sounds like this could be solved by just putting persistent=1 (or whatever it was) into the other players' side definitions in MP campaigns. I don't think we should have sides other than side 1 be persistent by default.
sergi34
Posts: 12
Joined: September 26th, 2006, 8:53 pm

Post by sergi34 »

I had tested this already. I had put persistent=1 on both sides and both scenarios, and the same thing happens.

I'm playing with 1.1.11.. should I try it on subversion trunk?

Sergi
Post Reply