[objectives] patch: allows changing objectives mid-game

This restricted forum is for discussion of the game’s development.

Moderator: Developers

[objectives] patch: allows changing objectives mid-game

Postby ott » March 16th, 2005, 8:27 pm

I posted a patch to implement Sanna's [objectives] WML tag to Savannah: http://savannah.nongnu.org/patch/index. ... em_id=3789

This tag allows setting of scenario objectives as events:
Code: Select allExpand
[scenario]
[event]
   name=prestart
   [objectives]
      summary= _ "Follow instructions"
      [objective]
         description= _ "Move one hex to the north"
         condition=win
      [/objective]
      [objective]
         description= _ "Death of Superelf"
         condition=lose
      [/objective]
   [/objectives]
[/event]
[/scenario]
This tag is backwards compatible with the existing usage:
Code: Select allExpand
[scenario]
   objectives= _ "Follow instructions
Victory:
@Move one hex to the north
Defeat:
#Death of Superelf"
[/scenario]
Note the special colour indicators and the need to have the string running across newlines. The new tag simply overwrites the value of the string that stores the objectives. Using [objectives] tags, the scenario objectives can be changed as many times as the scenario designer wishes: randomly, every few turns, every step, when reaching a specific hex, on attack, or any other event.

Here is how it can be used in a moveto event:
Code: Select allExpand
[event]
   name=moveto
   [filter]
      side=1
      x=6
      y=7
   [/filter]

   [objectives]
      summary= _ "Back to the boring stuff"
      show=yes
      victory_string= _ "Win:"
      defeat_string= _ "Lose:"
      [objective]
         description= _ "Defeat all enemy leaders"
         condition=win
      [/objective]
      [objective]
         description= _ "Death of Superelf"
         condition=lose
      [/objective]
   [/objectives]
[/event]


Summary of features:
    requires no changes to existing campaigns,
    fills in the colours for defeat and victory conditions automatically,
    can display objectives when they change (thanks to Invisible Philosopher for suggesting),
    eases translations, and
    adds a "quick summary" line to objectives.


Several campaign developers use hacks to change objectives mid-scenario. Turin has mentioned having a use for changing objectives, but is this patch worth including in the mainline distribution? If you think so, please state your opinion here, or even better, help to improve the patch so it doesn't muck around quite so much with global data structures. Right now the patch is languishing without any serious developer review, and needs to be updated frequently to keep up with CVS.
This quote is not attributable to Antoine de Saint-Exupéry.
ott
Developer
 
Posts: 838
Joined: September 28th, 2004, 10:20 am

Postby scott » March 16th, 2005, 9:39 pm

Awesome. Is the summary key displayed in addition to the "OBJECTIVES" line or does it replace it? Sounds like it is in addition.
Hope springs eternal.
Wesnoth acronym guide.
scott
Forum Regular
 
Posts: 5242
Joined: May 12th, 2004, 12:35 am
Location: Los Angeles, CA

Postby aelius » March 16th, 2005, 10:48 pm

I for one would love to see this in the main line. There are three (possibly four) scenarios in The South Guard where I'd use it.

- b.
La perfection est atteinte non quand il ne reste rien à ajouter, mais quand il ne reste rien à enlever. - Antoine de Saint Exupery (of course)
aelius
Forum Regular
 
Posts: 497
Joined: August 30th, 2004, 8:07 pm
Location: Virginia, USA

Postby MadMax » March 17th, 2005, 12:55 am

I'd like to see this make CVS too, because I will be able to have Kogw appear on turn 3 (Blue River, FtF), like I had planned.
"ILLEGITIMIS NON CARBORUNDUM"

Father of the Drake Campaign
http://www.wesnoth.org/wiki/FlightToFreedom
MadMax
Forum Regular
 
Posts: 1766
Joined: June 6th, 2004, 3:29 pm
Location: Weldyn, Wesnoth

Postby quartex » March 17th, 2005, 5:00 am

This would be awesome. If this gets implemented I could use it a plethora of times in my campaign. Thanks so much for making the patch.
quartex
Developer
 
Posts: 2258
Joined: December 22nd, 2003, 4:17 am
Location: Boston, MA

Postby fabi » March 17th, 2005, 9:27 pm

Could this patch be enhanced, to use another tag, normally only available at
scenario start:
[story] in an event ?

Greetings, Fabi
fabi
Developer
 
Posts: 921
Joined: March 21st, 2004, 2:42 pm
Location: Germany

Postby Sangel » March 17th, 2005, 10:03 pm

fabi wrote:Could this patch be enhanced, to use another tag, normally only available at
scenario start:
[story] in an event ?

Greetings, Fabi


Mid-scenario cutscenes? I love that idea.
"Pure logic is the ruin of the spirit." - Antoine de Saint-Exupéry
Sangel
Moderator Emeritus
 
Posts: 2235
Joined: March 26th, 2004, 10:58 pm
Location: New York, New York

Postby fabi » March 17th, 2005, 10:41 pm

Sangel wrote:
fabi wrote:Could this patch be enhanced, to use another tag, normally only available at
scenario start:
[story] in an event ?

Greetings, Fabi


Mid-scenario cutscenes? I love that idea.

Yes, i had this in mind, but it would have another side effect :

Cutscenes could be taken out of a wml pseudo database.

Greetings, Fabi
fabi
Developer
 
Posts: 921
Joined: March 21st, 2004, 2:42 pm
Location: Germany

