Qkrisi / ktanemodkit

Modding toolkit for Keep Talking and Nobody Explodes
Other
8 stars 12 forks source link

Add the ability to use DMG syntax to create missions #1

Closed ZekNikZ closed 3 years ago

ZekNikZ commented 3 years ago

I built this feature off of the main modkit, so this might create a merge conflict but should be easily resolved. I can rebase off of the master branch of the community modkit if needed.

For more information about this feature, below is a copy of the working draft of the user guide for the feature:

Modkit support for DMG

The community fork of the KTANE modkit supports loading and editing missions using DMG syntax.

All features above are supported, with the exception of room:[name], mode:[mode], tm/zm/sm settings, and ! (duplication reduction).

In addition, documentation comments ("doc comments") are also supported to specify mission names and descriptions within the DMG string. There are variants of doc comments using either inline or multiline comments:

//// Mission name (start line with four '/'s)
/// Description line 1 (start each description line with three '/'s)
/// Description line 2 

/** (start comment with two '*'s)
  Mission name
  Description line 1
  Description line 2
*/

In both cases, whitespace is ignored.

Creating a new mission using a DMG mission file (such as one saved using DMG in-game)

Under the Keep Talking ModKit menu, click Missions/Load DMG Misison File. This will create a mission in the Assets/Missions directory with a name matching the mission name, if specified in the doc comments.

Click Keep Talking ModKit/Missions/Load DMG Mission File

Editing mission using DMG syntax / getting DMG version of a mission

As seen in the screenshot below, there is now a DMG mission string box in the mission editor panel. The text area will automatically update with the current version of the DMG mission. If it does not update, use the Force Refresh DMG Mission String button to forcefully refresh it.

You can edit the DMG mission string in this text area. Clicking Load from DMG Mission String will update the mission asset to match the DMG specficiation.

image alt

Loading a DMG mission pack

The modkit supports loading an entire pack of missions specified in DMG syntax into mission and table of contents assets. To do so, begin by verifing that your "pack" directory looks like the following:

/pack_name/section_1_name/mission1.txt
/pack_name/section_1_name/mission2.txt
/pack_name/section_2_name/mission3.txt
/pack_name/section_3_name/mission4.txt
/pack_name/section_3_name/mission5.txt
/pack_name/section_3_name/mission6.txt

In other words, the "pack" directory should contain subfolders, each containing a series of mission files.

Section names are determined from the name of the section folders. Mission names are determined by the mission names in the mission doc strings. By default, sections and missions are ordered alphabetically. To override this behaivour, you can optionally specify numbers in the file names to order sections and missions:

/pack_name/2. section_1_name/1. mission1.txt
/pack_name/2. section_1_name/2. mission2.txt
/pack_name/3. section_2_name/mission3.txt
/pack_name/1. section_3_name/5. mission4.txt
/pack_name/1. section_3_name/20. mission5.txt
/pack_name/1. section_3_name/10. mission6.txt

This will result in a table of contents like this:

pack_name
  1. section_3_name
     1.1 mission 4 name
     1.2 mission 6 name
     1.3 mission 5 name
  2. section_1_name
     2.1 mission 1 name
     2.2 mission 2 name
  3. section_2_name
     3.1 mission 3 name

Under the Keep Talking ModKit menu, click Missions/Load DMG Misison Folder. This will create a mission pack in the Assets/Missions directory matching the above.

Click Keep Talking ModKit/Missions/Load DMG Mission File

ZekNikZ commented 3 years ago

Someone should double-check, but the the only merge conflicts arise from the interweaving of the DMG editor with the Multiple Bombs editor. I built the DMG editor into the version of the Multiple Bombs editor present in this repo, so it shouldn't cause any issues.

ZekNikZ commented 3 years ago

Now, come to think of it, for people only making mission packs, it might be nice to have a mission_packs branch or something for a modkit with just the mission editor features

Qkrisi commented 3 years ago

Wow! Awesome work there!

Seems like everything works as intended.

The only modification I've done is preventing the mode setting from going into the module pool.

Overall, I've merged the files in 073c3f5.

A mission_packs branch is a good idea, I'll definitely work on that.

Thank you for your contribution! :)