How to add new campaigns to 3.2

Get some help with creating maps or modding.
Need a map editor or other tools, look here!
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

How to add new campaigns to 3.2

Post by Per »

I've just added some new code to make it easier for modders to add entirely new campaigns to the game.

These depend on the new folder 'campaigns' that is read from both inside the data directory and the user write folder. In this folder you need to drop two files - one <campaign name>.ini and one <campaign name>.wz. Once they are present in this folder, the campaign defined in the .ini file will be added to the in-game menu alongside the official campaign. There is no need to use the autoload folder, or any command line parameters. Just ask the user to drop these two files into his or her campaigns folder.

This is the first Alpha campaign definition:

Code: Select all

[campaign]
name = "Alpha Campaign"
level = "CAM_1A"

[intro]
video = "cam1/c001.ogg"
captions = "cam1/c001.txa"
The name is what will be shown in the GUI menu system. The level is the name of the campaign in the .lev files. The intro lines are used for loading videos and its caption. Both those lines are optional.

As an example, I made a test campaign called "cam 4" where I just added the first alpha level. The .ini file looks like this:

Code: Select all

[campaign]
name = "Cam 4"
level = "CAM_4A"
loading = "cam4/cam4.lev"
package = "cam4-master-per.wz"
We need some extra files, and we tell the game where they are found in the "package" line. Since the CAM_4A level is not defined in gamedesc.lev, we have to supply it ourselves, in our own own level file. We tell the game which level file that is in the "loading" line. My example "cam4.lev" looks like this:

Code: Select all

camstart        CAM_4A
dataset         CAM_1
game            "wrf/cam1/cam1a.gam"
data            "wrf/cam1/cam1a.wrf"
And that is all. Now I've made a new campaign, that just loads the old campaign. It should not be hard to build upon this (I hope!). Comments and further feature requests welcome.
User avatar
Goth Zagog-Thou
Regular
Regular
Posts: 1582
Joined: 06 Jan 2007, 08:08
Location: Delta Base
Contact:

Re: How to add new campaigns to 3.2

Post by Goth Zagog-Thou »

Niiiice. :D

I assume that things like PROX messages (and the like) stay where they belong in the package file?
User avatar
Goth Zagog-Thou
Regular
Regular
Posts: 1582
Joined: 06 Jan 2007, 08:08
Location: Delta Base
Contact:

Re: How to add new campaigns to 3.2

Post by Goth Zagog-Thou »

