Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: kasperl on August 04, 2004, 06:04:22 am

Title: Random Mission Generator, what features do YOU want?
Post by: kasperl on August 04, 2004, 06:04:22 am
OK, I started coding a bit on the random mission builder discussed here:
http://www.hard-light.net/forums/index.php/topic,24234.0.html

NOTE: I have not finished anything yet, DO NOT MAKE MISSIONS FOR THIS, they will probably not work, since standards will change.

Now, BW and I have kind off set up the basics for standards to do this. I'll be leaving next monday though, for 3 weeks, so I won't finish it soon. I thought we could let you guys list features and ideas about it. Black Wolf and I will try to explain everything, here we go:

A mission is first made in FRED. Then, someone opens the mission in notepad, and changes all the things that have to be randomized to $VarName (for text), or %VarName (for random numbers), were name is anything you want. Then, at the start of the file, right after #Mission Info, you put something like the following:

Code: [Select]

#Mission Info
;NoOfPasses=3
;RndDefine{
;$VarShipName1 = $RndTShipname
;$VarShipClass1 = $RndTDest
;$VarWingName1 = $RndWingname1
;$VarShipClass2 = $RndTBomb
;%VarLocX = %Rnd(1,1000,1)
;%VarLocY = %Rnd(50,250,1)
;%VarLocZ = %Rnd(2000,3000,2)
;}

What you're doing here is telling the builder you want all instances of $VarShipName1 replaced by a random line out of the file TShipname.ini.

The ini files have a list of valid values.

In this context, the ini files pretty much just list the ships that fit into the categories you want to use, eg. you'd put all the Terran destroyers into one ini file, all the shivan cruisers, etc. They can be as general or as specific as you need them to be. For the test mission, the fighters for example were split into Terran Heavy and Terran Light. If you choose, you could also put in stuff like SOC fighters, and include things like the banshee and Erinyes. This means the mission can remain fairly balanced, while still have something of a random feel. This type of ini based system also makes converting the system (if not the mission templates themselves) for TCs a matter of a few minutes work rewriting the relevant inis.

For the numbers, you list a start, an end, a step for the randomizer. So with %VarLocZ you'll be getting a number, anywhere between 2k and 3k, but only one devideable(sp?) by 2.

NoOfPasses will be explained later.

Now, what if we want the user to do some of the choosing?

There is also a CnsDefine line, placed above the RndDefine. Example:

Code: [Select]

#Mission Info
;NoOfPasses=3
;CnsDefine{
;!"What species?"
;$CnsSpecies1 = (Terran, Shivan, Vasudan)
;!"What ship to protect?"
;$CnsEscort1 = (Orion, Fenris, Levyathan)
;}
;RndDefine{
;.. same as before
;}


Now, the ! defines that everything after that, minus the " will get outputted to the user. The $CnsSpecies1 bit pretty much works the exact same as a $Var thingy. The stuff between the rounded brackets will get outputted too, and the user will have to make a choice between them.

NoOfPasses will be explained even later, first, onto the ini files. Here's an example:

Tlightfight.ini
Code: [Select]

@version=000001
@reuse=1
GTF Perseus
GTF Myrmidon
GTF Ulysses
GTF Loki


@version always is the first line, followed by a 6 digit number. It'll be needed for the builder to know what value is expected were. Version changes will be highly documented, if everything goes as planned.

@reuse is for now a value to say if a value can be used twice. Meaning that if you do a list  of possible wingnames, putting @reuse=0 in there makes sure you only have one Cancer, and not 3 of em. Off course, for ship classes, you do want it to be reused. When there are more vars needed than lines in the file, the program will have to reuse the lines. Make sure you have enough entries.

The rest of the file is pretty straightforward. Each line will get copied verbatim into the file.

Now, for random backgrounds, you need more then one line, right?
This is what I thought of for that:

Bg.ini:
Code: [Select]

@version=000001
@reuse=0
$Fle=bg1.txt
$Fle=bg2.txt
$Fle=bg3.txt

Now, what happens here is that the program first goes through all the normal routines, and then, after everything is replaced, it'll do another pass,

and it'll copy all the contents of the files here into the mission. This is what NoOfPasses is for, to tell the program how often it needs to do this.

NoOfPasses has another, (IMO) more interesting use aswell. With the ability to use multiple passes, modular briefings can be written and randomized, but reference things like $ShipName1. For example, the first briefing ini might say:

