level editor - Poobslag/turbofat GitHub Wiki

Level editor

The level editor can be accessed from the main menu, or by launching the LevelEditor scene directly. This editor is still very unstable and omits some very basic UI features. Bad things will happen if you type invalid json. You can lose all of your data if you forget to save; it will not prompt you. Hopefully I'll improve it some day, but my first priority is finishing the game and making it fun.

Level editor screenshot

Left panel: Palette

The left panel provides a palette of pieces which can be dragged to the playfield to the right. The Rot button rotates the pieces, while the Chg button changes the snack/vegetable blocks into other varieties.

Center panel: Playfield

The playfield can be edited by dragging pieces from the palette on the left.

Pieces can be erased from the playfield with the right mouse button.

Right panel: Save and load

The top text field is the scenario name. This should be snake_case and should match the scenario filename. It's never displayed to the user, but is used when storing save data.

The Open File button loads a scenario from the file system. The Open Resource button loads a scenario from the game's resource files. The Save button saves a scenario to the file system.

The Test button will let you try out the scenario. When you're in test mode, clicking "Back" will bring you back to the level editor.

Bottom panel: Json file

All scenario data is stored in json. This text area shows you what will be written to disk. You can manually edit this.

Exit

The exit button is in the bottom-right corner. Make sure to save your changes first.

File format

Scenarios are stored in json files which define things how you win, how you lose, what types of pieces you're given, special scoring criteria and other obstacles.