I should also ask how deep does the rabbit hole go? For example, currently in Cam 4 I pretty much have to have a mirror of everything (intfac images, pie's, everything!) in order to get it to load.

Can / does this methodology have the capability to use #includes? Let's say I need to use MP data. Do I still need custom /stats, /wrf and a copy of all pies in the mod, or can it load base and/or mp.wz to get that data instead?

[EDIT] As an addendum, does/can it have the capability to "chain load" mods in a certain order? For instance, let's say that I make a new Campaign based upon Contingency, but I don't (or can't) integrate Contingency into the Campaign files. Could I (or would it be possible to) specify a loading order to the .ini so that it would look like:

Code: Select all

LoadOrderA = /mods/Contingency-XXX.wz
LoadOrderB = /mods/UltimateScavs-XXX.wz
LoadOrderC = /campaign/ContingencyCampaign.wz
Something like that, anyway. :)
Last edited by Goth Zagog-Thou on 11 Jan 2013, 01:48, edited 1 time in total.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: How to add new campaigns to 3.2

Post by Per »

It currently works just like before, so yes, mirroring "everything" is the only way to change lots of stuff at once.

I will look into being able to manipulate search paths to make this easier. Also, NoQ's ini diffs should help.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: How to add new campaigns to 3.2

Post by aubergine »

This is looking very promising!

Is there any info about the format of the .lev file? I'm trying to work out what 'dataset' refers to? And there are other strange things in there such as:

* expand
* miss_keep
* between

Also, what is a .gam file? (I used to think they were save game files, but just realised that isn't the case).

With regards to files in the messages/ folder (.txt files)... Are those essential? It's like an avalanche. The .lev points to a bunch fo .wrf files, that point to a bunch of message/*.txt files, that point to yet more files. O_o :augh:

If we could get a hackPlayVideo("path/file.ogg"[,subtitleA[,subtitleB]]) function, all the messages/*.txt files could be removed and replaced by stuff in the .js associated with the mission. We already have things like playSound(), addBeacon(), _() and eventArea<label>(), all that's missing seems to be the hackPlayVideo().

Oh, playSound() would need updating to allow an optional message string to be associated with the voice audio (currently dealt with via messages/strings/*.txt). Or better still, have the strings defined in to audio.cfg - so instead of having to keep redefining the strings, they are centrally associated with their audio files and playSound() automatically uses them without any extra effort in scripts. :)

Seems like a good opportunity to kull almost 100 files. :)
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: How to add new campaigns to 3.2

Post by Emdek »

Per, and how multiple campaigns will be sorted in that menu (no sorting, alphabetical, built-in first, using some timestamps like 2100-01.-01)?
Will be there way to create kind of dependencies, like you will be able to play some campaign only after completing previous one (also could be used for sorting)?
Progressing to next levels will be handled entirely by scripts or there will be also need to define such snippets for each (or at least those with videos) level like:

Code: Select all

[intro]
video = "cam1/c001.ogg"
captions = "cam1/c001.txa"
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: How to add new campaigns to 3.2

Post by Per »

Emdek - I do not have those answers. You (people working on campaign mods) tell me what is needed!
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: How to add new campaigns to 3.2

Post by Emdek »

Per, OK, so this is my input so far, now I'm asking for comments and ideas from others.
For sure infrastructure / API needs to be consistent and flexible, the rest is implementation detail.
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: How to add new campaigns to 3.2

Post by aubergine »

I have some ideas, will try and clarify them and present later.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: How to add new campaigns to 3.2

Post by aubergine »

"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: How to add new campaigns to 3.2

Post by Emdek »

aubergine, my feedback on feedback. ;-)
Do we really need optional and base properties for mission sections? Unless we are going to allow to pick single unlocked mission to play and we want to show additional information to player. This could be interesting but would require bigger UI overhaul and adding (after fixing it first) transparent saving at end of each mission.
Also instead of mandatory indexing missions by number and adding missions property to campaign I would go for adding there property which points to first mission / intro (and later on use JS to decide which one should be loaded next).
And we still need some property to sort them, since there could be later more mostly unrelated stories and we may end up with total mess in that menu. So maybe it would be good to add additional level of hierarchy, story which would be parent for set of campaigns. Then we could use that to for example separate modernized campaign from original one etc. (depending on other decisions).
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: How to add new campaigns to 3.2

Post by aubergine »

For away missions, the game needs to know where "home" is, hence the 'base' property (for want of a better property name). Home might not necessarily be the previous mission! Eg. One away mission might lead to another away mission immediately afterwards. The current scripting system deals with this in different ways, I think it's the expand / miss_keep / between settings I mentioned earlier in this topic (but not sure and certainly have no idea how those work). I was thinking it would be better to simply let a mission state where it's "home" is if it's an away mission. Also, presence of 'base' property could be used to prevent the user from building a HQ - because they already have a HQ back at 'base' and they're not meant to be setting up another one.

As for 'optional', I really would like to see that added. I desperately want a campaign that has optional side missions, secret levels, etc., things that would add replayability to the cam. The first time through a cam will usually be just focussed on winning, but once won people will often go back to a) do better and b) find stuff they missed the first time.

JS will be used to select which mission happens next, that was always my plan. But I wanted <campaign>.ini to list all the missions so it was clear by looking at that one file what all the missions are and where to go to find out more about them. The <mission>.ini files (one per mission, same format as <mapname>.ini) state which scripts are loaded, which map is used, etc. Everything else happens in the scripts once the game starts (think of it as custom rules.js, AIs etc).

In the example I gave for <campaign>.ini, my intention was that at the end of mission 1 you choose your destiny - you could go straight to mission 3, or you could do mission 2 (optional) before mission 3. The decision would be triggered by player actions and handled in the JS in mission 1. For example, go to LZ 2 for mission 2, or LZ 3 for mission 3.

The reason I want campaign/mission requirements in the <campaign>.ini is mainly for UI purposes... My ultimate desire would be that we could take, for example, a satellite photo of USA and for each campaign set what sector it appears in (and have some way of representing sectors on the USA map). Then for each mission, specify a more exact location. The player would then be able to see their progress on the map, as new missions become available they could see them appearing as blobs, with green blobs indicating completed missions, yellow blobs showing optional (but not yet completed) missions and red blobs showing mandatory missions that are available next. Blue blobs would show which missions are currently "in progress" (eg. you saved game to come back later). As more missions get unlocked, more blobs would appear on the map.

At some point in future, when WZ allows control over GUI from scripts, I'm going to implement that. I just want some of the architecture ready for when that happens.

As for sorting campaigns, their 'requires' property could be used. So cam2 would require cam1, and thus appear after cam1. Cam 3 would require cam1 and cam 2, and thus appear after those cams, etc. I'd also like to have png image for each campaign, so instead of showing boring menu we could at some point in future have graphical menu - bit like the pics here.

I know a lot of that stuff is a long way off, but if we're developing architecture we should at least do some future planning (even if just thought exercises) to reduce the chances of those future things breaking lots of stuff. It can help to guide implementation of the stuff we do now, so as not to rule out the stuff we want in future.

Anyway, semantics aside, what do you think of the overall concept of drastically reducing the number of files needed for a campaign? Things like the <campaign>.ini, <mission>.ini, audio.ini and sequences.ini? By my rough estimation that would allow removal of over 100 files just from the current campaigns. (all the messages, beacons, etc., would be done inside scripts, all the subtitles would be defined centrally in audio.ini or sequences.ini, and so on.)
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: How to add new campaigns to 3.2

Post by Emdek »

aubergine, I think that those things that would be handled base and optional should be done in mission script initialization. I don't need that INI files needs to be so much verbose, they are not supposed to be read by players. ;-)

For that map with missions locations, I like that idea, moreover, I'm familiar with it. It is done that way in Erath 2150, you get a globe with missions to pick, new batch each time previous one is completed (sometimes it depends on previous objectives, like order can be changed or some will be unavailable while new ones can show up).

Reducing file clutter is always good idea, it would be best if some unused things could be ditched (are there any such things left?), not only simply moved around into one single (or few) bigger files. The question is if we should go for scripts to define everything, or continue mixing them with INI files.
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: How to add new campaigns to 3.2

Post by aubergine »

I still prefer use of ini files where possible. They are certainly old-school, and basic, but they are the right fit for the task (which surprised me as initially I thought ini choice was a really bad idea).

I would certainly like to see an end to .wrf files, things like audio.ini and sequences.ini would kill a few of them (plus a plethora of other files).

Ini files are also a nice gentle intro to modding for many players who are no so technical. They might just want to change some stats and ini is a simple format for even the least technical person to understand (which is why they got used so much on M$ Windows!). They portray certain info much more cleanly than you ever could in a script of any kind.

To me an ini is the ideal starting point for a modding expedition. It sets out a certain amount of information, and leads you clearly to where the more advanced parts are. You can go exploring and stop when things are getting a bit too far outside your comfort zone. Forcing people to eat script, more script and a side-order of pie is not going to help convert mildly curious folk in to modding fanatics. I was mildly curious about modding WZ but never bothered until the JS API appeared - at least that was something I personally could understand and I've been slowly branching out from there. Ini format is something everyone can understand, even easier than a CSV file because of the named references used by inis. I think it will help tempt a new generation of curious folk in to varying degrees of modding.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: How to add new campaigns to 3.2

Post by Emdek »

For sure INI is easier to comprehend, but it's not cure-all solution. :-)
We could always go for hybrid solutions, but in this cases some things (like choosing next level conditions) make sense only in form of script, you can place JS expressions in INI and evaluate them later, but that doesn't make sense.
Also, if you want to be verbose you can always put comments, in both INI and JS files.
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
Post Reply