Prototyping - Debriefing Design & Programming
The debriefing sequence is the final piece to closing our game flow loop. After the mission ends, we see the results of a mission and then the debriefing. Finally, we return to the main menu.
Objects
We're only adding one new object for the debriefing to display the results of the mission. We can fully reuse obj_briefing and it's child objects to create all the debriefing sequences.
Concept | Object | Notes |
---|---|---|
Mission Results | obj_results | This object shows the results screen which includes Vel's face, kill count, and a qualitative description of her progress. |
Results Screen
GML Code
We'll create the results object to mimic the screen above. Then we'll add new storyboards to the briefing object for the debrefing sequences. The room determines which storyboard type is loaded (rm_brief vs rm_debrief)
obj_results: Create 1
Register the keyboard and reference the game data object.
1 2 3 4 |
///Set references and keyboard keyboard_register(id) gamedata = instance_find(obj_currentgame,0) |
obj_results: Create 2
Set some variables used for display
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
///Init variables line_height = sprite_get_height(LT2)*1.5 fade_in = true fade_out = false fade_alpha = 0 text_complete = false current_line = 0 if gamedata.current_mission < 60 then face = FACES3 if gamedata.current_mission < 41 then face = FACES2 if gamedata.current_mission < 21 then face = FACES1 |
obj_results: Create 3
Set the qualitative quotes in an array. We'll pull from the array later using an index derived from kill counts.
1 2 3 4 5 6 7 8 9 10 11 12 |
///Rating quotes quote[0] = string_upper("velasquez still needs experience... her navigation skills need work.") quote[1] = string_upper("velasquez has potential. she must concentrate on mission objectives.") quote[2] = string_upper("velasquez is becoming a decent pilot. her aim is improving.") quote[3] = string_upper("definate improvement. more advanced fighting skills needed.") quote[4] = string_upper("velasquez is becoming a true veteran. execellent target skills.") quote[5] = string_upper("velasquez is an ace pilot. her skills are exceptional!") quote[6] = string_upper("velasquez is progressing to the highest levels of piloting ability!") quote[7] = string_upper("velasquez is recommended for assignment to the toughest missions.") quote[8] = string_upper("velasquez has set new record for most kills!") quote[9] = string_upper("velasquez is establishing new standards of excellence") quote[10] = string_upper("velasquez is true genius in a skid!") |
obj_results: Create 4
Sets a pair of arrays for each display line on the screen. One array defines the line color which alternates between light green and dark green. The other array holds the actual desired text. A third array for each line starts empty and we'll fill it in one character at a time like the original game. We display the third array. Note that in line 12, we've buried the calculation for the qualitative quote index. Every 15 kills iterates the quote.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
///Set text lines /* Line settings */ line_col[0] = c_lime; full_line[0]="MISSION " + string(gamedata.current_mission) + " OF 59" line_col[1] = c_lime; full_line[1]="" line_col[2] = c_lime; full_line[2]="" line_col[3] = c_lime; full_line[3]="MISSION DEBRIEFING" line_col[4] = c_green; full_line[4]="MISSION SUCCESSFUL" line_col[5] = c_lime; full_line[5]="" line_col[6] = c_lime; full_line[6]="" line_col[7] = c_lime; full_line[7]="KILLS THIS MISSION - " + string(gamedata.current_mission_kills) line_col[8] = c_lime; full_line[8]="KILLS TO DATE - " + string(gamedata.current_total_kills) line_col[9] = c_lime; full_line[9]="" line_col[10] = c_lime; full_line[10]="" line_col[11] = c_lime; full_line[11]="COMPUTER FILE'S NOTE" line_col[12] = c_green; full_line[12]=quote[min(floor(gamedata.current_total_kills/15),10)] /* Partially drawn lines */ for (var i=0; i<13; i++) line[i] = "" |
obj_results: Destroy 1
Degregister the keyboard
1 2 |
///Deregister keyboard_deregister(id) |
obj_results: Destroy 2
Remove the stats from the mission we just completed
1 2 |
///Remove mission stats gamedata.current_mission_kills = 0 |
obj_results: Destroy 3
The results object creates the briefing object
1 2 |
///Create debriefing object instance_create(0,0,obj_briefing) |
obj_results: Step 1
Handle input in the same way we've always done. This time, any key will instantly complete the drawing or fade out if drawing has already finished.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
///Process input if ds_exists(command_stack,ds_type_stack) && !ds_stack_empty(command_stack) { var cmd = ds_stack_pop(command_stack) if cmd == "any" { if fade_in == true { /* instantly complete text drawing */ fade_alpha = 1 for (var i=0;i<13;i++) line[i] = full_line[i] } else fade_out = true } } |
obj_results: Step 2
Fading in and out. Fading out destroys the object when it's completely faded.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
///Fading if fade_in fade_alpha+=0.05 if fade_alpha > 1 then { fade_in = false fade_alpha = 1 } if fade_out fade_alpha-=0.05 if fade_alpha < 0 instance_destroy() |
obj_results: Step 3
Add a character to the results screen each step, line by line, until completed.
1 2 3 4 5 6 7 8 9 10 11 |
///Scroll text if current_line < 13 { var current_len = string_length(line[current_line]); var full_len = string_length(full_line[current_line]); if current_len < full_len then line[current_line] += string_copy(full_line[current_line],current_len+1,1) else current_line++ } |
obj_results: Draw 1
Render our completed text lines and Vel's face.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
///Render results /* Face */ draw_sprite_ext(face,0,160,0,1,1,0,c_white,fade_alpha) /* Text */ draw_set_alpha(fade_alpha) for (var i=0; i<13;i++) { var text = line[i] draw_set_color(line_col[i]) draw_set_halign(fa_left) draw_text_ext(view_wview[0]*0.03, round(view_hview[0]*0.2)+line_height*i,text,line_height,view_wview[0]*0.8) } |
obj_briefing: Create 6
Storyboards for the mission 1 debriefing sequence
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
///Debriefing Flow if room == rm_debrief { //Default none for (var i=6;i<=60;i++) brief[i,1]=BRIEFING.fin brief[1,1] = BRIEFING.scr brief[1,2] = asset_get_index("sprite13_HANGAR") brief[1,3] = "upper hangar" brief[1,4] = "traffic department headquarters" brief[1,5] = "5 radians later" brief[1,6] = BRIEFING.dialogue brief[1,7] = 1 brief[1,8] = BRIEFING.scr brief[1,9] = asset_get_index("sprite37_SOFFICE") brief[1,10] = "commander satairs office" brief[1,11] = "traffic department headquarters" brief[1,12] = "25 radians later" brief[1,13] = BRIEFING.dialogue brief[1,14] = 2 brief[1,15] = BRIEFING.fin } |
obj_briefing: Destroy 3
Updated obj_briefing destructor to go to the appropriate next room depending on the current room. This function will change for a third time by the end of this series.
1 2 3 4 5 6 |
///Next room if room == rm_brief then room_goto(rm_mission) if room == rm_debrief then room_goto(rm_mainmenu) |