Quote
The NTF has been active in this system, and we have recieved word that they intend to attack the $ShipName1.

OK Pilots, listen up. Local sensor stations have picked up intel suggesting an imminent NTF attack on the $ShipName1.

We've received a distress call from the $ShipName1. She's come under attack from the NTF!
[/size]

During the first pass, the program will choose a briefing stage at random. During the second pass, it'll insert the name of the destroyer into the briefing. The same applies to debriefs, mission goals and objectives, even messages.[/color]

Now, I'm not sure if we can do randoms twice, but I'll try to make it so even that is possible. The uses for this can be better explained by someone who knows FRED, so Black Wolf will list some possible uses.

Unfortunately, this isn't what you'd call a true Random Mission Generator as such, it's more an Existing Mission Randomizer. It relies heavily on mission makers input, and making a mission for this is a little bit more complex than making one for standard FRED, but you'll ultimately end up with more playtime from the one mission.

Release, when it happens, will probably be with just two basic mission templates - a capship defence, and a capship assault. Ultimately, I'd like to increase the random factor by providing more than one base template for each mission type, but this is in no way the limit of the concept. The beauty of the idea is that you can change literally anything that you want to in the mission, since the ini files are so simple to create. Say, for example, you wanted to do a convoy guard mission. The type of ships in the convoy, as well as the attacking ships could, of course, be changed. But so could their destination (Could be randomized to be an installation, a destroyer, or a jumpnode, for example). And, using some of the SCPs new sexps, especially is-ship-class, you can link things to the changing circumstances dictated by the randmizing. For example, you could have a cruiser arrive if-ship-class of $ShipName1 = GTD Orion or GTD Hecate, whereas if it equals a deimos or cruiser, the hostile cruiser does not arrive. Similar things can be applied to stuff like AI behaviour and the like.

You can also change things relating to the environment of the mission. The background system relies on the ability to place large chunks of text - this system can also be applied to place all the neccesary information about using a full nebula, or an asteroid field. You can even select the frequency this happens by placing more than one copy of the chosen data into the ini file. If you want a 1 in 5 chance that the mission takes place in a full nebula, then you place four entrys in the ini file linking to a non nebula text file, and one entry to the nebula data.

There's a lot more that can be done with this system. I'll admit, making templates for the randomizer requires a lot of datawork, certainly more than making a standard FRED mission, and a lot of mucking about in the mission file. It's something that requires almost an entirely new style of FREDding, because you have to take into account a lot more potential outcomes, and in many cases you'll need to do some pretty complex Sexping. But ultimatelym you get a much more replayable product than a standard, single use FRED mission.

One caveat however - these missions will never be able to replace properly FREDded missions in campaigns. A particularly well designed template might be able to spew out the bare bones of a campaign level mission, something that, with a lot of polishing and rewriting, might be able to be turned into a campaign level mission, but it's not going to replace proper FREDders or anything. Sorry guys - we've still got work to do. :)
Title: Random Mission Generator, what features do YOU want?
Post by: Unknown Target on August 04, 2004, 08:19:41 am
The basics:

--Number of enemy fighters
--Number of enemy fighter waves
--Number of enemy capital ships
--Number of enemy capital ship waves
--Skill of enemy fighters
--Skilly of enemy capital ships


-------------------

--Number of friendly fighters
--Number of friendly fighter waves
--Number of friendly capital ships
--Number of friendly capital ship waves
--Skill of friendly fighters
--Skilly of friendly capital ships
--Player and wingman load-outs (probably just a screen for Alpha and Beta wings)
Title: Random Mission Generator, what features do YOU want?
Post by: Goober5000 on August 04, 2004, 08:29:27 am
Nice!  This looks very promising. :)
Title: Random Mission Generator, what features do YOU want?
Post by: Unknown Target on August 04, 2004, 08:31:47 am
Oh, yea, you also need:

--Enviroment
+Asteroids:
++Number of asteroids
++Type of asteroids
++Average speed of asteroids
Title: Random Mission Generator, what features do YOU want?
Post by: kasperl on August 04, 2004, 09:03:30 am
UT: Read the post carefullly, and think if that us stuff you can do with the things I gave you already? Or does it need a special function, if so, wich?

