Author Topic: Badttuta's Bad Guide to Mid-mission Checkpoints  (Read 10878 times)

0 Members and 1 Guest are viewing this topic.

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Badttuta's Bad Guide to Mid-mission Checkpoints
At some point someone will do an awesome Wiki article like Axem's guide to tactical jumps. It'll have pictures and it won't be dry, rambling, and boring as ****.

In the meantime, here's the Blue Planet guide to rigging up mid-mission checkpoints in FreeSpace Open. It's hastily written and bad! Sorry.

This is a guide for those already fluent in FRED. It's not going to hold your hand. It's a low-quality guide compared to Karajorma's FREDDOCS or Axem's jump guide; it doesn't have any pictures of the events editor, or a sample mission to build and help you along. Here's the general outline:

  • Finding a good spot for a checkpoint
  • Setting up your checkpoint save using PPVs
  • Setting your checkpoint load
  • Allowing the player to load the checkpoint, and disguising the load process with a fadeout
  • Making your mission logic checkpoint-compliant

Here's a really simple diagram of how the checkpoint logic works:

badttuta's bad diagram

Normal playthrough:

MISSION START - INTERIM 1 - SAVE EVENT WRITES TO CHECKPOINT VARS - INTERIM 2 - MISSION END

Checkpoint playthrough:

MISSION START - CHECKPOINT LOAD WINDOW - CHECKPOINT LOAD CALL - INTERIM 1 BREAKS - FADEOUT - LOAD EVENT LOADS FROM CHECKPOINT VARS - INTERIM 2 BEGINS - MISSION END


STEP ONE
make a fred