Postby turin » March 17th, 2005, 10:56 pm

fabi wrote:Could this patch be enhanced, to use another tag, normally only available at
scenario start:
[story] in an event ?

Greetings, Fabi

This would also be useful, but it would probably be a different patch, not an extension.

--------

Many campaign developers could use this, and almost all agree it is a good idea. I think it should be implemented as soon as practical.
For I am Turin Turambar - Master of Doom, by doom mastered. On Wesbreak. Please don't PM me unless you have a question only I can answer.
And I hate stupid people.
The World of Orbivm
User avatar
turin
Lord of the East
 
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas

Postby MadMax » March 18th, 2005, 1:44 am

Sangel wrote:
fabi wrote:Could this patch be enhanced, to use another tag, normally only available at
scenario start:
[story] in an event ?

Greetings, Fabi


Mid-scenario cutscenes? I love that idea.
Me too.
"ILLEGITIMIS NON CARBORUNDUM"

Father of the Drake Campaign
http://www.wesnoth.org/wiki/FlightToFreedom
MadMax
Forum Regular
 
Posts: 1766
Joined: June 6th, 2004, 3:29 pm
Location: Weldyn, Wesnoth

Postby ott » March 18th, 2005, 6:34 pm

fabi wrote:Could this patch be enhanced, to use another tag, normally only available at
scenario start:
[story] in an event ?
You seem to be asking for more of the start-of-scenario initializations to be made into events. Perhaps you could start a new thread to discuss that -- seems to be a worthwhile idea, since (as I demonstrate with [objectives]) they can be put into a name=prestart event to achieve the same effect as the current start-of-scenario settings. Being more general, this would probably also simplify the parsing code.
This quote is not attributable to Antoine de Saint-Exupéry.
ott
Developer
 
Posts: 838
Joined: September 28th, 2004, 10:20 am

Postby ott » March 18th, 2005, 6:42 pm

scott wrote:Is the summary key displayed in addition to the "OBJECTIVES" line or does it replace it? Sounds like it is in addition.
The summary is concatenated with the victory and defeat objectives and the result put into the same place that the current objectives= attribute is stored. Forcemstr and Ayin have both taken a serious look at this code, but the exact location in the config data structure of where the objectives= attribute should be stored is currently under debate. It looks like it will be moved to a different place, once Ayin finds time to look at this again.
This quote is not attributable to Antoine de Saint-Exupéry.
ott
Developer
 
Posts: 838
Joined: September 28th, 2004, 10:20 am

Postby Ayin » March 19th, 2005, 1:32 pm

ott: Okay, a modified version of your patch has been commited, along with the ability to define per-side objectives.

Code: Select allExpand
   //provide a means of specifying win/loss conditions:
   // [event]
   // name=prestart
   // [objectives]
   //   side=1
   //   summary="Escape the forest alive"
   //   victory_string="Victory:"
   //   defeat_string="Defeat:"
   //   [objective]
   //     condition=win
   //     description="Defeat all enemies"
   //   [/objective]
   //   [objective]
   //     description="Death of Konrad"
   //     condition=loss
   //   [/objective]
   // [/objectives]
   // [/event]
   //instead of the current (but still supported):
   // objectives= _ "
   // Victory:
   // @Move Konrad to the signpost in the north-west
   // Defeat:
   // #Death of Konrad
   // #Death of Delfador
   // #Turns run out"
   //
   // If side is set to 0, the new objectives are added to each player.
   //
   // The new objectives will be automatically displayed, but only to the
   // player whose objectives did change, and only when it's this player's
   // turn.


The old way of defining objectives, which is to supply an "objectives=" value into the level, is still supported, but is considered obsolete, in favour of using prestart events setting objectives. The old way of setting objectives sets them for all sides.

[objective] events replace the current objectives, and do not merge them.

When the objectives of a player change during his turn, an "objectives" dialog automatically appears.

When the objectives of a player A change during player B's turn, the "objectives" dialog appear only to player A when it's his turn.

Objective changes for other players do never appear (those are, however, sent to clients, so cheaters may see them anyway.)
Ayin
Developer
 
Posts: 294
Joined: March 30th, 2004, 4:45 pm
Location: Nîmes, France

Postby scott » March 19th, 2005, 2:04 pm

Does side take a list?

For multiple win or loss conditions, do you use multiple [objective] tags or make a multiline string?

edit:
Can you leave out victory_string, defeat_string, and summary and get default values of "Victory:" "Defeat:" and ""?
Or any other keys for that matter?
side?
Hope springs eternal.
Wesnoth acronym guide.
scott
Forum Regular
 
Posts: 5242
Joined: May 12th, 2004, 12:35 am
Location: Los Angeles, CA

Postby Ayin » March 19th, 2005, 2:48 pm

scott wrote:Does side take a list?

For multiple win or loss conditions, do you use multiple [objective] tags or make a multiline string?


You may do either, but using multiple [objective] tags is strongly recommended: this allows re-using strings, and lessens the work of translators.

scott wrote:edit:
Can you leave out victory_string, defeat_string, and summary and get default values of "Victory:" "Defeat:" and ""?
Or any other keys for that matter?
side?


If you do not define them, they have the default values. My example was quite bad, indeed: as they are left to default values, they should not have been defined.
Ayin
Developer
 
Posts: 294
Joined: March 30th, 2004, 4:45 pm
Location: Nîmes, France

Next

Return to Developers’ Discussions

Who is online

Users browsing this forum: No registered users and 0 guests