BTW, Goob, could you sticky this, as I said, I'm off for 3 weeks starting monday, and it'd be nice if during my absense people would still add ideas.
Title: Random Mission Generator, what features do YOU want?
Post by: Goober5000 on August 04, 2004, 09:46:25 am
Schtickied.
Title: Random Mission Generator, what features do YOU want?
Post by: kasperl on August 04, 2004, 10:41:03 am
Quote
Originally posted by Unknown Target
The basics:
--Player and wingman load-outs (probably just a screen for Alpha and Beta wings)


That ought to be done in game, really. This thing only supplies a FS2 file, to be run ingame.

This si why I requested a launcher command line to start up the game with all the standard commandline flags, but pointed towars a specific mission.
Title: Random Mission Generator, what features do YOU want?
Post by: Kosh on August 04, 2004, 05:22:54 pm
I liked UT's idea of having a straight fleet to fleet fight. Since it is one of the simplist types of missions, we could do it first just get started before support for making more complicated types of missions is added.
Title: Random Mission Generator, what features do YOU want?
Post by: jdjtcagle on August 04, 2004, 05:36:03 pm
Fighter and Bomber activity, with few Capships to make a "that" big of a scene. Other than that, just suprise me ;)
Title: Random Mission Generator, what features do YOU want?
Post by: Solatar on August 04, 2004, 07:47:15 pm
Could integrate Kazan's random background utility.
Title: Random Mission Generator, what features do YOU want?
Post by: kasperl on August 05, 2004, 07:18:48 am
solatar: is the source of that released? And does it _always_  produce proper results?

Kosh, jdj, those are all things for the FREDder to do. I was asking for features you need in the _program_. It's good to have more idea's, but if there is something I missed bigtime, better tell me now.
Title: Random Mission Generator, what features do YOU want?
Post by: Solatar on August 05, 2004, 09:52:45 am
I'm not sure if it's released, but I've never had a problem with it. I think there was another one that did essentially the same thing around here somewhere.

Besides, while you're putting in random ships and everything, it can't be TOO hard to put in a randomly generated background can it? :D I could be wrong though...
Title: Random Mission Generator, what features do YOU want?
Post by: Black Wolf on August 05, 2004, 10:14:11 am
Wouldn;t look as good as preloaded BG templates though, and LS is already amassing those.
Title: Random Mission Generator, what features do YOU want?
Post by: Solatar on August 05, 2004, 10:32:00 am
Didn't think of that to be honest.

We could have an option to set which system the mission took place in (that might be up to the FREDer though)
Title: Random Mission Generator, what features do YOU want?
Post by: kasperl on September 04, 2004, 06:57:57 am
Look, the FREDder can load the BG of whatever he wants, he can use random numbers to pick out random images, he can use random lists to pick out complete sets, or he can simply hard code the whole thing into the file and screw randomization.