Make sure to design your mission with what I like to call 'mission phase space bottlenecks'. People who aren't assholes call these 'calm spots'. You need to make sure that the mission contains at least one moment during which there will be no active combat and as many ships as possible are at known, predictable locations. Here is a useful checklist:

  • There's no fighting going on
  • Large ships are at a predictable location - for example, the end of one set of waypoints, or 5000 meters from a target they're approaching
  • The player can be expected to be in a particular location - for example, near a ship she's guarding
  • The mission SEXP script is coming up on a major trigger event. You can easily jump the script ahead to this point without breaking the mission logic. (this one's the tricky one)

These criteria aren't all completely necessary, but they'll help you avoid going over your variable budget.

Now we'll start on the checkpoint.

STEP ZERO
office of player persistent variable budget control

The key element in the checkpoint system is the Player Persistent Variable, or PPV. Unlike other variable types (campaign persistent, for example) this type of variable is not set at mission end - it's set immediately and stored in the player file.

Unfortunately, you're only given 100* of them per campaign. This means you need to be economical in their use.

Now that you've identified WHEN in the mission your checkpoint is going to happen, you're going to use PPVs to store the location, hull state, and dead/alive status of key ships in the mission. There are two steps to a checkpoint: the SAVE and the LOAD. We're going to rig up the SAVE first, because it's a lot easier.

Keep in mind there are some factors you can't currently save: mission clock time, countermeasures fired, and player kills among them.

STEP TWO
every morning i wake up and open palm slam a vhs into the slot

Create two events - we'll call them CHECKPOINT LOAD and CHECKPOINT SAVE. Set them up to trigger at the calm spot you've selected.

Use the FRED events editor to create a series of Player Persistent Variables. You need one for the hull state of each ship you're going to save. (Bear in mind it's often safe to ignore the hull state of smaller ships like fighters and bombers -- though you should probably save the player's hull.) If you're going to save the position of a ship, you'll need three additional variables for its X, Y and Z coordinates. (With new improvements in the SCP, it may be possible to save these as a single number, then break it into three values when you want to load the checkpoint.)

Make sure to give these variables consistent names like alpha1hullstate, alpha1x, alpha1y, alpha1z.

Now, expand CHECKPOINT SAVE. Make sure you've got the trigger condition where you want it. Make sure this trigger condition is not based on the mission clock - you may want the SAVE to work properly even if the player has loaded a checkpoint, or you might want to disable it if the player has loaded a checkpoint. (You can use 'or' to good effect here: six minutes have elapsed in mission time, OR checkpoint 1 has been loaded.) Rig up events for each ship you're saving to read the necessary information (hull state at minimum, possibly coordinates) and write it to the variables in question.

You'll probably want to test the mission right about now. Rig up some messages to print these variables and make sure they were stored correctly. I've had some trouble with ships destroyed as of CHECKPOINT SAVE not saving their hull state as 0, so you may need to mix in additional variables to indicate whether a ship's been destroyed.

Sometimes you don't want to waste three PPVs to save a ship's position. You just want to set it to the same place every time the checkpoint's loaded. To get a good idea of where a ship is at any point in the mission, rig an event that prints the target ship's X, Y and Z coordinates to the training message box in your HUD, and have this event update every second. You can monitor a ship's coordinates and figure out where it is at the point when your checkpoint should be firing. You can just write the numbers down.

Another way to save PPVs is to use relative coordinates. Say you know three fighters will be escorting a freighter - you can save the freighter's position, and then just assume the fighters will be positioned in a triangle relative to it. This is a good way to put the player's fighter near a ship he's guarding.

Congrats: you're now saving coordinate and health information on the ships you've selected. There's one more key thing you need to do: set up a player persistent variable called 'checkpoint1unlocked' or something like that. Arrange for it to be set from 0 to 1 to indicate that the player has unlocked this first checkpoint.

 Time to move on to the hard bit, the LOAD.

STEP THREE
it's chronicles of riddick and right then and there i start doing the moves alongside the main character, riddick

Expand your LOAD event. Don't worry about the trigger for now. We're going to work backward: set up the back end of the LOAD event first.

Imagine for a moment what this event is going to do. It's going to take the mission's initial state and rearrange it to resemble the saved state. In order to do this, it needs to achieve the following:

  • Change the hull state of all starting ships to the saved state
  • Remove ships that are saved as destroyed
  • Move ships to their saved coordinates
  • If you're really OCD, alter the player's missile capacity and even weapon loadout to the saved state
  • A tricky one: cause ships that hadn't arrived at mission start, but should have arrived by the checkpoint, to jump in, and, if necessary, move to a new position

You need this event to accomplish everything, at least in abstract, that should've happened in the part of the mission you're skipping over.

The first thing you should do is use set-object-position to grab every ship from mission start and slap it in its slaved spot.

Next, delete ships that should be destroyed. You may want to use vanish instead of self-destruct, but bear in mind this won't trigger is-destroyed-delay conditions.

Sabotage hull subsystems to get ships to their correct hull state. If you want to save key subsystems on capships, here's the time to take care of that as well.

Do anything else you want to do, like alter player missile capacity or loadout based on saved info.

You may need to do some other kung fu as well. There's no way to save orientation state, so you may need to do some set-object-facing-object. Clear AI goals and set them to what they need to be. Make sure ships don't do anything dumb with their waypoint paths, like starting the whole thing over from the beginning. Make sure subsystem and ship guardians have been properly applied to ships that need them.

Here's a tricky bit: there may be ships that we need to cue to warp in, then quickly move to a new location. Set up their arrival triggers to include an OR condition which triggers at checkpoint load. Immediately kill the ship's entry momentum with a SEXP (this is glitchy and requires some work), then teleport them to where they want them, and apply any necessary hull and subsystem damage AFTER they arrive.

Bear in mind we still haven't told this LOAD event when, exactly, to fire. We're going to move forward a little further before you do that. You need to look at your mission logic going forward, and make sure that the flow of the script can continue based off either a normal mission play or from this checkpoint LOAD event. This should be easy as long as your mission logic is pretty linear, but it may take some finesse. I'll leave that as an exercise for the FREDder.

Time for the next step: arranging for the player's ability to fire the checkpoint, and actually triggering the LOAD event.

STEP FOUR
i do every move and i do every move hard, makin whooshin sounds when i slam down some necros

Let's look at what we have right now:

Mission start (the mission starts)
A LOAD event which sets the mission up the way we want it once the checkpoint loads
A SAVE event which stores the mission state. (You may want to alter the trigger for this event so it won't fire if the checkpoint has been loaded - this can lead to weird behavior.)

Since the SAVE event sets our checkpoint1available var from 0 to 1, the player will have access to this checkpoint after they've played through the mission once. (You may want to have a training message or HUD gauge indicate when the checkpoint's unlocked.) For testing and dev purposes, just set this var to 1 at mission start.

What do we want to happen if the checkpoint is available? Well, to keep things convenient, I usually give the player a 10 second window at mission start to select the checkpoint - if they don't do it right then, they're committed to a normal playthrough. If you let the player load the checkpoint at any time, you can cause all sorts of mess.

Let's set up an event which checks whether the checkpoint1var equals 0 or 1. If it's 1, we want to show the player a message. You can use a training message or a new HUD gauge.

Now, figure out how the player will tell the mission to load the checkpoint. In BP, we allowed the player to call in a com buoy from the reinforcement menu named 'Load Checkpoint 1'. Another approach is just to tell the player to press Alt-X or Alt-A, or 1 or 2 on a menu if you have more than one checkpoint. Remember, make sure the player can only take this option for the first 10 seconds or so of the mission.

No matter what happens, you should have a single flag which goes from 0 to 1 to indicate that the player has asked for a checkpoint load. We'll call this LOAD CALL. But you don't want the LOAD event to fire right away, or the player will see everything teleporting around. So once LOAD CALL fires, the first step is to fade out to white and lock the player's controls.

Once the fadeout to white is complete, fire your LOAD event. Give it another second, then fade back in and unlock the player's controls. Congrats! You've loaded your checkpoint.

But there's a problem: your mission start logic is probably still running.

STEP FIVE
not many can say they escaped the galaxy's most dangerous prison

Because you read this tutorial all the way through before starting your mission, you're going to know from the start that your pre-checkpoint mission logic needs a break point. After your 10 second starting window, check whether the LOAD CALL has fired. If it hasn't, mission proceeds as normal. If it has, break your mission logic and then resume from the point of the LOAD.

You'll also need to suppress any messages or events that would've fired before the checkpoint when, say, a loaded ship took damage or exploded. You don't want your checkpoint loading and immediately firing 15 messages about how ships have taken damage.

Okay I'm probably forgetting a bunch of important **** but congrats, off the top of my head I think you've got the rough outline of a working checkpoint! Time to check it a billion times. Ask me questions and point out my dumb mistakes here in this thread.

I'm skipping over a lot of finesse here. You need to build the whole mission with the checkpoint in mind, using clean, easily broken chains of mission logic. But if you're a good FREDder you'll have no trouble, and if you're not, it'll be a great way to touch up your skills. Good luck, and happy loading!

next time on battuta writes words: the easy business of dialogue skips
« Last Edit: March 27, 2012, 10:19:36 am by General Battuta »

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
i want to emphasize that this guide is in fact pretty bad and needs some sweet pictures

 

Offline Cyborg17

  • 29
  • Life? Don't talk to me about life....
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
You're being way too hard on yourself.  I understood it all, and the tutorial fulfilled it's purpose.

I was a little disappointed, though, since I guess I imagined your system was a little more complex than this. (not that it needs to be: it's an excellent system. I just imagined that there would be more manipulation of numbers or something like that so that you could save more data.)


 

Offline Darius

  • 211
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
Radttuta is being silly. This is an excellent addition to my ongoing FREDucation.

 

Offline Colonol Dekker

  • HLP is my mistress
  • 213
  • Aken Tigh Dekker- you've probably heard me
    • My old squad sub-domain
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
My head hurts..
Campaigns I've added my distinctiveness to-
- Blue Planet: Battle Captains
-Battle of Neptune
-Between the Ashes 2
-Blue planet: Age of Aquarius
-FOTG?
-Inferno R1
-Ribos: The aftermath / -Retreat from Deneb
-Sol: A History
-TBP EACW teaser
-Earth Brakiri war
-TBP Fortune Hunters (I think?)
-TBP Relic
-Trancsend (Possibly?)
-Uncharted Territory
-Vassagos Dirge
-War Machine
(Others lost to the mists of time and no discernible audit trail)

Your friendly Orestes tactical controller.

Secret bomb God.
That one time I got permabanned and got to read who was being bitxhy about me :p....
GO GO DEKKER RANGERSSSS!!!!!!!!!!!!!!!!!
President of the Scooby Doo Model Appreciation Society
The only good Zod is a dead Zod
NEWGROUNDS COMEDY GOLD, UPDATED DAILY
http://badges.steamprofile.com/profile/default/steam/76561198011784807.png

  

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
You're being way too hard on yourself.  I understood it all, and the tutorial fulfilled it's purpose.

I was a little disappointed, though, since I guess I imagined your system was a little more complex than this. (not that it needs to be: it's an excellent system. I just imagined that there would be more manipulation of numbers or something like that so that you could save more data.)

What more data do you want to save? I left most of that implied because I thought it was the easy part. I requested some string-related SEXPs recently that should allow much more dense data storage; Goob implemented them swiftly and they're available now.

You can if you're creative even store and recreate mission clock time and kill count - it's just sort of dumb and pointless.

Sorry to disappoint, though, guess I should've just left it a mystery so everyone could think it was impressive

e: I really don't understand your complaint here. You think it's as simple as it needs to be but what you want it to be more complicated so that...it can be more complicated?  :blah:

 

Offline Cyborg17

  • 29
  • Life? Don't talk to me about life....
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
I guess I imagined that you might be saving x,y,z coordinates in one variable, or something along those lines.  It must have just gotten it into my head at some point that there was too much information to store and so there was some masterful trick at work.

But thanks for showing us how to do it.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
I guess I imagined that you might be saving x,y,z coordinates in one variable, or something along those lines.  It must have just gotten it into my head at some point that there was too much information to store and so there was some masterful trick at work.

You can do that now (thanks to a feature request I put in and Goob implemented), but it was impossible at the time the system was devised, and it's still much more work for relatively little benefit.

The 'masterful trick' lies in being smart about what you need to store rather than brute-forcing everything and wasting a bunch of your time and resources.

 
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
Wow, great work. The whole checkpoint idea was brilliant. It may be ugly as hell, but it definitely made playing WiH more enjoyable.

@Cyborg17: Things like cramping several integers into one variable probably wouldn't be worth the effort, but I guess set-bit and is-bit-set could be quite indispensable for storing binary states in a longer campaign.
The lyf so short, the craft so long to lerne.

 

Offline Cyborg17

  • 29
  • Life? Don't talk to me about life....
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
Well, it doesn't matter now, apparently.

FSO moves quickly.


 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
I intended to use this new string functionality to manage big sets of persistent data. The plan was to track the status of the pilots in a 24-man squadron using a single 24-symbol string, with the value of each string digit or letter representing a code (dead, alive, experience level if alive) and each individual digit in the string modified separately and called when necessary.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
I really should just bite the bullet and work on my full collection classes idea.

Gah! Another one for the "When Diaspora is out" pile.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
What more data do you want to save? I left most of that implied because I thought it was the easy part. I requested some string-related SEXPs recently that should allow much more dense data storage; Goob implemented them swiftly and they're available now.
Which SEXPs were added for that purpose? Couldn't find anything related to better data storage.

I intended to use this new string functionality to manage big sets of persistent data. The plan was to track the status of the pilots in a 24-man squadron using a single 24-symbol string, with the value of each string digit or letter representing a code (dead, alive, experience level if alive) and each individual digit in the string modified separately and called when necessary.
That feels like one should write a script for that purpose...

And while you are talking about saving and loading shipdata, I created a script to do this and save things like hp (including subsystems), coordinates, weapons (and whatever else useful is in the ships array) into a file and load them again into the game. I posted it over a year ago - but as usual the scripting forum is ignored by most people. It might need some fine tuning if someone wants to use it but it should help reducing the amount of variables needed.
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
I wouldn't say the scripting forum is ignored - BP uses a ton of scripting in the same release that introduced these checkpoints. It just happened that someone with FRED knowhow and no LUA skill did these checkpoints (me)

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
I personally would be interested in a script that simplifies the process. Using less variables is handy because I do tend to use a lot of variables already..
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
I personally would be interested in a script that simplifies the process. Using less variables is handy because I do tend to use a lot of variables already..

I also use lots of variables! Pre-bump (I think the limit was bumped...) the problem is not total variables per mission but PPVs per campaign.

 
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
Maybe, at least in bigger teams there are people who have LUA skills or take a look into the scripting forum. There is a number scripts usable without any LUA skills.  The script I made should be easy to use as well and could help at checkpoints or getting a lot of shipdata easy from one mission to another but despite a lot of possible uses no one bothered testing it. Probably because they don't know that it even exists.

There may be bugs I can't find myself during testing or people don't like the way it works (which can be changed). Still that needs people actually trying to use it somewhere.

I personally would be interested in a script that simplifies the process. Using less variables is handy because I do tend to use a lot of variables already..

I can upload it again somewhere together with the sample mission if you want.
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
Again, the reason your script wasn't used here, in spite of all the LUA-fluent people on the BP team, was because I did the entire checkpoint system myself one afternoon when it seemed like it'd help with a mission and I'm completely useless at LUA. For all I know your script could be a 50000% better way to do it, please feel free to post/link it and the sample mission

It will definitely help with a checkpoint setup, though you'll still need to make sure your mission logic is set up right.

 
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
I think you made your checkpoint system long before I even had the idea for that script, so it wasn't directed at anyone specific ;)

So here is the script: http://www.mediafire.com/?az06q1gd3j4b95k

Contains two really short sample missions just showing what the script can do. I tested it on 3.6.14 RC5 and everything worked fine.
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 

Offline Cyborg17

  • 29
  • Life? Don't talk to me about life....
Re: Badttuta's Bad Guide to Mid-mission Checkpoints
Sounds like an excellent reason learn LUA.  *runs off to tinker*