Current implementation

  • blocks_during: Blocks/boxes which appear or disappear while the game is going on. clear_on_top_out
    • blocks_during.filled_line_clear_delay: How many pieces or trigger effects a line waits before being cleared; 0 = immediate
    • blocks_during.filled_line_clear_max: The maximum number of lines which can be cleared simultaneously.
    • blocks_during.filled_line_clear_min: The minimum number of lines which must be filled to trigger line clears.
    • blocks_during.filled_line_clear_order: The order in which filled lines are cleared. oldest, lowest, random, default.
    • blocks_during.line_clear_type: Whether lines drop when the player clears a line. default, float, float_fall
    • blocks_during.pickup_type: Whether pickups move with blocks. default, float, float_regen
    • blocks_during.refresh_on_top_out: If true, the playfield is restored to its initial state when the player tops out.
    • blocks_during.shuffle_filled_lines: bag, none, slice
    • blocks_during.shuffle_inserted_lines: bag, none, slice
    • fill_lines 0: If assigned, blank lines will be filled from the specified tile set.
  • color_string: Level button color. This is usually random, but for rank mode we use specific colors. red, blue.
  • combo_break: Things that disrupt the player's combo. veg_row
    • pieces 0, pieces 1, pieces 999999: Combo breaks if you drop this many pieces without continuing your combo. A value of '0' means you can't build combos. (Default: pieces 2)
  • finish_condition: How the player finishes. When the player finishes, they can't play anymore, and the level just ends. It should be used for limits such as serving 5 customers or clearing 10 lines.
    • finish_condition.type: customers, lines, pieces, score, time_over
    • finish_condition.value: 5, 60, 1000
  • input_replay: A set of computer-controlled piece inputs. This is used to steer pieces around during tutorials, and will prevent the player from controlling the piece.
  • lose_condition: How the player loses. For some scenarios, the player might lose in the middle of a level if they don't make enough blocks, or don't play quickly enough.
    • top_out 1, top_out 999999: Player loses if they top out too many times. (Default: top_out 3)
    • finish_on_lose: If the player loses, the 'finish' screen is shown and it is not recorded as a loss. Used for sandbox modes.
  • other: Rules which are unique enough that it doesn't make sense to put them in their own groups.
    • tutorial, after_tutorial
    • start_scenario ultra_normal: When the scenario is started, a different scenario is swapped in instead. Used for tutorials.
    • no_clear_on_finish: When finishing the level, don't do the usual final all_clear animation.
    • enhance_combo_fx: Makes the combo visuals more noticable. Used in combo-centric tutorials so that the player can more easily tell when they need to maintain a combo.
    • tile_set veggie
  • piece_types: The selection of pieces provided to the player.
    • ordered_start: If true, the start pieces always appear in the same order instead of being shuffled.
    • piece_j, piece_l, piece_o: Pieces which provided during a scenario.
    • suppress_piece_rotation, suppress_piece_initial_rotation: Prevents the player from rotating pieces, or from performing initial rotation
    • suppress_repeat_piece, no_suppress_repeat_piece: Enables/disables the behavior where the bag algorithm avoids repeat pieces. This behavior is enabled by default.
    • start_piece_j, start_piece_l, start_piece_o: Pieces provided at the start of a scenario. If multiple pieces are specified, they're shuffled.
  • rank: Tweaks to rank calculation. box_factor, combo_factor, customer_combo, extra_seconds_per_piece, hide_results, leftover_lines, master_pickup_score, master_pickup_score_per_line, 'preplaced_pieces', success_bonus, unranked
    • rank.show_pickups_rank: Show the player's rating for collecting pickups on the end-of-level results screen. Also available are show_boxes_rank, show_combos_rank, show_lines_rank, show_pickups_rank, show_pieces_rank, show_speed_rank
    • rank.hide_boxes_rank: Hide the player's rating for making boxes on the end-of-level results screen. Also available are hide_boxes_rank, hide_combos_rank, hide_lines_rank, hide_pickups_rank, hide_pieces_rank, hide_speed_rank
  • score: Rules for scoring points. veg_row 5, veg_row 15, snack_all 0, snack_all 1, cake_all 2
  • speed_ups: Requirements to speed up and make the game harder.
    • speed_ups.type: lines, time_over
    • speed_ups.value: 5, 60, 1000
    • speed_ups.speed: 1, A6, FB
  • start_speed: The speed the player starts on. 0, A5, FA the player with the expectation of them getting 150 lines. That '150 lines' is the lenient value. 100, 200, 500
  • success_condition: How the player succeeds. When the player succeeds, there's a big fanfare and celebration, it should be used for accomplishments such as surviving 10 minutes or getting 1,000 points.
    • success_condition.type: customers, lines, pieces, score, time_under
    • success_condition.value: 5, 60, 1000
    • success_condition.lenient_value: A marathon mode might end when the player clears 1,000 lines, but we only grade
  • tiles: Sets of blocks which are shown initially, or appear during the game.
    • tiles.start: A set of blocks which is shown initially.
    • tiles.0, tiles.1: Alternate set of blocks appear during the game.
  • timers: Timers which cause strange things to happen during a level.
    • timers.interval: How frequently the timer should fire, measured in seconds.
    • timers.initial_interval: How long the timer should wait to fire the first time, measured in seconds.
  • triggers: Triggers which cause strange things to happen during a level.
    • triggers.phase: piece_written n=1,3,5..., timer_0
    • triggers.phase.before_start Fires before the level even starts.
    • triggers.phase.box_built: box_built, box_built cake, box_built snack
    • triggers.phase.combo_ended: combo_ended, combo_ended combo=5...
    • triggers.phase.initial_rotated_: initial_rotated_180, initial_rotated_left, initial_rotated_right
    • triggers.phase.line_cleared: line_cleared n=25, line_cleared y=0-2, line_cleared combo=5,7,9..., line_cleared score=1000
    • triggers.phase.pickup_collected: pickup_collected pickup_collected snack pickup_collected cake
    • triggers.phase.piece_written: piece_written combo=0,1,2 piece_written n=1,3,5...
    • triggers.phase.rotated_: rotated_180, rotated_left, right
    • triggers.phase.start Fires immediately when the level starts.
    • triggers.phase.timer_: timer_0, timer_1 ... timer_9
    • triggers.effect: rotate_next_pieces, insert_line
    • triggers.effect.add_carrots: count=2, duration=8.4, size=large, smoke=none, x=0-2,6-8
    • triggers.effect.add_carrots.size: small, medium, large, xl
    • triggers.effect.add_carrots.smoke: none, small, medium, large
    • triggers.effect.add_moles: count=2, dig_duration=5, home=surface, reward=seed, x=0-2,6-8, y=0-6
    • triggers.effect.add_moles.home: any, veg, box, cake, surface, hole
    • triggers.effect.add_moles.reward: seed, star
    • triggers.effect.add_sharks: count=2, patience=5, home=surface, size=small, x=0-2,6-8, y=0-6
    • triggers.effect.add_spears: count=2, duration=5, sizes=x2,l4,R6, wait=3, y=3-5
    • triggers.effect.add_onion: dddennn.
    • triggers.effect.advance_moles
    • triggers.effect.advance_onion
    • triggers.effect.advance_sharks
    • triggers.effect.advance_spears
    • triggers.effect.clear_filled_lines: force=true
    • triggers.effect.insert_line: count=3, tiles_key=0, tiles_keys=1,2,3
    • triggers.effect.remove_carrots: 2, 99
    • triggers.effect.remove_onion
    • triggers.effect.remove_spears: 2, 99
    • triggers.effect.rotate_next_pieces: cw, ccw 0 0

Ideas

  • blocks_start: preset
  • lose_condition: block_grade 50, combo_grade 70, speed_grade 80
  • next_queue: Behavior of the next queue. untrust 10, untrust 50, double_l, nice_pair 80
  • piece_types:
    • Vegetable pieces, veg_j, veg_o, veg_p
    • Trominos, c, k
⚠️ **GitHub.com Fallback** ⚠️