BTW, I'm back, after 4 weeks. More posts in this would be nice, 'cause I'll be spending a bit of time on thinking and working on this sometime soon.
Title: Random Mission Generator, what features do YOU want?
Post by: Goober5000 on December 11, 2004, 09:32:19 pm
This hasn't been replied to in the past three (four) months, so I'm unstickying it.  It can be restickied when development resumes.
Title: Random Mission Generator, what features do YOU want?
Post by: kasperl on December 12, 2004, 06:33:12 am
Then someone else will have to do it. Due to major issues in real life (I've taken on quite a few classes more then the average student) I cannot resume learning C. A PHP implementation may be closer, but even then you're talking about 4 months away at the very least.  

If someone wants whatever docs I made, I'll dig em up. But there was some oddities in it too. If someone is really going to work on this, PM me and BW, set up an IRC meeting, and we'll talk about what I've got done. There isn't any working code, I couldn't even get the basic string stuff to compile properly.

Sorry people, but you are going to have to wait for a bit. Maybe next summer.
Title: Random Mission Generator, what features do YOU want?
Post by: speedyR on December 13, 2004, 07:13:11 am
yes, i would be interested in any information/documentation/ideas/features list or whatever you have done NONE-CODED so far.

i do plan to program a mission generator too, but with a different approach than you:

let's make an example to show what i want to do:


General Mission Complexity: /3/ (1-3, 3 is most complex)
General Mission Difficulty: /1/ (1-3, 3 is most difficult, this sets only the enemy AI settings and encounters!)
Increasing Difficulty: /yes/ to /3/ (difficulty increases during the whole! mission steps)

Mission type:
Primary: /x/ Recon // Attack // Escort // Defend // Battleship
in Asteroid field /yes/
Secondary: // None // Recon /x/ Attack // Defend // Battleship
in Asteroid field /yes/
Tertiary: // None // Recon // Attack // Escort // Defend /x/ Battleship
in Asteroid field /no/

Task force:
Primary: /3/ Wing(s)(1-3) /0/ Backup(0-2) /0/ Battleships (Wings are alpha,beta,gamma, Backup are delta,epsilon)
Secondary: /0/ Backup(0-2) /2/ Additional(0-4) /0/ Battleships (2:1 cruisers:battleships)
Tertiary: /2/ Backup(0-2) /4/ Additional(0-4) /4/ Battleships
General Wing size: /4/ (1-4)(alpha,beta,gamma are multiplayer coop enabled!)

Enemy force strength: (this is somewhat a multiplier to the "complexity" option above and the mission type!)
Primary: /light/ (light means you will only fight some fighters)
Secondary: /medium/ (medium means you will encounter fighter/bomber perhaps some transports/cruisers depending on the mission type)
Tertiary: /heavy/ (heavy means any enemy ship is possible (depending on the mission type))
General Wing size: /4/ (3-6) General Wing waves: /4/ (1-6) (only for fighter/bomber)

Custom Settings: /yes/ (when set to no: default/random settings for weapons, ships and encounters will be made)
if yes:
Enable restrictions to weapon choices: /no/ // (if set to yes you can set weapons which are NOT selectable)
Enable restrictions to ship choices: /no/ //


This is NOT the GUI of this generator, perhaps i will change it to Primary, Secondary and Tertiary and will add all this type anf force stuff under that...

Okay, what will you get when you would select these options:

- (12-Multiplayer-)Mission starts with some pre-defined voices saying that you have to recon some asteroid field scanning unknown radar blibs but your are not allowed to attack until you are ordered to.
- You will get 3 Wings that you can fully equip.
- Mission starts with an asteroid field and a nav boje in it and voice saying that you have to check all the nav points.
- You will encounter some transports/cargo boxes/inactive fighter/inactive cruiser which you have to scan (in freespace 1 there was a problem with scanning in multiplayer as it didn't work, is this problem still in freespace 2 open source ? if yes then you will have to go up to 200 m of these objects to "simulate" scanning)
- When scanning you will be attacked by "light" enemy presence (see starting diffy 1)
- After you have scanned 2/3 of the x objects (this is a random number depending on the general complexity) you will be ordered to actually destroy all these stuff (voice will say that they have analysed the cargo/... and you are ordered to destroy that, if you would have set the secondary mission type to escort/defend then you would have to escort/defend incoming allied transporters to these cargo/..., if you would then set tertiary objective to escort/defend then your order would be to escort/defend these transporters back to base/jump note...), you will get reinforcements and heavier enemies...
- After killing 2/3 of that stuff you will get information that enemy battleships going under warp but you reinforcements will shortly arrive
- So finally you will have to battle some enemy cruisers, battleships, bombers (as there are allied battleships! here too)

;-)

so this way users will get interesting multiplayer missions WITHOUT ever touching fred...
Title: Random Mission Generator, what features do YOU want?
Post by: kasperl on December 14, 2004, 10:48:10 am
Right now, the whole thing is non-existent. If you really, really want to see what I've got, call up BW and set up a meeting. Somewhere after christmas.

What you are basicly doing, as I see by skimming your post, is making the same thing as I do but hardcode the template. That seems a bit restrictive, perhaps. The end-user would never have to touch FRED if everything works OK with the thing I was thinking about, just the one who made the template.
Title: Random Mission Generator, what features do YOU want?
Post by: Solatar on December 14, 2004, 05:40:14 pm
Kasperl's way would save the "can we impliment FRED into the random mission generator, I want more customized missions." problems down the road
Title: Random Mission Generator, what features do YOU want?
Post by: speedyR on December 15, 2004, 03:36:06 am
okay i see...
but to start i have to begin with somewhat simple examples else i will never finish anything...
so my idea was to begin with a template (if you like this name) based on three stages (which will be definitely enough for missions up to at least 30 minutes) and randomize/customize from that.. always one step more...
let's see it as a beginning...
Title: Random Mission Generator, what features do YOU want?
Post by: kasperl on December 15, 2004, 07:44:22 am
Sure, but then if you do a nicely variable engine, you can let the template building to the FREDders.