https://keenwiki.shikadi.net/w/api.php?action=feedcontributions&user=Ceilick&feedformat=atomKeenWiki - User contributions [en-gb]2024-03-29T05:29:02ZUser contributionsMediaWiki 1.35.1https://keenwiki.shikadi.net/w/index.php?title=Operation_Station_Infiltration&diff=46366Operation Station Infiltration2022-12-26T18:42:23Z<p>Ceilick: /* Credits */</p>
<hr />
<div>{{Mod Infobox<br />
| Episode = 5<br />
| Authors = [[User:Ceilick|Ceilick]]<br />
| Status = Complete<br />
| ReleaseDate = 2022-12-25<br />
| LatestUpdate = 2022-12-25<br />
| Discussion = [https://pckf.com/viewtopic.php?t=15448 PCKF]<br />
| Homepage = <br />
| Levels = 19 <br />
| SecretLevels = 1<br />
| NewGameplay = No<br />
| NewGfx = Some<br />
| NewLevels = Yes<br />
| NewSfx = Yes<br />
| NewMusic = Yes<br />
| LatestDownloadURL = https://files.shikadi.net/keenwiki/Packs/SourceCode/l.ceilick.operation_station_infiltration_v1.0.2022-12-25.zip<br />
| LatestVersion = v.1.0<br />
| Download = [https://files.shikadi.net/keenwiki/Packs/SourceCode/l.ceilick.operation_station_infiltration.sc_omnispeak_v1.0.2022-12-25.zip source code]<br />
| Series = [[Return to the Shadowlands]]<!-- , <br>[[Aliens and their Just Desserts]] --><br />
}}<br />
<br />
'''Operation Station Infiltration''' is a source mod by [[User:Ceilick|Ceilick]], programmed by [[User:Multimania|Multimania]], and the first mod to use the [[Omnispeak (game engine)|Omnispeak game engine]]. It is the second episode in a trilogy of levelpack style mods utilizing mostly the original graphics from Keens 4-6. Enjoy the nostalgic [[Keen 5]] setting as you join Commander Keen on a mission that takes him aboard an [[Omegamatic]]-like space station.<br />
<br />
==Story==<br />
After learning that the [[Bloog|Bloogs]] are responsible for the kidnapping of his pet Yorp [[Spot]], Commander Keen sets course for [[Fribbulus Xax]]. However, the planet is protected by the [[Shikadi|Shikadi's]] space station the Omegamatrix! Keen must disable the station in order to reach the planet.<br />
<br />
<br />
==Levels==<br />
{{ModLevelList}}<br />
<br />
== Technical Information ==<br />
<br />
*Utilities used: [[Abiathar]], [[KeenScr]], [[IMFCrush]], [[MIDI2IMF]], [[uGrab]], [[Wolf_Data_Compiler_(WDC)|WDC]]<br />
<br />
==Credits==<br />
<br />
* Creator: [[User:Ceilick|Ceilick]]<br />
* Programming: [[User:Multimania|Multimania]]<br />
* Music: [[User:XkyRauh|Xky Rauh]]<br />
* Sound Effects: [[User:Ceilick|Ceilick]]<br />
* Graphics: [[User:Ceilick|Ceilick]], [[User:Gridlock|Gridlock]], [[User:Nisaba|Nisaba]], [[User:XkyRauh|Xky Rauh]], 55Aavenue<br />
* Level Design: [[User:Ceilick|Ceilick]]<br />
* Story: [[User:Ceilick|Ceilick]]<br />
* Testing: [[User:Multimania|Multimania]], [[User:Roobar|Roobar]]<br />
<br />
* Special Thanks: [[User:Fleexy|Fleexy]], [[User:Multimania|Multimania]], [[User:Nisaba|Nisaba]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Operation_Station_Infiltration&diff=46360Operation Station Infiltration2022-12-26T15:33:07Z<p>Ceilick: corrected omnispeak link to game engine</p>
<hr />
<div>{{Mod Infobox<br />
| Episode = 5<br />
| Authors = [[User:Ceilick|Ceilick]]<br />
| Status = Complete<br />
| ReleaseDate = 2022-12-25<br />
| LatestUpdate = 2022-12-25<br />
| Discussion = [https://pckf.com/viewtopic.php?t=15448 PCKF]<br />
| Homepage = <br />
| Levels = 19 <br />
| SecretLevels = 1<br />
| NewGameplay = No<br />
| NewGfx = Some<br />
| NewLevels = Yes<br />
| NewSfx = Yes<br />
| NewMusic = Yes<br />
| LatestDownloadURL = https://files.shikadi.net/keenwiki/Packs/SourceCode/l.ceilick.operation_station_infiltration_v1.0.2022-12-25.zip<br />
| LatestVersion = v.1.0<br />
| Download = [https://files.shikadi.net/keenwiki/Packs/SourceCode/l.ceilick.operation_station_infiltration_v1.0.2022-12-25.zip source code]<br />
| Series = [[Return to the Shadowlands]]<!-- , <br>[[Aliens and their Just Desserts]] --><br />
}}<br />
<br />
'''Operation Station Infiltration''' is a source mod by [[User:Ceilick|Ceilick]], programmed by [[User:Multimania|Multimania]], and the first mod to use the [[Omnispeak (game engine)|Omnispeak game engine]]. It is the second episode in a trilogy of levelpack style mods utilizing mostly the original graphics from Keens 4-6. Enjoy the nostalgic [[Keen 5]] setting as you join Commander Keen on a mission that takes him aboard an [[Omegamatic]]-like space station.<br />
<br />
==Story==<br />
After learning that the [[Bloog|Bloogs]] are responsible for the kidnapping of his pet Yorp [[Spot]], Commander Keen sets course for [[Fribbulus Xax]]. However, the planet is protected by the [[Shikadi|Shikadi's]] space station the Omegamatrix! Keen must disable the station in order to reach the planet.<br />
<br />
<br />
==Levels==<br />
{{ModLevelList}}<br />
<br />
== Technical Information ==<br />
<br />
*Utilities used: [[Abiathar]], [[KeenScr]], [[IMFCrush]], [[MIDI2IMF]], [[uGrab]], [[Wolf_Data_Compiler_(WDC)|WDC]]<br />
<br />
==Credits==<br />
<br />
* Creator: [[User:Ceilick|Ceilick]]<br />
* Programming: [[User:Multimania|Multimania]]<br />
* Music: [[User:XkyRauh|Xky Rauh]]<br />
* Sound Effects: [[User:Ceilick|Ceilick]]<br />
* Graphics: [[User:Ceilick|Ceilick]], [[User:Gridlock|Gridlock]], [[User:Nisaba|Nisaba]], [[User:XkyRauh|Xky Rauh]], 55Aavenue<br />
* Level Design: [[User:Ceilick|Ceilick]]<br />
* Story: [[User:Ceilick|Ceilick]]<br />
* Testing: [[User:Multimania|Multimania]], [[User:Roobar|Roobar]]<br />
<br />
* Special Thanks: [[User:Fleexy|Fleexy]], [[User:Multimania|Multimania]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Operation_Station_Infiltration&diff=46359Operation Station Infiltration2022-12-26T15:32:09Z<p>Ceilick: adding Omnispeak ref</p>
<hr />
<div>{{Mod Infobox<br />
| Episode = 5<br />
| Authors = [[User:Ceilick|Ceilick]]<br />
| Status = Complete<br />
| ReleaseDate = 2022-12-25<br />
| LatestUpdate = 2022-12-25<br />
| Discussion = [https://pckf.com/viewtopic.php?t=15448 PCKF]<br />
| Homepage = <br />
| Levels = 19 <br />
| SecretLevels = 1<br />
| NewGameplay = No<br />
| NewGfx = Some<br />
| NewLevels = Yes<br />
| NewSfx = Yes<br />
| NewMusic = Yes<br />
| LatestDownloadURL = https://files.shikadi.net/keenwiki/Packs/SourceCode/l.ceilick.operation_station_infiltration_v1.0.2022-12-25.zip<br />
| LatestVersion = v.1.0<br />
| Download = [https://files.shikadi.net/keenwiki/Packs/SourceCode/l.ceilick.operation_station_infiltration_v1.0.2022-12-25.zip source code]<br />
| Series = [[Return to the Shadowlands]]<!-- , <br>[[Aliens and their Just Desserts]] --><br />
}}<br />
<br />
'''Operation Station Infiltration''' is a source mod by [[User:Ceilick|Ceilick]], programmed by [[User:Multimania|Multimania]], and the first mod to use the [[Omnispeak|Omnispeak game engine]]. It is the second episode in a trilogy of levelpack style mods utilizing mostly the original graphics from Keens 4-6. Enjoy the nostalgic [[Keen 5]] setting as you join Commander Keen on a mission that takes him aboard an [[Omegamatic]]-like space station.<br />
<br />
==Story==<br />
After learning that the [[Bloog|Bloogs]] are responsible for the kidnapping of his pet Yorp [[Spot]], Commander Keen sets course for [[Fribbulus Xax]]. However, the planet is protected by the [[Shikadi|Shikadi's]] space station the Omegamatrix! Keen must disable the station in order to reach the planet.<br />
<br />
<br />
==Levels==<br />
{{ModLevelList}}<br />
<br />
== Technical Information ==<br />
<br />
*Utilities used: [[Abiathar]], [[KeenScr]], [[IMFCrush]], [[MIDI2IMF]], [[uGrab]], [[Wolf_Data_Compiler_(WDC)|WDC]]<br />
<br />
==Credits==<br />
<br />
* Creator: [[User:Ceilick|Ceilick]]<br />
* Programming: [[User:Multimania|Multimania]]<br />
* Music: [[User:XkyRauh|Xky Rauh]]<br />
* Sound Effects: [[User:Ceilick|Ceilick]]<br />
* Graphics: [[User:Ceilick|Ceilick]], [[User:Gridlock|Gridlock]], [[User:Nisaba|Nisaba]], [[User:XkyRauh|Xky Rauh]], 55Aavenue<br />
* Level Design: [[User:Ceilick|Ceilick]]<br />
* Story: [[User:Ceilick|Ceilick]]<br />
* Testing: [[User:Multimania|Multimania]], [[User:Roobar|Roobar]]<br />
<br />
* Special Thanks: [[User:Fleexy|Fleexy]], [[User:Multimania|Multimania]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Galaxy_Mods&diff=46358Galaxy Mods2022-12-26T14:44:38Z<p>Ceilick: /* Full Mods */ adding OSI, updating RttS</p>
<hr />
<div><!-- <div style="border: 4px solid red; padding: 1em; margin: 1em; background-color: #FFFFEE;"><br />
<center>'''This page is being replaced'''</center><br />
Due to the growing number of mods, and the fact that a lot of information is duplicated on this page and the mod pages themselves, it is proposed that this page be split into per-episode lists that are automatically generated from the infoboxes on each mod's page. Please see one of the new pages to see what this would look like:<br />
<br />
* [[Keen 4 mods]]<br />
* [[Keen 5 mods]]<br />
* [[Keen 6 mods]]<br />
<br />
Until all the mods are migrated to the new pages, the list below will remain available.<br />
<br />
If you can help, please remove mods from the list below once they appear on the new page, and all the information has been taken across correctly (especially release dates.)<br />
<br />
To add a new mod to the new list, create a new page for it and put an infobox on it (just copy it from an existing mod's page and change it accordingly.)<br />
</div> --><br />
<!-- Proposal for an optional usage of both types of lists: <br />
a) alphabetical & subcategories <br />
b) per-episode --><br />
{{Alert|The downloads for Keen 5 and 6 mods will not include the executable necessary to play the game (they are still not free to distribute). You will need to put your own executable in the mod directory and unpack it with [[UNLZEXE]] prior to playing for the first time.}}<br />
<br />
This is an '''alphabetical list''' of all Keen: Galaxy mods, one-level mods and level packs ever made for Keen. It also includes some in-progress mods.<br />
<br />
*Please click on the triangles to sort by different categories. i.e. if you click first on "Modder(s)" then on "Mod of", you will get a list that is sorted by which game was modded, and further sorted by modder name. Refresh the page to reset all sort settings.<br />
<br />
*Only the newest version of each mod or level pack is listed in the Download column; additional versions of mods or level packs may be found on their respective wiki pages.<br />
<br />
*Dates format: year-month-day (the release date is always for the ''first'' version of the mod, if known)<br />
<br />
<br />
For a '''per-episode list''' choose from the following instead: [[Keen 4 mods]], [[Keen 5 mods]], [[Keen 6 mods]].<br />
<br />
<br />
= Mods =<br />
<br />
A mod, or modification, is the alteration of content in order to make it operate in a manner different from its original version. They can include new items, modded weapons, characters, enemies, models, tile-sets, levels, music, story lines and game modes. <br />
<br />
== Full Mods ==<br />
{|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" style="font-size: 90%; border:1px solid gray; border-collapse: collapse; text-align: center; width: 100%;"<br />
|- style="background: #ececec"<br />
! Title<br />
! Download<br />
! Release date<br />
! Modder(s)<br />
! Mod of<br />
! # of levels<br />
! Notes<br />
|-<br />
|[[Aliens Ate My Babysitter ...Again]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen6/m.ny00123.aliens_ate_my_babysitter_again_v1.3.k6.2009-09-26.zip full v1.3]<br />
|2009-09-26<br />
|NY00123<br />
|Keen 6<br />
|18<br />
|Keen 6 rearranged, color swaps, alternate graphics. [http://ny.duke4.net/files.html Website] [https://pckf.com/viewtopic.php?t=880 Release Thread]<br />
|-<br />
|[[The Alphamatic]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.gridlock.the-alphamatic.k5.2017-11-26.zip full]<br />
|2017-07-04<br />
|[[User:Gridlock|Gridlock]]<br />
|Keen 5<br />
|20<br />
|An Atroxian Realm sequel. [https://pckf.com/viewtopic.php?f=4&t=4086 Release Thread]<br />
|-<br />
|[[The Armageddon App]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.55aavenue.the_armageddon_app_v.1.2.k5.2020-05-26.zip full]<br />
|2020-05-04<br />
|55Aavenue<br />
|Keen 5<br />
|20<br />
|A Short Circuit Oracle sequel. [https://pckf.com/viewtopic.php?f=4&t=6851 Release Thread]<br />
|-<br />
|[[The Armageddon Continues]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.alessandro.the_armageddon_continues.k5.2020-06-07.zip full]<br />
|2020-06-07<br />
|[[User:DarkAle|DarkAle]]<br />
|Keen 5<br />
|12<br />
| [https://pckf.com/viewtopic.php?f=4&t=6979 Release Thread] <br />
|-<br />
|[[Atroxian Realm]]<br />
|[https://files.shikadi.net/keenwiki/mods/SourceCode/m.gridlock.atroxian_realm_v1.3.sc.2019-11-15.zip full v1.3]<br />
|2016-01-16<br />
|[[User:Gridlock|Gridlock]]<br />
|Keen 4<br />
|25<br />
|First Source-Code Mod. [https://pckf.com/viewtopic.php?t=1812 Discussion Thread], [https://pckf.com/viewtopic.php?t=3536 Release Thread]<br />
|-<br />
|[[Aurora Bliss]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.dave216.aurora_bliss_v.1.1.k4.2022-09-21.zip full v1.1]<br />
|2022-08-01<br />
|Dave216<br />
|Keen 4<br />
|22<br />
|[https://pckf.com/viewtopic.php?t=13985 Release Thread]<br />
|-<br />
|[[Bounty Hunting Brouhaha]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.kohntarkosz_.bounty_hunting_brouhaha.k4.2019-11-26.zip full]<br />
|2019-11-26<br />
|Kohntarkosz_<br />
|Keen 4<br />
|19<br />
|[https://pckf.com/viewtopic.php?f=4&t=6172 Release Thread]<br />
|-<br />
|[[Commander Keen's Valentine Bash]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.levellass.commander_keens_valentine_bash.k4.2013-01-04.zip full]<br />
|2013-01-04<br />
|[[User:Levellass|Levellass]]<br />
|Keen 4<br />
|20<br />
|Monster bash cross-over. [https://pckf.com/viewtopic.php?t=2532 Discussion Thread], [https://pckf.com/viewtopic.php?t=2616 Release Thread]<br />
|-<br />
|[[Commander Keen X Bio Menace]]<br />
|<!--[https://dl.dropboxusercontent.com/u/4975825/CKxBM.zip full]-->[https://files.shikadi.net/keenwiki/mods/Keen4/m.szemigi.commander_keen_x_bio_menace.k4.2016-02-16.zip full]<br />
|2016-02-15<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 4<br />
|13<br />
|A crossover between Keen 4 and Bio Menace 1. [https://pckf.com/viewtopic.php?f=4&t=3571Release Thread]<br />
|-<br />
|[[The Eight Accumulators]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.bubbatom.the_eight_accumulators.k4.2011-12-13.zip full]<br />
|2011-12-13<br />
|[[User:Bubbatom|Bubbatom]]<br />
|Keen 4<br />
|18<br />
|Uses new and original tiles. [https://pckf.com/viewtopic.php?t=2042 Discussion Thread], [https://pckf.com/viewtopic.php?t=2171 Release Thread]<br />
|-<br />
|[[Episode 58 - The Ruin of Roib|Episode 58 - The Ruin of Roib]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.bernie.the_ruin_of_roib.k4.2013-07-01.zip beta v3.0]<br />
|2013-05-25<br />
|Bernie<br />
|Keen 4<br />
|24<br />
|Aged Keen. [https://pckf.com/viewtopic.php?t=2786 Discussion Thread], [https://pckf.com/viewtopic.php?t=2791 Re-Release Thread]<br />
|-<br />
|[[Episode 59 - Underworld Ultimate!|Episode 59 - Underworld Ultimate!]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.bernie.underworld_ultimate.k4.2014-05-06.zip beta v1.0]<br />
|2014-05-06<br />
|Bernie<br />
|Keen 4<br />
|18<br />
|Aged Keen. [https://pckf.com/viewtopic.php?t=3057 Release Thread]<br />
|-<br />
|[[The Grand Intelligence IV: Intelligent Intellect]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.szemigi.intelligent_intellect.k4.2013-12-07.zip full v2]<br />
|2013-09-02<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 4<br />
|18<br />
|Protaginist is Martinez McMeyer. [https://pckf.com/viewtopic.php?t=2848 Release Thread]<br />
|-<br />
|[[Marooned on Mars - Galaxy mod|Marooned on Mars]]<br />
|<!--[http://richard-balluff.de/MOMGalaxy1.0.rar beta v1.4]-->[https://files.shikadi.net/keenwiki/mods/Keen5/m.dr_colossus.marooned_on_mars_-_galaxy_mod_v.1.7.k5.2018-10-10.zip beta v1.7]<br />
|2016-03-14<br />
|[[User:DrColossus|Dr. Colossus]]<br />
|Keen 5<br />
|17<br />
|Keen 1 conversion into Galaxy style. [https://pckf.com/viewtopic.php?t=3598 Release Thread]<br />
|-<br />
|[[Keen 10: Mirror Menace|Mirror Menace]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen6/m.szemigi.mirror_menace.k6.2014-10-01.zip beta v1.3]<br />
|2013-11-24<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 6<br />
|18<br />
|<!--[https://pckf.com/viewtopic.php?t=2928 Beta I Release Thread], [https://pckf.com/viewtopic.php?f=4&t=3004 Beta II Release Thread], -->[https://pckf.com/viewtopic.php?t=3136 <!--Final--> Release Thread], known bug: the game freezes after Keen enters the teleporter<br />
|-<br />
|[[Operation Ocflore]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.bubbatom.operation_ocflore_v1.3.k4.2020-02-18.zip full v.1.3]<br />
|2020-01-14<br />
|[[User:Bubbatom|Bubbatom]]<br />
|Keen 4<br />
|18<br />
|Uses different EGA color palette [https://pckf.com/viewtopic.php?f=4&t=6379 Release Thread], [https://pckf.com/viewtopic.php?t=3022 Development Thread] <br />
|-<br />
|[[Operation Station Infiltration]]<br />
|[https://files.shikadi.net/keenwiki/Packs/SourceCode/l.ceilick.operation_station_infiltration_v1.0.2022-12-25.zip full v.1.0]<br />
|2022-12-25<br />
|[[User:Ceilick|Ceilick]]<br />
|Keen 5<br />
|19<br />
|Source code mod. Sequel to [[Return to the Shadowlands]]. [https://pckf.com/viewtopic.php?t=15448 Release Thread], [https://pckf.com/viewtopic.php?t=11178 Development Thread] <br />
|-<br />
|[[The Prisoner's Dilemma]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen6/m.kohntarkosz_.the_prisoner's_dilemma.k6.2021-07-16.zip full]<br />
|2021-07-16<br />
|Kohntarkosz_<br />
|Keen 6<br />
|<br />
|Sequel to [[Bounty Hunting Brouhaha]]. [https://pckf.com/viewtopic.php?f=4&t=11632 Release Thread]<br />
|-<br />
|[[Return to the Shadowlands]]<br />
|[https://files.shikadi.net/keenwiki/Packs/SourceCode/l.ceilick.return_to_the_shadowlands_v1.8.sc.2022-12-21.zip full v1.08]<br />
|2021-06-06<br />
|[[User:Ceilick|Ceilick]]<br />
|Keen 4<br />
|20<br />
|Source code mod. [https://pckf.com/viewtopic.php?f=4&t=11095 Release Thread] [https://pckf.com/viewtopic.php?f=2&t=9993 Development Thread].<br />
|-<br />
|[[Secret of the Sorcerer]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen6/m.darkale.secret_of_the_sorcerer_v1.4.k6.2022-10-04.zip full v1.4]<br />
|2022-02-26<br />
|[[User:DarkAle|DarkAle]]<br />
|Keen 6<br />
|16<br />
| [https://pckf.com/viewtopic.php?t=13031 Release Thread] <br />
|-<br />
|[[Commander Keen in Suburb Shenanigans|Suburb Shenanigans]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.bubbatom.suburb_shenanigans_v1.1.k5.2019-02-09.zip full v1.1]<br />
|2018-12-24<br />
|[[User:Bubbatom|Bubbatom]]<br />
|Keen 5<br />
|23<br />
|[https://pckf.com/viewtopic.php?t=2306 Development Thread], [https://pckf.com/viewtopic.php?f=4&t=4701&p=88325 Release Thread]<br />
|-<br />
|[[The Terror from Outer Space|The Terror from Outer Space]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.dr_colossus.the_terror_from_outer_space.k4.2013-09-29.zip full]<br />
|2013-09-16<br />
|[[User:DrColossus|Dr. Colossus]]<br />
|Keen 4<br />
|19<br />
|[https://pckf.com/viewtopic.php?t=2864 Release Thread]<br />
|-<br />
|[[The Keys of Krodacia|The Universe is Toast (unofficial) I: The Keys of Krodacia]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.ceilick.the_keys_of_krodacia.k4.2009-03-14.zip full v2]<br />
|2009-03-14<br />
|[[User:Ceilick|Ceilick]]<br />
|Keen 4<br />
|18<br />
|[http://publiccommanderkeenforum.yuku.com/topic/886/Keen-4-mod-The-Keys-of-Krodacia Release Thread], [https://pckf.com/viewtopic.php?t=1379 Post Discussion Thread], [https://pckf.com/viewtopic.php?t=566 Re-Release Thread] (includes new music, additional content, and bug fixes)<br />
|-<br />
|[[Dead in the Desert|The Universe is Toast (unofficial) II: Dead in the Desert]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen6/m.ceilick.dead_in_the_desert.k6.2011-11-23.zip full v3.2]<br />
|2009-07-21<br />
|[[User:Ceilick|Ceilick]]<br />
|Keen 6<br />
|18<br />
|[https://pckf.com/viewtopic.php?t=536 Discussion Thread] [https://pckf.com/viewtopic.php?t=762 Release Thread]<br />
|-<br />
|[[Battle of the Brains|The Universe is Toast (unofficial) III: Battle of the Brains]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.ceilick_mink_tulip.battle_of_the_brains.k5.2011-11-23.zip full v2.5] <br/><br />
|2011-11-23<br />
|[[User:Ceilick|Ceilick]], [[User:Mink|Mink]], [[User:Tulip|Tulip]]<br />
|Keen 5<br />
|15<br />
|[https://pckf.com/viewtopic.php?t=774 Discussion Thread], [https://pckf.com/viewtopic.php?t=1808 Release Thread]<br />
|-<br />
|[[Zoltan's Revenge]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.levellass.zoltans_revenge.k4.2012-10-20.zip full]<br />
|2012-10-20<br />
|[[User:Levellass|Levellass]]<br />
|Keen 4<br />
|16<br />
|The first demo won 1st place in the 2007 [http://keenmodding.org/viewtopic.php?t=924 Keen 4 minimod contest]<br />
|}<br />
<br />
== Changed Gameplay Mods ==<br />
<br />
This topic contains mods which differ largely from the ordinary Keen Galaxy gameplay. (Nearly) all mods in this category have substantial similarity in a distinctive gameplay derived from heavy patching.<br />
{|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" style="font-size: 90%; border:1px solid gray; border-collapse: collapse; text-align: center; width: 100%;"<br />
|- style="background: #ececec"<br />
! Title<br />
! Download<br />
! Release date<br />
! Modder(s)<br />
! Mod of<br />
! # of levels<br />
! Notes<br />
|-<br />
|[[Adventures in the BWB Megarocket]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.gargapplesauce.adventures_in_the_bwb_megarocket.k4.2010-06-09.zip beta]<br />
|2010-06-09<br />
|[[User:GARGapplesauce|GARGapplesauce]]<br />
|Keen 4<br />
|10<br />
|Changed Gameplay: Designed to pilot the BWB Megarocket. [https://pckf.com/viewtopic.php?t=1998 Discussion Thread]<br />
|-<br />
|[[Birdman]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.br1ck_dr_witherstone.birdman.k4.2004-03-26.zip demo]<br />
|2004-03-26<br />
|Br1ck, Dr.&nbsp;Witherstone<br />
|Keen 4<br />
|1<br />
|Changed Gameplay: Designed to fly as Blue Bird. Also first Keen 4 mod. [http://keenmodding.org/viewtopic.php?t=266 Forum Thread]<br />
|-<br />
|[[Galaxy Defender]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.dr_colossus.galaxy_defender.k4.2017-03-14.zip demo]<br />
|2017-03-14<br />
|[[User:DrColossus|Dr. Colossus]]<br />
|Keen 4<br />
|1<br />
|Changed Gameplay: BwB space-shooter style gameplay. [https://pckf.com/viewtopic.php?f=4&t=4029 Release Thread]<br />
|-<br />
|[[Keenball]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.levellass.keenball.k4.2019-03-14.zip demo]<br />
|2019-03-14<br />
|[[User:Levellass|Levellass]]<br />
|Keen 4<br />
|4<br />
|Changed Gameplay: pinball/snooker like game with an unique crosshairs mechanic. [https://keenmodding.org/viewtopic.php?f=13&t=3224 Release Thread]<br />
|-<br />
|[[Keen 60: Kreeg Crisis!]]<br />
|<!--[https://dl.dropboxusercontent.com/u/3940020/Keen60.zip full]-->[https://files.shikadi.net/keenwiki/mods/Keen4/m.levellass.keen_60_kreeg_crisis_.k4.2016-04-03.zip full]<br />
|2016-04-01<br />
|[[User:Levellass| Levellass]]<br />
|Keen 4<br />
|1<br />
|Changed Gameplay: Pogoing, jumping, shooting disabled. [https://pckf.com/viewtopic.php?t=3620 Forum Thread]<br />
|-<br />
|[[Kube]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.levellass.kube.k4.2015-07-09.zip full]<br />
|2015-07-08<br />
|[[User:Levellass|Levellass]]<br />
|Keen 4<br />
|11<br />
|Changed Gameplay: Worldmap mod. [https://pckf.com/viewtopic.php?t=3347 Discussion Thread]<br />
|-<br />
|[[Lemm's TLANP]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.lemm.lemms_tlanp.k5.2013-03-25.zip demo]<br />
|2013-03-25<br />
|[[User:Lemm|Lemm]]<br />
|Keen 5<br />
|3<br />
|Three puzzle levels and a nifty patch. [https://pckf.com/viewtopic.php?t=2726 Release Thread]<br />
|-<br />
|[[Mink's Puzzle Pack]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.mink.minks_puzzle_pack.k5.2010-01-03.zip full v3]<br />
|2010-01-03<br />
|[[User:Mink|Mink]]<br />
|Keen 5<br />
|13<br />
|Changed Gameplay: Keen Clones to solve puzzles. [https://pckf.com/viewtopic.php?t=1007 Release Thread]<br />
|-<br />
|[[NY00123's tests level]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.ny00123.ny00123s_tests_level.k4.2017-04-22.zip full v1.3]<br />
|2017-04-22<br />
|NY00123<br />
|Keen 4<br />
|1<br />
|Changed Gameplay: Numerous challenges to go from A to B. [https://pckf.com/viewtopic.php?t=4049 Discussion Thread]<br />
|-<br />
|[[Pak Een]]<br />
|<!--[https://dl.dropboxusercontent.com/u/3940020/Pakeen.zip full]-->[https://files.shikadi.net/keenwiki/mods/Keen4/m.levellass.pakeen.k4.2016-06-01.zip full]<br />
|2016-06-01<br />
|[[User:Levellass|Levellass]]<br />
|Keen 4<br />
|11+<br />
|Changed Gameplay: Worldmap mod. [https://pckf.com/viewtopic.php?t=3537 Discussion Thread]<br />
|-<br />
|[[Save the Quillsheep]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.xky_rauh.save_the_quillsheep.k4.2007-07-14.zip full]<br />
|2007-07-14<br />
|[[User:XkyRauh|Xkylyr Rauh]]<br />
|Keen 4<br />
|4<br />
|Changed Gameplay: Save Quillsheep. 2nd place in the [http://keenmodding.org/viewtopic.php?t=924 Keen 4 minimod contest]<br />
|-<br />
|[[Skater Squirrel]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.levellass.skater_squirrel.k4.2017-10-19 demo]<br />
|2017-10-19<br />
|[[User:Levellass|Levellass]]<br />
|Keen 4<br />
|4<br />
|Changed Gameplay: stars a squirrel. has changed game physics. [https://pckf.com/viewtopic.php?f=4&t=4138 Release Thread]<br />
|-<br />
|[[Space Evaders]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.levellass.keenev.k4.2017-03-13.zip full]<br />
|2017-03-13<br />
|[[User:Levellass|Levellass]]<br />
|Keen 4<br />
|86<br />
|Changed Gameplay: shmup design. [https://pckf.com/viewtopic.php?f=4&t=4023 Release Thread]<br />
|-<br />
|}<br />
<br />
<!--<br />
== Announced Upcoming Mods / Demos ==<br />
{|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" style="font-size: 90%; border:1px solid gray; border-collapse: collapse; text-align: center; width: 100%;"<br />
|- style="background: #ececec"<br />
! Title<br />
! Download<br />
! Release date<br />
! Modder(s)<br />
! Mod of<br />
! # of levels<br />
! Notes<br />
|-<br />
|[[Foray in the Forest]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.nisaba.foray_in_the_forest.k4.2017-03-14.zip demo]<br />
|2017-03-14<br />
|[[User:Mr.M|Mr.M]], [[User:Nisaba|Nisaba]]<br />
|Keen 4<br />
|2<br />
|Abandoned by Mr.M. but recreated from scratch by Nisaba. [https://pckf.com/viewtopic.php?t=823 Discussion Thread], [https://pckf.com/viewtopic.php?p=83707#p83707 Demo Release Thread]<br />
|-<br />
|[[Sign of the Vool|Sign of the Vool]]<br />
|[[link needed]]<br />
|TBA<br />
|[[User:Ceilick|Ceilick]]<br />
|Keen 4<br />
|?<br />
|In-development [https://pckf.com/viewtopic.php?t=2494 Discussion Thread]<br />
|}<br />
--><br />
<br />
== Notable Alpha Versions ==<br />
This topic contains unfinished, abandoned, pre-alpha mods which are notable for unique creative reasons (see the notes). <br />
{|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" style="font-size: 90%; border:1px solid gray; border-collapse: collapse; text-align: center; width: 100%;"<br />
|- style="background: #ececec"<br />
! Title<br />
! Download<br />
! Release date<br />
! Modder(s)<br />
! Mod of<br />
! # of levels<br />
! Notes<br />
|-<br />
|[[ChargingMoose's 1st Levelpack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.chargingmoose.k4.2001-04-17.zip full]<br />
|2001-04-17<br />
|ChargingMoose<br />
|Keen 4<br />
|1<br />
|First fan-made galaxy level ever. (Partially made with a hex editor.) [http://archive.shikadi.net/pckf/official/151.htm Discussion]<br />
|-<br />
|[[Commander Keen at Ballican IV]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.fleexy.commander_keen_at_ballican_iv.k4.2009-03-15.zip alpha v0.1]<br />
|2009-03-15<br />
|[[User:Fleexy|Fleexy]]<br />
|Keen 4<br />
|1<br />
|Flashy creatures also on worldmap. [http://keenmodding.org/viewtopic.php?t=1135 Forum Thread]<br />
|-<br />
|[[Dr. Colossus: The Temple of Cydonia]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.dr_colossus.the_temple_of_cydonia.k5.2014-02-06.zip demo]<br />
|2014-02-06<br />
|[[User:DrColossus|Dr. Colossus]]<br />
|Keen 5<br />
|1<br />
|Keen is replaced by a new player. [https://pckf.com/viewtopic.php?t=2998 Discussion Thread]. (Abandoned)<br />
|-<br />
|[[Episode -3]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.cyber_zero.episode_-3.k4.2015-03-15.zip demo]<br />
|2015-03-15<br />
|cyber zero and brother<br />
|Keen 4<br />
|2<br />
|Planned as a prequel of the Keen series. [https://pckf.com/viewtopic.php?t=2546 Discussion Thread]<br />
|-<br />
|[[Keen 1 Redone]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.gridlock.keen_1_redone.k5.2011-02-11.zip alpha]<br />
|2011-02-11<br />
|[[User:Gridlock|Gridlock]]<br />
|Keen 5<br />
|4<br />
|Keen 1 conversion into Galaxy style. [https://pckf.com/viewtopic.php?t=1827 Discussion Thread]. (Abandoned)<br />
|-<br />
|[[NY00123's first abandoned CK4 level pack]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.ny00123.abandoned_levels.k4.2011-10-02.zip alpha]<br />
|2011-10-02<br />
|NY00123<br />
|Keen 4<br />
|2<br />
|Contains horizontally flipped graphics. [http://ny.duke4.net/files.html Website] [https://pckf.com/viewtopic.php?p=48636 Forum Thread]<br />
|-<br />
|[[Torgopolis]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.benvolio.torgopolis.k4.2005-03-13.zip demo]<br />
|2005-03-13<br />
|[[User:Benvolio|Benvolio]]<br />
|Keen 4<br />
|1<br />
|Style conversion into Vorticons look. [http://www.maguidhir.com/benvolio/ Homepage]<br />
|-<br />
|[[XkyKeen4|XkyKeen4 aka. Episode Pound: Fibers of Danak]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.xky_rauh.xkykeen4.k4.2008-09-20.zip alpha]<br />
|2008-09-20<br />
|[[User:XkyRauh|Xkylyr Rauh]]<br />
|Keen 4<br />
|1<br />
|Graphical redesign. [https://pckf.com/viewtopic.php?t=382 Thread] (Abandoned)<br />
|-<br />
|[[Zero X]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.zero_x_diamond.zero_x.k4.2007-07-14.zip demo]<br />
|2007-07-14<br />
|Zero X. Diamond<br />
|Keen 4<br />
|1<br />
|3rd place in the [http://keenmodding.org/viewtopic.php?t=924 Keen 4 minimod contest]<br />
|-<br />
|}<br />
<br />
<br />
= Level Packs =<br />
<br />
In contrast to mods, level packs do only change level designs and arrangements. Generally other alterations of content stay untouched though there might be some little exceptions.<br />
<br />
== Full Level Packs ==<br />
{|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" style="font-size: 90%; border:1px solid gray; border-collapse: collapse; text-align: center; width: 100%;"<br />
|- style="background: #ececec"<br />
! Title<br />
! Download<br />
! Release date<br />
! Modder(s)<br />
! Pack for<br />
! # of levels<br />
! Notes<br />
|-<br />
|[[Buried in Oblivion]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.nisaba.buried_in_oblivion_v.1.4.k4.2020-10-10.zip full v1.4]<br />
|2020-10-10<br />
|[[User:Nisaba|Nisaba]] et al.<br />
|Keen 4<br />
|18<br />
|[https://pckf.com/viewtopic.php?f=4&t=3936 Discussion]. Community Pack: Level designs by multiple creators.<br />
|-<br />
|[[The Dead in the Desert Community Levelpack]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen6/m.keen_community.dead_in_the_desert.k6.2011-12-25.zip full]<br />
|2011-12-25<br />
|Keen Community<br />
|Keen 8<br />
|20<br />
|[https://pckf.com/viewtopic.php?t=2186 Discussion]<br />
|-<br />
|[[Fleex & Markeen's Keen 5 Level Pack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.fleex_&_markeen%27s_keen_5_level_pack_v.1.1.k5.2022-03-14.zip full]<br />
|2022-01-01<br />
|[[User:Fleexy|Fleexy]] & Markeen<br />
|Keen 5<br />
|13<br />
|Level maps were randomly generated by the tool [[Markeen]]. [https://pckf.com/viewtopic.php?t=12694 Discussion]<br />
|-<br />
|[[Keen_5.5|Keen 5½ ]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.ck_guy.k5.2007-11-18.zip full v5]<br />
|2007-11-18<br />
|[[User:CK Guy|CK Guy]]<br />
|Keen 5<br />
|9<br />
|[https://pckf.com/viewtopic.php?t=24 Discussion]<br />
|-<br />
|[[Keen Asylum]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.dr_witherstone.k5.2003-11-13.zip full]<br />
|2003-11-13<br />
|Br1ck, Dr.&nbsp;Witherstone<br />
|Keen 5<br />
|14<br />
|[http://web.archive.org/web/20040329072306/http://cosmicoding.com/Keendom/?BaseType=Articles:Review&QString1=keen%20asylum.asp Website] [http://archive.shikadi.net/pckf/other/779.htm Discussion]<br />
|-<br />
|[[Keen Fifteen: Hello Galaxy!]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.zeus.k5.2012-03-13.zip beta]<br />
|2012-03-13<br />
|Zeus<br />
|Keen 5<br />
|13<br />
|[https://pckf.com/viewtopic.php?t=2302 Discussion]<br />
|-<br />
|[[Keen 4 Ultimate Edition]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.szemigi.keen_4_ultimate_edition.k4.2019-10-01.zip full]<br />
|2019-10-01<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 4<br />
|24<br />
|[https://pckf.com/viewtopic.php?f=4&t=5412 Release Thread]<br />
|-<br />
|[[MrBlackPack v4]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.mrblack.k4.2012-04-18.zip beta]<br />
|2012-04-18<br />
|[[User:MrBlack|MrBlack]]<br />
|Keen 4<br />
|15<br />
|[https://pckf.com/viewtopic.php?t=2369 Discussion]<br />
|-<br />
|[[The Rapid Pack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen6/l.shikadi.k6.2009-02-18.zip full v4]<br />
|2009-02-18<br />
|[[User:shikadi|Shikadi]]<br />
|Keen 6<br />
|12<br />
|[https://keenmodding.org/viewtopic.php?t=1084 Discussion]<br />
|-<br />
|[[Short Circuit Oracle]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.55aavenue.short_circuit_oracle_v1.5.k4.2019-12-22.zip full]<br />
|2018-06-18<br />
|55Aavenue<br />
|Keen 4<br />
|19<br />
|[https://pckf.com/viewtopic.php?f=4&t=4346 Discussion]<br />
|-<br />
|[[The Sunnylands]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.quillax.sunnylands.k4.2018-03-14.zip full]<br />
|2018-03-14<br />
|[[User:Quinton|Quillax]]<br />
|Keen 4<br />
|19<br />
|[http://quillaxship.com/game_detail.php?ID=10 Website] [https://pckf.com/viewtopic.php?f=4&t=4271 Discussion]<br />
|-<br />
|[[Twenty To]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.dr_witherstone.k5.2005-06-07.zip full]<br />
|2005-06-07<br />
|Dr. Witherstone<br />
|Keen 5<br />
|7<br />
|[https://www.tapatalk.com/groups/publiccommanderkeenforum/cool-new-keen-5-levels-t854.html Discussion]<br />
|-<br />
|[[The Ultra Omegamatic]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.darkale.the_ultra_omegamatic_v2.0.k5.2020-09-08.zip full v2.0]<br />
|2020-09-08<br />
|[[User:DarkAle|DarkAle]]<br />
|Keen 5<br />
|23<br />
|[https://pckf.com/viewtopic.php?f=4&t=6802 Release Thread]<br />
|}<br />
<br />
== Unfinished / abandoned Level Packs ==<br />
This topic contains unfinished, abandoned, or level packs with only a few altered levels (see the notes).<br />
{|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" style="font-size: 90%; border:1px solid gray; border-collapse: collapse; text-align: center; width: 100%;"<br />
|- style="background: #ececec"<br />
! Title<br />
! Download<br />
! Release date<br />
! Modder(s)<br />
! Pack for<br />
! # of levels<br />
! Notes<br />
|-<br />
|[[Br1ck's Keen 5 Level]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.br1ck.k5.2003-04-10.zip full]<br />
|2003-04-10<br />
|Br1ck, Dr.&nbsp;Witherstone<br />
|Keen 5<br />
|1<br />
|The first level has been replaced by level 11. [http://archive.shikadi.net/pckf/other/654.htm Discussion]<br />
|-<br />
|[[BwB Megarocket Keen 5]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.szemigi.bwb_megarocket_keen_5.k5.2013-11-28.zip full]<br />
|2013-11-28<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 5<br />
|1<br />
|Level 14, the missing BWB Megarocket level. [https://pckf.com/viewtopic.php?t=2933 Thread]<br />
|-<br />
|[[ChargingMoose's 2nd Levelpack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.chargingmoose.k4.2002-07-16.zip full]<br />
|2002-07-16<br />
|ChargingMoose<br />
|Keen 4<br />
|7<br />
|[http://archive.shikadi.net/pckf/official/378.htm Discussion]<br />
|-<br />
<!--<br />
|[[Fire Station]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.quirky_moron.k5.2004-02-15.zip alpha]<br />
|2004-02-15<br />
|Quirky Moron<br />
|Keen 5<br />
|1<br />
|[http://keenmodding.org/viewtopic.php?f=13&t=199 Discussion]<br />
|-<br />
--><br />
|[[Funny]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.dr_witherstone.k5.2003-12-07.zip full]<br />
|2003-12-07<br />
|Dr. Witherstone<br />
|Keen 5<br />
|4<br />
|<br />
|-<br />
|[[Gridlock's Dead in the Desert Levelpack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/ModPacks/l.gridlock.dead_in_the_desert.2011-02-11.zip beta]<br />
|2011-02-11<br />
|[[User:Gridlock|Gridlock]]<br />
|Keen 8<br />
|1.5<br />
|[https://pckf.com/viewtopic.php?t=1827 Discussion]. Abandoned.<br />
|-<br />
|[[Gridlock's Keen 4 Levelpack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.gridlock.k4.2011-02-11.zip beta]<br />
|2011-02-11<br />
|[[User:Gridlock|Gridlock]]<br />
|Keen 4<br />
|8<br />
|[https://pckf.com/viewtopic.php?t=1827 Discussion]. Abandoned.<br />
|-<br />
|[[KeenMark 4]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.the_candyjunk.k4.2003-12-09.zip beta]<br />
|2003-12-09<br />
|The Candyjunk<br />
|Keen 4<br />
|4<br />
|Released in a pack with Keen 5 levels. [http://archive.shikadi.net/pckf/official/574.htm Discussion]<br />
|-<br />
|[[KeenMark 5]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.the_candyjunk.k5.2003-12-09.zip beta]<br />
|2003-12-09<br />
|The Candyjunk<br />
|Keen 5<br />
|4<br />
|Released in a pack with Keen 4 levels. [http://archive.shikadi.net/pckf/official/574.htm Discussion]<br />
|-<br />
|[[New QED]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.grelphy.k5.2003-06-27.zip full]<br />
|2003-06-27<br />
|Grelphy<br />
|Keen 5<br />
|1<br />
|[http://web.archive.org/web/20050905025440/http://grelphy.spatang.com/levels/index.html Website]<br />
|-<br />
|[[PCKF Keen 6 Patchwork LevelPair]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen6/l.keen_community.k6.2014-03-07.zip full]<br />
|2014-03-07<br />
|Keen Community<br />
|Keen 6<br />
|2<br />
|[https://pckf.com/viewtopic.php?t=2736 Discussion] [https://pckf.com/viewtopic.php?t=3014 Release]<br />
|-<br />
<!--<br />
|[[Quirky Moron's Keen 4 Levelpack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.quirky_moron.k4.2004-02-03.zip full]<br />
|2004-02-03<br />
|Quirky Moron<br />
|Keen 4<br />
|2<br />
|[http://keenmodding.org/viewtopic.php?f=13&t=108 Discussion]<br />
|-<br />
--><br />
|[[The Pyramid of the Allowed]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.szemigi.the_pyramid_of_the_allowed.k4.2012-11-03.zip full]<br />
|2012-11-03<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 4<br />
|1<br />
|The opposite of the Pyramid of the Forbidden. [https://pckf.com/viewtopic.php?t=2545 Release Thread]<br />
|-<br />
|[[SupFanat's Keen 4 Level Pack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.supfanat.k4.2006-01-10.zip full]<br />
|2006-01-10<br />
|SupFanat<br />
|Keen 4<br />
|3<br />
|Released in a pack with Keen 5 and 6 levels. [https://www.tapatalk.com/groups/publiccommanderkeenforum/10-new-levels-for-keen-4-6-t464.html Discussion]<br />
|-<br />
|[[SupFanat's Keen 5 Level Pack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.supfanat.k5.2006-01-10.zip full]<br />
|2006-01-10<br />
|SupFanat<br />
|Keen 5<br />
|5<br />
|Released in a pack with Keen 4 and 6 levels. [https://www.tapatalk.com/groups/publiccommanderkeenforum/10-new-levels-for-keen-4-6-t464.html Discussion]<br />
|-<br />
|[[SupFanat's Keen 6 Level Pack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen6/l.supfanat.k6.2006-01-10.zip full]<br />
|2006-01-10<br />
|SupFanat<br />
|Keen 6<br />
|3<br />
|Released in a pack with Keen 4 and 5 levels. [https://www.tapatalk.com/groups/publiccommanderkeenforum/10-new-levels-for-keen-4-6-t464.html Discussion]<br />
|-<br />
|[[The Unknown Pyramid]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.the_shifted_one.k4.2009-02-14.zip full]<br />
|2009-02-14<br />
|The Shifted One<br />
|Keen 4<br />
|1<br />
|[http://keenmodding.org/viewtopic.php?f=12&t=1119 Discussion]<br />
|}<br />
<br />
<br />
= Skin Mods =<br />
<br />
Skin Mods only change the look and feel of characters or tile-sets. But in contrast to level packs or mods, the original level designs stay untouched. <br />
<br />
[[Translations]] can be found on a separate page.<br />
<br />
{|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" style="font-size: 90%; border:1px solid gray; border-collapse: collapse; text-align: center; width: 100%;"<br />
|- style="background: #ececec"<br />
! Title<br />
! Download<br />
! Release date<br />
! Modder(s)<br />
! Mod for<br />
! Notes<br />
|-<br />
|[[Attack of the Silurians]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.stupidbunny.attack_of_the_silurians.k4.2012-03-16.zip demo]<br />
|2012-03-16<br />
|[[User:StupidBunny|StupidBunny]]<br />
|Keen 4<br />
|Abandoned. [https://pckf.com/viewtopic.php?t=2320 Release Thread] all enemies sprites replaced<br />
|-<br />
|[[DasBrot's First Mod]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.dasbrot.dasbrots_first_mod.k4.2004-11-30.zip demo]<br />
|2004-11-30<br />
|DasBrot<br />
|Keen 4<br />
|Original Keen 4 levels, edited monster graphics<br />
|- <!--<br />
|[[Mortimer McMire - The Armageddon Machine]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.szemigi.mortimer_mcmire_-_the_armageddon_machine.k5.2010-08-29.zip full]<br />
|2010-08-29<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 5<br />
|The Keen sprite is replaced by the Mortimer McMire sprite<br />
|-<br />
|[[Mortimer McMire - Aliens Ate My Babysitter]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen6/m.szemigi.mortimer_mcmire_-_aliens_ate_my_babysitter.k6.2010-08-02.zip full]<br />
|2010-08-02<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 6<br />
|The Keen sprite is replaced by the Mortimer McMire sprite<br />
|- --><br />
|[[Trouble on Xion 2]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.dasbrot.trouble_on_xion_2.k4.2004-12-05.zip beta]<br />
|2004-12-05<br />
|DasBrot<br />
|Keen 4<br />
|Original Keen 4 levels, new graphics and story<br />
|}<br />
<br />
<!--= Improvement Mods =<br />
This section has mods, which contains updates in connection with bugfixes, improvements. <br />
{|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" style="font-size: 90%; border:1px solid gray; border-collapse: collapse; text-align: center; width: 100%;"<br />
|- style="background: #ececec"<br />
! Title<br />
! Download<br />
! Release date<br />
! Modder(s)<br />
! Mod of<br />
! Notes<br />
|-<br />
|[[Version 1.6]]<br />
|[https://www.dropbox.com/s/8tpewlkp74s56tb/CK6v16.zip?dl=0 full]<br />
|2019-01-31<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 6<br />
|An unofficial bugfix patch mod to Keen 6<br />
|}--><br />
<br />
= See Also =<br />
*[[Vorticon Mods]]<br />
<br />
[[Category:Mods| ]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=User:Ceilick&diff=46357User:Ceilick2022-12-26T14:35:47Z<p>Ceilick: removing OSI from current projects</p>
<hr />
<div>'''Ceilick''' is an active keener and one of the administrators of the [https://pckf.com/index.php Public Commander Keen Forum] and the [http://www.keenmodding.org/ Keen:Modding forum]. He has created a number of Keen Vorticons mods and is the mastermind behind the unofficial [[The_Universe_Is_Toast_(MOD_Trilogy)|The Universe is Toast]] galaxy mod series. He has contributed significantly to the multiplayer [[Netkeen]], as well as a variety of other fangame and modding projects.<br />
<br />
<span style="font-size:150%">'''Upcoming Mod Projects'''</span><br />
<br />
'''[[Aliens and Their Just Desserts]]'''<br />
<br />
Episode 3 of a source mod trilogy in which Keen returns to the familiar setting of Fribbulus Xax! Featuring an all new story, levels, an expanded cast of Keen 6 enemies, and other graphical additions to the Keen 6 tile set.<br />
<br />
'''[[Sign of the Vool]]'''<br />
<br />
A source mod, standalone episode in which Keen must face the sinister Vool on the dreaded planet Yuggossus.<br />
<br />
<span style="font-size:150%">'''Keen Vorticons Mods'''</span><br />
<br />
'''Invasion of the Yorps'''<br />
<br />
In this series Commander Keen must stop the brainwashed Yorps from causing havoc across the galaxy!<br />
<br />
*[[Crash on Gobo III]] (2002)<br />
*[[Planet Destruction]] (2003)<br />
*[[Tribulation of the Yorps]] (abandoned by Ceilick in 2003, completed by [[User:Tulip|Tulip]] and others in 2009)<br />
<br />
'''Decree of the Skree'''<br />
<br />
In this series Commander Keen must stop an evil threat which involves the Gargs, the Shikadi, and a new alien race, the Skree!<br />
<br />
*[[Kidnapped Keen]] (2004)<br />
*[[Zapping the Zot]] (2004)<br />
*[[Return of the Guardians]] (2005)<br />
<br />
'''The Adventures of the Oracle Janitor'''<br />
<br />
This comedic, one-level mod series sees the player as the Oracle Janitor on his hilarious missions to rescue Commander Keen from peril!<br />
<br />
*[[The Adventures of The Oracle Janitor]] (2005)<br />
*[[Oracle_Janitor_2|Mystery of the Monastery]] (2005)<br />
*[[Oracle Janitor 3|Space Pirate Trouble]] (2005)<br />
<br />
'''Standalone Episodes'''<br />
*[[The Perilous Pursuit]] is an out of this world chase in which Commander Keen pursues Mortimer across a mysterious planet! (2005)<br />
*[[Story Land]] is a fairy tail adventure in which Commander Keen must rescue a princess from the evil wizard Merlock! (2005)<br />
*[[Episode Z]] is a sequel to [[Episode X]] by [[User:XkyRauh|Xky Rauh]] and [[Episode Y]] by Grelphy, concluding an exciting interpretation of The Universe is Toast! (2009)<br />
*[[Shadow Jack]] is an alpha demo in which the protagonist Shadow Jack must navigate the realm of darkness. (2014)<br />
*[[Ye Olde Pirate Modde]] is a nautical quest featuring treasure hunting and Voticon pirate swashbuckling! (abandoned by Ceilick in 2012, completed by [[User:Levellass|Levellass]] in 2013)<br />
<br />
<span style="font-size:150%">'''Keen Dreams Mods'''</span><br />
*[[Commander Keen Xmas 2010]] features Commander Keen in a dream like quest to save Christmas from the evil Bad Elf! (2011) (Co-authored with [[User:Levellass|Levellass]] and [[User:Szemigi|Szemi]])<br />
*[[Keen Dreams Plus]] is an enhanced version of Keen Dreams, telling the same story but featuring new enemies, levels, and more! (2011)<br />
<br />
<span style="font-size:150%">'''Keen Galaxy Mods'''</span><br />
<br />
'''The Unofficial The Universe is Toast'''<br />
<br />
In this cosmic trilogy Commander Keen battles his nemesis Mortimer McMire over the fate of the universe!<br />
<br />
*[[The Keys of Krodacia]] (2006)<br />
*[[Dead in the Desert]] (2009)<br />
*[[Battle of the Brains]] (2011) (Co-Authored with [[User:Mink|Mink]] and [[User:Tulip|Tulip]])<br />
<br />
<span style="font-size:150%">'''Keen Galaxy Source Mods'''</span><br />
<br />
'''The New Adventures of Commander Keen'''<br />
<br />
In this nostalgic trilogy Commander Keen revisits Gnosticus IV, a Shikadi space station, and Fribbulus Xax on a quest to rescue his pet Yorp!<br />
<br />
*[[Return to the Shadowlands]] (2021)<br />
*[[Operation Station Infiltration]] (2022)<br />
*[[Aliens and Their Just Desserts]] (TBD)<br />
<br />
<span style="font-size:150%">'''Other Projects'''</span><br />
*[[Netkeen]] is a fangame in which 2-4 players go head to head in stunning multiplayer action! (2011) (A project by [[User:Lemm|Lemm]] in which Ceilick provided graphics, levels, multi-episode support, and general assistance in testing and content management)<br />
*[[Keen Crisis Earth]] is an abandoned Bio Menace mod featuring an adult Commander Keen battling an alien invasion! (2012) (Co-Authored with [[User:Paramultart|Paramultart]] and NY00123)<br />
<br />
<span style="font-size:150%">'''Articles and Tutorials'''</span><br />
*Ceilick began the [[Keen Galaxy Modding Tutorial (patch based)]] in 2011 as a guide to modding for complete beginners. It has seen various updates over the years, most recently in 2022. In the advent of source code based Keen modding, it remains a valuable first course which teaches modding and tool fundamentals that can be carried forward to source based projects.<br />
<br />
*Ceilick and [[User:Nisaba|Nisaba]] began the [[Keen Galaxy Modding Tutorial (source code based)]] in 2021 as a guide for advanced modders wishing to utilize [[User:Lemm|Lemm's]] [[Keen:Galaxy Source Modding Package]] or similar Keen Galaxy source code recreations. <br />
<br />
<br />
<br />
<br />
== My Mods ==<br />
<br />
{{MyMods}}</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Operation_Station_Infiltration&diff=46356Operation Station Infiltration2022-12-26T14:22:28Z<p>Ceilick: fixed version number</p>
<hr />
<div>{{Mod Infobox<br />
| Episode = 5<br />
| Authors = [[User:Ceilick|Ceilick]]<br />
| Status = Complete<br />
| ReleaseDate = 2022-12-25<br />
| LatestUpdate = 2022-12-25<br />
| Discussion = [https://pckf.com/viewtopic.php?t=15448 PCKF]<br />
| Homepage = <br />
| Levels = 19 <br />
| SecretLevels = 1<br />
| NewGameplay = No<br />
| NewGfx = Some<br />
| NewLevels = Yes<br />
| NewSfx = Yes<br />
| NewMusic = Yes<br />
| LatestDownloadURL = https://files.shikadi.net/keenwiki/Packs/SourceCode/l.ceilick.operation_station_infiltration_v1.0.2022-12-25.zip<br />
| LatestVersion = v.1.0<br />
| Download = [https://files.shikadi.net/keenwiki/Packs/SourceCode/l.ceilick.operation_station_infiltration_v1.0.2022-12-25.zip source code]<br />
| Series = [[Return to the Shadowlands]]<!-- , <br>[[Aliens and their Just Desserts]] --><br />
}}<br />
<br />
'''Operation Station Infiltration''' is a source mod by [[User:Ceilick|Ceilick]] and programmed by [[User:Multimania|Multimania]]. It is the second episode in a trilogy of levelpack style mods utilizing mostly the original graphics from Keens 4-6. Enjoy the nostalgic [[Keen 5]] setting as you join Commander Keen on a mission that takes him aboard an [[Omegamatic]]-like space station.<br />
<br />
==Story==<br />
After learning that the [[Bloog|Bloogs]] are responsible for the kidnapping of his pet Yorp [[Spot]], Commander Keen sets course for [[Fribbulus Xax]]. However, the planet is protected by the [[Shikadi|Shikadi's]] space station the Omegamatrix! Keen must disable the station in order to reach the planet.<br />
<br />
<br />
==Levels==<br />
{{ModLevelList}}<br />
<br />
== Technical Information ==<br />
<br />
*Utilities used: [[Abiathar]], [[KeenScr]], [[IMFCrush]], [[MIDI2IMF]], [[uGrab]], [[Wolf_Data_Compiler_(WDC)|WDC]]<br />
<br />
==Credits==<br />
<br />
* Creator: [[User:Ceilick|Ceilick]]<br />
* Programming: [[User:Multimania|Multimania]]<br />
* Music: [[User:XkyRauh|Xky Rauh]]<br />
* Sound Effects: [[User:Ceilick|Ceilick]]<br />
* Graphics: [[User:Ceilick|Ceilick]], [[User:Gridlock|Gridlock]], [[User:Nisaba|Nisaba]], [[User:XkyRauh|Xky Rauh]], 55Aavenue<br />
* Level Design: [[User:Ceilick|Ceilick]]<br />
* Story: [[User:Ceilick|Ceilick]]<br />
* Testing: [[User:Multimania|Multimania]], [[User:Roobar|Roobar]]<br />
<br />
* Special Thanks: [[User:Fleexy|Fleexy]], [[User:Multimania|Multimania]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Return_to_the_Shadowlands&diff=46355Return to the Shadowlands2022-12-26T14:21:38Z<p>Ceilick: adding series episode</p>
<hr />
<div>{{Mod Infobox<br />
| Episode = 4<br />
| Authors = [[User:Ceilick|Ceilick]]<br />
| Status = Complete<br />
| ReleaseDate = 2021-06-06<br />
| LatestUpdate = 2022-12-21<br />
| Discussion = [https://pckf.com/viewtopic.php?f=4&t=11095 PCKF]<br />
| Homepage = <br />
| Levels = 20 <br />
| SecretLevels = 1<br />
| NewGameplay = No<br />
| NewGfx = Some<br />
| NewLevels = Yes<br />
| NewSfx = Yes<br />
| NewMusic = Yes<br />
| LatestDownloadURL = https://files.shikadi.net/keenwiki/Packs/SourceCode/l.ceilick.return_to_the_shadowlands_v1.8.sc.2022-12-21.zip<br />
| LatestVersion = v.1.8<br />
| Download = [https://files.shikadi.net/keenwiki/Packs/SourceCode/l.ceilick.return_to_the_shadowlands_source_code_v1.8.sc.2022-12-21.zip source code] <br> [https://files.shikadi.net/keenwiki/Packs/SourceCode/l.ceilick.return_to_the_shadowlands_v1.6.sc.2021-06-06.zip v.1.6]<br />
| Series = [[Operation Station Infiltration]]<!-- , <br>[[Aliens and their Just Desserts]] --><br />
}}<br />
<br />
'''Return to the Shadowlands''' is a source mod by [[User:Ceilick|Ceilick]] and programmed by [[User:K1n9_Duk3|K1n9_Duk3]]. It is the first episode in a trilogy of levelpack style mods utilizing mostly the original graphics from Keens 4-6. Enjoy the nostalgic [[Keen 4]] setting as you join Commander Keen on a mission that takes him back to [[Gnosticus IV]] and the [[Shadowlands]].<br />
<br />
==Story==<br />
While working in his clubhouse Billy hears a loud noise from the yard and decides to investigate. Someone has kidnapped his pet Yorp, Spot! Rushing to Gnosticus IV Keen hopes to use the Oracle to find out who took his beloved pet. But the Oracle Council seems to have other plans for our hero...<br />
<br />
==Levels==<br />
{{ModLevelList}}<br />
<br />
== Technical Information ==<br />
<br />
*Utilities used: [[Abiathar]], Borland C++ Compiler, [[KeenScr]], [[IMFCrush]], [[MIDI2IMF]], [[uGrab]], [[Wolf_Data_Compiler_(WDC)|WDC]]<br />
<br />
==Credits==<br />
<br />
* Creator: [[User:Ceilick|Ceilick]]<br />
* Programming: [[User:K1n9_Duk3|K1n9_Duk3]]<br />
* Music: Robert Prince, [[User:XkyRauh|Xky Rauh]]<br />
* Sound Effects: [[User:Ceilick|Ceilick]]<br />
* Graphics: [[User:Ceilick|Ceilick]], [[User:Nisaba|Nisaba]], 55Aavenue<br />
* Level Design: [[User:Ceilick|Ceilick]]<br />
* Story: [[User:Ceilick|Ceilick]]<br />
* Testing: [[User:K1n9_Duk3|K1n9_Duk3]], [[User:Roobar|Roobar]]<br />
<br />
* Special Thanks: [[User:K1n9_Duk3|K1n9_Duk3]], [[User:Nisaba|Nisaba]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Operation_Station_Infiltration&diff=46354Operation Station Infiltration2022-12-26T14:20:17Z<p>Ceilick: basic page info</p>
<hr />
<div>{{Mod Infobox<br />
| Episode = 5<br />
| Authors = [[User:Ceilick|Ceilick]]<br />
| Status = Complete<br />
| ReleaseDate = 2022-12-25<br />
| LatestUpdate = 2022-12-25<br />
| Discussion = [https://pckf.com/viewtopic.php?t=15448 PCKF]<br />
| Homepage = <br />
| Levels = 19 <br />
| SecretLevels = 1<br />
| NewGameplay = No<br />
| NewGfx = Some<br />
| NewLevels = Yes<br />
| NewSfx = Yes<br />
| NewMusic = Yes<br />
| LatestDownloadURL = https://files.shikadi.net/keenwiki/Packs/SourceCode/l.ceilick.operation_station_infiltration_v1.0.2022-12-25.zip<br />
| LatestVersion = v.1.8<br />
| Download = [https://files.shikadi.net/keenwiki/Packs/SourceCode/l.ceilick.operation_station_infiltration_v1.0.2022-12-25.zip source code]<br />
| Series = [[Return to the Shadowlands]]<!-- , <br>[[Aliens and their Just Desserts]] --><br />
}}<br />
<br />
'''Operation Station Infiltration''' is a source mod by [[User:Ceilick|Ceilick]] and programmed by [[User:Multimania|Multimania]]. It is the second episode in a trilogy of levelpack style mods utilizing mostly the original graphics from Keens 4-6. Enjoy the nostalgic [[Keen 5]] setting as you join Commander Keen on a mission that takes him aboard an [[Omegamatic]]-like space station.<br />
<br />
==Story==<br />
After learning that the [[Bloog|Bloogs]] are responsible for the kidnapping of his pet Yorp [[Spot]], Commander Keen sets course for [[Fribbulus Xax]]. However, the planet is protected by the [[Shikadi|Shikadi's]] space station the Omegamatrix! Keen must disable the station in order to reach the planet.<br />
<br />
<br />
==Levels==<br />
{{ModLevelList}}<br />
<br />
== Technical Information ==<br />
<br />
*Utilities used: [[Abiathar]], [[KeenScr]], [[IMFCrush]], [[MIDI2IMF]], [[uGrab]], [[Wolf_Data_Compiler_(WDC)|WDC]]<br />
<br />
==Credits==<br />
<br />
* Creator: [[User:Ceilick|Ceilick]]<br />
* Programming: [[User:Multimania|Multimania]]<br />
* Music: [[User:XkyRauh|Xky Rauh]]<br />
* Sound Effects: [[User:Ceilick|Ceilick]]<br />
* Graphics: [[User:Ceilick|Ceilick]], [[User:Gridlock|Gridlock]], [[User:Nisaba|Nisaba]], [[User:XkyRauh|Xky Rauh]], 55Aavenue<br />
* Level Design: [[User:Ceilick|Ceilick]]<br />
* Story: [[User:Ceilick|Ceilick]]<br />
* Testing: [[User:Multimania|Multimania]], [[User:Roobar|Roobar]]<br />
<br />
* Special Thanks: [[User:Fleexy|Fleexy]], [[User:Multimania|Multimania]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_6:_Aliens_Ate_My_Baby_Sitter!&diff=46348Keen 6: Aliens Ate My Baby Sitter!2022-12-21T15:43:30Z<p>Ceilick: Removed spoilers and speculation, formatted similar to other Galaxy episodes.</p>
<hr />
<div>{{Game Infobox<br />
| Episode = 6<br />
| ReleaseDate = November, 1991<br />
| Levels = 18<br />
| SecretLevels = 1<br />
| Distribution = Commercial<br />
<br />
<!--<br />
Do not add download links for Keen 6, it is illegal to download it without purchasing it.<br />
Feel free to add links to any online stores selling it though. (But not eBay or other<br />
links that will expire quickly.)<br />
--><br />
| Download = ''Not available for purchase''<br>[ftp://ftp.3drealms.com/share/k6_demo.zip Demo (v1.0)]<br />
| Prev = [[Keen 5: The Armageddon Machine|Keen 5]]<br />
| Next = [[Commander Keen (Game Boy Color game)|Keen GBC]]<br />
}}<br />
<br />
'''Keen 6: Aliens Ate My Baby Sitter!''' takes place some time after ''"[[Goodbye, Galaxy!]]"''. In this episode, Keen must rescue his baby sitter [[Molly McMire|Molly]] from the hungry [[Bloog]]s of [[Fribbulus Xax]]. <br />
<br />
Due to complications over distribution rights, the game is no longer available for purchase except for used copies through secondhand sales. <br />
<br />
{{EpisodeInfo<br />
| Episode = 6<br />
| ImgGame = Bloog.png<br />
| ImgFun = Stupendous_Sandwich_of_Chungella_IV.png<br />
| ImgBeyond = Cactoid.png<br />
| Music = Yes<br />
}}<br />
<br />
== Official media ==<br />
<br />
* Keen 6 [https://files.shikadi.net/keenwiki/documents/keen6_manual.pdf user manual] (PDF, 2.8 MB)</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=The_Land_of_Tuberia&diff=46337The Land of Tuberia2022-12-19T01:25:32Z<p>Ceilick: Adding the five named sub areas of Tuberia, which can be found in the Keen Dreams manual. Removing some of what appears to be fan speculation. Needs more work.</p>
<hr />
<div>[[Image:Ckdlv80.png|thumb|The Land of Tuberia as seen in Keen Dreams]]<br />
<br />
'''The Land of Tuberia''' is the main level map for [[Keen Dreams]]. This is where Keen awakes when he falls asleep at the start of [[Keen Dreams]]. It is ruled over by [[King Boobus Tuber]] and his army of [[Tater Trooper]]s which carry out his commands. This is also where Tuberia gets its name from. There are five named areas found in Tuberia:<br />
<br />
* Kumquat Chasm, which includes: [[Bridge Bottoms]], [[Parsnip Pass]], and [[Rhubarb Rapids]]<br />
* Fruity Forest, which includes: [[Apple Acres]] and [[Grape Grove]]<br />
* Lettuce Lake, which includes: [[Brussels Sprout Bay]] and [[Squash Swamp]]<br />
* Mount Tuberest, which includes: [[Castle Tuberia]] and [[Boobus' Chamber]]<br />
* Potato Point, which includes [[Spud City]]<br />
<br />
There is no named area associated with [[Horseradish Hill]] and [[The Melon Mines]].<br />
<br />
There are also four small [[Level 6|secret levels]] that cannot be reached from the map. (Or without cheating.)<br />
<br />
The Land of Tuberia itself exists only in a dream dimension, to reach it one has to be dreaming and brought to Tuberia itself by some means. Keen (and many other children) were kidnapped using the [[Dream Machine]], then enslaved. The Dream Machine may be the only thing keeping children in Tuberia, as when it is deactivated, Keen (and presumably all the other children) fall asleep and subsequently awake on [[Earth]].<br />
<br />
Tuberia is a temperate place. It consists of rivers, lakes, streams, forests and fields. The forests appear quite friendly, with [[Waving Tree|trees often waving]] at Keen on the map.<br />
<br />
It is possible that nobody can die in Tuberia as anyone injured falls asleep. It is possible they will simply reawaken, or go back to Earth. King Boobus Tuber however is most definitely killed eventually. Tuberia seems to "float" in the sky, having a definite edge, and thus likely being flat like the world was once imagined to be.<br />
<br />
== See also ==<br />
<br />
* [[Tuberians]] – the native inhabitants of Tuberia<br />
<br />
[[Category:Keen Dreams]]<br />
[[Category:Keen Dreams levels]]<br />
[[Category:Locations]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(source_code_based)&diff=46323Keen Galaxy Modding Tutorial (source code based)2022-11-14T17:30:52Z<p>Ceilick: /* Adding Additional Graphics and Text Files */ how to add aditional tiles</p>
<hr />
<div>{{Alert|'''This page is still under construction!'''}}<br />
<br />
This tutorial aims to teach [[Keen:Galaxy Source Modding Package|Keen:Galaxy Source Mod]] modding in terms of what is different from modding without source code. It will primarily cover tool usage and the new options provided by the supplied source code package and its modification. Creating a full source mod requires some basic coding knowledge that this tutorial will not cover, but it will explain where and what needs to be coded and provide limited code examples for common tasks and features. <br />
<br />
For general, introductory Keen Galaxy modding information not covered here, please consult the [[Keen Galaxy Modding Tutorial (patch based)|patch based Keen Galaxy Modding Tutorial]]. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft</tt> <tt>Windows</tt> s based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Downlad the core [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen:Galaxy Source Modding Package]. This bundle contains a source code package with a number of pre-setup tools and files. Make sure to extract all files and keep the pre-defined folder structure. To facilitate modding, this package contains all resources present in their decompressed format.<br />
<br />
== Tools ==<br />
<br />
This is the complete list of tools used for source modding:<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|''Version 2.11.4 Beta 1 or higher is required'' <br />
|-<br />
|[[Borland C++ Compiler]]<br />
|Source Code Compiler <br />
|''Borland 3.1 is used to compile the code; a Borland 3.1 project file ([[SRCMOD.PRJ]]) has been included for this purpose. Borland compilers can be invoked in a 16-bit DOS environment (e.g., DOSBox v0.74 has been successfully used).''<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro Graphic Text Editor <br />
|<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.''<br />
|-<br />
|[[TliExtend]]<br />
|Tileinfo Extension <br />
|''This tool is a command line based tileinfo extension utility for Abiathar.''<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|''Functions as an <tt>EGAGRAPH.CKS</tt> editor. Two batch files are included for easy import and export of graphics.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.''<br />
|<br />
|}<br />
<br />
== Modding Package ==<br />
<br />
The modding package contains, amongst others, the following folders:<br />
<br />
=== Base Folder Name ===<br />
<br />
This folder contains the following files:<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|audio.asnds<br />
|Abiathar definition file for audio.<br />
|''This can be modified in a text editor for adding additional music and sound effects to AUDIOHED.CKS.''<br />
|-<br />
|AUDIOHED.CKS<br />
|Container file for audio chunks/files.<br />
|<br />
|-<br />
|AUDIOT.CKS<br />
|Audio location pointers for AUDIOHED.CKS.<br />
|<br />
|-<br />
|ega.def<br />
|UGrab definition file for graphics and text. <br />
|''This can be modified in a text editor for adding additional graphics and texts to EGAGRAPH.CKS.''<br />
|-<br />
|EGAGRAPH.CKS<br />
|Container file for graphics and text chunks/files.<br />
|<br />
|-<br />
|EGAHEAD.CKS<br />
|Graphics and text location pointers for EGAGRAPH.CKS.<br />
|<br />
|-<br />
|EGAINFO.BMP<br />
|Graphic for infoplane.<br />
|<br />
|-<br />
|ega-in.bat<br />
|Batch script to import graphics and text.<br />
|<br />
|-<br />
|ega-out.bat<br />
|Batch script to export graphics and text.<br />
|<br />
|-<br />
|MAPHEAD.CKS<br />
|Container file which stores levels.<br />
|<br />
|-<br />
|maps.adep<br />
|Abiathar definition file for levels.<br />
|<br />
|-<br />
|MAPTEMP.CKS<br />
|Level location pointers for MAPHEAD.CKS and tile properties.<br />
|<br />
|-<br />
|SRCMOD.EXE<br />
|Game executable. <br />
|<br />
|}<br />
<br />
=== AUDIO ===<br />
<br />
This folder contains the music and sound effect files in their decompressed format. Compressed, these are stored in the <tt>AUDIOT.CKS</tt> container file.<br />
<br />
=== EGA ===<br />
<br />
This folder contains mainly graphic and text files in their decompressed format. Compressed, these are stored in the <tt>EGAGRAPH.CKS</tt> container file. <br />
<br />
=== SOURCE ===<br />
<br />
This folder contains everything source code related written in the high-level language <tt>C/C++</tt>. <tt>SRCMOD.EXE</tt> is the compiled executable.<br />
<br />
= Engine Information = <br />
<br />
In contrast to classic modding via patches, working with the source code allows much more freedom. Nevertheless, there are some limitations that must be taken into account.<br />
<br />
For several reasons DOS only allows a maximum amount of 640KiB of memory available to programs. Therefore DOS (and maybe some drivers) as well as the game program and most of the game data (levels, music, graphics) must fit into these 640KiB.<br />
<br />
The game engine organizes certain segments into memory blocks with an upper limit of 64KiB. This means that the number of music tracks, sprites and tiles is limited to a certain degree. Realistically music and levels are the only parts (besides, perhaps, the sprite info block) where the 64KiB limit could be problematic.<br />
<br />
Here are some basic limitations:<br />
<br />
*<u><tt>Audio</tt></u>: each sound and each piece of music must not be larger than 64KiB.<br />
<br />
*<u><tt>Levels</tt></u>: also referred to as map-planes, each of these must not exceed 64KiB. For details, see the below section on [[Keen Source Mod Modding Tutorial#Memory_.26_Technical_Limitations|level limitations]].<br />
<br />
*<u><tt>Tilesets</tt></u>: There is no concrete upper limit for the number of tiles a tileset can have. The only requirement is that the MAPHEAD and EGAHEAD must be smaller than 64KiB each in order to be loaded into memory correctly. (Theoretically a little more than 7,200 tiles per tileset are allowed.)<br />
<br />
*<u><tt>Sprites:</tt></u> The maximum number of sprites in the EGAGRAPH file is limited to 3640. If more sprites are inserted, then the data block with the sprite info (width, height, hitbox, shifts, etc.) will be larger than 64KiB.<br />
<br />
'''Note''': Some of this is not set in stone. In ID_RF.H some of these values can be adjusted, but this would then consume more memory.<br />
<br />
<!--<br />
== EGAHEAD ==<br />
<br />
[[Information on the EGAHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
<br />
== MAPHEAD ==<br />
<br />
[[Information on the MAPHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
--><br />
<br />
= Graphics and Texts (EGAGRAPH) =<br />
<br />
The <tt>EGAGRAPH.CKS</tt> file (aslo called the EGA graphics library) functions as a container the stores compressed sub files which are individually called chunks. Chunks in this container include all graphics, demos, fonts, sprites, tiles, texts and other game files. <br />
<br />
The <tt>EGAHEAD.CKS</tt> file contains information about the size of the <tt>EGAGRAPH.CKS</tt> file and the offset location of each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/EGAGraph_Format EGAGraph_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted graphics and text files from <tt>EGAGRAPH.CKS</tt> the can be found in the '''<tt>EGA</tt>''' folder. Likewise, a definitions file (<tt>ega.def</tt>) [[add ega.def to the package]] has been added to the setup. If additional files, such as graphics or sprites, are to be added to the game, the definitions file must be updated. The tool [[uGrab]] is used to read this definition file and import/export the changed or new files into/from the <tt>EGAGRAPH.CKS</tt> container.<br />
<br />
[[Image:Ega-Color-Palette.png|160px|thumb|EGA Color Palette]]<br />
To begin editing graphics and most texts found in the game, go to the '''<tt>EGA</tt>''' folder. You can edit any of the images how you want but must follow two rules: you must use the [[moddingwiki:EGA_Palette|original 16 EGA Keen colours]], and all images must have a width that is a multiple of 8 pixels.<br />
<br />
All the image, text, and other files within '''<tt>EGA</tt>''' are arranged in clusters by file type. The following table gives an overview of each file type, and you can can find a corresponding overview in the <tt>ega.def</tt> definitions file as well.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|CKS_ansi_*.bin<br />
|Final screen <br />
|''Appears after quitting the game.''<br />
|-<br />
|CKS_fon_*.bmp<br />
|Font sheets <br />
|''These fonts are used throughout the game.''<br />
|-<br />
|CKS_pic_*.bmp<br />
|Main menu and help section images<br />
|<br />
|-<br />
|CKS_sprite_*.bmp<br />
|Sprite images <br />
|<br />
|-<br />
|CKS_sprites.txt<br />
|Sprite definition text file<br />
|''Hitboxes and offset values are defined for each sprite.''<br />
|-<br />
|CKS_terminator_*<br />
|Terminator text sequence <br />
|''Appears at the games first start and leads to the title screen.''<br />
|-<br />
|CKS_tile8*.bmp<br />
|Drop-down menu Tilesets <br />
|''These tilesets contain numerous tiles. Each tile has a size of 8x8 pixel.''<br />
|-<br />
|CKS_tile16*.bmp<br />
|Fore- and Background-Tileset <br />
|''These tilesets contain numerous tiles. Each tile has a size of 16x16 pixel.''<br />
|-<br />
|CKS_txt*.txt<br />
|Text sheets<br />
|''Containing story element texts and help section information.''<br />
|-<br />
|CKS_txt_STARWARS.txt<br />
|Scrolling story text<br />
|''The so called Star Wars Story Screen.''<br />
|-<br />
|CKS_DEMO*.CKS<br />
|Demo recordings <br />
|<br />
|}<br />
<br />
== Import and Export Files ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
To import / export the files located in '''EGA''', use <tt>[[uGrab]]</tt>. <tt>uGrab</tt> is an advanced EGAGRAPH editor with a graphical user interface which can not only import / export graphics, but can also add, move or remove sprites in Commander Keen source mods. <br />
<br />
For <tt>uGrab</tt> to work, a definition file is required, which is already included within the Source Code Modding bundle. [[How to manually modify definition file]].<br />
<br />
To begin, open <tt>uGrab</tt> and go to <code>Import</code> and select <code>Import from bitmap folder...</code>. Locate the <tt>ega.def</tt> definition file in your project folder and open it. A dialog pops up that asks you to select the '''EGA''' folder. Do so and press <code>OK</code>. The graphics and text files have now been imported into <tt>uGrab</tt>. <br />
<br />
To import these files into the EGAGRAPH simply go to <code>Export</code> and select <code>Export as EGAGRAPH...</code>. In the following window locate <tt>EGAGRAPH.CKS</tt> file and press <code>Save</code>. <tt>uGrab</tt> will then ask you to select a Huffman Compression Type; choose <code>Best (Slowest)</code>. It will then ask if you want to update the definition file, which you should confirm. The new graphics and text files should now be exported into the game files.<br />
<br />
An alternative to running an instance of <tt>uGrab</tt> is through batch files. The modding package comes with two batch files which can be used to speed up and automate the import / export process significantly. Simply double-click <code>ega-in.bat</code> to import and double-click <code>ega-out.bat</code> to export all files. To learn more about how those batch files operate, simply open them with a text editor such as notepad.<br />
<br />
== Tilesets == <br />
<br />
You can edit tiles in the typical manner, however, the first row of tiles in the foreground tileset (<tt>CKS_tile16m</tt>) is generally reserved to render certain blocking elements. Those are used for debugging reasons and should stay untouched. <br />
<br />
[[Short note about tiles (16x16 pixel) for the novice modder]]<br />
<br />
[[Reminder: inserted corresponding graphics to the tile16m file for the final modding package.]]<br />
<br />
[[example image goes here.]]<br />
<br />
== Sprite Hitboxes ==<br />
<br />
Just like standard modding, <tt>CKS_sprites.txt</tt> is used for establishing Sprite hitboxes. Since we are dealing with a modified version of the source code, the last value in a <tt>CKS_sprites.txt</tt> entry, handling animation frame rate, must stay at 1. Otherwise there will be errors in the rendering. (Desired adjustments need to be taken in the source code)<br />
<br />
== Texts ==<br />
<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
Text files can be edited with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
They employ a formatting code:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting code<br />
! style="text-align:left;"| Description<br />
|-<br />
|<code>^P</code> <br />
|''Marks the beginning of a page.''<br />
|-<br />
|<code>^Gy,x,n</code> <br />
|''Displays a bitmap. The image number <tt>n</tt> used here doesn't match up with the image numbers in your EGA folder; [[OUTDATED? the image shown is the image number plus seven (n + 7)]]. The <tt>x,y</tt> are coordinates which determine where the image appears on the screen. The <tt>^G</tt> command can also use sprites and both types of 16x16 pixel tiles (TILE16 and TILE16M).''<br />
|-<br />
|<code>^Ly,x</code> <br />
|''Following text will be aligned beginning at pixel location <tt>x,y</tt>.''<br />
|-<br />
|<code>^Ty,x,n,t</code> <br />
|''After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap [[OUTDATED? (n + 7)]] at pixel location <tt>x,y</tt> on the screen.''<br />
|-<br />
|<code>^By,x,w,h,c</code> <br />
|''Fills the width-by-height-pixel rectangle at pixel location <tt>x,y</tt> with dimensions of <tt>w,h</tt> and the color <tt>c</tt>. <tt>c</tt> is the hexadecimal color digit, the rest are decimal digits. If the line ends before the parser can find a hex digit, the code will use the background color (for compatibility with Keen 4-6 texts).''<br />
|-<br />
|[[^Mxxx]]<br />
|''[[Starts playing music number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^MOxxx]]<br />
|''[[Plays the music track number]] <tt>xxx</tt> [[only once, without repeating.]]''<br />
|-<br />
|[[^MP]]<br />
|''[[Pauses the current running music track and allows to resume it later.]]''<br />
|-<br />
|[[^MR]]<br />
|''[[Resumes music paused by]] <tt>^MP</tt>.''<br />
|-<br />
|[[^Sxxx]]<br />
|''[[Plays sound number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^W]]<br />
|''[[Waits until the current sound is done (does not update the screen).]]''<br />
|-<br />
|[[^Dttt]]<br />
|''[[Waits]] <tt>ttt</tt> [[tics (screen will be updated)]]''<br />
|-<br />
|[[^Q]] <br />
|''[["quiet" - stops sounds and music.]]''<br />
|-<br />
|[[^H]]<br />
|''[[Shows the high scores in any of the help texts.]]''<br />
|-<br />
|<code>^E</code> <br />
|''Marks the end of the dialogue.''<br />
|}<br />
<br />
<br />
The specific codes for changing the color of text are:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:center;"| Description<br>.<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:middle;"| Description<br>.<br />
|-<br />
|<br />
|''<code>^Cx</code> changes the text to color <tt>x</tt>''<br />
|<br />
|''<code>x</code> = single hex digit: <tt>0-9</tt>, <tt>A-F</tt>''<br />
|-<br />
|<code>^CA</code> <br />
|<code style="background:#AA0000; color:#55FF55"><b>bright green text color </b></code><br />
|<code>^C2</code> <br />
|<code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
|-<br />
|<code>^CB</code> <br />
|<code style="background:#AA0000; color:#55FFFF"><b>bright cyan text color </b></code><br />
|<code>^C3</code> <br />
|<code style="background:#AA0000; color:#00AAAA"><b>cyan text color </b></code><br />
|-<br />
|<code>^CC</code> <br />
|<code style="background:#AA0000; color:#FF5555"><b>bright red text color </b></code><br />
|<code>^C4</code> <br />
|<code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
|-<br />
|<code>^CD</code> <br />
|<code style="background:#AA0000; color:#FF55FF"><b>bright magenta text color</b></code><br />
|<code>^C5</code> <br />
|<code style="background:#AA0000; color:#AA00AA"><b>magenta text color </b></code><br />
|-<br />
|<code>^CE</code> <br />
|<code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
|<code>^C6</code> <br />
|<code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
|-<br />
|<code>^C9</code> <br />
|<code style="background:#AA0000; color:#5555ff"><b>bright blue text color </b></code><br />
|<code>^C1</code> <br />
|<code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
|-<br />
|<code>^CF</code> <br />
|<code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
|<code>^C7</code> <br />
|<code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
|-<br />
|<code>^C8</code> <br />
|<code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
|<code>^C0</code> <br />
|<code style="background:#AA0000; color:#000000"><b>black text color </b></code><br />
|}<br />
<br />
== Other Texts ==<br />
<br />
Some editable texts, such as level entrance messages, are not found in files within the <tt>'''EGA'''</tt> folder and instead require using a text editor to modify specific source code files located in the <tt>'''../SOURCE/MAKESTR'''</tt> folder. To edit most text files that appear in game open up the <tt>MAKESTR.C</tt> file with a text editor. This file contains Level Names, Level Entrance Texts, In-Game Messages and related texts. <br />
<br />
After editing these files, the game must be recompiled in order to integrate the changes. We'll get to the [[compiling process]] later.<br />
<br />
<br />
== Loading Window ==<br />
<br />
<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
<br />
KeenScr, in combination with TheDraw, is used for editing the loading and closing screen graphics.<br />
<br />
[[Where to find the loading screen files, copy it to keenscr folder]] <br />
<br />
Go to commander prompt and navigate to your <tt>keenscr</tt> folder and then type: <br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will immediately start editing the screen, with the filename keenscr.bin. <br />
<br />
<code>Alt</code>+<code>H</code> will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename [[keenscr.bin]]. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
[[files must be copied back to origin folder. Does this require uGrab or a recompile?]] <br />
<br />
<br />
<br />
<br />
<br />
== Adding Additional Graphics and Text Files ==<br />
Unlike standard Keen Galaxy modding, the number of text and graphics files can be expanded or rearranged in source modding. <br />
<br />
For any additions it is required to edit the the uGrab definitions file, Abiathar's *.adeps definitions file, and GRAPHCKS.H. These files categorize the EGAGRAPH into sections of chunk types (such as bitmaps, sprites, tiles), provide the total number of chunks within a chunk section (such as the total sprite images, or total number of tiles), and include a running total chunk number used for identifying where the chunk sections begin. [[What is the tablestart?]] Whenever chunks are added to a chunk section, the running total value must be updated for all subsequent entries. For example, if 100 sprite images are added, the number of sprites is changed from the default 397 to 497, then the subsequent entry for TILE8 must be updated to 621, TILE8M to 622, and so on. <br />
<br />
Here is the default EGAGRAPH structure: <br />
<br />
<pre><br />
CHUNKS 4751<br />
FONT 3 3 #num, start<br />
FONTM 0 6<br />
PICS 115 6 0 #num, start, tablestart<br />
PICM 3 121 1<br />
SPRITES 397 124 2<br />
TILE8 104 521<br />
TILE8M 20 522<br />
TILE16 1296 523<br />
TILE16M 2916 1819<br />
TILE32 0 4735<br />
TILE32M 0 4735<br />
<br />
B800TEXT 4735 endgame<br />
TERMINATOR 4736 commander<br />
TERMINATOR 4737 keen<br />
B800TEXT 4738 outofmem<br />
<br />
TEXT 4739 helpart1<br />
TEXT 4740 helpart2<br />
TEXT 4741 helpart3<br />
TEXT 4742 helpart4<br />
TEXT 4743 endart<br />
TEXT 4744 demoart<br />
TEXT 4745 helpart5<br />
<br />
DEMO 4746 0<br />
DEMO 4747 1<br />
DEMO 4748 2<br />
DEMO 4749 3<br />
DEMO 4750 4<br />
</pre><br />
<br />
Here is a brief description of each chunk section:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Chunk Category<br />
! style="text-align:left;"| Description<br />
|-<br />
|FONT <br />
|''.''<br />
|-<br />
|FONTM <br />
|''.''<br />
|-<br />
|PICS <br />
|''These are the image files that can be accessed by the text files.''<br />
|-<br />
|PICSM <br />
|''.''<br />
|-<br />
|SPRITES <br />
|''These are the sprite animation frames.''<br />
|-<br />
|TILE8<br />
|''.''<br />
|-<br />
|TILE8M<br />
|''.''<br />
|-<br />
|TILE16<br />
|''These are the background tiles.''<br />
|-<br />
|TILE16M<br />
|''These are the foreground tiles.''<br />
|-<br />
|TILE32<br />
|''.''<br />
|-<br />
|TILE32M<br />
|''.''<br />
|-<br />
|B800TEXT<br />
|''.''<br />
|-<br />
|TERMINATOR <br />
|''.''<br />
|-<br />
|TEXT <br />
|''These are the text files for the F1 sections and the end game sequence.''<br />
|-<br />
|DEMO <br />
|''These are the recorded demo files.''<br />
|}<br />
<br />
=== Adding Bitmaps Example ===<br />
<br />
Create an image file and save it as the next image in the sequence of bitmap images found in your EGA folder. By default this would be [[default next image file name]].<br />
<br />
[[Using uGrab to add an image]]<br />
<br />
Update the uGrab definitions file, Abiathar's *.adeps definitions file, and GRAPHCKS.H to reflect that there is one additional bitmap image: PICS is updated from 115 to 116, PICM's running total is updated from 121 to 122, and so on for the running totals of all remaining chunk sections.<br />
<br />
=== Adding Sprites Example ===<br />
<br />
Create a series of image files and save them as the next images in the sequence of existing sprite images found in your EGA folder. By default this would begin with [[default next sprite file name]].<br />
<br />
[[Using uGrab to add a sprite image]]<br />
<br />
Update the uGrab definitions file, Abiathar's *.adeps definitions file, and GRAPHCKS.H to reflect that there are additional sprites image, remembering to update the running total values for the subsequent chunk sections.<br />
<br />
=== Adding Tiles Example ===<br />
<br />
Create a copy of [[tileset file name]] from your EGA folder and modify the copy to include an additional row of tiles by changing the canvas size. One row is equal to [[number of tiles]].<br />
<br />
Open the uGrab definitions file, gfx.def, in uGrab. Go to the Tiles tab and select TILE16 or TILE16M. The select Replace at the bottom and replace the old [[tileset file name]] with your new modified one. Export the changes as EGAGRAPH and as gfx.def.<br />
<br />
You will need to update information in Abiathar's *.adeps definitions file, GRAPHCKS.EQU, and GRAPHCKS.H to reflect that there are additional tile chunks (one row equates to [[number of chunks]], remembering to update the running total values for the subsequent chunk sections. This easily accomplished by copying the information from gfx.def.<br />
<br />
At this point you will need to compile a new executable file (CKSRCMOD.EXE).<br />
<br />
Lastly, MAPHEAD.CKS must be updated using TliExtend. To do this, edit the included batch file called TliExtend.bat. This file lists the instructions for TliExtend, using default values, in the following format:<br />
<br />
<pre>existing tileinfo file (MAPHEAD) name<br />
current number of background tiles<br />
current number of foreground tiles <br />
output tileinfo file (MAPHEAD) name<br />
new number of background tiles<br />
new number of foreground tiles<br />
length of non-tileinfo (MAPHEAD) data<br />
</pre><br />
<br />
To proceed, edit the file to include the new number of background tiles and/or the new number of foreground tiles. If you have already added additional tiles previously, you will need to change the current number of background and foreground tiles as well.<br />
<br />
You can then run TliExtend.bat, which will output MAPHEAD--new.CKS. You will need to rename this file to MAPHEAD.CKS and copy it to your game files folder.<br />
<br />
= Level Editing (MAPHEAD) =<br />
<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
<br />
Open Abiathar and go to <code>File</code> and select <code>Open Project</code>. Within your projects folder you should find a dependency file called <tt>maps.adeps</tt> which you want to choose. This is your pre-setup from where you can start building levels.<br />
<br />
To store modifications press <code>Save</code> under <code>File</code>. The settings for the levels will be written to the <tt>maps.adeps</tt> file, which only contains references and pointers to the real resources files, but doesn’t store any level data on their own. <br />
<br />
Closing Abiathar for the first time, quite a few settings will get saved to the <tt>editor.aconf</tt> config file. Those settings are loaded when Abiathar starts.<br />
<br />
For basic usage, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Using_Abiathar| using Abiathar section] of the patched based modding tutorial.<br />
<br />
== Memory & Technical Limitations ==<br />
<br />
Each level must not exceed 64KiB: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about.<br />
<br />
The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
The greater the variety of tiles used, the more memory is used; each foreground tile consumes 128 bytes, whereas each background tile consumes 160 bytes.<br />
<br />
There is a maximum of 50 sprites visible on-screen at the same time, but not limit for the level as a whole. Each Sprite in the refresh manager is 50 bytes. This is calculated by taking the sprite list entry (34 bytes for each sprite), and adding the erase list entry multiplied by two due to double buffering <code>(8*2=16)</code>; thus: <code>34 + 8 * 2 = 50 bytes</code> per Sprite. The number of Sprites that are in use can be checked using the <code>F10+C</code> cheat code in game.<br />
<br />
Sprites may be placed on top of animating tiles, but a foreground animating tile may not be placed on an animating background tile.<br />
<br />
There is a maximum of 100 different tile animation sequences and 100 animated tiles visible on-screen at the same time.<br />
<br />
The song played during the level will contribute toward the overall byte size of the level.<br />
<br />
In general, when it comes to level design, compromises may need to be made for memory purposes. For example, if you want to use a lot of different graphics in a level then you might have to make the level smaller or use a music track with a smaller file size so the game doesn't run out of memory.<br />
<br />
= Tile Properties = <br />
<br />
[[what is the saving process/files involved]]<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. Consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Changing_Tile_Properties| tile properties section] of the patch based modding tutorial for further instructions.<br />
<br />
<br />
= Music and Sounds (AUDIOT) = <br />
<br />
To alter music and sounds, this chapter will discuss the following files and folders: <tt>AUDIOT.CKS, AUDIOHED.CKS, AUDIO, audio.asnds, Abiathar, MIDI2IMF, IMFCrush, WDC.</tt><br />
<br />
The <tt>AUDIOT.CKS</tt> file functions as a container that stores compressed sub files individually called chunks. Chunks in this container include AdLib music (<tt>*.IMF, *.KMF</tt>), AdLib sound effects (<tt>*AL.SND</tt>) and PC Speaker sound effects (<tt>*PC.SND</tt>). <br />
<br />
The <tt>AUDIOT.CKS</tt> file requires an associated <tt>AUDIOHED.CKS</tt> file which stores the offset location of each each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/AudioT_Format AudioT_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted music and sound files from <tt>AUDIOT.CKS</tt> that can be found in the '''<tt>AUDIO</tt>''' folder. Likewise, a configuration file (<tt>audio.asnds</tt>) [[add audio.asnds to the package]] has been added to the setup. If additional files, such as sound effects or music, are to be added to the game, the configuration file must be updated. The tool [[Abiathar]] is used to read this configuration file and import/export the changed or new files into/from the <tt>AUDIOT.CKS</tt> container.<br />
<br />
== Brief introduction into music and sound ==<br />
<br />
=== PC Sounds ===<br />
<br />
=== AdLib Sounds ===<br />
<br />
=== IMF / KMF Music ===<br />
<br />
IMF/KMF format files are packed at the end of the audio file. As IMF/KMF files contain AdLib music for games that also have AdLib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict. This is done by reserving the OPL's first channel for sound effects, leaving eight remaining channels available for use in IMF files. <br />
<br />
[[more info about this procedure needed]]<br />
<br />
It is advised to perform optimizations on existing IMF files. [[IMFCrush]] removes by default everything that drives the first AdLib/OPL channel. Generally the original IMF file is reduced by roundabout a third by converting to KMF. The reduction depends entirely on the contents of the source file. <br />
(Side note: IMFCrush is also capable of converting songs to a different playback rate, or even truncate songs.)<br />
<br />
== Music Composition ==<br />
<br />
For tips on music composition as well as the conversion process to the IMF format, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Music| music section] of the patch based modding tutorial.<br />
<br />
== Sound Effect Composition ==<br />
<br />
[[create a pre-defined setup that can be downloaded as well to shortcut things and bypass source code incompatibilities WDC has!]]<br />
<br />
WDC is an older modding tool that contains a sound effect design tool. For instructions on how to access and use this tool, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Sound_Effects| sound effects section] of the patch based modding tutorial.<br />
<br />
== Abiathar Setup and Usage == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
[[Image:Abiathar audio-mappings.png |320px|thumb|Abiathar's Audio Mappings tool]]<br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select [[the option to select]]. <br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format).<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
=== Abiathar Configuration File ===<br />
<br />
Abiathar uses <tt>audio.asnds</tt> for importing and exporting the sound and music files. It contains an entry for each song and music file in a certain format.<br />
<br />
A pc speaker sound looks like: <br />
<br />
<code>?046|PC|?046PC.SND|50 </code><br />
<br />
The first part of this entry indicates the offset location of the sound. Next, <code>PC</code> indicates [[???]]. Next is the sound file that will be used at this offset. The last digit defines the sound effect's priority; since the engine can only play one sound effect at a time this number tells it which sound has priority to play. Values can be from 00 to 99 with the higher numbers being higher priority. <br />
<br />
An AdLib sound looks like: <br />
<br />
<code>?098|PC|?098AL.SND|50|6|1,48,79,0,240,96,255,1,0,0,0,0,0 </code><br />
<br />
As you can see, this entry begins in the same manner as a PC speaker sound, right up to the priority value. The additional numbers that occur after are instrument information that can be ignored (the source engine does not actually use these values), however, Abiathar requires placeholder numbers to be included (any values will do). <br />
<br />
[[example of Music entries]]<br />
<br />
=== Additional Music and Sound Effects ===<br />
<br />
Sound effects and music must occur sequentially in the numbered list found in <tt>'''audio.asnds'''</tt>. Beginning with PC speaker sounds, additional sounds must appear after the last PC speaker sound. Then existing AdLib sound entries must be shifted up the numbered list by the number of PC speaker sounds added, followed by additional entries corresponding to the number of new AdLib sounds. The number of of PC spaker sounds and Adlib sounds must equal each other. Lastly, music is shifted up the numbered list by the required amount. The result is a consistent numbered list of pc speaker sounds, AdLib sounds, and music files.<br />
<br />
This process requires a lot of relabeling files, detailed modification to <tt>'''audio.asnds'''</tt>, importing with Abiathar, and modification to and recompiling the source code. With that in mind, it is highly recommended to import all additional sound effects at one time (using placeholders if necessary), to avoid repeatedly having to reorder files and filenames. Adding new music is a similar process, but because the music cluster of chunks appears last in <tt>'''AUDIOT.CKS'''</tt>, it is a simpler task requiring less forethought.<br />
<br />
==== Adding Sound Effects ====<br />
<br />
Begin the process by naming your PC speaker sound effects so that they occur after the final existing PC speaker sound in your '''AUDIO''' folder.<br />
<br />
Next, all AdLib sounds must be renamed so that their numbered order begins after the new final PC speaker sound. [[Automating this process?]]<br />
<br />
Next, your new AdLib sounds should be renamed to occur after the newly ordered final existing AdLib sound. <br />
<br />
Next, all music files must be renamed so that their numbered order begins after the new final AdLib sound.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified in the same manner that the files were renamed: PC speaker sound entries added, Adlib entries renumbered, Adlib entries added, and music entries renumbered.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, and <tt>NUMSNDCHUNKS</tt> to two times the value of <tt>NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
==== Adding Music ====<br />
<br />
Begin by naming your songs so that they occur after the final existing music files in your '''AUDIO''' folder.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified with music entries added for the new songs.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, <tt>NUMMUSIC</tt> to the number of songs, and <tt>NUMSNDCHUNKS</tt> to two times the value of NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
= Source Code Editing =<br />
<br />
Because source code modding provides endless possibilities, only limited by a modder's programming ability, this section will only introduce the most basic steps involved in some fundamental modifications that a modder might want when creating a 'typical' Commander Keen mod. <br />
<br />
[[How to add additional levels]]<br />
<br />
[[How to modify a creature's behavior]]<br />
<br />
[[How to create a new enemy actor]]<br />
<br />
[[How to create a new tile property]]<br />
<br />
<br />
= Compiling the Source Code =<br />
<br />
[[Image:Borland C source code compiling 01.png |320px|thumb|Working with Borland C++ v3.1]]<br />
<br />
[[Image:Borland C source code compiling 02.png |320px|thumb|Compiling, error message]]<br />
<br />
[[Introduction into Borland C++ v.3.1]]<br />
<br />
= Credits For This Tutorial =<br />
<br />
* Written and assembled by [[User:Ceilick|Ceilick]] and [[User:Nisaba|Nisaba]]<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Galaxy_Mods&diff=46306Galaxy Mods2022-10-18T18:28:30Z<p>Ceilick: /* Full Mods */ alphabetized order</p>
<hr />
<div><!-- <div style="border: 4px solid red; padding: 1em; margin: 1em; background-color: #FFFFEE;"><br />
<center>'''This page is being replaced'''</center><br />
Due to the growing number of mods, and the fact that a lot of information is duplicated on this page and the mod pages themselves, it is proposed that this page be split into per-episode lists that are automatically generated from the infoboxes on each mod's page. Please see one of the new pages to see what this would look like:<br />
<br />
* [[Keen 4 mods]]<br />
* [[Keen 5 mods]]<br />
* [[Keen 6 mods]]<br />
<br />
Until all the mods are migrated to the new pages, the list below will remain available.<br />
<br />
If you can help, please remove mods from the list below once they appear on the new page, and all the information has been taken across correctly (especially release dates.)<br />
<br />
To add a new mod to the new list, create a new page for it and put an infobox on it (just copy it from an existing mod's page and change it accordingly.)<br />
</div> --><br />
<!-- Proposal for an optional usage of both types of lists: <br />
a) alphabetical & subcategories <br />
b) per-episode --><br />
{{Alert|The downloads for Keen 5 and 6 mods will not include the executable necessary to play the game (they are still not free to distribute). You will need to put your own executable in the mod directory and unpack it with [[UNLZEXE]] prior to playing for the first time.}}<br />
<br />
This is an '''alphabetical list''' of all Keen: Galaxy mods, one-level mods and level packs ever made for Keen. It also includes some in-progress mods.<br />
<br />
*Please click on the triangles to sort by different categories. i.e. if you click first on "Modder(s)" then on "Mod of", you will get a list that is sorted by which game was modded, and further sorted by modder name. Refresh the page to reset all sort settings.<br />
<br />
*Only the newest version of each mod or level pack is listed in the Download column; additional versions of mods or level packs may be found on their respective wiki pages.<br />
<br />
*Dates format: year-month-day (the release date is always for the ''first'' version of the mod, if known)<br />
<br />
<br />
For a '''per-episode list''' choose from the following instead: [[Keen 4 mods]], [[Keen 5 mods]], [[Keen 6 mods]].<br />
<br />
<br />
= Mods =<br />
<br />
A mod, or modification, is the alteration of content in order to make it operate in a manner different from its original version. They can include new items, modded weapons, characters, enemies, models, tile-sets, levels, music, story lines and game modes. <br />
<br />
== Full Mods ==<br />
{|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" style="font-size: 90%; border:1px solid gray; border-collapse: collapse; text-align: center; width: 100%;"<br />
|- style="background: #ececec"<br />
! Title<br />
! Download<br />
! Release date<br />
! Modder(s)<br />
! Mod of<br />
! # of levels<br />
! Notes<br />
|-<br />
|[[Aliens Ate My Babysitter ...Again]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen6/m.ny00123.aliens_ate_my_babysitter_again_v1.3.k6.2009-09-26.zip full v1.3]<br />
|2009-09-26<br />
|NY00123<br />
|Keen 6<br />
|18<br />
|Keen 6 rearranged, color swaps, alternate graphics. [http://ny.duke4.net/files.html Website] [https://pckf.com/viewtopic.php?t=880 Release Thread]<br />
|-<br />
|[[The Alphamatic]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.gridlock.the-alphamatic.k5.2017-11-26.zip full]<br />
|2017-07-04<br />
|[[User:Gridlock|Gridlock]]<br />
|Keen 5<br />
|20<br />
|An Atroxian Realm sequel. [https://pckf.com/viewtopic.php?f=4&t=4086 Release Thread]<br />
|-<br />
|[[The Armageddon App]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.55aavenue.the_armageddon_app_v.1.2.k5.2020-05-26.zip full]<br />
|2020-05-04<br />
|55Aavenue<br />
|Keen 5<br />
|20<br />
|A Short Circuit Oracle sequel. [https://pckf.com/viewtopic.php?f=4&t=6851 Release Thread]<br />
|-<br />
|[[The Armageddon Continues]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.alessandro.the_armageddon_continues.k5.2020-06-07.zip full]<br />
|2020-06-07<br />
|[[User:DarkAle|DarkAle]]<br />
|Keen 5<br />
|12<br />
| [https://pckf.com/viewtopic.php?f=4&t=6979 Release Thread] <br />
|-<br />
|[[Atroxian Realm]]<br />
|[https://files.shikadi.net/keenwiki/mods/SourceCode/m.gridlock.atroxian_realm_v1.3.sc.2019-11-15.zip full v1.3]<br />
|2016-01-16<br />
|[[User:Gridlock|Gridlock]]<br />
|Keen 4<br />
|25<br />
|First Source-Code Mod. [https://pckf.com/viewtopic.php?t=1812 Discussion Thread], [https://pckf.com/viewtopic.php?t=3536 Release Thread]<br />
|-<br />
|[[Aurora Bliss]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.dave216.aurora_bliss_v.1.1.k4.2022-09-21.zip full v1.1]<br />
|2022-08-01<br />
|Dave216<br />
|Keen 4<br />
|22<br />
|[https://pckf.com/viewtopic.php?t=13985 Release Thread]<br />
|-<br />
|[[Bounty Hunting Brouhaha]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.kohntarkosz_.bounty_hunting_brouhaha.k4.2019-11-26.zip full]<br />
|2019-11-26<br />
|Kohntarkosz_<br />
|Keen 4<br />
|19<br />
|[https://pckf.com/viewtopic.php?f=4&t=6172 Release Thread]<br />
|-<br />
|[[Commander Keen's Valentine Bash]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.levellass.commander_keens_valentine_bash.k4.2013-01-04.zip full]<br />
|2013-01-04<br />
|[[User:Levellass|Levellass]]<br />
|Keen 4<br />
|20<br />
|Monster bash cross-over. [https://pckf.com/viewtopic.php?t=2532 Discussion Thread], [https://pckf.com/viewtopic.php?t=2616 Release Thread]<br />
|-<br />
|[[Commander Keen X Bio Menace]]<br />
|<!--[https://dl.dropboxusercontent.com/u/4975825/CKxBM.zip full]-->[https://files.shikadi.net/keenwiki/mods/Keen4/m.szemigi.commander_keen_x_bio_menace.k4.2016-02-16.zip full]<br />
|2016-02-15<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 4<br />
|13<br />
|A crossover between Keen 4 and Bio Menace 1. [https://pckf.com/viewtopic.php?f=4&t=3571Release Thread]<br />
|-<br />
|[[The Eight Accumulators]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.bubbatom.the_eight_accumulators.k4.2011-12-13.zip full]<br />
|2011-12-13<br />
|[[User:Bubbatom|Bubbatom]]<br />
|Keen 4<br />
|18<br />
|Uses new and original tiles. [https://pckf.com/viewtopic.php?t=2042 Discussion Thread], [https://pckf.com/viewtopic.php?t=2171 Release Thread]<br />
|-<br />
|[[Episode 58 - The Ruin of Roib|Episode 58 - The Ruin of Roib]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.bernie.the_ruin_of_roib.k4.2013-07-01.zip beta v3.0]<br />
|2013-05-25<br />
|Bernie<br />
|Keen 4<br />
|24<br />
|Aged Keen. [https://pckf.com/viewtopic.php?t=2786 Discussion Thread], [https://pckf.com/viewtopic.php?t=2791 Re-Release Thread]<br />
|-<br />
|[[Episode 59 - Underworld Ultimate!|Episode 59 - Underworld Ultimate!]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.bernie.underworld_ultimate.k4.2014-05-06.zip beta v1.0]<br />
|2014-05-06<br />
|Bernie<br />
|Keen 4<br />
|18<br />
|Aged Keen. [https://pckf.com/viewtopic.php?t=3057 Release Thread]<br />
|-<br />
|[[The Grand Intelligence IV: Intelligent Intellect]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.szemigi.intelligent_intellect.k4.2013-12-07.zip full v2]<br />
|2013-09-02<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 4<br />
|18<br />
|Protaginist is Martinez McMeyer. [https://pckf.com/viewtopic.php?t=2848 Release Thread]<br />
|-<br />
|[[Marooned on Mars - Galaxy mod|Marooned on Mars]]<br />
|<!--[http://richard-balluff.de/MOMGalaxy1.0.rar beta v1.4]-->[https://files.shikadi.net/keenwiki/mods/Keen5/m.dr_colossus.marooned_on_mars_-_galaxy_mod_v.1.7.k5.2018-10-10.zip beta v1.7]<br />
|2016-03-14<br />
|[[User:DrColossus|Dr. Colossus]]<br />
|Keen 5<br />
|17<br />
|Keen 1 conversion into Galaxy style. [https://pckf.com/viewtopic.php?t=3598 Release Thread]<br />
|-<br />
|[[Keen 10: Mirror Menace|Mirror Menace]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen6/m.szemigi.mirror_menace.k6.2014-10-01.zip beta v1.3]<br />
|2013-11-24<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 6<br />
|18<br />
|<!--[https://pckf.com/viewtopic.php?t=2928 Beta I Release Thread], [https://pckf.com/viewtopic.php?f=4&t=3004 Beta II Release Thread], -->[https://pckf.com/viewtopic.php?t=3136 <!--Final--> Release Thread], known bug: the game freezes after Keen enters the teleporter<br />
|-<br />
|[[Operation Ocflore]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.bubbatom.operation_ocflore_v1.3.k4.2020-02-18.zip full v.1.3]<br />
|2020-01-14<br />
|[[User:Bubbatom|Bubbatom]]<br />
|Keen 4<br />
|18<br />
|Uses different EGA color palette [https://pckf.com/viewtopic.php?f=4&t=6379 Release Thread], [https://pckf.com/viewtopic.php?t=3022 Development Thread] <br />
|-<br />
|[[The Prisoner's Dilemma]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen6/m.kohntarkosz_.the_prisoner's_dilemma.k6.2021-07-16.zip full]<br />
|2021-07-16<br />
|Kohntarkosz_<br />
|Keen 6<br />
|<br />
|Sequel to [[Bounty Hunting Brouhaha]]. [https://pckf.com/viewtopic.php?f=4&t=11632 Release Thread]<br />
|-<br />
|[[Return to the Shadowlands]]<br />
|[https://files.shikadi.net/keenwiki/Packs/SourceCode/l.ceilick.return_to_the_shadowlands_v.1.6.sc.2021-06-06.zip full v1.06]<br />
|2021-06-06<br />
|[[User:Ceilick|Ceilick]]<br />
|Keen 4<br />
|20<br />
|[https://pckf.com/viewtopic.php?f=4&t=11095 Release Thread] [https://pckf.com/viewtopic.php?f=2&t=9993 Discussion] Source code mod.<br />
|-<br />
|[[Secret of the Sorcerer]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen6/m.darkale.secret_of_the_sorcerer_v1.4.k6.2022-10-04.zip full v1.4]<br />
|2022-02-26<br />
|[[User:DarkAle|DarkAle]]<br />
|Keen 6<br />
|16<br />
| [https://pckf.com/viewtopic.php?t=13031 Release Thread] <br />
|-<br />
|[[Commander Keen in Suburb Shenanigans|Suburb Shenanigans]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.bubbatom.suburb_shenanigans_v1.1.k5.2019-02-09.zip full v1.1]<br />
|2018-12-24<br />
|[[User:Bubbatom|Bubbatom]]<br />
|Keen 5<br />
|23<br />
|[https://pckf.com/viewtopic.php?t=2306 Development Thread], [https://pckf.com/viewtopic.php?f=4&t=4701&p=88325 Release Thread]<br />
|-<br />
|[[The Terror from Outer Space|The Terror from Outer Space]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.dr_colossus.the_terror_from_outer_space.k4.2013-09-29.zip full]<br />
|2013-09-16<br />
|[[User:DrColossus|Dr. Colossus]]<br />
|Keen 4<br />
|19<br />
|[https://pckf.com/viewtopic.php?t=2864 Release Thread]<br />
|-<br />
|[[The Keys of Krodacia|The Universe is Toast (unofficial) I: The Keys of Krodacia]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.ceilick.the_keys_of_krodacia.k4.2009-03-14.zip full v2]<br />
|2009-03-14<br />
|[[User:Ceilick|Ceilick]]<br />
|Keen 4<br />
|18<br />
|[http://publiccommanderkeenforum.yuku.com/topic/886/Keen-4-mod-The-Keys-of-Krodacia Release Thread], [https://pckf.com/viewtopic.php?t=1379 Post Discussion Thread], [https://pckf.com/viewtopic.php?t=566 Re-Release Thread] (includes new music, additional content, and bug fixes)<br />
|-<br />
|[[Dead in the Desert|The Universe is Toast (unofficial) II: Dead in the Desert]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen6/m.ceilick.dead_in_the_desert.k6.2011-11-23.zip full v3.2]<br />
|2009-07-21<br />
|[[User:Ceilick|Ceilick]]<br />
|Keen 6<br />
|18<br />
|[https://pckf.com/viewtopic.php?t=536 Discussion Thread] [https://pckf.com/viewtopic.php?t=762 Release Thread]<br />
|-<br />
|[[Battle of the Brains|The Universe is Toast (unofficial) III: Battle of the Brains]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.ceilick_mink_tulip.battle_of_the_brains.k5.2011-11-23.zip full v2.5] <br/><br />
|2011-11-23<br />
|[[User:Ceilick|Ceilick]], [[User:Mink|Mink]], [[User:Tulip|Tulip]]<br />
|Keen 5<br />
|15<br />
|[https://pckf.com/viewtopic.php?t=774 Discussion Thread], [https://pckf.com/viewtopic.php?t=1808 Release Thread]<br />
|-<br />
|[[Zoltan's Revenge]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.levellass.zoltans_revenge.k4.2012-10-20.zip full]<br />
|2012-10-20<br />
|[[User:Levellass|Levellass]]<br />
|Keen 4<br />
|16<br />
|The first demo won 1st place in the 2007 [http://keenmodding.org/viewtopic.php?t=924 Keen 4 minimod contest]<br />
|}<br />
<br />
== Changed Gameplay Mods ==<br />
<br />
This topic contains mods which differ largely from the ordinary Keen Galaxy gameplay. (Nearly) all mods in this category have substantial similarity in a distinctive gameplay derived from heavy patching.<br />
{|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" style="font-size: 90%; border:1px solid gray; border-collapse: collapse; text-align: center; width: 100%;"<br />
|- style="background: #ececec"<br />
! Title<br />
! Download<br />
! Release date<br />
! Modder(s)<br />
! Mod of<br />
! # of levels<br />
! Notes<br />
|-<br />
|[[Adventures in the BWB Megarocket]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.gargapplesauce.adventures_in_the_bwb_megarocket.k4.2010-06-09.zip beta]<br />
|2010-06-09<br />
|[[User:GARGapplesauce|GARGapplesauce]]<br />
|Keen 4<br />
|10<br />
|Changed Gameplay: Designed to pilot the BWB Megarocket. [https://pckf.com/viewtopic.php?t=1998 Discussion Thread]<br />
|-<br />
|[[Birdman]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.br1ck_dr_witherstone.birdman.k4.2004-03-26.zip demo]<br />
|2004-03-26<br />
|Br1ck, Dr.&nbsp;Witherstone<br />
|Keen 4<br />
|1<br />
|Changed Gameplay: Designed to fly as Blue Bird. Also first Keen 4 mod. [http://keenmodding.org/viewtopic.php?t=266 Forum Thread]<br />
|-<br />
|[[Galaxy Defender]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.dr_colossus.galaxy_defender.k4.2017-03-14.zip demo]<br />
|2017-03-14<br />
|[[User:DrColossus|Dr. Colossus]]<br />
|Keen 4<br />
|1<br />
|Changed Gameplay: BwB space-shooter style gameplay. [https://pckf.com/viewtopic.php?f=4&t=4029 Release Thread]<br />
|-<br />
|[[Keenball]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.levellass.keenball.k4.2019-03-14.zip demo]<br />
|2019-03-14<br />
|[[User:Levellass|Levellass]]<br />
|Keen 4<br />
|4<br />
|Changed Gameplay: pinball/snooker like game with an unique crosshairs mechanic. [https://keenmodding.org/viewtopic.php?f=13&t=3224 Release Thread]<br />
|-<br />
|[[Keen 60: Kreeg Crisis!]]<br />
|<!--[https://dl.dropboxusercontent.com/u/3940020/Keen60.zip full]-->[https://files.shikadi.net/keenwiki/mods/Keen4/m.levellass.keen_60_kreeg_crisis_.k4.2016-04-03.zip full]<br />
|2016-04-01<br />
|[[User:Levellass| Levellass]]<br />
|Keen 4<br />
|1<br />
|Changed Gameplay: Pogoing, jumping, shooting disabled. [https://pckf.com/viewtopic.php?t=3620 Forum Thread]<br />
|-<br />
|[[Kube]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.levellass.kube.k4.2015-07-09.zip full]<br />
|2015-07-08<br />
|[[User:Levellass|Levellass]]<br />
|Keen 4<br />
|11<br />
|Changed Gameplay: Worldmap mod. [https://pckf.com/viewtopic.php?t=3347 Discussion Thread]<br />
|-<br />
|[[Mink's Puzzle Pack]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.mink.minks_puzzle_pack.k5.2010-01-03.zip full v3]<br />
|2010-01-03<br />
|[[User:Mink|Mink]]<br />
|Keen 5<br />
|13<br />
|Changed Gameplay: Keen Clones to solve puzzles. [https://pckf.com/viewtopic.php?t=1007 Release Thread]<br />
|-<br />
|[[NY00123's tests level]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.ny00123.ny00123s_tests_level.k4.2017-04-22.zip full v1.3]<br />
|2017-04-22<br />
|NY00123<br />
|Keen 4<br />
|1<br />
|Changed Gameplay: Numerous challenges to go from A to B. [https://pckf.com/viewtopic.php?t=4049 Discussion Thread]<br />
|-<br />
|[[Pak Een]]<br />
|<!--[https://dl.dropboxusercontent.com/u/3940020/Pakeen.zip full]-->[https://files.shikadi.net/keenwiki/mods/Keen4/m.levellass.pakeen.k4.2016-06-01.zip full]<br />
|2016-06-01<br />
|[[User:Levellass|Levellass]]<br />
|Keen 4<br />
|11+<br />
|Changed Gameplay: Worldmap mod. [https://pckf.com/viewtopic.php?t=3537 Discussion Thread]<br />
|-<br />
|[[Save the Quillsheep]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.xky_rauh.save_the_quillsheep.k4.2007-07-14.zip full]<br />
|2007-07-14<br />
|[[User:XkyRauh|Xkylyr Rauh]]<br />
|Keen 4<br />
|4<br />
|Changed Gameplay: Save Quillsheep. 2nd place in the [http://keenmodding.org/viewtopic.php?t=924 Keen 4 minimod contest]<br />
|-<br />
|[[Skater Squirrel]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.levellass.skater_squirrel.k4.2017-10-19 demo]<br />
|2017-10-19<br />
|[[User:Levellass|Levellass]]<br />
|Keen 4<br />
|4<br />
|Changed Gameplay: stars a squirrel. has changed game physics. [https://pckf.com/viewtopic.php?f=4&t=4138 Release Thread]<br />
|-<br />
|[[Space Evaders]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.levellass.keenev.k4.2017-03-13.zip full]<br />
|2017-03-13<br />
|[[User:Levellass|Levellass]]<br />
|Keen 4<br />
|86<br />
|Changed Gameplay: shmup design. [https://pckf.com/viewtopic.php?f=4&t=4023 Release Thread]<br />
|-<br />
|}<br />
<br />
<!--<br />
== Announced Upcoming Mods / Demos ==<br />
{|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" style="font-size: 90%; border:1px solid gray; border-collapse: collapse; text-align: center; width: 100%;"<br />
|- style="background: #ececec"<br />
! Title<br />
! Download<br />
! Release date<br />
! Modder(s)<br />
! Mod of<br />
! # of levels<br />
! Notes<br />
|-<br />
|[[Foray in the Forest]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.nisaba.foray_in_the_forest.k4.2017-03-14.zip demo]<br />
|2017-03-14<br />
|[[User:Mr.M|Mr.M]], [[User:Nisaba|Nisaba]]<br />
|Keen 4<br />
|2<br />
|Abandoned by Mr.M. but recreated from scratch by Nisaba. [https://pckf.com/viewtopic.php?t=823 Discussion Thread], [https://pckf.com/viewtopic.php?p=83707#p83707 Demo Release Thread]<br />
|-<br />
|[[Sign of the Vool|Sign of the Vool]]<br />
|[[link needed]]<br />
|TBA<br />
|[[User:Ceilick|Ceilick]]<br />
|Keen 4<br />
|?<br />
|In-development [https://pckf.com/viewtopic.php?t=2494 Discussion Thread]<br />
|}<br />
--><br />
<br />
== Notable Alpha Versions ==<br />
This topic contains unfinished, abandoned, pre-alpha mods which are notable for unique creative reasons (see the notes). <br />
{|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" style="font-size: 90%; border:1px solid gray; border-collapse: collapse; text-align: center; width: 100%;"<br />
|- style="background: #ececec"<br />
! Title<br />
! Download<br />
! Release date<br />
! Modder(s)<br />
! Mod of<br />
! # of levels<br />
! Notes<br />
|-<br />
|[[ChargingMoose's 1st Levelpack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.chargingmoose.k4.2001-04-17.zip full]<br />
|2001-04-17<br />
|ChargingMoose<br />
|Keen 4<br />
|1<br />
|First fan-made galaxy level ever. (Partially made with a hex editor.) [http://archive.shikadi.net/pckf/official/151.htm Discussion]<br />
|-<br />
|[[Commander Keen at Ballican IV]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.fleexy.commander_keen_at_ballican_iv.k4.2009-03-15.zip alpha v0.1]<br />
|2009-03-15<br />
|[[User:Fleexy|Fleexy]]<br />
|Keen 4<br />
|1<br />
|Flashy creatures also on worldmap. [http://keenmodding.org/viewtopic.php?t=1135 Forum Thread]<br />
|-<br />
|[[Dr. Colossus: The Temple of Cydonia]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.dr_colossus.the_temple_of_cydonia.k5.2014-02-06.zip demo]<br />
|2014-02-06<br />
|[[User:DrColossus|Dr. Colossus]]<br />
|Keen 5<br />
|1<br />
|Keen is replaced by a new player. [https://pckf.com/viewtopic.php?t=2998 Discussion Thread]. (Abandoned)<br />
|-<br />
|[[Episode -3]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.cyber_zero.episode_-3.k4.2015-03-15.zip demo]<br />
|2015-03-15<br />
|cyber zero and brother<br />
|Keen 4<br />
|2<br />
|Planned as a prequel of the Keen series. [https://pckf.com/viewtopic.php?t=2546 Discussion Thread]<br />
|-<br />
|[[Keen 1 Redone]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.gridlock.keen_1_redone.k5.2011-02-11.zip alpha]<br />
|2011-02-11<br />
|[[User:Gridlock|Gridlock]]<br />
|Keen 5<br />
|4<br />
|Keen 1 conversion into Galaxy style. [https://pckf.com/viewtopic.php?t=1827 Discussion Thread]. (Abandoned)<br />
|-<br />
|[[NY00123's first abandoned CK4 level pack]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.ny00123.abandoned_levels.k4.2011-10-02.zip alpha]<br />
|2011-10-02<br />
|NY00123<br />
|Keen 4<br />
|2<br />
|Contains horizontally flipped graphics. [http://ny.duke4.net/files.html Website] [https://pckf.com/viewtopic.php?p=48636 Forum Thread]<br />
|-<br />
|[[Torgopolis]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.benvolio.torgopolis.k4.2005-03-13.zip demo]<br />
|2005-03-13<br />
|[[User:Benvolio|Benvolio]]<br />
|Keen 4<br />
|1<br />
|Style conversion into Vorticons look. [http://www.maguidhir.com/benvolio/ Homepage]<br />
|-<br />
|[[XkyKeen4|XkyKeen4 aka. Episode Pound: Fibers of Danak]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.xky_rauh.xkykeen4.k4.2008-09-20.zip alpha]<br />
|2008-09-20<br />
|[[User:XkyRauh|Xkylyr Rauh]]<br />
|Keen 4<br />
|1<br />
|Graphical redesign. [https://pckf.com/viewtopic.php?t=382 Thread] (Abandoned)<br />
|-<br />
|[[Zero X]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.zero_x_diamond.zero_x.k4.2007-07-14.zip demo]<br />
|2007-07-14<br />
|Zero X. Diamond<br />
|Keen 4<br />
|1<br />
|3rd place in the [http://keenmodding.org/viewtopic.php?t=924 Keen 4 minimod contest]<br />
|-<br />
|}<br />
<br />
<br />
= Level Packs =<br />
<br />
In contrast to mods, level packs do only change level designs and arrangements. Generally other alterations of content stay untouched though there might be some little exceptions.<br />
<br />
== Full Level Packs ==<br />
{|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" style="font-size: 90%; border:1px solid gray; border-collapse: collapse; text-align: center; width: 100%;"<br />
|- style="background: #ececec"<br />
! Title<br />
! Download<br />
! Release date<br />
! Modder(s)<br />
! Pack for<br />
! # of levels<br />
! Notes<br />
|-<br />
|[[Buried in Oblivion]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.nisaba.buried_in_oblivion_v.1.4.k4.2020-10-10.zip full v1.4]<br />
|2020-10-10<br />
|[[User:Nisaba|Nisaba]] et al.<br />
|Keen 4<br />
|18<br />
|[https://pckf.com/viewtopic.php?f=4&t=3936 Discussion]. Community Pack: Level designs by multiple creators.<br />
|-<br />
|[[The Dead in the Desert Community Levelpack]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen6/m.keen_community.dead_in_the_desert.k6.2011-12-25.zip full]<br />
|2011-12-25<br />
|Keen Community<br />
|Keen 8<br />
|20<br />
|[https://pckf.com/viewtopic.php?t=2186 Discussion]<br />
|-<br />
|[[Fleex & Markeen's Keen 5 Level Pack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.fleex_&_markeen%27s_keen_5_level_pack_v.1.1.k5.2022-03-14.zip full]<br />
|2022-01-01<br />
|[[User:Fleexy|Fleexy]] & Markeen<br />
|Keen 5<br />
|13<br />
|Level maps were randomly generated by the tool [[Markeen]]. [https://pckf.com/viewtopic.php?t=12694 Discussion]<br />
|-<br />
|[[Keen_5.5|Keen 5½ ]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.ck_guy.k5.2007-11-18.zip full v5]<br />
|2007-11-18<br />
|[[User:CK Guy|CK Guy]]<br />
|Keen 5<br />
|9<br />
|[https://pckf.com/viewtopic.php?t=24 Discussion]<br />
|-<br />
|[[Keen Asylum]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.dr_witherstone.k5.2003-11-13.zip full]<br />
|2003-11-13<br />
|Br1ck, Dr.&nbsp;Witherstone<br />
|Keen 5<br />
|14<br />
|[http://web.archive.org/web/20040329072306/http://cosmicoding.com/Keendom/?BaseType=Articles:Review&QString1=keen%20asylum.asp Website] [http://archive.shikadi.net/pckf/other/779.htm Discussion]<br />
|-<br />
|[[Keen Fifteen: Hello Galaxy!]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.zeus.k5.2012-03-13.zip beta]<br />
|2012-03-13<br />
|Zeus<br />
|Keen 5<br />
|13<br />
|[https://pckf.com/viewtopic.php?t=2302 Discussion]<br />
|-<br />
|[[Keen 4 Ultimate Edition]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.szemigi.keen_4_ultimate_edition.k4.2019-10-01.zip full]<br />
|2019-10-01<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 4<br />
|24<br />
|[https://pckf.com/viewtopic.php?f=4&t=5412 Release Thread]<br />
|-<br />
|[[MrBlackPack v4]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.mrblack.k4.2012-04-18.zip beta]<br />
|2012-04-18<br />
|[[User:MrBlack|MrBlack]]<br />
|Keen 4<br />
|15<br />
|[https://pckf.com/viewtopic.php?t=2369 Discussion]<br />
|-<br />
|[[The Rapid Pack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen6/l.shikadi.k6.2009-02-18.zip full v4]<br />
|2009-02-18<br />
|[[User:shikadi|Shikadi]]<br />
|Keen 6<br />
|12<br />
|[https://keenmodding.org/viewtopic.php?t=1084 Discussion]<br />
|-<br />
|[[Short Circuit Oracle]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.55aavenue.short_circuit_oracle_v1.5.k4.2019-12-22.zip full]<br />
|2018-06-18<br />
|55Aavenue<br />
|Keen 4<br />
|19<br />
|[https://pckf.com/viewtopic.php?f=4&t=4346 Discussion]<br />
|-<br />
|[[The Sunnylands]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.quillax.sunnylands.k4.2018-03-14.zip full]<br />
|2018-03-14<br />
|[[User:Quinton|Quillax]]<br />
|Keen 4<br />
|19<br />
|[http://quillaxship.com/game_detail.php?ID=10 Website] [https://pckf.com/viewtopic.php?f=4&t=4271 Discussion]<br />
|-<br />
|[[Twenty To]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.dr_witherstone.k5.2005-06-07.zip full]<br />
|2005-06-07<br />
|Dr. Witherstone<br />
|Keen 5<br />
|7<br />
|[https://www.tapatalk.com/groups/publiccommanderkeenforum/cool-new-keen-5-levels-t854.html Discussion]<br />
|-<br />
|[[The Ultra Omegamatic]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.darkale.the_ultra_omegamatic_v2.0.k5.2020-09-08.zip full v2.0]<br />
|2020-09-08<br />
|[[User:DarkAle|DarkAle]]<br />
|Keen 5<br />
|23<br />
|[https://pckf.com/viewtopic.php?f=4&t=6802 Release Thread]<br />
|}<br />
<br />
== Unfinished / abandoned Level Packs ==<br />
This topic contains unfinished, abandoned, or level packs with only a few altered levels (see the notes).<br />
{|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" style="font-size: 90%; border:1px solid gray; border-collapse: collapse; text-align: center; width: 100%;"<br />
|- style="background: #ececec"<br />
! Title<br />
! Download<br />
! Release date<br />
! Modder(s)<br />
! Pack for<br />
! # of levels<br />
! Notes<br />
|-<br />
|[[Br1ck's Keen 5 Level]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.br1ck.k5.2003-04-10.zip full]<br />
|2003-04-10<br />
|Br1ck, Dr.&nbsp;Witherstone<br />
|Keen 5<br />
|1<br />
|The first level has been replaced by level 11. [http://archive.shikadi.net/pckf/other/654.htm Discussion]<br />
|-<br />
|[[BwB Megarocket Keen 5]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.szemigi.bwb_megarocket_keen_5.k5.2013-11-28.zip full]<br />
|2013-11-28<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 5<br />
|1<br />
|Level 14, the missing BWB Megarocket level. [https://pckf.com/viewtopic.php?t=2933 Thread]<br />
|-<br />
|[[ChargingMoose's 2nd Levelpack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.chargingmoose.k4.2002-07-16.zip full]<br />
|2002-07-16<br />
|ChargingMoose<br />
|Keen 4<br />
|7<br />
|[http://archive.shikadi.net/pckf/official/378.htm Discussion]<br />
|-<br />
<!--<br />
|[[Fire Station]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.quirky_moron.k5.2004-02-15.zip alpha]<br />
|2004-02-15<br />
|Quirky Moron<br />
|Keen 5<br />
|1<br />
|[http://keenmodding.org/viewtopic.php?f=13&t=199 Discussion]<br />
|-<br />
--><br />
|[[Funny]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.dr_witherstone.k5.2003-12-07.zip full]<br />
|2003-12-07<br />
|Dr. Witherstone<br />
|Keen 5<br />
|4<br />
|<br />
|-<br />
|[[Gridlock's Dead in the Desert Levelpack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/ModPacks/l.gridlock.dead_in_the_desert.2011-02-11.zip beta]<br />
|2011-02-11<br />
|[[User:Gridlock|Gridlock]]<br />
|Keen 8<br />
|1.5<br />
|[https://pckf.com/viewtopic.php?t=1827 Discussion]. Abandoned.<br />
|-<br />
|[[Gridlock's Keen 4 Levelpack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.gridlock.k4.2011-02-11.zip beta]<br />
|2011-02-11<br />
|[[User:Gridlock|Gridlock]]<br />
|Keen 4<br />
|8<br />
|[https://pckf.com/viewtopic.php?t=1827 Discussion]. Abandoned.<br />
|-<br />
|[[KeenMark 4]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.the_candyjunk.k4.2003-12-09.zip beta]<br />
|2003-12-09<br />
|The Candyjunk<br />
|Keen 4<br />
|4<br />
|Released in a pack with Keen 5 levels. [http://archive.shikadi.net/pckf/official/574.htm Discussion]<br />
|-<br />
|[[KeenMark 5]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.the_candyjunk.k5.2003-12-09.zip beta]<br />
|2003-12-09<br />
|The Candyjunk<br />
|Keen 5<br />
|4<br />
|Released in a pack with Keen 4 levels. [http://archive.shikadi.net/pckf/official/574.htm Discussion]<br />
|-<br />
|[[New QED]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.grelphy.k5.2003-06-27.zip full]<br />
|2003-06-27<br />
|Grelphy<br />
|Keen 5<br />
|1<br />
|[http://web.archive.org/web/20050905025440/http://grelphy.spatang.com/levels/index.html Website]<br />
|-<br />
|[[PCKF Keen 6 Patchwork LevelPair]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen6/l.keen_community.k6.2014-03-07.zip full]<br />
|2014-03-07<br />
|Keen Community<br />
|Keen 6<br />
|2<br />
|[https://pckf.com/viewtopic.php?t=2736 Discussion] [https://pckf.com/viewtopic.php?t=3014 Release]<br />
|-<br />
<!--<br />
|[[Quirky Moron's Keen 4 Levelpack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.quirky_moron.k4.2004-02-03.zip full]<br />
|2004-02-03<br />
|Quirky Moron<br />
|Keen 4<br />
|2<br />
|[http://keenmodding.org/viewtopic.php?f=13&t=108 Discussion]<br />
|-<br />
--><br />
|[[The Pyramid of the Allowed]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.szemigi.the_pyramid_of_the_allowed.k4.2012-11-03.zip full]<br />
|2012-11-03<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 4<br />
|1<br />
|The opposite of the Pyramid of the Forbidden. [https://pckf.com/viewtopic.php?t=2545 Release Thread]<br />
|-<br />
|[[SupFanat's Keen 4 Level Pack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.supfanat.k4.2006-01-10.zip full]<br />
|2006-01-10<br />
|SupFanat<br />
|Keen 4<br />
|3<br />
|Released in a pack with Keen 5 and 6 levels. [https://www.tapatalk.com/groups/publiccommanderkeenforum/10-new-levels-for-keen-4-6-t464.html Discussion]<br />
|-<br />
|[[SupFanat's Keen 5 Level Pack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen5/l.supfanat.k5.2006-01-10.zip full]<br />
|2006-01-10<br />
|SupFanat<br />
|Keen 5<br />
|5<br />
|Released in a pack with Keen 4 and 6 levels. [https://www.tapatalk.com/groups/publiccommanderkeenforum/10-new-levels-for-keen-4-6-t464.html Discussion]<br />
|-<br />
|[[SupFanat's Keen 6 Level Pack]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen6/l.supfanat.k6.2006-01-10.zip full]<br />
|2006-01-10<br />
|SupFanat<br />
|Keen 6<br />
|3<br />
|Released in a pack with Keen 4 and 5 levels. [https://www.tapatalk.com/groups/publiccommanderkeenforum/10-new-levels-for-keen-4-6-t464.html Discussion]<br />
|-<br />
|[[The Unknown Pyramid]]<br />
|[https://files.shikadi.net/keenwiki/Packs/Keen4/l.the_shifted_one.k4.2009-02-14.zip full]<br />
|2009-02-14<br />
|The Shifted One<br />
|Keen 4<br />
|1<br />
|[http://keenmodding.org/viewtopic.php?f=12&t=1119 Discussion]<br />
|}<br />
<br />
<br />
= Skin Mods =<br />
<br />
Skin Mods only change the look and feel of characters or tile-sets. But in contrast to level packs or mods, the original level designs stay untouched. <br />
<br />
[[Translations]] can be found on a separate page.<br />
<br />
{|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" style="font-size: 90%; border:1px solid gray; border-collapse: collapse; text-align: center; width: 100%;"<br />
|- style="background: #ececec"<br />
! Title<br />
! Download<br />
! Release date<br />
! Modder(s)<br />
! Mod for<br />
! Notes<br />
|-<br />
|[[Attack of the Silurians]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.stupidbunny.attack_of_the_silurians.k4.2012-03-16.zip demo]<br />
|2012-03-16<br />
|[[User:StupidBunny|StupidBunny]]<br />
|Keen 4<br />
|Abandoned. [https://pckf.com/viewtopic.php?t=2320 Release Thread] all enemies sprites replaced<br />
|-<br />
|[[DasBrot's First Mod]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.dasbrot.dasbrots_first_mod.k4.2004-11-30.zip demo]<br />
|2004-11-30<br />
|DasBrot<br />
|Keen 4<br />
|Original Keen 4 levels, edited monster graphics<br />
|- <!--<br />
|[[Mortimer McMire - The Armageddon Machine]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen5/m.szemigi.mortimer_mcmire_-_the_armageddon_machine.k5.2010-08-29.zip full]<br />
|2010-08-29<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 5<br />
|The Keen sprite is replaced by the Mortimer McMire sprite<br />
|-<br />
|[[Mortimer McMire - Aliens Ate My Babysitter]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen6/m.szemigi.mortimer_mcmire_-_aliens_ate_my_babysitter.k6.2010-08-02.zip full]<br />
|2010-08-02<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 6<br />
|The Keen sprite is replaced by the Mortimer McMire sprite<br />
|- --><br />
|[[Trouble on Xion 2]]<br />
|[https://files.shikadi.net/keenwiki/mods/Keen4/m.dasbrot.trouble_on_xion_2.k4.2004-12-05.zip beta]<br />
|2004-12-05<br />
|DasBrot<br />
|Keen 4<br />
|Original Keen 4 levels, new graphics and story<br />
|}<br />
<br />
<!--= Improvement Mods =<br />
This section has mods, which contains updates in connection with bugfixes, improvements. <br />
{|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" style="font-size: 90%; border:1px solid gray; border-collapse: collapse; text-align: center; width: 100%;"<br />
|- style="background: #ececec"<br />
! Title<br />
! Download<br />
! Release date<br />
! Modder(s)<br />
! Mod of<br />
! Notes<br />
|-<br />
|[[Version 1.6]]<br />
|[https://www.dropbox.com/s/8tpewlkp74s56tb/CK6v16.zip?dl=0 full]<br />
|2019-01-31<br />
|[[User:Szemigi|Szemigi]]<br />
|Keen 6<br />
|An unofficial bugfix patch mod to Keen 6<br />
|}--><br />
<br />
= See Also =<br />
*[[Vorticon Mods]]<br />
<br />
[[Category:Mods| ]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(source_code_based)&diff=46305Keen Galaxy Modding Tutorial (source code based)2022-10-17T21:37:23Z<p>Ceilick: /* Adding Additional Graphics and Text Files */</p>
<hr />
<div>{{Alert|'''This page is still under construction!'''}}<br />
<br />
This tutorial aims to teach [[Keen:Galaxy Source Modding Package|Keen:Galaxy Source Mod]] modding in terms of what is different from modding without source code. It will primarily cover tool usage and the new options provided by the supplied source code package and its modification. Creating a full source mod requires some basic coding knowledge that this tutorial will not cover, but it will explain where and what needs to be coded and provide limited code examples for common tasks and features. <br />
<br />
For general, introductory Keen Galaxy modding information not covered here, please consult the [[Keen Galaxy Modding Tutorial (patch based)|patch based Keen Galaxy Modding Tutorial]]. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft</tt> <tt>Windows</tt> s based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Downlad the core [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen:Galaxy Source Modding Package]. This bundle contains a source code package with a number of pre-setup tools and files. Make sure to extract all files and keep the pre-defined folder structure. To facilitate modding, this package contains all resources present in their decompressed format.<br />
<br />
== Tools ==<br />
<br />
This is the complete list of tools used for source modding:<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|''Version 2.11.4 Beta 1 or higher is required'' <br />
|-<br />
|[[Borland C++ Compiler]]<br />
|Source Code Compiler <br />
|''Borland 3.1 is used to compile the code; a Borland 3.1 project file ([[SRCMOD.PRJ]]) has been included for this purpose. Borland compilers can be invoked in a 16-bit DOS environment (e.g., DOSBox v0.74 has been successfully used).''<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro Graphic Text Editor <br />
|<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.''<br />
|-<br />
|[[TliExtend]]<br />
|Tileinfo Extension <br />
|''This tool is a command line based tileinfo extension utility for Abiathar.''<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|''Functions as an <tt>EGAGRAPH.CKS</tt> editor. Two batch files are included for easy import and export of graphics.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.''<br />
|<br />
|}<br />
<br />
== Modding Package ==<br />
<br />
The modding package contains, amongst others, the following folders:<br />
<br />
=== Base Folder Name ===<br />
<br />
This folder contains the following files:<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|audio.asnds<br />
|Abiathar definition file for audio.<br />
|''This can be modified in a text editor for adding additional music and sound effects to AUDIOHED.CKS.''<br />
|-<br />
|AUDIOHED.CKS<br />
|Container file for audio chunks/files.<br />
|<br />
|-<br />
|AUDIOT.CKS<br />
|Audio location pointers for AUDIOHED.CKS.<br />
|<br />
|-<br />
|ega.def<br />
|UGrab definition file for graphics and text. <br />
|''This can be modified in a text editor for adding additional graphics and texts to EGAGRAPH.CKS.''<br />
|-<br />
|EGAGRAPH.CKS<br />
|Container file for graphics and text chunks/files.<br />
|<br />
|-<br />
|EGAHEAD.CKS<br />
|Graphics and text location pointers for EGAGRAPH.CKS.<br />
|<br />
|-<br />
|EGAINFO.BMP<br />
|Graphic for infoplane.<br />
|<br />
|-<br />
|ega-in.bat<br />
|Batch script to import graphics and text.<br />
|<br />
|-<br />
|ega-out.bat<br />
|Batch script to export graphics and text.<br />
|<br />
|-<br />
|MAPHEAD.CKS<br />
|Container file which stores levels.<br />
|<br />
|-<br />
|maps.adep<br />
|Abiathar definition file for levels.<br />
|<br />
|-<br />
|MAPTEMP.CKS<br />
|Level location pointers for MAPHEAD.CKS and tile properties.<br />
|<br />
|-<br />
|SRCMOD.EXE<br />
|Game executable. <br />
|<br />
|}<br />
<br />
=== AUDIO ===<br />
<br />
This folder contains the music and sound effect files in their decompressed format. Compressed, these are stored in the <tt>AUDIOT.CKS</tt> container file.<br />
<br />
=== EGA ===<br />
<br />
This folder contains mainly graphic and text files in their decompressed format. Compressed, these are stored in the <tt>EGAGRAPH.CKS</tt> container file. <br />
<br />
=== SOURCE ===<br />
<br />
This folder contains everything source code related written in the high-level language <tt>C/C++</tt>. <tt>SRCMOD.EXE</tt> is the compiled executable.<br />
<br />
= Engine Information = <br />
<br />
In contrast to classic modding via patches, working with the source code allows much more freedom. Nevertheless, there are some limitations that must be taken into account.<br />
<br />
For several reasons DOS only allows a maximum amount of 640KiB of memory available to programs. Therefore DOS (and maybe some drivers) as well as the game program and most of the game data (levels, music, graphics) must fit into these 640KiB.<br />
<br />
The game engine organizes certain segments into memory blocks with an upper limit of 64KiB. This means that the number of music tracks, sprites and tiles is limited to a certain degree. Realistically music and levels are the only parts (besides, perhaps, the sprite info block) where the 64KiB limit could be problematic.<br />
<br />
Here are some basic limitations:<br />
<br />
*<u><tt>Audio</tt></u>: each sound and each piece of music must not be larger than 64KiB.<br />
<br />
*<u><tt>Levels</tt></u>: also referred to as map-planes, each of these must not exceed 64KiB. For details, see the below section on [[Keen Source Mod Modding Tutorial#Memory_.26_Technical_Limitations|level limitations]].<br />
<br />
*<u><tt>Tilesets</tt></u>: There is no concrete upper limit for the number of tiles a tileset can have. The only requirement is that the MAPHEAD and EGAHEAD must be smaller than 64KiB each in order to be loaded into memory correctly. (Theoretically a little more than 7,200 tiles per tileset are allowed.)<br />
<br />
*<u><tt>Sprites:</tt></u> The maximum number of sprites in the EGAGRAPH file is limited to 3640. If more sprites are inserted, then the data block with the sprite info (width, height, hitbox, shifts, etc.) will be larger than 64KiB.<br />
<br />
'''Note''': Some of this is not set in stone. In ID_RF.H some of these values can be adjusted, but this would then consume more memory.<br />
<br />
<!--<br />
== EGAHEAD ==<br />
<br />
[[Information on the EGAHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
<br />
== MAPHEAD ==<br />
<br />
[[Information on the MAPHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
--><br />
<br />
= Graphics and Texts (EGAGRAPH) =<br />
<br />
The <tt>EGAGRAPH.CKS</tt> file (aslo called the EGA graphics library) functions as a container the stores compressed sub files which are individually called chunks. Chunks in this container include all graphics, demos, fonts, sprites, tiles, texts and other game files. <br />
<br />
The <tt>EGAHEAD.CKS</tt> file contains information about the size of the <tt>EGAGRAPH.CKS</tt> file and the offset location of each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/EGAGraph_Format EGAGraph_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted graphics and text files from <tt>EGAGRAPH.CKS</tt> the can be found in the '''<tt>EGA</tt>''' folder. Likewise, a definitions file (<tt>ega.def</tt>) [[add ega.def to the package]] has been added to the setup. If additional files, such as graphics or sprites, are to be added to the game, the definitions file must be updated. The tool [[uGrab]] is used to read this definition file and import/export the changed or new files into/from the <tt>EGAGRAPH.CKS</tt> container.<br />
<br />
[[Image:Ega-Color-Palette.png|160px|thumb|EGA Color Palette]]<br />
To begin editing graphics and most texts found in the game, go to the '''<tt>EGA</tt>''' folder. You can edit any of the images how you want but must follow two rules: you must use the [[moddingwiki:EGA_Palette|original 16 EGA Keen colours]], and all images must have a width that is a multiple of 8 pixels.<br />
<br />
All the image, text, and other files within '''<tt>EGA</tt>''' are arranged in clusters by file type. The following table gives an overview of each file type, and you can can find a corresponding overview in the <tt>ega.def</tt> definitions file as well.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|CKS_ansi_*.bin<br />
|Final screen <br />
|''Appears after quitting the game.''<br />
|-<br />
|CKS_fon_*.bmp<br />
|Font sheets <br />
|''These fonts are used throughout the game.''<br />
|-<br />
|CKS_pic_*.bmp<br />
|Main menu and help section images<br />
|<br />
|-<br />
|CKS_sprite_*.bmp<br />
|Sprite images <br />
|<br />
|-<br />
|CKS_sprites.txt<br />
|Sprite definition text file<br />
|''Hitboxes and offset values are defined for each sprite.''<br />
|-<br />
|CKS_terminator_*<br />
|Terminator text sequence <br />
|''Appears at the games first start and leads to the title screen.''<br />
|-<br />
|CKS_tile8*.bmp<br />
|Drop-down menu Tilesets <br />
|''These tilesets contain numerous tiles. Each tile has a size of 8x8 pixel.''<br />
|-<br />
|CKS_tile16*.bmp<br />
|Fore- and Background-Tileset <br />
|''These tilesets contain numerous tiles. Each tile has a size of 16x16 pixel.''<br />
|-<br />
|CKS_txt*.txt<br />
|Text sheets<br />
|''Containing story element texts and help section information.''<br />
|-<br />
|CKS_txt_STARWARS.txt<br />
|Scrolling story text<br />
|''The so called Star Wars Story Screen.''<br />
|-<br />
|CKS_DEMO*.CKS<br />
|Demo recordings <br />
|<br />
|}<br />
<br />
== Import and Export Files ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
To import / export the files located in '''EGA''', use <tt>[[uGrab]]</tt>. <tt>uGrab</tt> is an advanced EGAGRAPH editor with a graphical user interface which can not only import / export graphics, but can also add, move or remove sprites in Commander Keen source mods. <br />
<br />
For <tt>uGrab</tt> to work, a definition file is required, which is already included within the Source Code Modding bundle. [[How to manually modify definition file]].<br />
<br />
To begin, open <tt>uGrab</tt> and go to <code>Import</code> and select <code>Import from bitmap folder...</code>. Locate the <tt>ega.def</tt> definition file in your project folder and open it. A dialog pops up that asks you to select the '''EGA''' folder. Do so and press <code>OK</code>. The graphics and text files have now been imported into <tt>uGrab</tt>. <br />
<br />
To import these files into the EGAGRAPH simply go to <code>Export</code> and select <code>Export as EGAGRAPH...</code>. In the following window locate <tt>EGAGRAPH.CKS</tt> file and press <code>Save</code>. <tt>uGrab</tt> will then ask you to select a Huffman Compression Type; choose <code>Best (Slowest)</code>. It will then ask if you want to update the definition file, which you should confirm. The new graphics and text files should now be exported into the game files.<br />
<br />
An alternative to running an instance of <tt>uGrab</tt> is through batch files. The modding package comes with two batch files which can be used to speed up and automate the import / export process significantly. Simply double-click <code>ega-in.bat</code> to import and double-click <code>ega-out.bat</code> to export all files. To learn more about how those batch files operate, simply open them with a text editor such as notepad.<br />
<br />
== Tilesets == <br />
<br />
You can edit tiles in the typical manner, however, the first row of tiles in the foreground tileset (<tt>CKS_tile16m</tt>) is generally reserved to render certain blocking elements. Those are used for debugging reasons and should stay untouched. <br />
<br />
[[Short note about tiles (16x16 pixel) for the novice modder]]<br />
<br />
[[Reminder: inserted corresponding graphics to the tile16m file for the final modding package.]]<br />
<br />
[[example image goes here.]]<br />
<br />
== Sprite Hitboxes ==<br />
<br />
Just like standard modding, <tt>CKS_sprites.txt</tt> is used for establishing Sprite hitboxes. Since we are dealing with a modified version of the source code, the last value in a <tt>CKS_sprites.txt</tt> entry, handling animation frame rate, must stay at 1. Otherwise there will be errors in the rendering. (Desired adjustments need to be taken in the source code)<br />
<br />
== Texts ==<br />
<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
Text files can be edited with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
They employ a formatting code:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting code<br />
! style="text-align:left;"| Description<br />
|-<br />
|<code>^P</code> <br />
|''Marks the beginning of a page.''<br />
|-<br />
|<code>^Gy,x,n</code> <br />
|''Displays a bitmap. The image number <tt>n</tt> used here doesn't match up with the image numbers in your EGA folder; [[OUTDATED? the image shown is the image number plus seven (n + 7)]]. The <tt>x,y</tt> are coordinates which determine where the image appears on the screen. The <tt>^G</tt> command can also use sprites and both types of 16x16 pixel tiles (TILE16 and TILE16M).''<br />
|-<br />
|<code>^Ly,x</code> <br />
|''Following text will be aligned beginning at pixel location <tt>x,y</tt>.''<br />
|-<br />
|<code>^Ty,x,n,t</code> <br />
|''After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap [[OUTDATED? (n + 7)]] at pixel location <tt>x,y</tt> on the screen.''<br />
|-<br />
|<code>^By,x,w,h,c</code> <br />
|''Fills the width-by-height-pixel rectangle at pixel location <tt>x,y</tt> with dimensions of <tt>w,h</tt> and the color <tt>c</tt>. <tt>c</tt> is the hexadecimal color digit, the rest are decimal digits. If the line ends before the parser can find a hex digit, the code will use the background color (for compatibility with Keen 4-6 texts).''<br />
|-<br />
|[[^Mxxx]]<br />
|''[[Starts playing music number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^MOxxx]]<br />
|''[[Plays the music track number]] <tt>xxx</tt> [[only once, without repeating.]]''<br />
|-<br />
|[[^MP]]<br />
|''[[Pauses the current running music track and allows to resume it later.]]''<br />
|-<br />
|[[^MR]]<br />
|''[[Resumes music paused by]] <tt>^MP</tt>.''<br />
|-<br />
|[[^Sxxx]]<br />
|''[[Plays sound number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^W]]<br />
|''[[Waits until the current sound is done (does not update the screen).]]''<br />
|-<br />
|[[^Dttt]]<br />
|''[[Waits]] <tt>ttt</tt> [[tics (screen will be updated)]]''<br />
|-<br />
|[[^Q]] <br />
|''[["quiet" - stops sounds and music.]]''<br />
|-<br />
|[[^H]]<br />
|''[[Shows the high scores in any of the help texts.]]''<br />
|-<br />
|<code>^E</code> <br />
|''Marks the end of the dialogue.''<br />
|}<br />
<br />
<br />
The specific codes for changing the color of text are:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:center;"| Description<br>.<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:middle;"| Description<br>.<br />
|-<br />
|<br />
|''<code>^Cx</code> changes the text to color <tt>x</tt>''<br />
|<br />
|''<code>x</code> = single hex digit: <tt>0-9</tt>, <tt>A-F</tt>''<br />
|-<br />
|<code>^CA</code> <br />
|<code style="background:#AA0000; color:#55FF55"><b>bright green text color </b></code><br />
|<code>^C2</code> <br />
|<code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
|-<br />
|<code>^CB</code> <br />
|<code style="background:#AA0000; color:#55FFFF"><b>bright cyan text color </b></code><br />
|<code>^C3</code> <br />
|<code style="background:#AA0000; color:#00AAAA"><b>cyan text color </b></code><br />
|-<br />
|<code>^CC</code> <br />
|<code style="background:#AA0000; color:#FF5555"><b>bright red text color </b></code><br />
|<code>^C4</code> <br />
|<code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
|-<br />
|<code>^CD</code> <br />
|<code style="background:#AA0000; color:#FF55FF"><b>bright magenta text color</b></code><br />
|<code>^C5</code> <br />
|<code style="background:#AA0000; color:#AA00AA"><b>magenta text color </b></code><br />
|-<br />
|<code>^CE</code> <br />
|<code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
|<code>^C6</code> <br />
|<code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
|-<br />
|<code>^C9</code> <br />
|<code style="background:#AA0000; color:#5555ff"><b>bright blue text color </b></code><br />
|<code>^C1</code> <br />
|<code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
|-<br />
|<code>^CF</code> <br />
|<code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
|<code>^C7</code> <br />
|<code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
|-<br />
|<code>^C8</code> <br />
|<code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
|<code>^C0</code> <br />
|<code style="background:#AA0000; color:#000000"><b>black text color </b></code><br />
|}<br />
<br />
== Other Texts ==<br />
<br />
Some editable texts, such as level entrance messages, are not found in files within the <tt>'''EGA'''</tt> folder and instead require using a text editor to modify specific source code files located in the <tt>'''../SOURCE/MAKESTR'''</tt> folder. To edit most text files that appear in game open up the <tt>MAKESTR.C</tt> file with a text editor. This file contains Level Names, Level Entrance Texts, In-Game Messages and related texts. <br />
<br />
After editing these files, the game must be recompiled in order to integrate the changes. We'll get to the [[compiling process]] later.<br />
<br />
<br />
== Loading Window ==<br />
<br />
<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
<br />
KeenScr, in combination with TheDraw, is used for editing the loading and closing screen graphics.<br />
<br />
[[Where to find the loading screen files, copy it to keenscr folder]] <br />
<br />
Go to commander prompt and navigate to your <tt>keenscr</tt> folder and then type: <br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will immediately start editing the screen, with the filename keenscr.bin. <br />
<br />
<code>Alt</code>+<code>H</code> will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename [[keenscr.bin]]. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
[[files must be copied back to origin folder. Does this require uGrab or a recompile?]] <br />
<br />
<br />
<br />
<br />
<br />
== Adding Additional Graphics and Text Files ==<br />
Unlike standard Keen Galaxy modding, the number of text and graphics files can be expanded or rearranged in source modding. <br />
<br />
For any additions it is required to edit the the uGrab definitions file, Abiathar's *.adeps definitions file, and GRAPHCKS.H. These files categorize the EGAGRAPH into sections of chunk types (such as bitmaps, sprites, tiles), provide the total number of chunks within a chunk section (such as the total sprite images, or total number of tiles), and include a running total chunk number used for identifying where the chunk sections begin. [[What is the tablestart?]] Whenever chunks are added to a chunk section, the running total value must be updated for all subsequent entries. For example, if 100 sprite images are added, the number of sprites is changed from the default 397 to 497, then the subsequent entry for TILE8 must be updated to 621, TILE8M to 622, and so on. <br />
<br />
Here is the default EGAGRAPH structure: <br />
<br />
<pre><br />
CHUNKS 4751<br />
FONT 3 3 #num, start<br />
FONTM 0 6<br />
PICS 115 6 0 #num, start, tablestart<br />
PICM 3 121 1<br />
SPRITES 397 124 2<br />
TILE8 104 521<br />
TILE8M 20 522<br />
TILE16 1296 523<br />
TILE16M 2916 1819<br />
TILE32 0 4735<br />
TILE32M 0 4735<br />
<br />
B800TEXT 4735 endgame<br />
TERMINATOR 4736 commander<br />
TERMINATOR 4737 keen<br />
B800TEXT 4738 outofmem<br />
<br />
TEXT 4739 helpart1<br />
TEXT 4740 helpart2<br />
TEXT 4741 helpart3<br />
TEXT 4742 helpart4<br />
TEXT 4743 endart<br />
TEXT 4744 demoart<br />
TEXT 4745 helpart5<br />
<br />
DEMO 4746 0<br />
DEMO 4747 1<br />
DEMO 4748 2<br />
DEMO 4749 3<br />
DEMO 4750 4<br />
</pre><br />
<br />
Here is a brief description of each chunk section:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Chunk Category<br />
! style="text-align:left;"| Description<br />
|-<br />
|FONT <br />
|''.''<br />
|-<br />
|FONTM <br />
|''.''<br />
|-<br />
|PICS <br />
|''These are the image files that can be accessed by the text files.''<br />
|-<br />
|PICSM <br />
|''.''<br />
|-<br />
|SPRITES <br />
|''These are the sprite animation frames.''<br />
|-<br />
|TILE8<br />
|''.''<br />
|-<br />
|TILE8M<br />
|''.''<br />
|-<br />
|TILE16<br />
|''These are the background tiles.''<br />
|-<br />
|TILE16M<br />
|''These are the foreground tiles.''<br />
|-<br />
|TILE32<br />
|''.''<br />
|-<br />
|TILE32M<br />
|''.''<br />
|-<br />
|B800TEXT<br />
|''.''<br />
|-<br />
|TERMINATOR <br />
|''.''<br />
|-<br />
|TEXT <br />
|''These are the text files for the F1 sections and the end game sequence.''<br />
|-<br />
|DEMO <br />
|''These are the recorded demo files.''<br />
|}<br />
<br />
=== Adding Bitmaps Example ===<br />
<br />
Create an image file and save it as the next image in the sequence of bitmap images found in your EGA folder. By default this would be [[default next image file name]].<br />
<br />
Update the uGrab definitions file, Abiathar's *.adeps definitions file, and GRAPHCKS.H to reflect that there is one additional bitmap image: PICS is updated from 115 to 116, PICM's running total is updated from 121 to 122, and so on for the running totals of all remaining chunk sections.<br />
<br />
=== Adding Sprites Example ===<br />
<br />
Create a series of image files and save them as the next images in the sequence of existing sprite images found in your EGA folder. By default this would begin with [[default next sprite file name]].<br />
<br />
Update the uGrab definitions file, Abiathar's *.adeps definitions file, and GRAPHCKS.H to reflect that there are additional sprites image, remembering to update the running total values for the subsequent chunk sections.<br />
<br />
=== Adding Tiles Example ===<br />
<br />
Modify [[tileset file name]] from your EGA folder to include an additional row of tiles by changing the canvas size. One row is equal to [[number of tiles]].<br />
<br />
Update the uGrab definitions file, Abiathar's *.adeps definitions file, and GRAPHCKS.H to reflect that there are additional tile chunks (one row equates to [[number of chunks]], remembering to update the running total values for the subsequent chunk sections.<br />
<br />
= Level Editing (MAPHEAD) =<br />
<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
<br />
Open Abiathar and go to <code>File</code> and select <code>Open Project</code>. Within your projects folder you should find a dependency file called <tt>maps.adeps</tt> which you want to choose. This is your pre-setup from where you can start building levels.<br />
<br />
To store modifications press <code>Save</code> under <code>File</code>. The settings for the levels will be written to the <tt>maps.adeps</tt> file, which only contains references and pointers to the real resources files, but doesn’t store any level data on their own. <br />
<br />
Closing Abiathar for the first time, quite a few settings will get saved to the <tt>editor.aconf</tt> config file. Those settings are loaded when Abiathar starts.<br />
<br />
For basic usage, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Using_Abiathar| using Abiathar section] of the patched based modding tutorial.<br />
<br />
== Memory & Technical Limitations ==<br />
<br />
Each level must not exceed 64KiB: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about.<br />
<br />
The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
The greater the variety of tiles used, the more memory is used; each foreground tile consumes 128 bytes, whereas each background tile consumes 160 bytes.<br />
<br />
There is a maximum of 50 sprites visible on-screen at the same time, but not limit for the level as a whole. Each Sprite in the refresh manager is 50 bytes. This is calculated by taking the sprite list entry (34 bytes for each sprite), and adding the erase list entry multiplied by two due to double buffering <code>(8*2=16)</code>; thus: <code>34 + 8 * 2 = 50 bytes</code> per Sprite. The number of Sprites that are in use can be checked using the <code>F10+C</code> cheat code in game.<br />
<br />
Sprites may be placed on top of animating tiles, but a foreground animating tile may not be placed on an animating background tile.<br />
<br />
There is a maximum of 100 different tile animation sequences and 100 animated tiles visible on-screen at the same time.<br />
<br />
The song played during the level will contribute toward the overall byte size of the level.<br />
<br />
In general, when it comes to level design, compromises may need to be made for memory purposes. For example, if you want to use a lot of different graphics in a level then you might have to make the level smaller or use a music track with a smaller file size so the game doesn't run out of memory.<br />
<br />
= Tile Properties = <br />
<br />
[[what is the saving process/files involved]]<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. Consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Changing_Tile_Properties| tile properties section] of the patch based modding tutorial for further instructions.<br />
<br />
<br />
= Music and Sounds (AUDIOT) = <br />
<br />
To alter music and sounds, this chapter will discuss the following files and folders: <tt>AUDIOT.CKS, AUDIOHED.CKS, AUDIO, audio.asnds, Abiathar, MIDI2IMF, IMFCrush, WDC.</tt><br />
<br />
The <tt>AUDIOT.CKS</tt> file functions as a container that stores compressed sub files individually called chunks. Chunks in this container include AdLib music (<tt>*.IMF, *.KMF</tt>), AdLib sound effects (<tt>*AL.SND</tt>) and PC Speaker sound effects (<tt>*PC.SND</tt>). <br />
<br />
The <tt>AUDIOT.CKS</tt> file requires an associated <tt>AUDIOHED.CKS</tt> file which stores the offset location of each each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/AudioT_Format AudioT_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted music and sound files from <tt>AUDIOT.CKS</tt> that can be found in the '''<tt>AUDIO</tt>''' folder. Likewise, a configuration file (<tt>audio.asnds</tt>) [[add audio.asnds to the package]] has been added to the setup. If additional files, such as sound effects or music, are to be added to the game, the configuration file must be updated. The tool [[Abiathar]] is used to read this configuration file and import/export the changed or new files into/from the <tt>AUDIOT.CKS</tt> container.<br />
<br />
== Brief introduction into music and sound ==<br />
<br />
=== PC Sounds ===<br />
<br />
=== AdLib Sounds ===<br />
<br />
=== IMF / KMF Music ===<br />
<br />
IMF/KMF format files are packed at the end of the audio file. As IMF/KMF files contain AdLib music for games that also have AdLib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict. This is done by reserving the OPL's first channel for sound effects, leaving eight remaining channels available for use in IMF files. <br />
<br />
[[more info about this procedure needed]]<br />
<br />
It is advised to perform optimizations on existing IMF files. [[IMFCrush]] removes by default everything that drives the first AdLib/OPL channel. Generally the original IMF file is reduced by roundabout a third by converting to KMF. The reduction depends entirely on the contents of the source file. <br />
(Side note: IMFCrush is also capable of converting songs to a different playback rate, or even truncate songs.)<br />
<br />
== Music Composition ==<br />
<br />
For tips on music composition as well as the conversion process to the IMF format, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Music| music section] of the patch based modding tutorial.<br />
<br />
== Sound Effect Composition ==<br />
<br />
[[create a pre-defined setup that can be downloaded as well to shortcut things and bypass source code incompatibilities WDC has!]]<br />
<br />
WDC is an older modding tool that contains a sound effect design tool. For instructions on how to access and use this tool, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Sound_Effects| sound effects section] of the patch based modding tutorial.<br />
<br />
== Abiathar Setup and Usage == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
[[Image:Abiathar audio-mappings.png |320px|thumb|Abiathar's Audio Mappings tool]]<br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select [[the option to select]]. <br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format).<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
=== Abiathar Configuration File ===<br />
<br />
Abiathar uses <tt>audio.asnds</tt> for importing and exporting the sound and music files. It contains an entry for each song and music file in a certain format.<br />
<br />
A pc speaker sound looks like: <br />
<br />
<code>?046|PC|?046PC.SND|50 </code><br />
<br />
The first part of this entry indicates the offset location of the sound. Next, <code>PC</code> indicates [[???]]. Next is the sound file that will be used at this offset. The last digit defines the sound effect's priority; since the engine can only play one sound effect at a time this number tells it which sound has priority to play. Values can be from 00 to 99 with the higher numbers being higher priority. <br />
<br />
An AdLib sound looks like: <br />
<br />
<code>?098|PC|?098AL.SND|50|6|1,48,79,0,240,96,255,1,0,0,0,0,0 </code><br />
<br />
As you can see, this entry begins in the same manner as a PC speaker sound, right up to the priority value. The additional numbers that occur after are instrument information that can be ignored (the source engine does not actually use these values), however, Abiathar requires placeholder numbers to be included (any values will do). <br />
<br />
[[example of Music entries]]<br />
<br />
=== Additional Music and Sound Effects ===<br />
<br />
Sound effects and music must occur sequentially in the numbered list found in <tt>'''audio.asnds'''</tt>. Beginning with PC speaker sounds, additional sounds must appear after the last PC speaker sound. Then existing AdLib sound entries must be shifted up the numbered list by the number of PC speaker sounds added, followed by additional entries corresponding to the number of new AdLib sounds. The number of of PC spaker sounds and Adlib sounds must equal each other. Lastly, music is shifted up the numbered list by the required amount. The result is a consistent numbered list of pc speaker sounds, AdLib sounds, and music files.<br />
<br />
This process requires a lot of relabeling files, detailed modification to <tt>'''audio.asnds'''</tt>, importing with Abiathar, and modification to and recompiling the source code. With that in mind, it is highly recommended to import all additional sound effects at one time (using placeholders if necessary), to avoid repeatedly having to reorder files and filenames. Adding new music is a similar process, but because the music cluster of chunks appears last in <tt>'''AUDIOT.CKS'''</tt>, it is a simpler task requiring less forethought.<br />
<br />
==== Adding Sound Effects ====<br />
<br />
Begin the process by naming your PC speaker sound effects so that they occur after the final existing PC speaker sound in your '''AUDIO''' folder.<br />
<br />
Next, all AdLib sounds must be renamed so that their numbered order begins after the new final PC speaker sound. [[Automating this process?]]<br />
<br />
Next, your new AdLib sounds should be renamed to occur after the newly ordered final existing AdLib sound. <br />
<br />
Next, all music files must be renamed so that their numbered order begins after the new final AdLib sound.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified in the same manner that the files were renamed: PC speaker sound entries added, Adlib entries renumbered, Adlib entries added, and music entries renumbered.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, and <tt>NUMSNDCHUNKS</tt> to two times the value of <tt>NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
==== Adding Music ====<br />
<br />
Begin by naming your songs so that they occur after the final existing music files in your '''AUDIO''' folder.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified with music entries added for the new songs.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, <tt>NUMMUSIC</tt> to the number of songs, and <tt>NUMSNDCHUNKS</tt> to two times the value of NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
= Source Code Editing =<br />
<br />
Because source code modding provides endless possibilities, only limited by a modder's programming ability, this section will only introduce the most basic steps involved in some fundamental modifications that a modder might want when creating a 'typical' Commander Keen mod. <br />
<br />
[[How to add additional levels]]<br />
<br />
[[How to modify a creature's behavior]]<br />
<br />
[[How to create a new enemy actor]]<br />
<br />
[[How to create a new tile property]]<br />
<br />
<br />
= Compiling the Source Code =<br />
<br />
[[Image:Borland C source code compiling 01.png |320px|thumb|Working with Borland C++ v3.1]]<br />
<br />
[[Image:Borland C source code compiling 02.png |320px|thumb|Compiling, error message]]<br />
<br />
[[Introduction into Borland C++ v.3.1]]<br />
<br />
= Credits For This Tutorial =<br />
<br />
* Written and assembled by [[User:Ceilick|Ceilick]] and [[User:Nisaba|Nisaba]]<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(source_code_based)&diff=46304Keen Galaxy Modding Tutorial (source code based)2022-10-17T21:36:13Z<p>Ceilick: /* Adding Additional Graphics and Text Files */</p>
<hr />
<div>{{Alert|'''This page is still under construction!'''}}<br />
<br />
This tutorial aims to teach [[Keen:Galaxy Source Modding Package|Keen:Galaxy Source Mod]] modding in terms of what is different from modding without source code. It will primarily cover tool usage and the new options provided by the supplied source code package and its modification. Creating a full source mod requires some basic coding knowledge that this tutorial will not cover, but it will explain where and what needs to be coded and provide limited code examples for common tasks and features. <br />
<br />
For general, introductory Keen Galaxy modding information not covered here, please consult the [[Keen Galaxy Modding Tutorial (patch based)|patch based Keen Galaxy Modding Tutorial]]. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft</tt> <tt>Windows</tt> s based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Downlad the core [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen:Galaxy Source Modding Package]. This bundle contains a source code package with a number of pre-setup tools and files. Make sure to extract all files and keep the pre-defined folder structure. To facilitate modding, this package contains all resources present in their decompressed format.<br />
<br />
== Tools ==<br />
<br />
This is the complete list of tools used for source modding:<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|''Version 2.11.4 Beta 1 or higher is required'' <br />
|-<br />
|[[Borland C++ Compiler]]<br />
|Source Code Compiler <br />
|''Borland 3.1 is used to compile the code; a Borland 3.1 project file ([[SRCMOD.PRJ]]) has been included for this purpose. Borland compilers can be invoked in a 16-bit DOS environment (e.g., DOSBox v0.74 has been successfully used).''<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro Graphic Text Editor <br />
|<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.''<br />
|-<br />
|[[TliExtend]]<br />
|Tileinfo Extension <br />
|''This tool is a command line based tileinfo extension utility for Abiathar.''<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|''Functions as an <tt>EGAGRAPH.CKS</tt> editor. Two batch files are included for easy import and export of graphics.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.''<br />
|<br />
|}<br />
<br />
== Modding Package ==<br />
<br />
The modding package contains, amongst others, the following folders:<br />
<br />
=== Base Folder Name ===<br />
<br />
This folder contains the following files:<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|audio.asnds<br />
|Abiathar definition file for audio.<br />
|''This can be modified in a text editor for adding additional music and sound effects to AUDIOHED.CKS.''<br />
|-<br />
|AUDIOHED.CKS<br />
|Container file for audio chunks/files.<br />
|<br />
|-<br />
|AUDIOT.CKS<br />
|Audio location pointers for AUDIOHED.CKS.<br />
|<br />
|-<br />
|ega.def<br />
|UGrab definition file for graphics and text. <br />
|''This can be modified in a text editor for adding additional graphics and texts to EGAGRAPH.CKS.''<br />
|-<br />
|EGAGRAPH.CKS<br />
|Container file for graphics and text chunks/files.<br />
|<br />
|-<br />
|EGAHEAD.CKS<br />
|Graphics and text location pointers for EGAGRAPH.CKS.<br />
|<br />
|-<br />
|EGAINFO.BMP<br />
|Graphic for infoplane.<br />
|<br />
|-<br />
|ega-in.bat<br />
|Batch script to import graphics and text.<br />
|<br />
|-<br />
|ega-out.bat<br />
|Batch script to export graphics and text.<br />
|<br />
|-<br />
|MAPHEAD.CKS<br />
|Container file which stores levels.<br />
|<br />
|-<br />
|maps.adep<br />
|Abiathar definition file for levels.<br />
|<br />
|-<br />
|MAPTEMP.CKS<br />
|Level location pointers for MAPHEAD.CKS and tile properties.<br />
|<br />
|-<br />
|SRCMOD.EXE<br />
|Game executable. <br />
|<br />
|}<br />
<br />
=== AUDIO ===<br />
<br />
This folder contains the music and sound effect files in their decompressed format. Compressed, these are stored in the <tt>AUDIOT.CKS</tt> container file.<br />
<br />
=== EGA ===<br />
<br />
This folder contains mainly graphic and text files in their decompressed format. Compressed, these are stored in the <tt>EGAGRAPH.CKS</tt> container file. <br />
<br />
=== SOURCE ===<br />
<br />
This folder contains everything source code related written in the high-level language <tt>C/C++</tt>. <tt>SRCMOD.EXE</tt> is the compiled executable.<br />
<br />
= Engine Information = <br />
<br />
In contrast to classic modding via patches, working with the source code allows much more freedom. Nevertheless, there are some limitations that must be taken into account.<br />
<br />
For several reasons DOS only allows a maximum amount of 640KiB of memory available to programs. Therefore DOS (and maybe some drivers) as well as the game program and most of the game data (levels, music, graphics) must fit into these 640KiB.<br />
<br />
The game engine organizes certain segments into memory blocks with an upper limit of 64KiB. This means that the number of music tracks, sprites and tiles is limited to a certain degree. Realistically music and levels are the only parts (besides, perhaps, the sprite info block) where the 64KiB limit could be problematic.<br />
<br />
Here are some basic limitations:<br />
<br />
*<u><tt>Audio</tt></u>: each sound and each piece of music must not be larger than 64KiB.<br />
<br />
*<u><tt>Levels</tt></u>: also referred to as map-planes, each of these must not exceed 64KiB. For details, see the below section on [[Keen Source Mod Modding Tutorial#Memory_.26_Technical_Limitations|level limitations]].<br />
<br />
*<u><tt>Tilesets</tt></u>: There is no concrete upper limit for the number of tiles a tileset can have. The only requirement is that the MAPHEAD and EGAHEAD must be smaller than 64KiB each in order to be loaded into memory correctly. (Theoretically a little more than 7,200 tiles per tileset are allowed.)<br />
<br />
*<u><tt>Sprites:</tt></u> The maximum number of sprites in the EGAGRAPH file is limited to 3640. If more sprites are inserted, then the data block with the sprite info (width, height, hitbox, shifts, etc.) will be larger than 64KiB.<br />
<br />
'''Note''': Some of this is not set in stone. In ID_RF.H some of these values can be adjusted, but this would then consume more memory.<br />
<br />
<!--<br />
== EGAHEAD ==<br />
<br />
[[Information on the EGAHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
<br />
== MAPHEAD ==<br />
<br />
[[Information on the MAPHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
--><br />
<br />
= Graphics and Texts (EGAGRAPH) =<br />
<br />
The <tt>EGAGRAPH.CKS</tt> file (aslo called the EGA graphics library) functions as a container the stores compressed sub files which are individually called chunks. Chunks in this container include all graphics, demos, fonts, sprites, tiles, texts and other game files. <br />
<br />
The <tt>EGAHEAD.CKS</tt> file contains information about the size of the <tt>EGAGRAPH.CKS</tt> file and the offset location of each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/EGAGraph_Format EGAGraph_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted graphics and text files from <tt>EGAGRAPH.CKS</tt> the can be found in the '''<tt>EGA</tt>''' folder. Likewise, a definitions file (<tt>ega.def</tt>) [[add ega.def to the package]] has been added to the setup. If additional files, such as graphics or sprites, are to be added to the game, the definitions file must be updated. The tool [[uGrab]] is used to read this definition file and import/export the changed or new files into/from the <tt>EGAGRAPH.CKS</tt> container.<br />
<br />
[[Image:Ega-Color-Palette.png|160px|thumb|EGA Color Palette]]<br />
To begin editing graphics and most texts found in the game, go to the '''<tt>EGA</tt>''' folder. You can edit any of the images how you want but must follow two rules: you must use the [[moddingwiki:EGA_Palette|original 16 EGA Keen colours]], and all images must have a width that is a multiple of 8 pixels.<br />
<br />
All the image, text, and other files within '''<tt>EGA</tt>''' are arranged in clusters by file type. The following table gives an overview of each file type, and you can can find a corresponding overview in the <tt>ega.def</tt> definitions file as well.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|CKS_ansi_*.bin<br />
|Final screen <br />
|''Appears after quitting the game.''<br />
|-<br />
|CKS_fon_*.bmp<br />
|Font sheets <br />
|''These fonts are used throughout the game.''<br />
|-<br />
|CKS_pic_*.bmp<br />
|Main menu and help section images<br />
|<br />
|-<br />
|CKS_sprite_*.bmp<br />
|Sprite images <br />
|<br />
|-<br />
|CKS_sprites.txt<br />
|Sprite definition text file<br />
|''Hitboxes and offset values are defined for each sprite.''<br />
|-<br />
|CKS_terminator_*<br />
|Terminator text sequence <br />
|''Appears at the games first start and leads to the title screen.''<br />
|-<br />
|CKS_tile8*.bmp<br />
|Drop-down menu Tilesets <br />
|''These tilesets contain numerous tiles. Each tile has a size of 8x8 pixel.''<br />
|-<br />
|CKS_tile16*.bmp<br />
|Fore- and Background-Tileset <br />
|''These tilesets contain numerous tiles. Each tile has a size of 16x16 pixel.''<br />
|-<br />
|CKS_txt*.txt<br />
|Text sheets<br />
|''Containing story element texts and help section information.''<br />
|-<br />
|CKS_txt_STARWARS.txt<br />
|Scrolling story text<br />
|''The so called Star Wars Story Screen.''<br />
|-<br />
|CKS_DEMO*.CKS<br />
|Demo recordings <br />
|<br />
|}<br />
<br />
== Import and Export Files ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
To import / export the files located in '''EGA''', use <tt>[[uGrab]]</tt>. <tt>uGrab</tt> is an advanced EGAGRAPH editor with a graphical user interface which can not only import / export graphics, but can also add, move or remove sprites in Commander Keen source mods. <br />
<br />
For <tt>uGrab</tt> to work, a definition file is required, which is already included within the Source Code Modding bundle. [[How to manually modify definition file]].<br />
<br />
To begin, open <tt>uGrab</tt> and go to <code>Import</code> and select <code>Import from bitmap folder...</code>. Locate the <tt>ega.def</tt> definition file in your project folder and open it. A dialog pops up that asks you to select the '''EGA''' folder. Do so and press <code>OK</code>. The graphics and text files have now been imported into <tt>uGrab</tt>. <br />
<br />
To import these files into the EGAGRAPH simply go to <code>Export</code> and select <code>Export as EGAGRAPH...</code>. In the following window locate <tt>EGAGRAPH.CKS</tt> file and press <code>Save</code>. <tt>uGrab</tt> will then ask you to select a Huffman Compression Type; choose <code>Best (Slowest)</code>. It will then ask if you want to update the definition file, which you should confirm. The new graphics and text files should now be exported into the game files.<br />
<br />
An alternative to running an instance of <tt>uGrab</tt> is through batch files. The modding package comes with two batch files which can be used to speed up and automate the import / export process significantly. Simply double-click <code>ega-in.bat</code> to import and double-click <code>ega-out.bat</code> to export all files. To learn more about how those batch files operate, simply open them with a text editor such as notepad.<br />
<br />
== Tilesets == <br />
<br />
You can edit tiles in the typical manner, however, the first row of tiles in the foreground tileset (<tt>CKS_tile16m</tt>) is generally reserved to render certain blocking elements. Those are used for debugging reasons and should stay untouched. <br />
<br />
[[Short note about tiles (16x16 pixel) for the novice modder]]<br />
<br />
[[Reminder: inserted corresponding graphics to the tile16m file for the final modding package.]]<br />
<br />
[[example image goes here.]]<br />
<br />
== Sprite Hitboxes ==<br />
<br />
Just like standard modding, <tt>CKS_sprites.txt</tt> is used for establishing Sprite hitboxes. Since we are dealing with a modified version of the source code, the last value in a <tt>CKS_sprites.txt</tt> entry, handling animation frame rate, must stay at 1. Otherwise there will be errors in the rendering. (Desired adjustments need to be taken in the source code)<br />
<br />
== Texts ==<br />
<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
Text files can be edited with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
They employ a formatting code:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting code<br />
! style="text-align:left;"| Description<br />
|-<br />
|<code>^P</code> <br />
|''Marks the beginning of a page.''<br />
|-<br />
|<code>^Gy,x,n</code> <br />
|''Displays a bitmap. The image number <tt>n</tt> used here doesn't match up with the image numbers in your EGA folder; [[OUTDATED? the image shown is the image number plus seven (n + 7)]]. The <tt>x,y</tt> are coordinates which determine where the image appears on the screen. The <tt>^G</tt> command can also use sprites and both types of 16x16 pixel tiles (TILE16 and TILE16M).''<br />
|-<br />
|<code>^Ly,x</code> <br />
|''Following text will be aligned beginning at pixel location <tt>x,y</tt>.''<br />
|-<br />
|<code>^Ty,x,n,t</code> <br />
|''After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap [[OUTDATED? (n + 7)]] at pixel location <tt>x,y</tt> on the screen.''<br />
|-<br />
|<code>^By,x,w,h,c</code> <br />
|''Fills the width-by-height-pixel rectangle at pixel location <tt>x,y</tt> with dimensions of <tt>w,h</tt> and the color <tt>c</tt>. <tt>c</tt> is the hexadecimal color digit, the rest are decimal digits. If the line ends before the parser can find a hex digit, the code will use the background color (for compatibility with Keen 4-6 texts).''<br />
|-<br />
|[[^Mxxx]]<br />
|''[[Starts playing music number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^MOxxx]]<br />
|''[[Plays the music track number]] <tt>xxx</tt> [[only once, without repeating.]]''<br />
|-<br />
|[[^MP]]<br />
|''[[Pauses the current running music track and allows to resume it later.]]''<br />
|-<br />
|[[^MR]]<br />
|''[[Resumes music paused by]] <tt>^MP</tt>.''<br />
|-<br />
|[[^Sxxx]]<br />
|''[[Plays sound number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^W]]<br />
|''[[Waits until the current sound is done (does not update the screen).]]''<br />
|-<br />
|[[^Dttt]]<br />
|''[[Waits]] <tt>ttt</tt> [[tics (screen will be updated)]]''<br />
|-<br />
|[[^Q]] <br />
|''[["quiet" - stops sounds and music.]]''<br />
|-<br />
|[[^H]]<br />
|''[[Shows the high scores in any of the help texts.]]''<br />
|-<br />
|<code>^E</code> <br />
|''Marks the end of the dialogue.''<br />
|}<br />
<br />
<br />
The specific codes for changing the color of text are:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:center;"| Description<br>.<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:middle;"| Description<br>.<br />
|-<br />
|<br />
|''<code>^Cx</code> changes the text to color <tt>x</tt>''<br />
|<br />
|''<code>x</code> = single hex digit: <tt>0-9</tt>, <tt>A-F</tt>''<br />
|-<br />
|<code>^CA</code> <br />
|<code style="background:#AA0000; color:#55FF55"><b>bright green text color </b></code><br />
|<code>^C2</code> <br />
|<code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
|-<br />
|<code>^CB</code> <br />
|<code style="background:#AA0000; color:#55FFFF"><b>bright cyan text color </b></code><br />
|<code>^C3</code> <br />
|<code style="background:#AA0000; color:#00AAAA"><b>cyan text color </b></code><br />
|-<br />
|<code>^CC</code> <br />
|<code style="background:#AA0000; color:#FF5555"><b>bright red text color </b></code><br />
|<code>^C4</code> <br />
|<code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
|-<br />
|<code>^CD</code> <br />
|<code style="background:#AA0000; color:#FF55FF"><b>bright magenta text color</b></code><br />
|<code>^C5</code> <br />
|<code style="background:#AA0000; color:#AA00AA"><b>magenta text color </b></code><br />
|-<br />
|<code>^CE</code> <br />
|<code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
|<code>^C6</code> <br />
|<code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
|-<br />
|<code>^C9</code> <br />
|<code style="background:#AA0000; color:#5555ff"><b>bright blue text color </b></code><br />
|<code>^C1</code> <br />
|<code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
|-<br />
|<code>^CF</code> <br />
|<code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
|<code>^C7</code> <br />
|<code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
|-<br />
|<code>^C8</code> <br />
|<code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
|<code>^C0</code> <br />
|<code style="background:#AA0000; color:#000000"><b>black text color </b></code><br />
|}<br />
<br />
== Other Texts ==<br />
<br />
Some editable texts, such as level entrance messages, are not found in files within the <tt>'''EGA'''</tt> folder and instead require using a text editor to modify specific source code files located in the <tt>'''../SOURCE/MAKESTR'''</tt> folder. To edit most text files that appear in game open up the <tt>MAKESTR.C</tt> file with a text editor. This file contains Level Names, Level Entrance Texts, In-Game Messages and related texts. <br />
<br />
After editing these files, the game must be recompiled in order to integrate the changes. We'll get to the [[compiling process]] later.<br />
<br />
<br />
== Loading Window ==<br />
<br />
<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
<br />
KeenScr, in combination with TheDraw, is used for editing the loading and closing screen graphics.<br />
<br />
[[Where to find the loading screen files, copy it to keenscr folder]] <br />
<br />
Go to commander prompt and navigate to your <tt>keenscr</tt> folder and then type: <br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will immediately start editing the screen, with the filename keenscr.bin. <br />
<br />
<code>Alt</code>+<code>H</code> will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename [[keenscr.bin]]. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
[[files must be copied back to origin folder. Does this require uGrab or a recompile?]] <br />
<br />
<br />
<br />
<br />
<br />
== Adding Additional Graphics and Text Files ==<br />
Unlike standard Keen Galaxy modding, the number of text and graphics files can be expanded or rearranged in source modding. <br />
<br />
For any additions it is required to edit the the uGrab definitions file, Abiathar's *.adeps definitions file, and GRAPHCKS.H. These files categorize the EGAGRAPH into sections of chunk types (such as bitmaps, sprites, tiles), provide the total number of chunks within a chunk section (such as the total sprite images, or total number of tiles), and include a running total chunk number used for identifying where the chunk sections begin. [[What is the tablestart?]] Whenever chunks are added to a chunk section, the running total value must be updated for all subsequent entries. For example, if 100 sprite images are added, the number of sprites is changed from the default 397 to 497, then the subsequent entry for TILE8 must be updated to 621, TILE8M to 622, and so on. <br />
<br />
Here is the default EGAGRAPH structure: <br />
<br />
<pre><br />
CHUNKS 4751<br />
FONT 3 3 #num, start<br />
FONTM 0 6<br />
PICS 115 6 0 #num, start, tablestart<br />
PICM 3 121 1<br />
SPRITES 397 124 2<br />
TILE8 104 521<br />
TILE8M 20 522<br />
TILE16 1296 523<br />
TILE16M 2916 1819<br />
TILE32 0 4735<br />
TILE32M 0 4735<br />
<br />
B800TEXT 4735 endgame<br />
TERMINATOR 4736 commander<br />
TERMINATOR 4737 keen<br />
B800TEXT 4738 outofmem<br />
<br />
TEXT 4739 helpart1<br />
TEXT 4740 helpart2<br />
TEXT 4741 helpart3<br />
TEXT 4742 helpart4<br />
TEXT 4743 endart<br />
TEXT 4744 demoart<br />
TEXT 4745 helpart5<br />
<br />
DEMO 4746 0<br />
DEMO 4747 1<br />
DEMO 4748 2<br />
DEMO 4749 3<br />
DEMO 4750 4<br />
</pre><br />
<br />
Here is a brief description of each chunk section:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Chunk Category<br />
! style="text-align:left;"| Description<br />
|-<br />
|FONT <br />
|''.''<br />
|-<br />
|FONTM <br />
|''.''<br />
|-<br />
|PICS <br />
|''These are the image files that can be accessed by the text files.''<br />
|-<br />
|PICSM <br />
|''.''<br />
|-<br />
|SPRITES <br />
|''These are the sprite animation frames.''<br />
|-<br />
|TILE8<br />
|''.''<br />
|-<br />
|TILE8M<br />
|''.''<br />
|-<br />
|TILE16<br />
|''.''<br />
|-<br />
|TILE16M<br />
|''.''<br />
|-<br />
|TILE32<br />
|''.''<br />
|-<br />
|TILE32M<br />
|''.''<br />
|-<br />
|B800TEXT<br />
|''.''<br />
|-<br />
|TERMINATOR <br />
|''.''<br />
|-<br />
|TEXT <br />
|''These are the text files for the F1 sections and the end game sequence.''<br />
|-<br />
|DEMO <br />
|''These are the recorded demo files.''<br />
|}<br />
<br />
=== Adding Bitmaps Example ===<br />
<br />
Create an image file and save it as the next image in the sequence of bitmap images found in your EGA folder. By default this would be [[default next image file name]].<br />
<br />
Update the uGrab definitions file, Abiathar's *.adeps definitions file, and GRAPHCKS.H to reflect that there is one additional bitmap image: PICS is updated from 115 to 116, PICM's running total is updated from 121 to 122, and so on for the running totals of all remaining chunk sections.<br />
<br />
=== Adding Sprites Example ===<br />
<br />
Create a series of image files and save them as the next images in the sequence of existing sprite images found in your EGA folder. By default this would begin with [[default next sprite file name]].<br />
<br />
Update the uGrab definitions file, Abiathar's *.adeps definitions file, and GRAPHCKS.H to reflect that there are additional sprites image, remembering to update the running total values for the subsequent chunk sections.<br />
<br />
=== Adding Tiles Example ===<br />
<br />
Modify [[tileset file name]] from your EGA folder to include an additional row of tiles by changing the canvas size. One row is equal to [[number of tiles]].<br />
<br />
Update the uGrab definitions file, Abiathar's *.adeps definitions file, and GRAPHCKS.H to reflect that there are additional tile chunks (one row equates to [[number of chunks]], remembering to update the running total values for the subsequent chunk sections.<br />
<br />
= Level Editing (MAPHEAD) =<br />
<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
<br />
Open Abiathar and go to <code>File</code> and select <code>Open Project</code>. Within your projects folder you should find a dependency file called <tt>maps.adeps</tt> which you want to choose. This is your pre-setup from where you can start building levels.<br />
<br />
To store modifications press <code>Save</code> under <code>File</code>. The settings for the levels will be written to the <tt>maps.adeps</tt> file, which only contains references and pointers to the real resources files, but doesn’t store any level data on their own. <br />
<br />
Closing Abiathar for the first time, quite a few settings will get saved to the <tt>editor.aconf</tt> config file. Those settings are loaded when Abiathar starts.<br />
<br />
For basic usage, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Using_Abiathar| using Abiathar section] of the patched based modding tutorial.<br />
<br />
== Memory & Technical Limitations ==<br />
<br />
Each level must not exceed 64KiB: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about.<br />
<br />
The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
The greater the variety of tiles used, the more memory is used; each foreground tile consumes 128 bytes, whereas each background tile consumes 160 bytes.<br />
<br />
There is a maximum of 50 sprites visible on-screen at the same time, but not limit for the level as a whole. Each Sprite in the refresh manager is 50 bytes. This is calculated by taking the sprite list entry (34 bytes for each sprite), and adding the erase list entry multiplied by two due to double buffering <code>(8*2=16)</code>; thus: <code>34 + 8 * 2 = 50 bytes</code> per Sprite. The number of Sprites that are in use can be checked using the <code>F10+C</code> cheat code in game.<br />
<br />
Sprites may be placed on top of animating tiles, but a foreground animating tile may not be placed on an animating background tile.<br />
<br />
There is a maximum of 100 different tile animation sequences and 100 animated tiles visible on-screen at the same time.<br />
<br />
The song played during the level will contribute toward the overall byte size of the level.<br />
<br />
In general, when it comes to level design, compromises may need to be made for memory purposes. For example, if you want to use a lot of different graphics in a level then you might have to make the level smaller or use a music track with a smaller file size so the game doesn't run out of memory.<br />
<br />
= Tile Properties = <br />
<br />
[[what is the saving process/files involved]]<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. Consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Changing_Tile_Properties| tile properties section] of the patch based modding tutorial for further instructions.<br />
<br />
<br />
= Music and Sounds (AUDIOT) = <br />
<br />
To alter music and sounds, this chapter will discuss the following files and folders: <tt>AUDIOT.CKS, AUDIOHED.CKS, AUDIO, audio.asnds, Abiathar, MIDI2IMF, IMFCrush, WDC.</tt><br />
<br />
The <tt>AUDIOT.CKS</tt> file functions as a container that stores compressed sub files individually called chunks. Chunks in this container include AdLib music (<tt>*.IMF, *.KMF</tt>), AdLib sound effects (<tt>*AL.SND</tt>) and PC Speaker sound effects (<tt>*PC.SND</tt>). <br />
<br />
The <tt>AUDIOT.CKS</tt> file requires an associated <tt>AUDIOHED.CKS</tt> file which stores the offset location of each each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/AudioT_Format AudioT_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted music and sound files from <tt>AUDIOT.CKS</tt> that can be found in the '''<tt>AUDIO</tt>''' folder. Likewise, a configuration file (<tt>audio.asnds</tt>) [[add audio.asnds to the package]] has been added to the setup. If additional files, such as sound effects or music, are to be added to the game, the configuration file must be updated. The tool [[Abiathar]] is used to read this configuration file and import/export the changed or new files into/from the <tt>AUDIOT.CKS</tt> container.<br />
<br />
== Brief introduction into music and sound ==<br />
<br />
=== PC Sounds ===<br />
<br />
=== AdLib Sounds ===<br />
<br />
=== IMF / KMF Music ===<br />
<br />
IMF/KMF format files are packed at the end of the audio file. As IMF/KMF files contain AdLib music for games that also have AdLib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict. This is done by reserving the OPL's first channel for sound effects, leaving eight remaining channels available for use in IMF files. <br />
<br />
[[more info about this procedure needed]]<br />
<br />
It is advised to perform optimizations on existing IMF files. [[IMFCrush]] removes by default everything that drives the first AdLib/OPL channel. Generally the original IMF file is reduced by roundabout a third by converting to KMF. The reduction depends entirely on the contents of the source file. <br />
(Side note: IMFCrush is also capable of converting songs to a different playback rate, or even truncate songs.)<br />
<br />
== Music Composition ==<br />
<br />
For tips on music composition as well as the conversion process to the IMF format, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Music| music section] of the patch based modding tutorial.<br />
<br />
== Sound Effect Composition ==<br />
<br />
[[create a pre-defined setup that can be downloaded as well to shortcut things and bypass source code incompatibilities WDC has!]]<br />
<br />
WDC is an older modding tool that contains a sound effect design tool. For instructions on how to access and use this tool, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Sound_Effects| sound effects section] of the patch based modding tutorial.<br />
<br />
== Abiathar Setup and Usage == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
[[Image:Abiathar audio-mappings.png |320px|thumb|Abiathar's Audio Mappings tool]]<br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select [[the option to select]]. <br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format).<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
=== Abiathar Configuration File ===<br />
<br />
Abiathar uses <tt>audio.asnds</tt> for importing and exporting the sound and music files. It contains an entry for each song and music file in a certain format.<br />
<br />
A pc speaker sound looks like: <br />
<br />
<code>?046|PC|?046PC.SND|50 </code><br />
<br />
The first part of this entry indicates the offset location of the sound. Next, <code>PC</code> indicates [[???]]. Next is the sound file that will be used at this offset. The last digit defines the sound effect's priority; since the engine can only play one sound effect at a time this number tells it which sound has priority to play. Values can be from 00 to 99 with the higher numbers being higher priority. <br />
<br />
An AdLib sound looks like: <br />
<br />
<code>?098|PC|?098AL.SND|50|6|1,48,79,0,240,96,255,1,0,0,0,0,0 </code><br />
<br />
As you can see, this entry begins in the same manner as a PC speaker sound, right up to the priority value. The additional numbers that occur after are instrument information that can be ignored (the source engine does not actually use these values), however, Abiathar requires placeholder numbers to be included (any values will do). <br />
<br />
[[example of Music entries]]<br />
<br />
=== Additional Music and Sound Effects ===<br />
<br />
Sound effects and music must occur sequentially in the numbered list found in <tt>'''audio.asnds'''</tt>. Beginning with PC speaker sounds, additional sounds must appear after the last PC speaker sound. Then existing AdLib sound entries must be shifted up the numbered list by the number of PC speaker sounds added, followed by additional entries corresponding to the number of new AdLib sounds. The number of of PC spaker sounds and Adlib sounds must equal each other. Lastly, music is shifted up the numbered list by the required amount. The result is a consistent numbered list of pc speaker sounds, AdLib sounds, and music files.<br />
<br />
This process requires a lot of relabeling files, detailed modification to <tt>'''audio.asnds'''</tt>, importing with Abiathar, and modification to and recompiling the source code. With that in mind, it is highly recommended to import all additional sound effects at one time (using placeholders if necessary), to avoid repeatedly having to reorder files and filenames. Adding new music is a similar process, but because the music cluster of chunks appears last in <tt>'''AUDIOT.CKS'''</tt>, it is a simpler task requiring less forethought.<br />
<br />
==== Adding Sound Effects ====<br />
<br />
Begin the process by naming your PC speaker sound effects so that they occur after the final existing PC speaker sound in your '''AUDIO''' folder.<br />
<br />
Next, all AdLib sounds must be renamed so that their numbered order begins after the new final PC speaker sound. [[Automating this process?]]<br />
<br />
Next, your new AdLib sounds should be renamed to occur after the newly ordered final existing AdLib sound. <br />
<br />
Next, all music files must be renamed so that their numbered order begins after the new final AdLib sound.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified in the same manner that the files were renamed: PC speaker sound entries added, Adlib entries renumbered, Adlib entries added, and music entries renumbered.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, and <tt>NUMSNDCHUNKS</tt> to two times the value of <tt>NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
==== Adding Music ====<br />
<br />
Begin by naming your songs so that they occur after the final existing music files in your '''AUDIO''' folder.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified with music entries added for the new songs.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, <tt>NUMMUSIC</tt> to the number of songs, and <tt>NUMSNDCHUNKS</tt> to two times the value of NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
= Source Code Editing =<br />
<br />
Because source code modding provides endless possibilities, only limited by a modder's programming ability, this section will only introduce the most basic steps involved in some fundamental modifications that a modder might want when creating a 'typical' Commander Keen mod. <br />
<br />
[[How to add additional levels]]<br />
<br />
[[How to modify a creature's behavior]]<br />
<br />
[[How to create a new enemy actor]]<br />
<br />
[[How to create a new tile property]]<br />
<br />
<br />
= Compiling the Source Code =<br />
<br />
[[Image:Borland C source code compiling 01.png |320px|thumb|Working with Borland C++ v3.1]]<br />
<br />
[[Image:Borland C source code compiling 02.png |320px|thumb|Compiling, error message]]<br />
<br />
[[Introduction into Borland C++ v.3.1]]<br />
<br />
= Credits For This Tutorial =<br />
<br />
* Written and assembled by [[User:Ceilick|Ceilick]] and [[User:Nisaba|Nisaba]]<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(source_code_based)&diff=46303Keen Galaxy Modding Tutorial (source code based)2022-10-17T21:30:07Z<p>Ceilick: /* Adding Additional Graphics and Text Files */</p>
<hr />
<div>{{Alert|'''This page is still under construction!'''}}<br />
<br />
This tutorial aims to teach [[Keen:Galaxy Source Modding Package|Keen:Galaxy Source Mod]] modding in terms of what is different from modding without source code. It will primarily cover tool usage and the new options provided by the supplied source code package and its modification. Creating a full source mod requires some basic coding knowledge that this tutorial will not cover, but it will explain where and what needs to be coded and provide limited code examples for common tasks and features. <br />
<br />
For general, introductory Keen Galaxy modding information not covered here, please consult the [[Keen Galaxy Modding Tutorial (patch based)|patch based Keen Galaxy Modding Tutorial]]. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft</tt> <tt>Windows</tt> s based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Downlad the core [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen:Galaxy Source Modding Package]. This bundle contains a source code package with a number of pre-setup tools and files. Make sure to extract all files and keep the pre-defined folder structure. To facilitate modding, this package contains all resources present in their decompressed format.<br />
<br />
== Tools ==<br />
<br />
This is the complete list of tools used for source modding:<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|''Version 2.11.4 Beta 1 or higher is required'' <br />
|-<br />
|[[Borland C++ Compiler]]<br />
|Source Code Compiler <br />
|''Borland 3.1 is used to compile the code; a Borland 3.1 project file ([[SRCMOD.PRJ]]) has been included for this purpose. Borland compilers can be invoked in a 16-bit DOS environment (e.g., DOSBox v0.74 has been successfully used).''<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro Graphic Text Editor <br />
|<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.''<br />
|-<br />
|[[TliExtend]]<br />
|Tileinfo Extension <br />
|''This tool is a command line based tileinfo extension utility for Abiathar.''<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|''Functions as an <tt>EGAGRAPH.CKS</tt> editor. Two batch files are included for easy import and export of graphics.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.''<br />
|<br />
|}<br />
<br />
== Modding Package ==<br />
<br />
The modding package contains, amongst others, the following folders:<br />
<br />
=== Base Folder Name ===<br />
<br />
This folder contains the following files:<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|audio.asnds<br />
|Abiathar definition file for audio.<br />
|''This can be modified in a text editor for adding additional music and sound effects to AUDIOHED.CKS.''<br />
|-<br />
|AUDIOHED.CKS<br />
|Container file for audio chunks/files.<br />
|<br />
|-<br />
|AUDIOT.CKS<br />
|Audio location pointers for AUDIOHED.CKS.<br />
|<br />
|-<br />
|ega.def<br />
|UGrab definition file for graphics and text. <br />
|''This can be modified in a text editor for adding additional graphics and texts to EGAGRAPH.CKS.''<br />
|-<br />
|EGAGRAPH.CKS<br />
|Container file for graphics and text chunks/files.<br />
|<br />
|-<br />
|EGAHEAD.CKS<br />
|Graphics and text location pointers for EGAGRAPH.CKS.<br />
|<br />
|-<br />
|EGAINFO.BMP<br />
|Graphic for infoplane.<br />
|<br />
|-<br />
|ega-in.bat<br />
|Batch script to import graphics and text.<br />
|<br />
|-<br />
|ega-out.bat<br />
|Batch script to export graphics and text.<br />
|<br />
|-<br />
|MAPHEAD.CKS<br />
|Container file which stores levels.<br />
|<br />
|-<br />
|maps.adep<br />
|Abiathar definition file for levels.<br />
|<br />
|-<br />
|MAPTEMP.CKS<br />
|Level location pointers for MAPHEAD.CKS and tile properties.<br />
|<br />
|-<br />
|SRCMOD.EXE<br />
|Game executable. <br />
|<br />
|}<br />
<br />
=== AUDIO ===<br />
<br />
This folder contains the music and sound effect files in their decompressed format. Compressed, these are stored in the <tt>AUDIOT.CKS</tt> container file.<br />
<br />
=== EGA ===<br />
<br />
This folder contains mainly graphic and text files in their decompressed format. Compressed, these are stored in the <tt>EGAGRAPH.CKS</tt> container file. <br />
<br />
=== SOURCE ===<br />
<br />
This folder contains everything source code related written in the high-level language <tt>C/C++</tt>. <tt>SRCMOD.EXE</tt> is the compiled executable.<br />
<br />
= Engine Information = <br />
<br />
In contrast to classic modding via patches, working with the source code allows much more freedom. Nevertheless, there are some limitations that must be taken into account.<br />
<br />
For several reasons DOS only allows a maximum amount of 640KiB of memory available to programs. Therefore DOS (and maybe some drivers) as well as the game program and most of the game data (levels, music, graphics) must fit into these 640KiB.<br />
<br />
The game engine organizes certain segments into memory blocks with an upper limit of 64KiB. This means that the number of music tracks, sprites and tiles is limited to a certain degree. Realistically music and levels are the only parts (besides, perhaps, the sprite info block) where the 64KiB limit could be problematic.<br />
<br />
Here are some basic limitations:<br />
<br />
*<u><tt>Audio</tt></u>: each sound and each piece of music must not be larger than 64KiB.<br />
<br />
*<u><tt>Levels</tt></u>: also referred to as map-planes, each of these must not exceed 64KiB. For details, see the below section on [[Keen Source Mod Modding Tutorial#Memory_.26_Technical_Limitations|level limitations]].<br />
<br />
*<u><tt>Tilesets</tt></u>: There is no concrete upper limit for the number of tiles a tileset can have. The only requirement is that the MAPHEAD and EGAHEAD must be smaller than 64KiB each in order to be loaded into memory correctly. (Theoretically a little more than 7,200 tiles per tileset are allowed.)<br />
<br />
*<u><tt>Sprites:</tt></u> The maximum number of sprites in the EGAGRAPH file is limited to 3640. If more sprites are inserted, then the data block with the sprite info (width, height, hitbox, shifts, etc.) will be larger than 64KiB.<br />
<br />
'''Note''': Some of this is not set in stone. In ID_RF.H some of these values can be adjusted, but this would then consume more memory.<br />
<br />
<!--<br />
== EGAHEAD ==<br />
<br />
[[Information on the EGAHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
<br />
== MAPHEAD ==<br />
<br />
[[Information on the MAPHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
--><br />
<br />
= Graphics and Texts (EGAGRAPH) =<br />
<br />
The <tt>EGAGRAPH.CKS</tt> file (aslo called the EGA graphics library) functions as a container the stores compressed sub files which are individually called chunks. Chunks in this container include all graphics, demos, fonts, sprites, tiles, texts and other game files. <br />
<br />
The <tt>EGAHEAD.CKS</tt> file contains information about the size of the <tt>EGAGRAPH.CKS</tt> file and the offset location of each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/EGAGraph_Format EGAGraph_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted graphics and text files from <tt>EGAGRAPH.CKS</tt> the can be found in the '''<tt>EGA</tt>''' folder. Likewise, a definitions file (<tt>ega.def</tt>) [[add ega.def to the package]] has been added to the setup. If additional files, such as graphics or sprites, are to be added to the game, the definitions file must be updated. The tool [[uGrab]] is used to read this definition file and import/export the changed or new files into/from the <tt>EGAGRAPH.CKS</tt> container.<br />
<br />
[[Image:Ega-Color-Palette.png|160px|thumb|EGA Color Palette]]<br />
To begin editing graphics and most texts found in the game, go to the '''<tt>EGA</tt>''' folder. You can edit any of the images how you want but must follow two rules: you must use the [[moddingwiki:EGA_Palette|original 16 EGA Keen colours]], and all images must have a width that is a multiple of 8 pixels.<br />
<br />
All the image, text, and other files within '''<tt>EGA</tt>''' are arranged in clusters by file type. The following table gives an overview of each file type, and you can can find a corresponding overview in the <tt>ega.def</tt> definitions file as well.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|CKS_ansi_*.bin<br />
|Final screen <br />
|''Appears after quitting the game.''<br />
|-<br />
|CKS_fon_*.bmp<br />
|Font sheets <br />
|''These fonts are used throughout the game.''<br />
|-<br />
|CKS_pic_*.bmp<br />
|Main menu and help section images<br />
|<br />
|-<br />
|CKS_sprite_*.bmp<br />
|Sprite images <br />
|<br />
|-<br />
|CKS_sprites.txt<br />
|Sprite definition text file<br />
|''Hitboxes and offset values are defined for each sprite.''<br />
|-<br />
|CKS_terminator_*<br />
|Terminator text sequence <br />
|''Appears at the games first start and leads to the title screen.''<br />
|-<br />
|CKS_tile8*.bmp<br />
|Drop-down menu Tilesets <br />
|''These tilesets contain numerous tiles. Each tile has a size of 8x8 pixel.''<br />
|-<br />
|CKS_tile16*.bmp<br />
|Fore- and Background-Tileset <br />
|''These tilesets contain numerous tiles. Each tile has a size of 16x16 pixel.''<br />
|-<br />
|CKS_txt*.txt<br />
|Text sheets<br />
|''Containing story element texts and help section information.''<br />
|-<br />
|CKS_txt_STARWARS.txt<br />
|Scrolling story text<br />
|''The so called Star Wars Story Screen.''<br />
|-<br />
|CKS_DEMO*.CKS<br />
|Demo recordings <br />
|<br />
|}<br />
<br />
== Import and Export Files ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
To import / export the files located in '''EGA''', use <tt>[[uGrab]]</tt>. <tt>uGrab</tt> is an advanced EGAGRAPH editor with a graphical user interface which can not only import / export graphics, but can also add, move or remove sprites in Commander Keen source mods. <br />
<br />
For <tt>uGrab</tt> to work, a definition file is required, which is already included within the Source Code Modding bundle. [[How to manually modify definition file]].<br />
<br />
To begin, open <tt>uGrab</tt> and go to <code>Import</code> and select <code>Import from bitmap folder...</code>. Locate the <tt>ega.def</tt> definition file in your project folder and open it. A dialog pops up that asks you to select the '''EGA''' folder. Do so and press <code>OK</code>. The graphics and text files have now been imported into <tt>uGrab</tt>. <br />
<br />
To import these files into the EGAGRAPH simply go to <code>Export</code> and select <code>Export as EGAGRAPH...</code>. In the following window locate <tt>EGAGRAPH.CKS</tt> file and press <code>Save</code>. <tt>uGrab</tt> will then ask you to select a Huffman Compression Type; choose <code>Best (Slowest)</code>. It will then ask if you want to update the definition file, which you should confirm. The new graphics and text files should now be exported into the game files.<br />
<br />
An alternative to running an instance of <tt>uGrab</tt> is through batch files. The modding package comes with two batch files which can be used to speed up and automate the import / export process significantly. Simply double-click <code>ega-in.bat</code> to import and double-click <code>ega-out.bat</code> to export all files. To learn more about how those batch files operate, simply open them with a text editor such as notepad.<br />
<br />
== Tilesets == <br />
<br />
You can edit tiles in the typical manner, however, the first row of tiles in the foreground tileset (<tt>CKS_tile16m</tt>) is generally reserved to render certain blocking elements. Those are used for debugging reasons and should stay untouched. <br />
<br />
[[Short note about tiles (16x16 pixel) for the novice modder]]<br />
<br />
[[Reminder: inserted corresponding graphics to the tile16m file for the final modding package.]]<br />
<br />
[[example image goes here.]]<br />
<br />
== Sprite Hitboxes ==<br />
<br />
Just like standard modding, <tt>CKS_sprites.txt</tt> is used for establishing Sprite hitboxes. Since we are dealing with a modified version of the source code, the last value in a <tt>CKS_sprites.txt</tt> entry, handling animation frame rate, must stay at 1. Otherwise there will be errors in the rendering. (Desired adjustments need to be taken in the source code)<br />
<br />
== Texts ==<br />
<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
Text files can be edited with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
They employ a formatting code:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting code<br />
! style="text-align:left;"| Description<br />
|-<br />
|<code>^P</code> <br />
|''Marks the beginning of a page.''<br />
|-<br />
|<code>^Gy,x,n</code> <br />
|''Displays a bitmap. The image number <tt>n</tt> used here doesn't match up with the image numbers in your EGA folder; [[OUTDATED? the image shown is the image number plus seven (n + 7)]]. The <tt>x,y</tt> are coordinates which determine where the image appears on the screen. The <tt>^G</tt> command can also use sprites and both types of 16x16 pixel tiles (TILE16 and TILE16M).''<br />
|-<br />
|<code>^Ly,x</code> <br />
|''Following text will be aligned beginning at pixel location <tt>x,y</tt>.''<br />
|-<br />
|<code>^Ty,x,n,t</code> <br />
|''After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap [[OUTDATED? (n + 7)]] at pixel location <tt>x,y</tt> on the screen.''<br />
|-<br />
|<code>^By,x,w,h,c</code> <br />
|''Fills the width-by-height-pixel rectangle at pixel location <tt>x,y</tt> with dimensions of <tt>w,h</tt> and the color <tt>c</tt>. <tt>c</tt> is the hexadecimal color digit, the rest are decimal digits. If the line ends before the parser can find a hex digit, the code will use the background color (for compatibility with Keen 4-6 texts).''<br />
|-<br />
|[[^Mxxx]]<br />
|''[[Starts playing music number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^MOxxx]]<br />
|''[[Plays the music track number]] <tt>xxx</tt> [[only once, without repeating.]]''<br />
|-<br />
|[[^MP]]<br />
|''[[Pauses the current running music track and allows to resume it later.]]''<br />
|-<br />
|[[^MR]]<br />
|''[[Resumes music paused by]] <tt>^MP</tt>.''<br />
|-<br />
|[[^Sxxx]]<br />
|''[[Plays sound number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^W]]<br />
|''[[Waits until the current sound is done (does not update the screen).]]''<br />
|-<br />
|[[^Dttt]]<br />
|''[[Waits]] <tt>ttt</tt> [[tics (screen will be updated)]]''<br />
|-<br />
|[[^Q]] <br />
|''[["quiet" - stops sounds and music.]]''<br />
|-<br />
|[[^H]]<br />
|''[[Shows the high scores in any of the help texts.]]''<br />
|-<br />
|<code>^E</code> <br />
|''Marks the end of the dialogue.''<br />
|}<br />
<br />
<br />
The specific codes for changing the color of text are:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:center;"| Description<br>.<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:middle;"| Description<br>.<br />
|-<br />
|<br />
|''<code>^Cx</code> changes the text to color <tt>x</tt>''<br />
|<br />
|''<code>x</code> = single hex digit: <tt>0-9</tt>, <tt>A-F</tt>''<br />
|-<br />
|<code>^CA</code> <br />
|<code style="background:#AA0000; color:#55FF55"><b>bright green text color </b></code><br />
|<code>^C2</code> <br />
|<code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
|-<br />
|<code>^CB</code> <br />
|<code style="background:#AA0000; color:#55FFFF"><b>bright cyan text color </b></code><br />
|<code>^C3</code> <br />
|<code style="background:#AA0000; color:#00AAAA"><b>cyan text color </b></code><br />
|-<br />
|<code>^CC</code> <br />
|<code style="background:#AA0000; color:#FF5555"><b>bright red text color </b></code><br />
|<code>^C4</code> <br />
|<code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
|-<br />
|<code>^CD</code> <br />
|<code style="background:#AA0000; color:#FF55FF"><b>bright magenta text color</b></code><br />
|<code>^C5</code> <br />
|<code style="background:#AA0000; color:#AA00AA"><b>magenta text color </b></code><br />
|-<br />
|<code>^CE</code> <br />
|<code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
|<code>^C6</code> <br />
|<code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
|-<br />
|<code>^C9</code> <br />
|<code style="background:#AA0000; color:#5555ff"><b>bright blue text color </b></code><br />
|<code>^C1</code> <br />
|<code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
|-<br />
|<code>^CF</code> <br />
|<code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
|<code>^C7</code> <br />
|<code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
|-<br />
|<code>^C8</code> <br />
|<code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
|<code>^C0</code> <br />
|<code style="background:#AA0000; color:#000000"><b>black text color </b></code><br />
|}<br />
<br />
== Other Texts ==<br />
<br />
Some editable texts, such as level entrance messages, are not found in files within the <tt>'''EGA'''</tt> folder and instead require using a text editor to modify specific source code files located in the <tt>'''../SOURCE/MAKESTR'''</tt> folder. To edit most text files that appear in game open up the <tt>MAKESTR.C</tt> file with a text editor. This file contains Level Names, Level Entrance Texts, In-Game Messages and related texts. <br />
<br />
After editing these files, the game must be recompiled in order to integrate the changes. We'll get to the [[compiling process]] later.<br />
<br />
<br />
== Loading Window ==<br />
<br />
<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
<br />
KeenScr, in combination with TheDraw, is used for editing the loading and closing screen graphics.<br />
<br />
[[Where to find the loading screen files, copy it to keenscr folder]] <br />
<br />
Go to commander prompt and navigate to your <tt>keenscr</tt> folder and then type: <br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will immediately start editing the screen, with the filename keenscr.bin. <br />
<br />
<code>Alt</code>+<code>H</code> will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename [[keenscr.bin]]. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
[[files must be copied back to origin folder. Does this require uGrab or a recompile?]] <br />
<br />
<br />
<br />
<br />
<br />
== Adding Additional Graphics and Text Files ==<br />
Unlike standard Keen Galaxy modding, the number of text and graphics files can be expanded or rearranged in source modding. <br />
<br />
For any additions it is required to edit the the uGrab definitions file, Abiathar's *.adeps definitions file, and GRAPHCKS.H. These files categorize the EGAGRAPH into sections of chunk types (such as bitmaps, sprites, tiles), provide the total number of chunks within a chunk section (such as the total sprite images, or total number of tiles), and include a running total chunk number used for identifying where the chunk sections begin. [[What is the tablestart?]] Whenever chunks are added to a chunk section, the running total value must be updated for all subsequent entries. For example, if 100 sprite images are added, the number of sprites is changed from the default 397 to 497, then the subsequent entry for TILE8 must be updated to 621, TILE8M to 622, and so on. <br />
<br />
Here is the default EGAGRAPH structure: <br />
<br />
<pre><br />
CHUNKS 4751<br />
FONT 3 3 #num, start<br />
FONTM 0 6<br />
PICS 115 6 0 #num, start, tablestart<br />
PICM 3 121 1<br />
SPRITES 397 124 2<br />
TILE8 104 521<br />
TILE8M 20 522<br />
TILE16 1296 523<br />
TILE16M 2916 1819<br />
TILE32 0 4735<br />
TILE32M 0 4735<br />
<br />
B800TEXT 4735 endgame<br />
TERMINATOR 4736 commander<br />
TERMINATOR 4737 keen<br />
B800TEXT 4738 outofmem<br />
<br />
TEXT 4739 helpart1<br />
TEXT 4740 helpart2<br />
TEXT 4741 helpart3<br />
TEXT 4742 helpart4<br />
TEXT 4743 endart<br />
TEXT 4744 demoart<br />
TEXT 4745 helpart5<br />
<br />
DEMO 4746 0<br />
DEMO 4747 1<br />
DEMO 4748 2<br />
DEMO 4749 3<br />
DEMO 4750 4<br />
</pre><br />
<br />
Here is a brief description of each chunk section:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Chunk Category<br />
! style="text-align:left;"| Description<br />
|-<br />
|FONT <br />
|''.''<br />
|-<br />
|FONTM <br />
|''.''<br />
|-<br />
|PICS <br />
|''.''<br />
|-<br />
|PICSM <br />
|''.''<br />
|-<br />
|SPRITES <br />
|''.''<br />
|-<br />
|TILE8<br />
|''.''<br />
|-<br />
|TILE8M<br />
|''.''<br />
|-<br />
|TILE16<br />
|''.''<br />
|-<br />
|TILE16M<br />
|''.''<br />
|-<br />
|TILE32<br />
|''.''<br />
|-<br />
|TILE32M<br />
|''.''<br />
|-<br />
|B800TEXT<br />
|''.''<br />
|-<br />
|TERMINATOR <br />
|''.''<br />
|-<br />
|TEXT <br />
|''.''<br />
|-<br />
|DEMO <br />
|''.''<br />
|}<br />
<br />
=== Adding Bitmaps Example ===<br />
<br />
Create an image file and save it as the next image in the sequence of bitmap images found in your EGA folder. By default this would be [[default next image file name]].<br />
<br />
Update the uGrab definitions file, Abiathar's *.adeps definitions file, and GRAPHCKS.H to reflect that there is one additional bitmap image: PICS is updated from 115 to 116, PICM's running total is updated from 121 to 122, and so on for the running totals of all remaining chunk sections.<br />
<br />
=== Adding Sprites Example ===<br />
<br />
Create a series of image files and save them as the next images in the sequence of existing sprite images found in your EGA folder. By default this would begin with [[default next sprite file name]].<br />
<br />
Update the uGrab definitions file, Abiathar's *.adeps definitions file, and GRAPHCKS.H to reflect that there are additional sprites image, remembering to update the running total values for the subsequent chunk sections.<br />
<br />
=== Adding Tiles Example ===<br />
<br />
Modify [[tileset file name]] from your EGA folder to include an additional row of tiles by changing the canvas size. One row is equal to [[number of tiles]].<br />
<br />
Update the uGrab definitions file, Abiathar's *.adeps definitions file, and GRAPHCKS.H to reflect that there are additional tile chunks (one row equates to [[number of chunks]], remembering to update the running total values for the subsequent chunk sections.<br />
<br />
= Level Editing (MAPHEAD) =<br />
<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
<br />
Open Abiathar and go to <code>File</code> and select <code>Open Project</code>. Within your projects folder you should find a dependency file called <tt>maps.adeps</tt> which you want to choose. This is your pre-setup from where you can start building levels.<br />
<br />
To store modifications press <code>Save</code> under <code>File</code>. The settings for the levels will be written to the <tt>maps.adeps</tt> file, which only contains references and pointers to the real resources files, but doesn’t store any level data on their own. <br />
<br />
Closing Abiathar for the first time, quite a few settings will get saved to the <tt>editor.aconf</tt> config file. Those settings are loaded when Abiathar starts.<br />
<br />
For basic usage, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Using_Abiathar| using Abiathar section] of the patched based modding tutorial.<br />
<br />
== Memory & Technical Limitations ==<br />
<br />
Each level must not exceed 64KiB: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about.<br />
<br />
The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
The greater the variety of tiles used, the more memory is used; each foreground tile consumes 128 bytes, whereas each background tile consumes 160 bytes.<br />
<br />
There is a maximum of 50 sprites visible on-screen at the same time, but not limit for the level as a whole. Each Sprite in the refresh manager is 50 bytes. This is calculated by taking the sprite list entry (34 bytes for each sprite), and adding the erase list entry multiplied by two due to double buffering <code>(8*2=16)</code>; thus: <code>34 + 8 * 2 = 50 bytes</code> per Sprite. The number of Sprites that are in use can be checked using the <code>F10+C</code> cheat code in game.<br />
<br />
Sprites may be placed on top of animating tiles, but a foreground animating tile may not be placed on an animating background tile.<br />
<br />
There is a maximum of 100 different tile animation sequences and 100 animated tiles visible on-screen at the same time.<br />
<br />
The song played during the level will contribute toward the overall byte size of the level.<br />
<br />
In general, when it comes to level design, compromises may need to be made for memory purposes. For example, if you want to use a lot of different graphics in a level then you might have to make the level smaller or use a music track with a smaller file size so the game doesn't run out of memory.<br />
<br />
= Tile Properties = <br />
<br />
[[what is the saving process/files involved]]<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. Consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Changing_Tile_Properties| tile properties section] of the patch based modding tutorial for further instructions.<br />
<br />
<br />
= Music and Sounds (AUDIOT) = <br />
<br />
To alter music and sounds, this chapter will discuss the following files and folders: <tt>AUDIOT.CKS, AUDIOHED.CKS, AUDIO, audio.asnds, Abiathar, MIDI2IMF, IMFCrush, WDC.</tt><br />
<br />
The <tt>AUDIOT.CKS</tt> file functions as a container that stores compressed sub files individually called chunks. Chunks in this container include AdLib music (<tt>*.IMF, *.KMF</tt>), AdLib sound effects (<tt>*AL.SND</tt>) and PC Speaker sound effects (<tt>*PC.SND</tt>). <br />
<br />
The <tt>AUDIOT.CKS</tt> file requires an associated <tt>AUDIOHED.CKS</tt> file which stores the offset location of each each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/AudioT_Format AudioT_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted music and sound files from <tt>AUDIOT.CKS</tt> that can be found in the '''<tt>AUDIO</tt>''' folder. Likewise, a configuration file (<tt>audio.asnds</tt>) [[add audio.asnds to the package]] has been added to the setup. If additional files, such as sound effects or music, are to be added to the game, the configuration file must be updated. The tool [[Abiathar]] is used to read this configuration file and import/export the changed or new files into/from the <tt>AUDIOT.CKS</tt> container.<br />
<br />
== Brief introduction into music and sound ==<br />
<br />
=== PC Sounds ===<br />
<br />
=== AdLib Sounds ===<br />
<br />
=== IMF / KMF Music ===<br />
<br />
IMF/KMF format files are packed at the end of the audio file. As IMF/KMF files contain AdLib music for games that also have AdLib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict. This is done by reserving the OPL's first channel for sound effects, leaving eight remaining channels available for use in IMF files. <br />
<br />
[[more info about this procedure needed]]<br />
<br />
It is advised to perform optimizations on existing IMF files. [[IMFCrush]] removes by default everything that drives the first AdLib/OPL channel. Generally the original IMF file is reduced by roundabout a third by converting to KMF. The reduction depends entirely on the contents of the source file. <br />
(Side note: IMFCrush is also capable of converting songs to a different playback rate, or even truncate songs.)<br />
<br />
== Music Composition ==<br />
<br />
For tips on music composition as well as the conversion process to the IMF format, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Music| music section] of the patch based modding tutorial.<br />
<br />
== Sound Effect Composition ==<br />
<br />
[[create a pre-defined setup that can be downloaded as well to shortcut things and bypass source code incompatibilities WDC has!]]<br />
<br />
WDC is an older modding tool that contains a sound effect design tool. For instructions on how to access and use this tool, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Sound_Effects| sound effects section] of the patch based modding tutorial.<br />
<br />
== Abiathar Setup and Usage == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
[[Image:Abiathar audio-mappings.png |320px|thumb|Abiathar's Audio Mappings tool]]<br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select [[the option to select]]. <br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format).<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
=== Abiathar Configuration File ===<br />
<br />
Abiathar uses <tt>audio.asnds</tt> for importing and exporting the sound and music files. It contains an entry for each song and music file in a certain format.<br />
<br />
A pc speaker sound looks like: <br />
<br />
<code>?046|PC|?046PC.SND|50 </code><br />
<br />
The first part of this entry indicates the offset location of the sound. Next, <code>PC</code> indicates [[???]]. Next is the sound file that will be used at this offset. The last digit defines the sound effect's priority; since the engine can only play one sound effect at a time this number tells it which sound has priority to play. Values can be from 00 to 99 with the higher numbers being higher priority. <br />
<br />
An AdLib sound looks like: <br />
<br />
<code>?098|PC|?098AL.SND|50|6|1,48,79,0,240,96,255,1,0,0,0,0,0 </code><br />
<br />
As you can see, this entry begins in the same manner as a PC speaker sound, right up to the priority value. The additional numbers that occur after are instrument information that can be ignored (the source engine does not actually use these values), however, Abiathar requires placeholder numbers to be included (any values will do). <br />
<br />
[[example of Music entries]]<br />
<br />
=== Additional Music and Sound Effects ===<br />
<br />
Sound effects and music must occur sequentially in the numbered list found in <tt>'''audio.asnds'''</tt>. Beginning with PC speaker sounds, additional sounds must appear after the last PC speaker sound. Then existing AdLib sound entries must be shifted up the numbered list by the number of PC speaker sounds added, followed by additional entries corresponding to the number of new AdLib sounds. The number of of PC spaker sounds and Adlib sounds must equal each other. Lastly, music is shifted up the numbered list by the required amount. The result is a consistent numbered list of pc speaker sounds, AdLib sounds, and music files.<br />
<br />
This process requires a lot of relabeling files, detailed modification to <tt>'''audio.asnds'''</tt>, importing with Abiathar, and modification to and recompiling the source code. With that in mind, it is highly recommended to import all additional sound effects at one time (using placeholders if necessary), to avoid repeatedly having to reorder files and filenames. Adding new music is a similar process, but because the music cluster of chunks appears last in <tt>'''AUDIOT.CKS'''</tt>, it is a simpler task requiring less forethought.<br />
<br />
==== Adding Sound Effects ====<br />
<br />
Begin the process by naming your PC speaker sound effects so that they occur after the final existing PC speaker sound in your '''AUDIO''' folder.<br />
<br />
Next, all AdLib sounds must be renamed so that their numbered order begins after the new final PC speaker sound. [[Automating this process?]]<br />
<br />
Next, your new AdLib sounds should be renamed to occur after the newly ordered final existing AdLib sound. <br />
<br />
Next, all music files must be renamed so that their numbered order begins after the new final AdLib sound.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified in the same manner that the files were renamed: PC speaker sound entries added, Adlib entries renumbered, Adlib entries added, and music entries renumbered.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, and <tt>NUMSNDCHUNKS</tt> to two times the value of <tt>NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
==== Adding Music ====<br />
<br />
Begin by naming your songs so that they occur after the final existing music files in your '''AUDIO''' folder.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified with music entries added for the new songs.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, <tt>NUMMUSIC</tt> to the number of songs, and <tt>NUMSNDCHUNKS</tt> to two times the value of NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
= Source Code Editing =<br />
<br />
Because source code modding provides endless possibilities, only limited by a modder's programming ability, this section will only introduce the most basic steps involved in some fundamental modifications that a modder might want when creating a 'typical' Commander Keen mod. <br />
<br />
[[How to add additional levels]]<br />
<br />
[[How to modify a creature's behavior]]<br />
<br />
[[How to create a new enemy actor]]<br />
<br />
[[How to create a new tile property]]<br />
<br />
<br />
= Compiling the Source Code =<br />
<br />
[[Image:Borland C source code compiling 01.png |320px|thumb|Working with Borland C++ v3.1]]<br />
<br />
[[Image:Borland C source code compiling 02.png |320px|thumb|Compiling, error message]]<br />
<br />
[[Introduction into Borland C++ v.3.1]]<br />
<br />
= Credits For This Tutorial =<br />
<br />
* Written and assembled by [[User:Ceilick|Ceilick]] and [[User:Nisaba|Nisaba]]<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_GBC_Development&diff=46302Keen GBC Development2022-10-16T18:39:16Z<p>Ceilick: /* Sprites */ The unknown green creature is most likely the Hovva in an unused stun state</p>
<hr />
<div>This page is intended to have information regarding events that led to the development of [[Commander Keen (Game Boy Color game)|Commander Keen]] and some interesting insights into what happened during the development.<br />
<br />
== Announcement ==<br />
=== Press Release ===<br />
On March 01, 2001, [[Wikipedia: Id Software|id Software]] issued a surprise press release<ref>http://web.archive.org/web/20010302233727/www.stomped.com/published/redwood983448644_1_1.html</ref> announcing the development of a new Commander Keen game:<br />
<br />
<br />
:'''ID AND ACTIVISION BRING COMMANDER KEEN TO GAME BOY COLOR'''<br />
:''id's Original Hero Blazes A New Adventure''<br />
<br />
:'''Santa Monica, CA March 01, 2000''' id Software and Activision, Inc. (Nasdaq: ATVI) are teaming up this spring to release Commander Keen, an action-packed, comedic quest to save the cosmos for the Game Boy Color. Commander Keen is rated "E," for "Everyone," by the ESRB.<br />
<br />
:Commander Keen marks a return to id Software's roots -- developing over-the-top, comic book-style adventure games for kids. Based on id's original Commander Keen series on the PC, Commander Keen finds precocious 8-year-old superhero Billy Blaze on an all-new quest to save the world from his alien adversaries, the Droidiccus, Shikadia and Bloogs of Fribbulus Xax.<br />
<br />
:"Commander Keen shows a kinder, gentler side of id Software," Todd Hollenshead, CEO, id Software said. "Like the original Commander Keen adventures, this is a game that appeals to the spunky 8-year-old hero in all of us putting the 'id' back in 'kid.'"<br />
<br />
:But no one said saving the world before bedtime would be easy. A side scrolling platform game, Commander Keen challenges players to save the world by finding super-powerful plasma crystals hidden on three separate alien worlds. Each world contains several multi-level maps rife with progressively precarious puzzles. Throughout the adventure, Keen will encounter more than 35 different aliens as well as puzzles, slime pits, magical platforms, secret rooms and teleporters.<br />
<br />
:"An undisputed classic, the original Commander Keen games combined excellent level design and platform action for an unforgettable gameplay experience," said Larry Goldberg, executive vice president, Activision Worldwide Studios. "Our goal with Commander Keen for the Game Boy Color is to bring this incredibly satisfying and addictive experience to a whole new generation of console gamers."<br />
<br />
:Commander Keen for the Game Boy Color is being developed by David A. Palmer Productions for Activision and id Software.<br />
<br />
<br />
=== Interview with Todd Hollenshead ===<br />
A few hours after the press release, the then-existent website Stomped.com posted an interview<ref>http://web.archive.org/web/20010302232726/www.stomped.com/shared/nsystem/comments/15147_1_page_1.php</ref> with id Software's CEO [[Wikipedia: Todd Hollenshead|Todd Hollenshead]]:<br />
<br />
<br />
:'''Stomped''': Why did id wish to return to the Commander Keen universe after such a long time?<br />
<br />
:'''Hollenshead''': There are several reasons. First, we thought that we could make a fun and compelling game for the GBC. Some of us have GBCs or have kids who do, and we honestly believe that a Keen game can be well done for the platform and can really compete well with the best GBC games from a gameplay standpoint. While I understand that it's not a Disney or Pokemon franchise, which is certainly important for the GBC demographic, I think we can make a game that's more fun to actually play. Further, I like the idea of making games that appeal to different consumer types. The Keen games were revolutionary in their own right, and still have tons of fans. I hope we'll see a bunch of new fans with Commander Keen for GBC. Finally, it's a fun project to work on. Like the press release stated, I think Billy Blaze really does appeal to the 8 yr old hero in all of us, including us at id.<br />
<br />
:'''Stomped''': How did id select David A. Palmer Productions as the developer for the new game?<br />
<br />
:'''Hollenshead''': They were experienced with GBC development, had an existing relationship with Activision and were very enthusiastic about the project. They were an easy choice.<br />
<br />
:'''Stomped''': How much is id Software involved in the design process for Commander Keen?<br />
<br />
:'''Hollenshead''': Pretty deep, actually. The original idea to do the game came straight from John Carmack, and Adrian Carmack has been involved even to the point of actually creating some new game artwork. That's not to take away anything from David Palmer's group, because those guys have been fantastic and have done an excellent job of developing a game that new and old Keen fans will love.<br />
<br />
:'''Stomped''': Can you go into more detail on the story of the new game and how it relates to the original id title?<br />
<br />
:'''Hollenshead''': We'll have more info on that later, so I'll hold off on that for right now.<br />
<br />
:'''Stomped''': How has it been to help develop a game that is so far removed from what id has mostly done for the past decade or so and on a platform that id has never used before?<br />
<br />
:'''Hollenshead''': It's been a ton of fun. We're excited about the game's potential, and it's neat to have a game that you can recommend to anyone with a 6 yr. old without reservation.<br />
<br />
:'''Stomped''': What weapons and enemies will show up in the new game that will be familiar to Keen fans?<br />
<br />
:'''Hollenshead''': Again, more will come out on that later.<br />
<br />
:'''Stomped''': Any future plans for Keen or other id properties for Game Boy Advance?<br />
<br />
:'''Hollenshead''': I don't know about Keen and GBA, but I will say that we're exploring our opportunities on GBA. It's a powerful little system and we're excited about it's potential.<br />
<br />
== Development ==<br />
[[Image:Keen GBC Tileset.gif|frame|right|A sampling of two of the tilesets used in [[Commander Keen (Game Boy Color game)|Commander Keen]].<ref>http://archive.shikadi.net/sites/vertwelder.co.uk/gbc.htm</ref>]]<br />
=== David A. Palmer Productions ===<br />
id Software enlisted UK developer David A. Palmer Productions to create a new Commander Keen game exclusively for the [[Wikipedia: Game Boy Color|Game Boy Color]]. The team at David A. Palmer Productions consisted of the Producer David A. Palmer, the Associate Producer James Palmer, the Lead Programmer who is mysteriously known only as Roo, and the Game Tester Neil Palmer.<ref>Credits section of Commander Keen manual</ref> David A. Palmer Productions hired [[Wikipedia: Mark Cooksey|Mark Cooksey]] to create the sound effects and music, and [http://www.smilie.com :)Smilie Ltd.] to design the game, create the levels, and most of the art.<ref>Personal e-mail from Martin Turner to Dave "[[User:Flaose|Flaose]]" Allen</ref><br />
<br />
=== :)Smilie Ltd. ===<br />
[http://www.smilie.com :)Smilie Ltd.] is a UK developer that had worked previously with David A. Palmer Productions on the Game Boy Version of [[Wikipedia: Gex: Enter the Gecko|Gex: Enter the Gecko]]. Jim Meston was Lead Artist on Commander Keen, and designed a large portion of the game, creating the levels themselves and most of their elements.<ref>Ibid.</ref> Enemy design was handled by Support Artist Martin Turner, who was tasked with recreating most of the original Keen enemies to fit the low resolution and restricted colour palette of the Game Boy Color, and designed miscellaneous art elements.<ref>Ibid.</ref> Additional art elements were created by Support Artist Ian Terry, and all three artists used (among other things) tools designed in-house by Damian Slee.<ref>Ibid.</ref><br />
<br />
Development of Commander Keen was completed in about six months, and the game was released only a few months after the surprise announcement.<br />
<br />
== Release ==<br />
[[Commander Keen (Game Boy Color game)|Commander Keen]] was released in the North American market on May 30, 2001, and in [[Wikipedia: PAL|PAL]] markets on June 15, 2001, to average reviews.<ref>http://www.mobygames.com/game/gameboy-color/commander-keen/mobyrank</ref><br />
<br />
== Gallery ==<br />
=== Beta Version Screenshots ===<br />
Numerous promotional screenshots were published before the game's release, some of which clearly show an earlier version of the game. The most common sight in those are point items with a different color palette. Apparently, the coloring of the point items depended on the level, whereas in the released game they are generally red and yellow. The captions of the screenshots in the following gallery denote the level name and any differences besides said point items.<br />
<br />
<gallery widths=160 heights=144><br />
File:KeenGBC beta screen Robot Hive 1.png|[[Robot Hive]]<br />
File:KeenGBC beta screen Robot Hive 2.png|Robot Hive<br />
File:KeenGBC beta screen Robot Hive 3.png|Robot Hive<br />
File:KeenGBC beta screen Robot Hive 4.png|Robot Hive: The [[Droidican Soldier]] is colored yellow and the [[Droid 1]]'s emission is bigger.<br />
File:KeenGBC beta screen Robot Hive map.png|Robot Hive on world map: A mysterious green object is partly seen on the left edge. The factory's surroundings are slightly different.<br />
File:KeenGBC beta screen Fiery Canyon.png|[[Fiery Canyon]]: Keen faces a pink [[Droid 2]].<br />
File:KeenGBC beta screen The Imperial Palace 1.png|[[The Imperial Palace]]: The [[Droidican Emperor]]'s robot appears outside the boss battle.<br />
File:KeenGBC beta screen The Imperial Palace 2.png|The Imperial Palace<br />
File:KeenGBC beta screen The Plasma Crystal Mines 1.png|[[The Plasma Crystal Mines]]: An unknown bulky creature stands above Keen.<br />
File:KeenGBC beta screen The Plasma Crystal Mines 2.png|The Plasma Crystal Mines<br />
File:KeenGBC beta screen Blooglet Lake.png|[[Blooglet Lake]]: The [[Fleex]] seems to jump in this scene. Also note the clouds appearing in front of the tree and the floating soil rather than behind them.<br />
File:KeenGBC beta screen Blooglet Lake map.png|Blooglet Lake on world map: The lake's surface appears to be animated.<br />
File:KeenGBC beta screen Techno Lab 1.png|[[Techno Lab]]: The [[Casta]] appears in yellow.<br />
File:KeenGBC beta screen Techno Lab 2.png|Techno Lab: A robotic (and presumably stunned) enemy not found in the final release and another yellow Casta are seen.<br />
File:KeenGBC slideshow smilie.gif|GIF slideshow of beta screenshots found on the website of :)Smilie Ltd.<ref>http://www.smilie.com/console_done.php3</ref> Keen's sprites were modified to appear more detailed. The first image shows the Fiery Canyon on the map with two torches and the caption "Underworld".<br />
</gallery><br />
<br />
=== Website Screenshots ===<br />
Activision's official site for Commander Keen that went online about a month before the game's release featured a gallery of five screenshots.<ref>http://web.archive.org/web/20010501161656/http://www.activision.com/games/commanderkeen/features.asp</ref> Again, they are not from the final game and the point items appear in different colors. Four of the images are unique for the fact that Keen wears a yellow helmet with white stripes rather than a white one with orange stripes.<br />
<br />
<gallery widths=160 heights=144><br />
File:KeenGBC website screen 1.png|[[Shikadi in Space]]: The [[Shikadi Master]] floats around without a platform under it. The background differs significantly from the final one. Three of the point items, [[Rocket]], [[Cookie]] and [[Sugar Stoopies Cereal]], are slightly different.<br />
File:KeenGBC website screen 2.png|The Plasma Crystal Mines: The [[Small Crystal]]'s sprite is different, the object is viewed from a different angle.<br />
File:KeenGBC website screen 3.png|[[Forest o' Crazy Mushrooms]]<br />
File:KeenGBC website screen 4.png|The Plasma Crystal Mines: A weapon is seen on the left, implying that limited ammo for the [[Neural Ray Blaster]] or even different weapons were considered. Yet another sprite for the Small Crystal and an unidentified point item, possibly a [[wikipedia:Lemon drop|lemon drop]]. The red background features abstract shapes rather than crystals.<br />
File:KeenGBC website screen 5.png|Fiery Canyon: The stunned [[Darg]] looks slightly different.<br />
</gallery><br />
<br />
=== Sprites ===<br />
With two exceptions, all sprites in the following table are taken from the screenshots above. They either differ from the released game's sprites or don't appear there at all (though at least certain ones may still be available in the game's code). The table does not include graphics that simply use a different color palette but are otherwise identical to the final version.<br />
<br />
{|class="wikitable"<br />
!Picture!!Name!!Description<br />
|-<br />
| <center>[[File:KeenGBC beta Keen.png]]</center> || [[Commander Keen]] || Keen with yellow helmet as seen in the former website's screenshots only.<br />
|-<br />
| <center>[[File:KeenGBC beta Darg.png]]</center> || [[Darg]] || Stunned Darg with fewer details.<br />
|-<br />
| <center>[[File:KeenGBC beta Droid 1.png]]</center> || [[Droid 1]] || Droid 1 with bigger emission.<br />
|-<br />
| <center>[[File:KeenGBC beta Mad Mushroom.gif]]</center> || [[Mad Mushroom]] || Mad Mushroom with crazy eyes, found on Martin Turner's website.<ref>http://archive.shikadi.net/sites/vertwelder.co.uk/gbc.htm</ref><br />
|-<br />
| <center>[[File:KeenGBC beta enemy 1.png]]</center> || [[Hovva]] || The Hovva in an unused stun state.<br />
|-<br />
| <center>[[File:KeenGBC beta enemy 2.png]]</center> || unknown enemy || Brown bulky creature from The Plasma Crystal Mines rising its fists.<br />
|-<br />
| <center>[[File:KeenGBC beta enemy 3.gif]]</center> || unknown [[Droidiccus|Droidican]] || Droidican clad in red armor, revealed through Martin Turner's website. Interestingly, the animation was given the filename "vort2.gif".<ref>http://archive.shikadi.net/sites/vertwelder.co.uk/gbc.htm</ref> Statues of it appear in the final game in The Imperial Palace.<br />
|-<br />
| <center>[[File:KeenGBC beta Cookie.png]]</center> || [[Cookie]] || Cookie in narrower shape.<br />
|-<br />
| <center>[[File:KeenGBC beta Rocket.png]]</center> || [[Rocket]] || Rocket with its details arranged in a slightly different manner.<br />
|-<br />
| <center>[[File:KeenGBC beta Small Crystal 1.png]]</center> || [[Small Crystal]] || Small Crystal viewed from a different angle.<br />
|-<br />
| <center>[[File:KeenGBC beta Small Crystal 2.png]]</center> || Small Crystal || Small Crystal from another angle.<br />
|-<br />
| <center>[[File:KeenGBC beta Sugar Stoopies Cereal.png]]</center> || [[Sugar Stoopies Cereal]] || Sugar Stoopies Cereal with the spoon placed one pixel higher.<br />
|-<br />
| <center>[[File:KeenGBC beta point item.png]]</center> || unknown point item || Point item from The Plasma Crystal Mines that is possibly intended to be a [[wikipedia:lemon drop|lemon drop]].<br />
|-<br />
| <center>[[File:KeenGBC beta weapon.png]]</center> || unknown weapon || A weapon that could either represent ammo for the [[Neural Ray Blaster]] or an extra weapon.<br />
|}<br />
<br />
=== Map Elements ===<br />
{|class="wikitable"<br />
!Picture!!Name!!Description<br />
|-<br />
| <center>[[File:KeenGBC beta Fiery Canyon map 1.png]]</center> || [[Fiery Canyon]] || An earlier design of Fiery Canyon using a different color palette, found on Martin Turner's website.<ref>http://archive.shikadi.net/sites/vertwelder.co.uk/gbc.htm</ref><br />
|-<br />
| <center>[[File:KeenGBC beta Fiery Canyon map 2.png]]</center> || Fiery Canyon || This design taken from a promotional screenshot includes two torches not seen in the released game, otherwise it is nearly identical to the finished one.<br />
|-<br />
| <center>[[File:KeenGBC beta Shikadi in Space map.png]]</center> || [[Shikadi in Space]] || The saucer's shading is slightly more simple in this earlier design found on Martin Turner's website.<ref>http://archive.shikadi.net/sites/vertwelder.co.uk/gbc.htm</ref> There are no grass blades in the released game at the positions shown in this image, the grass blades on the right are not seen on the map of [[Shikadi World|Shikadi]] at all.<br />
|}<br />
<br />
== References ==<br />
<references /><br />
<br />
[[Category:Keen GBC]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(source_code_based)&diff=46168Keen Galaxy Modding Tutorial (source code based)2022-08-31T15:46:54Z<p>Ceilick: /* Base Folder Name */ additional notes</p>
<hr />
<div>{{Alert|'''This page is still under construction!'''}}<br />
<br />
This tutorial aims to teach [[Keen:Galaxy Source Modding Package|Keen:Galaxy Source Mod]] modding in terms of what is different from modding without source code. It will primarily cover tool usage and the new options provided by the supplied source code package and its modification. Creating a full source mod requires some basic coding knowledge that this tutorial will not cover, but it will explain where and what needs to be coded and provide limited code examples for common tasks and features. <br />
<br />
For general, introductory Keen Galaxy modding information not covered here, please consult the [[Keen Galaxy Modding Tutorial (patch based)|patch based Keen Galaxy Modding Tutorial]]. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft</tt> <tt>Windows</tt> s based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Downlad the core [[Keen:Galaxy Source Modding Package]]. This bundle contains a source code package with a number of pre-setup tools and files. Make sure to extract all files and keep the pre-defined folder structure. To facilitate modding, this package contains all resources present in their decompressed format.<br />
<br />
== Tools ==<br />
<br />
This is the complete list of tools used for source modding:<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|''Version 2.11.4 Beta 1 or higher is required'' <br />
|-<br />
|[[Borland C++ Compiler]]<br />
|Source Code Compiler <br />
|''Borland 3.1 is used to compile the code; a Borland 3.1 project file ([[SRCMOD.PRJ]]) has been included for this purpose. Borland compilers can be invoked in a 16-bit DOS environment (e.g., DOSBox v0.74 has been successfully used).''<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro Graphic Text Editor <br />
|<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.''<br />
|-<br />
|[[TliExtend]]<br />
|Tileinfo Extension <br />
|''This tool is a command line based tileinfo extension utility for Abiathar.''<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|''Functions as an <tt>EGAGRAPH.CKS</tt> editor. Two batch files are included for easy import and export of graphics.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.''<br />
|<br />
|}<br />
<br />
== Modding Package ==<br />
<br />
The modding package contains, amongst others, the following folders:<br />
<br />
=== Base Folder Name ===<br />
<br />
This folder contains the following files:<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|audio.asnds<br />
|Abiathar definition file for audio.<br />
|''This can be modified in a text editor for adding additional music and sound effects to AUDIOHED.CKS.''<br />
|-<br />
|AUDIOHED.CKS<br />
|Container file for audio chunks/files.<br />
|<br />
|-<br />
|AUDIOT.CKS<br />
|Audio location pointers for AUDIOHED.CKS.<br />
|<br />
|-<br />
|ega.def<br />
|UGrab definition file for graphics and text. <br />
|''This can be modified in a text editor for adding additional graphics and texts to EGAGRAPH.CKS.''<br />
|-<br />
|EGAGRAPH.CKS<br />
|Container file for graphics and text chunks/files.<br />
|<br />
|-<br />
|EGAHEAD.CKS<br />
|Graphics and text location pointers for EGAGRAPH.CKS.<br />
|<br />
|-<br />
|EGAINFO.BMP<br />
|Graphic for infoplane.<br />
|<br />
|-<br />
|ega-in.bat<br />
|Batch script to import graphics and text.<br />
|<br />
|-<br />
|ega-out.bat<br />
|Batch script to export graphics and text.<br />
|<br />
|-<br />
|MAPHEAD.CKS<br />
|Container file which stores levels.<br />
|<br />
|-<br />
|maps.adep<br />
|Abiathar definition file for levels.<br />
|<br />
|-<br />
|MAPTEMP.CKS<br />
|Level location pointers for MAPHEAD.CKS and tile properties.<br />
|<br />
|-<br />
|SRCMOD.EXE<br />
|Game executable. <br />
|<br />
|}<br />
<br />
=== AUDIO ===<br />
<br />
This folder contains the music and sound effect files in their decompressed format. Compressed, these are stored in the <tt>AUDIOT.CKS</tt> container file.<br />
<br />
=== EGA ===<br />
<br />
This folder contains mainly graphic and text files in their decompressed format. Compressed, these are stored in the <tt>EGAGRAPH.CKS</tt> container file. <br />
<br />
=== SOURCE ===<br />
<br />
This folder contains everything source code related written in the high-level language <tt>C/C++</tt>. <tt>SRCMOD.EXE</tt> is the compiled executable.<br />
<br />
= Engine Information = <br />
<br />
In contrast to classic modding via patches, working with the source code allows much more freedom. Nevertheless, there are some limitations that must be taken into account.<br />
<br />
For several reasons DOS only allows a maximum amount of 640KiB of memory available to programs. Therefore DOS (and maybe some drivers) as well as the game program and most of the game data (levels, music, graphics) must fit into these 640KiB.<br />
<br />
The game engine organizes certain segments into memory blocks with an upper limit of 64KiB. This means that the number of music tracks, sprites and tiles is limited to a certain degree. Realistically music and levels are the only parts (besides, perhaps, the sprite info block) where the 64KiB limit could be problematic.<br />
<br />
Here are some basic limitations:<br />
<br />
*<u><tt>Audio</tt></u>: each sound and each piece of music must not be larger than 64KiB.<br />
<br />
*<u><tt>Levels</tt></u>: also referred to as map-planes, each of these must not exceed 64KiB. For details, see the below section on [[Keen Source Mod Modding Tutorial#Memory_.26_Technical_Limitations|level limitations]].<br />
<br />
*<u><tt>Tilesets</tt></u>: There is no concrete upper limit for the number of tiles a tileset can have. The only requirement is that the MAPHEAD and EGAHEAD must be smaller than 64KiB each in order to be loaded into memory correctly. (Theoretically a little more than 7,200 tiles per tileset are allowed.)<br />
<br />
*<u><tt>Sprites:</tt></u> The maximum number of sprites in the EGAGRAPH file is limited to 3640. If more sprites are inserted, then the data block with the sprite info (width, height, hitbox, shifts, etc.) will be larger than 64KiB.<br />
<br />
'''Note''': Some of this is not set in stone. In ID_RF.H some of these values can be adjusted, but this would then consume more memory.<br />
<br />
<!--<br />
== EGAHEAD ==<br />
<br />
[[Information on the EGAHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
<br />
== MAPHEAD ==<br />
<br />
[[Information on the MAPHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
--><br />
<br />
= Graphics and Texts (EGAGRAPH) =<br />
<br />
The <tt>EGAGRAPH.CKS</tt> file (aslo called the EGA graphics library) functions as a container the stores compressed sub files which are individually called chunks. Chunks in this container include all graphics, demos, fonts, sprites, tiles, texts and other game files. <br />
<br />
The <tt>EGAHEAD.CKS</tt> file contains information about the size of the <tt>EGAGRAPH.CKS</tt> file and the offset location of each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/EGAGraph_Format EGAGraph_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted graphics and text files from <tt>EGAGRAPH.CKS</tt> the can be found in the '''<tt>EGA</tt>''' folder. Likewise, a definitions file (<tt>ega.def</tt>) [[add ega.def to the package]] has been added to the setup. If additional files, such as graphics or sprites, are to be added to the game, the definitions file must be updated. The tool [[uGrab]] is used to read this definition file and import/export the changed or new files into/from the <tt>EGAGRAPH.CKS</tt> container.<br />
<br />
[[Image:Ega-Color-Palette.png|160px|thumb|EGA Color Palette]]<br />
To begin editing graphics and most texts found in the game, go to the '''<tt>EGA</tt>''' folder. You can edit any of the images how you want but must follow two rules: you must use the [[moddingwiki:EGA_Palette|original 16 EGA Keen colours]], and all images must have a width that is a multiple of 8 pixels.<br />
<br />
All the image, text, and other files within '''<tt>EGA</tt>''' are arranged in clusters by file type. The following table gives an overview of each file type, and you can can find a corresponding overview in the <tt>ega.def</tt> definitions file as well.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|CKS_ansi_*.bin<br />
|Final screen <br />
|''Appears after quitting the game.''<br />
|-<br />
|CKS_fon_*.bmp<br />
|Font sheets <br />
|''These fonts are used throughout the game.''<br />
|-<br />
|CKS_pic_*.bmp<br />
|Main menu and help section images<br />
|<br />
|-<br />
|CKS_sprite_*.bmp<br />
|Sprite images <br />
|<br />
|-<br />
|CKS_sprites.txt<br />
|Sprite definition text file<br />
|''Hitboxes and offset values are defined for each sprite.''<br />
|-<br />
|CKS_terminator_*<br />
|Terminator text sequence <br />
|''Appears at the games first start and leads to the title screen.''<br />
|-<br />
|CKS_tile8*.bmp<br />
|Drop-down menu Tilesets <br />
|''These tilesets contain numerous tiles. Each tile has a size of 8x8 pixel.''<br />
|-<br />
|CKS_tile16*.bmp<br />
|Fore- and Background-Tileset <br />
|''These tilesets contain numerous tiles. Each tile has a size of 16x16 pixel.''<br />
|-<br />
|CKS_txt*.txt<br />
|Text sheets<br />
|''Containing story element texts and help section information.''<br />
|-<br />
|CKS_txt_STARWARS.txt<br />
|Scrolling story text<br />
|''The so called Star Wars Story Screen.''<br />
|-<br />
|CKS_DEMO*.CKS<br />
|Demo recordings <br />
|<br />
|}<br />
<br />
== Import and Export Files ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
To import / export the files located in '''EGA''', use <tt>[[uGrab]]</tt>. <tt>uGrab</tt> is an advanced EGAGRAPH editor with a graphical user interface which can not only import / export graphics, but can also add, move or remove sprites in Commander Keen source mods. <br />
<br />
For <tt>uGrab</tt> to work, a definition file is required, which is already included within the Source Code Modding bundle. [[How to manually modify definition file]].<br />
<br />
To begin, open <tt>uGrab</tt> and go to <code>Import</code> and select <code>Import from bitmap folder...</code>. Locate the <tt>ega.def</tt> definition file in your project folder and open it. A dialog pops up that asks you to select the '''EGA''' folder. Do so and press <code>OK</code>. The graphics and text files have now been imported into <tt>uGrab</tt>. <br />
<br />
To import these files into the EGAGRAPH simply go to <code>Export</code> and select <code>Export as EGAGRAPH...</code>. In the following window locate <tt>EGAGRAPH.CKS</tt> file and press <code>Save</code>. <tt>uGrab</tt> will then ask you to select a Huffman Compression Type; choose <code>Best (Slowest)</code>. It will then ask if you want to update the definition file, which you should confirm. The new graphics and text files should now be exported into the game files.<br />
<br />
An alternative to running an instance of <tt>uGrab</tt> is through batch files. The modding package comes with two batch files which can be used to speed up and automate the import / export process significantly. Simply double-click <code>ega-in.bat</code> to import and double-click <code>ega-out.bat</code> to export all files. To learn more about how those batch files operate, simply open them with a text editor such as notepad.<br />
<br />
== Tilesets == <br />
<br />
You can edit tiles in the typical manner, however, the first row of tiles in the foreground tileset (<tt>CKS_tile16m</tt>) is generally reserved to render certain blocking elements. Those are used for debugging reasons and should stay untouched. <br />
<br />
[[Short note about tiles (16x16 pixel) for the novice modder]]<br />
<br />
[[Reminder: inserted corresponding graphics to the tile16m file for the final modding package.]]<br />
<br />
[[example image goes here.]]<br />
<br />
== Sprite Hitboxes ==<br />
<br />
Just like standard modding, <tt>CKS_sprites.txt</tt> is used for establishing Sprite hitboxes. Since we are dealing with a modified version of the source code, the last value in a <tt>CKS_sprites.txt</tt> entry, handling animation frame rate, must stay at 1. Otherwise there will be errors in the rendering. (Desired adjustments need to be taken in the source code)<br />
<br />
== Texts ==<br />
<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
Text files can be edited with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
They employ a formatting code:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting code<br />
! style="text-align:left;"| Description<br />
|-<br />
|<code>^P</code> <br />
|''Marks the beginning of a page.''<br />
|-<br />
|<code>^Gy,x,n</code> <br />
|''Displays a bitmap. The image number <tt>n</tt> used here doesn't match up with the image numbers in your EGA folder; [[OUTDATED? the image shown is the image number plus seven (n + 7)]]. The <tt>x,y</tt> are coordinates which determine where the image appears on the screen. The <tt>^G</tt> command can also use sprites and both types of 16x16 pixel tiles (TILE16 and TILE16M).''<br />
|-<br />
|<code>^Ly,x</code> <br />
|''Following text will be aligned beginning at pixel location <tt>x,y</tt>.''<br />
|-<br />
|<code>^Ty,x,n,t</code> <br />
|''After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap [[OUTDATED? (n + 7)]] at pixel location <tt>x,y</tt> on the screen.''<br />
|-<br />
|<code>^By,x,w,h,c</code> <br />
|''Fills the width-by-height-pixel rectangle at pixel location <tt>x,y</tt> with dimensions of <tt>w,h</tt> and the color <tt>c</tt>. <tt>c</tt> is the hexadecimal color digit, the rest are decimal digits. If the line ends before the parser can find a hex digit, the code will use the background color (for compatibility with Keen 4-6 texts).''<br />
|-<br />
|[[^Mxxx]]<br />
|''[[Starts playing music number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^MOxxx]]<br />
|''[[Plays the music track number]] <tt>xxx</tt> [[only once, without repeating.]]''<br />
|-<br />
|[[^MP]]<br />
|''[[Pauses the current running music track and allows to resume it later.]]''<br />
|-<br />
|[[^MR]]<br />
|''[[Resumes music paused by]] <tt>^MP</tt>.''<br />
|-<br />
|[[^Sxxx]]<br />
|''[[Plays sound number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^W]]<br />
|''[[Waits until the current sound is done (does not update the screen).]]''<br />
|-<br />
|[[^Dttt]]<br />
|''[[Waits]] <tt>ttt</tt> [[tics (screen will be updated)]]''<br />
|-<br />
|[[^Q]] <br />
|''[["quiet" - stops sounds and music.]]''<br />
|-<br />
|[[^H]]<br />
|''[[Shows the high scores in any of the help texts.]]''<br />
|-<br />
|<code>^E</code> <br />
|''Marks the end of the dialogue.''<br />
|}<br />
<br />
<br />
The specific codes for changing the color of text are:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:center;"| Description<br>.<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:middle;"| Description<br>.<br />
|-<br />
|<br />
|''<code>^Cx</code> changes the text to color <tt>x</tt>''<br />
|<br />
|''<code>x</code> = single hex digit: <tt>0-9</tt>, <tt>A-F</tt>''<br />
|-<br />
|<code>^CA</code> <br />
|<code style="background:#AA0000; color:#55FF55"><b>bright green text color </b></code><br />
|<code>^C2</code> <br />
|<code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
|-<br />
|<code>^CB</code> <br />
|<code style="background:#AA0000; color:#55FFFF"><b>bright cyan text color </b></code><br />
|<code>^C3</code> <br />
|<code style="background:#AA0000; color:#00AAAA"><b>cyan text color </b></code><br />
|-<br />
|<code>^CC</code> <br />
|<code style="background:#AA0000; color:#FF5555"><b>bright red text color </b></code><br />
|<code>^C4</code> <br />
|<code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
|-<br />
|<code>^CD</code> <br />
|<code style="background:#AA0000; color:#FF55FF"><b>bright magenta text color</b></code><br />
|<code>^C5</code> <br />
|<code style="background:#AA0000; color:#AA00AA"><b>magenta text color </b></code><br />
|-<br />
|<code>^CE</code> <br />
|<code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
|<code>^C6</code> <br />
|<code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
|-<br />
|<code>^C9</code> <br />
|<code style="background:#AA0000; color:#5555ff"><b>bright blue text color </b></code><br />
|<code>^C1</code> <br />
|<code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
|-<br />
|<code>^CF</code> <br />
|<code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
|<code>^C7</code> <br />
|<code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
|-<br />
|<code>^C8</code> <br />
|<code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
|<code>^C0</code> <br />
|<code style="background:#AA0000; color:#000000"><b>black text color </b></code><br />
|}<br />
<br />
== Other Texts ==<br />
<br />
Some editable texts, such as level entrance messages, are not found in files within the <tt>'''EGA'''</tt> folder and instead require using a text editor to modify specific source code files located in the <tt>'''../SOURCE/MAKESTR'''</tt> folder. To edit most text files that appear in game open up the <tt>MAKESTR.C</tt> file with a text editor. This file contains Level Names, Level Entrance Texts, In-Game Messages and related texts. <br />
<br />
After editing these files, the game must be recompiled in order to integrate the changes. We'll get to the [[compiling process]] later.<br />
<br />
<br />
== Loading Window ==<br />
<br />
<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
<br />
KeenScr, in combination with TheDraw, is used for editing the loading and closing screen graphics.<br />
<br />
[[Where to find the loading screen files, copy it to keenscr folder]] <br />
<br />
Go to commander prompt and navigate to your <tt>keenscr</tt> folder and then type: <br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will immediately start editing the screen, with the filename keenscr.bin. <br />
<br />
<code>Alt</code>+<code>H</code> will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename [[keenscr.bin]]. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
[[files must be copied back to origin folder. Does this require uGrab or a recompile?]] <br />
<br />
<br />
<br />
<br />
<br />
== Adding Additional Graphics and Text Files ==<br />
Unlike standard Keen Galaxy modding, the number of text and graphics files can be expanded or rearranged in source modding. (This section will go into how to add these things, a later section will go into actually utilizing new stuff)<br />
<br />
=== Images and Sprites ===<br />
<br />
=== Text Files === <br />
<br />
=== Tiles ===<br />
<br />
= Level Editing (MAPHEAD) =<br />
<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
<br />
Open Abiathar and go to <code>File</code> and select <code>Open Project</code>. Within your projects folder you should find a dependency file called <tt>maps.adeps</tt> which you want to choose. This is your pre-setup from where you can start building levels.<br />
<br />
To store modifications press <code>Save</code> under <code>File</code>. The settings for the levels will be written to the <tt>maps.adeps</tt> file, which only contains references and pointers to the real resources files, but doesn’t store any level data on their own. <br />
<br />
Closing Abiathar for the first time, quite a few settings will get saved to the <tt>editor.aconf</tt> config file. Those settings are loaded when Abiathar starts.<br />
<br />
For basic usage, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Using_Abiathar| using Abiathar section] of the patched based modding tutorial.<br />
<br />
== Memory & Technical Limitations ==<br />
<br />
Each level must not exceed 64KiB: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about.<br />
<br />
The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
The greater the variety of tiles used, the more memory is used; each foreground tile consumes 128 bytes, whereas each background tile consumes 160 bytes.<br />
<br />
There is a maximum of 50 sprites visible on-screen at the same time, but not limit for the level as a whole. Each Sprite in the refresh manager is 50 bytes. This is calculated by taking the sprite list entry (34 bytes for each sprite), and adding the erase list entry multiplied by two due to double buffering <code>(8*2=16)</code>; thus: <code>34 + 8 * 2 = 50 bytes</code> per Sprite. The number of Sprites that are in use can be checked using the <code>F10+C</code> cheat code in game.<br />
<br />
Sprites may be placed on top of animating tiles, but a foreground animating tile may not be placed on an animating background tile.<br />
<br />
There is a maximum of 100 different tile animation sequences and 100 animated tiles visible on-screen at the same time.<br />
<br />
The song played during the level will contribute toward the overall byte size of the level.<br />
<br />
In general, when it comes to level design, compromises may need to be made for memory purposes. For example, if you want to use a lot of different graphics in a level then you might have to make the level smaller or use a music track with a smaller file size so the game doesn't run out of memory.<br />
<br />
= Tile Properties = <br />
<br />
[[what is the saving process/files involved]]<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. Consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Changing_Tile_Properties| tile properties section] of the patch based modding tutorial for further instructions.<br />
<br />
<br />
= Music and Sounds (AUDIOT) = <br />
<br />
To alter music and sounds, this chapter will discuss the following files and folders: <tt>AUDIOT.CKS, AUDIOHED.CKS, AUDIO, audio.asnds, Abiathar, MIDI2IMF, IMFCrush, WDC.</tt><br />
<br />
The <tt>AUDIOT.CKS</tt> file functions as a container that stores compressed sub files individually called chunks. Chunks in this container include AdLib music (<tt>*.IMF, *.KMF</tt>), AdLib sound effects (<tt>*AL.SND</tt>) and PC Speaker sound effects (<tt>*PC.SND</tt>). <br />
<br />
The <tt>AUDIOT.CKS</tt> file requires an associated <tt>AUDIOHED.CKS</tt> file which stores the offset location of each each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/AudioT_Format AudioT_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted music and sound files from <tt>AUDIOT.CKS</tt> that can be found in the '''<tt>AUDIO</tt>''' folder. Likewise, a configuration file (<tt>audio.asnds</tt>) [[add audio.asnds to the package]] has been added to the setup. If additional files, such as sound effects or music, are to be added to the game, the configuration file must be updated. The tool [[Abiathar]] is used to read this configuration file and import/export the changed or new files into/from the <tt>AUDIOT.CKS</tt> container.<br />
<br />
== Brief introduction into music and sound ==<br />
<br />
=== PC Sounds ===<br />
<br />
=== AdLib Sounds ===<br />
<br />
=== IMF / KMF Music ===<br />
<br />
IMF/KMF format files are packed at the end of the audio file. As IMF/KMF files contain AdLib music for games that also have AdLib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict. This is done by reserving the OPL's first channel for sound effects, leaving eight remaining channels available for use in IMF files. <br />
<br />
[[more info about this procedure needed]]<br />
<br />
It is advised to perform optimizations on existing IMF files. [[IMFCrush]] removes by default everything that drives the first AdLib/OPL channel. Generally the original IMF file is reduced by roundabout a third by converting to KMF. The reduction depends entirely on the contents of the source file. <br />
(Side note: IMFCrush is also capable of converting songs to a different playback rate, or even truncate songs.)<br />
<br />
== Music Composition ==<br />
<br />
For tips on music composition as well as the conversion process to the IMF format, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Music| music section] of the patch based modding tutorial.<br />
<br />
== Sound Effect Composition ==<br />
<br />
[[create a pre-defined setup that can be downloaded as well to shortcut things and bypass source code incompatibilities WDC has!]]<br />
<br />
WDC is an older modding tool that contains a sound effect design tool. For instructions on how to access and use this tool, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Sound_Effects| sound effects section] of the patch based modding tutorial.<br />
<br />
== Abiathar Setup and Usage == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
[[Image:Abiathar audio-mappings.png |320px|thumb|Abiathar's Audio Mappings tool]]<br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select [[the option to select]]. <br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format).<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
=== Abiathar Configuration File ===<br />
<br />
Abiathar uses <tt>audio.asnds</tt> for importing and exporting the sound and music files. It contains an entry for each song and music file in a certain format.<br />
<br />
A pc speaker sound looks like: <br />
<br />
<code>?046|PC|?046PC.SND|50 </code><br />
<br />
The first part of this entry indicates the offset location of the sound. Next, <code>PC</code> indicates [[???]]. Next is the sound file that will be used at this offset. The last digit defines the sound effect's priority; since the engine can only play one sound effect at a time this number tells it which sound has priority to play. Values can be from 00 to 99 with the higher numbers being higher priority. <br />
<br />
An AdLib sound looks like: <br />
<br />
<code>?098|PC|?098AL.SND|50|6|1,48,79,0,240,96,255,1,0,0,0,0,0 </code><br />
<br />
As you can see, this entry begins in the same manner as a PC speaker sound, right up to the priority value. The additional numbers that occur after are instrument information that can be ignored (the source engine does not actually use these values), however, Abiathar requires placeholder numbers to be included (any values will do). <br />
<br />
[[example of Music entries]]<br />
<br />
=== Additional Music and Sound Effects ===<br />
<br />
Sound effects and music must occur sequentially in the numbered list found in <tt>'''audio.asnds'''</tt>. Beginning with PC speaker sounds, additional sounds must appear after the last PC speaker sound. Then existing AdLib sound entries must be shifted up the numbered list by the number of PC speaker sounds added, followed by additional entries corresponding to the number of new AdLib sounds. The number of of PC spaker sounds and Adlib sounds must equal each other. Lastly, music is shifted up the numbered list by the required amount. The result is a consistent numbered list of pc speaker sounds, AdLib sounds, and music files.<br />
<br />
This process requires a lot of relabeling files, detailed modification to <tt>'''audio.asnds'''</tt>, importing with Abiathar, and modification to and recompiling the source code. With that in mind, it is highly recommended to import all additional sound effects at one time (using placeholders if necessary), to avoid repeatedly having to reorder files and filenames. Adding new music is a similar process, but because the music cluster of chunks appears last in <tt>'''AUDIOT.CKS'''</tt>, it is a simpler task requiring less forethought.<br />
<br />
==== Adding Sound Effects ====<br />
<br />
Begin the process by naming your PC speaker sound effects so that they occur after the final existing PC speaker sound in your '''AUDIO''' folder.<br />
<br />
Next, all AdLib sounds must be renamed so that their numbered order begins after the new final PC speaker sound. [[Automating this process?]]<br />
<br />
Next, your new AdLib sounds should be renamed to occur after the newly ordered final existing AdLib sound. <br />
<br />
Next, all music files must be renamed so that their numbered order begins after the new final AdLib sound.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified in the same manner that the files were renamed: PC speaker sound entries added, Adlib entries renumbered, Adlib entries added, and music entries renumbered.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, and <tt>NUMSNDCHUNKS</tt> to two times the value of <tt>NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
==== Adding Music ====<br />
<br />
Begin by naming your songs so that they occur after the final existing music files in your '''AUDIO''' folder.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified with music entries added for the new songs.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, <tt>NUMMUSIC</tt> to the number of songs, and <tt>NUMSNDCHUNKS</tt> to two times the value of NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
= Source Code Editing =<br />
<br />
Because source code modding provides endless possibilities, only limited by a modder's programming ability, this section will only introduce the most basic steps involved in some fundamental modifications that a modder might want when creating a 'typical' Commander Keen mod. <br />
<br />
[[How to add additional levels]]<br />
<br />
[[How to modify a creature's behavior]]<br />
<br />
[[How to create a new enemy actor]]<br />
<br />
[[How to create a new tile property]]<br />
<br />
<br />
= Compiling the Source Code =<br />
<br />
[[Image:Borland C source code compiling 01.png |320px|thumb|Working with Borland C++ v3.1]]<br />
<br />
[[Image:Borland C source code compiling 02.png |320px|thumb|Compiling, error message]]<br />
<br />
[[Introduction into Borland C++ v.3.1]]<br />
<br />
= Credits For This Tutorial =<br />
<br />
* Written and assembled by [[User:Ceilick|Ceilick]] and [[User:Nisaba|Nisaba]]<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(source_code_based)&diff=46167Keen Galaxy Modding Tutorial (source code based)2022-08-31T15:38:58Z<p>Ceilick: /* Base Folder Name */ adding clarifications</p>
<hr />
<div>{{Alert|'''This page is still under construction!'''}}<br />
<br />
This tutorial aims to teach [[Keen:Galaxy Source Modding Package|Keen:Galaxy Source Mod]] modding in terms of what is different from modding without source code. It will primarily cover tool usage and the new options provided by the supplied source code package and its modification. Creating a full source mod requires some basic coding knowledge that this tutorial will not cover, but it will explain where and what needs to be coded and provide limited code examples for common tasks and features. <br />
<br />
For general, introductory Keen Galaxy modding information not covered here, please consult the [[Keen Galaxy Modding Tutorial (patch based)|patch based Keen Galaxy Modding Tutorial]]. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft</tt> <tt>Windows</tt> s based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Downlad the core [[Keen:Galaxy Source Modding Package]]. This bundle contains a source code package with a number of pre-setup tools and files. Make sure to extract all files and keep the pre-defined folder structure. To facilitate modding, this package contains all resources present in their decompressed format.<br />
<br />
== Tools ==<br />
<br />
This is the complete list of tools used for source modding:<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|''Version 2.11.4 Beta 1 or higher is required'' <br />
|-<br />
|[[Borland C++ Compiler]]<br />
|Source Code Compiler <br />
|''Borland 3.1 is used to compile the code; a Borland 3.1 project file ([[SRCMOD.PRJ]]) has been included for this purpose. Borland compilers can be invoked in a 16-bit DOS environment (e.g., DOSBox v0.74 has been successfully used).''<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro Graphic Text Editor <br />
|<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.''<br />
|-<br />
|[[TliExtend]]<br />
|Tileinfo Extension <br />
|''This tool is a command line based tileinfo extension utility for Abiathar.''<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|''Functions as an <tt>EGAGRAPH.CKS</tt> editor. Two batch files are included for easy import and export of graphics.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.''<br />
|<br />
|}<br />
<br />
== Modding Package ==<br />
<br />
The modding package contains, amongst others, the following folders:<br />
<br />
=== Base Folder Name ===<br />
<br />
This folder contains the following files:<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
|-<br />
|audio.asnds<br />
|Abiathar definition file for audio.<br />
|-<br />
|AUDIOHED.CKS<br />
|Container file for audio chunks/files.<br />
|-<br />
|AUDIOT.CKS<br />
|Audio location pointers for AUDIOHED.CKS.<br />
|-<br />
|ega.def<br />
|UGrab definition file for graphics and text. <br />
|-<br />
|EGAGRAPH.CKS<br />
|Container file for graphics and text chunks/files.<br />
|-<br />
|EGAHEAD.CKS<br />
|Graphics and text location pointers for EGAGRAPH.CKS.<br />
|-<br />
|EGAINFO.BMP<br />
|Graphic for infoplane.<br />
|-<br />
|ega-in.bat<br />
|Batch script to import graphics and text.<br />
|-<br />
|ega-out.bat<br />
|Batch script to export graphics and text.<br />
|-<br />
|MAPHEAD.CKS<br />
|Container file which stores levels.<br />
|-<br />
|maps.adep<br />
|Abiathar definition file for levels.<br />
|-<br />
|MAPTEMP.CKS<br />
|Level location pointers for MAPHEAD.CKS and tile properties.<br />
|-<br />
|SRCMOD.EXE<br />
|Game executable. <br />
|}<br />
<br />
=== AUDIO ===<br />
<br />
This folder contains the music and sound effect files in their decompressed format. Compressed, these are stored in the <tt>AUDIOT.CKS</tt> container file.<br />
<br />
=== EGA ===<br />
<br />
This folder contains mainly graphic and text files in their decompressed format. Compressed, these are stored in the <tt>EGAGRAPH.CKS</tt> container file. <br />
<br />
=== SOURCE ===<br />
<br />
This folder contains everything source code related written in the high-level language <tt>C/C++</tt>. <tt>SRCMOD.EXE</tt> is the compiled executable.<br />
<br />
= Engine Information = <br />
<br />
In contrast to classic modding via patches, working with the source code allows much more freedom. Nevertheless, there are some limitations that must be taken into account.<br />
<br />
For several reasons DOS only allows a maximum amount of 640KiB of memory available to programs. Therefore DOS (and maybe some drivers) as well as the game program and most of the game data (levels, music, graphics) must fit into these 640KiB.<br />
<br />
The game engine organizes certain segments into memory blocks with an upper limit of 64KiB. This means that the number of music tracks, sprites and tiles is limited to a certain degree. Realistically music and levels are the only parts (besides, perhaps, the sprite info block) where the 64KiB limit could be problematic.<br />
<br />
Here are some basic limitations:<br />
<br />
*<u><tt>Audio</tt></u>: each sound and each piece of music must not be larger than 64KiB.<br />
<br />
*<u><tt>Levels</tt></u>: also referred to as map-planes, each of these must not exceed 64KiB. For details, see the below section on [[Keen Source Mod Modding Tutorial#Memory_.26_Technical_Limitations|level limitations]].<br />
<br />
*<u><tt>Tilesets</tt></u>: There is no concrete upper limit for the number of tiles a tileset can have. The only requirement is that the MAPHEAD and EGAHEAD must be smaller than 64KiB each in order to be loaded into memory correctly. (Theoretically a little more than 7,200 tiles per tileset are allowed.)<br />
<br />
*<u><tt>Sprites:</tt></u> The maximum number of sprites in the EGAGRAPH file is limited to 3640. If more sprites are inserted, then the data block with the sprite info (width, height, hitbox, shifts, etc.) will be larger than 64KiB.<br />
<br />
'''Note''': Some of this is not set in stone. In ID_RF.H some of these values can be adjusted, but this would then consume more memory.<br />
<br />
<!--<br />
== EGAHEAD ==<br />
<br />
[[Information on the EGAHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
<br />
== MAPHEAD ==<br />
<br />
[[Information on the MAPHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
--><br />
<br />
= Graphics and Texts (EGAGRAPH) =<br />
<br />
The <tt>EGAGRAPH.CKS</tt> file (aslo called the EGA graphics library) functions as a container the stores compressed sub files which are individually called chunks. Chunks in this container include all graphics, demos, fonts, sprites, tiles, texts and other game files. <br />
<br />
The <tt>EGAHEAD.CKS</tt> file contains information about the size of the <tt>EGAGRAPH.CKS</tt> file and the offset location of each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/EGAGraph_Format EGAGraph_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted graphics and text files from <tt>EGAGRAPH.CKS</tt> the can be found in the '''<tt>EGA</tt>''' folder. Likewise, a definitions file (<tt>ega.def</tt>) [[add ega.def to the package]] has been added to the setup. If additional files, such as graphics or sprites, are to be added to the game, the definitions file must be updated. The tool [[uGrab]] is used to read this definition file and import/export the changed or new files into/from the <tt>EGAGRAPH.CKS</tt> container.<br />
<br />
[[Image:Ega-Color-Palette.png|160px|thumb|EGA Color Palette]]<br />
To begin editing graphics and most texts found in the game, go to the '''<tt>EGA</tt>''' folder. You can edit any of the images how you want but must follow two rules: you must use the [[moddingwiki:EGA_Palette|original 16 EGA Keen colours]], and all images must have a width that is a multiple of 8 pixels.<br />
<br />
All the image, text, and other files within '''<tt>EGA</tt>''' are arranged in clusters by file type. The following table gives an overview of each file type, and you can can find a corresponding overview in the <tt>ega.def</tt> definitions file as well.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|CKS_ansi_*.bin<br />
|Final screen <br />
|''Appears after quitting the game.''<br />
|-<br />
|CKS_fon_*.bmp<br />
|Font sheets <br />
|''These fonts are used throughout the game.''<br />
|-<br />
|CKS_pic_*.bmp<br />
|Main menu and help section images<br />
|<br />
|-<br />
|CKS_sprite_*.bmp<br />
|Sprite images <br />
|<br />
|-<br />
|CKS_sprites.txt<br />
|Sprite definition text file<br />
|''Hitboxes and offset values are defined for each sprite.''<br />
|-<br />
|CKS_terminator_*<br />
|Terminator text sequence <br />
|''Appears at the games first start and leads to the title screen.''<br />
|-<br />
|CKS_tile8*.bmp<br />
|Drop-down menu Tilesets <br />
|''These tilesets contain numerous tiles. Each tile has a size of 8x8 pixel.''<br />
|-<br />
|CKS_tile16*.bmp<br />
|Fore- and Background-Tileset <br />
|''These tilesets contain numerous tiles. Each tile has a size of 16x16 pixel.''<br />
|-<br />
|CKS_txt*.txt<br />
|Text sheets<br />
|''Containing story element texts and help section information.''<br />
|-<br />
|CKS_txt_STARWARS.txt<br />
|Scrolling story text<br />
|''The so called Star Wars Story Screen.''<br />
|-<br />
|CKS_DEMO*.CKS<br />
|Demo recordings <br />
|<br />
|}<br />
<br />
== Import and Export Files ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
To import / export the files located in '''EGA''', use <tt>[[uGrab]]</tt>. <tt>uGrab</tt> is an advanced EGAGRAPH editor with a graphical user interface which can not only import / export graphics, but can also add, move or remove sprites in Commander Keen source mods. <br />
<br />
For <tt>uGrab</tt> to work, a definition file is required, which is already included within the Source Code Modding bundle. [[How to manually modify definition file]].<br />
<br />
To begin, open <tt>uGrab</tt> and go to <code>Import</code> and select <code>Import from bitmap folder...</code>. Locate the <tt>ega.def</tt> definition file in your project folder and open it. A dialog pops up that asks you to select the '''EGA''' folder. Do so and press <code>OK</code>. The graphics and text files have now been imported into <tt>uGrab</tt>. <br />
<br />
To import these files into the EGAGRAPH simply go to <code>Export</code> and select <code>Export as EGAGRAPH...</code>. In the following window locate <tt>EGAGRAPH.CKS</tt> file and press <code>Save</code>. <tt>uGrab</tt> will then ask you to select a Huffman Compression Type; choose <code>Best (Slowest)</code>. It will then ask if you want to update the definition file, which you should confirm. The new graphics and text files should now be exported into the game files.<br />
<br />
An alternative to running an instance of <tt>uGrab</tt> is through batch files. The modding package comes with two batch files which can be used to speed up and automate the import / export process significantly. Simply double-click <code>ega-in.bat</code> to import and double-click <code>ega-out.bat</code> to export all files. To learn more about how those batch files operate, simply open them with a text editor such as notepad.<br />
<br />
== Tilesets == <br />
<br />
You can edit tiles in the typical manner, however, the first row of tiles in the foreground tileset (<tt>CKS_tile16m</tt>) is generally reserved to render certain blocking elements. Those are used for debugging reasons and should stay untouched. <br />
<br />
[[Short note about tiles (16x16 pixel) for the novice modder]]<br />
<br />
[[Reminder: inserted corresponding graphics to the tile16m file for the final modding package.]]<br />
<br />
[[example image goes here.]]<br />
<br />
== Sprite Hitboxes ==<br />
<br />
Just like standard modding, <tt>CKS_sprites.txt</tt> is used for establishing Sprite hitboxes. Since we are dealing with a modified version of the source code, the last value in a <tt>CKS_sprites.txt</tt> entry, handling animation frame rate, must stay at 1. Otherwise there will be errors in the rendering. (Desired adjustments need to be taken in the source code)<br />
<br />
== Texts ==<br />
<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
Text files can be edited with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
They employ a formatting code:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting code<br />
! style="text-align:left;"| Description<br />
|-<br />
|<code>^P</code> <br />
|''Marks the beginning of a page.''<br />
|-<br />
|<code>^Gy,x,n</code> <br />
|''Displays a bitmap. The image number <tt>n</tt> used here doesn't match up with the image numbers in your EGA folder; [[OUTDATED? the image shown is the image number plus seven (n + 7)]]. The <tt>x,y</tt> are coordinates which determine where the image appears on the screen. The <tt>^G</tt> command can also use sprites and both types of 16x16 pixel tiles (TILE16 and TILE16M).''<br />
|-<br />
|<code>^Ly,x</code> <br />
|''Following text will be aligned beginning at pixel location <tt>x,y</tt>.''<br />
|-<br />
|<code>^Ty,x,n,t</code> <br />
|''After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap [[OUTDATED? (n + 7)]] at pixel location <tt>x,y</tt> on the screen.''<br />
|-<br />
|<code>^By,x,w,h,c</code> <br />
|''Fills the width-by-height-pixel rectangle at pixel location <tt>x,y</tt> with dimensions of <tt>w,h</tt> and the color <tt>c</tt>. <tt>c</tt> is the hexadecimal color digit, the rest are decimal digits. If the line ends before the parser can find a hex digit, the code will use the background color (for compatibility with Keen 4-6 texts).''<br />
|-<br />
|[[^Mxxx]]<br />
|''[[Starts playing music number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^MOxxx]]<br />
|''[[Plays the music track number]] <tt>xxx</tt> [[only once, without repeating.]]''<br />
|-<br />
|[[^MP]]<br />
|''[[Pauses the current running music track and allows to resume it later.]]''<br />
|-<br />
|[[^MR]]<br />
|''[[Resumes music paused by]] <tt>^MP</tt>.''<br />
|-<br />
|[[^Sxxx]]<br />
|''[[Plays sound number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^W]]<br />
|''[[Waits until the current sound is done (does not update the screen).]]''<br />
|-<br />
|[[^Dttt]]<br />
|''[[Waits]] <tt>ttt</tt> [[tics (screen will be updated)]]''<br />
|-<br />
|[[^Q]] <br />
|''[["quiet" - stops sounds and music.]]''<br />
|-<br />
|[[^H]]<br />
|''[[Shows the high scores in any of the help texts.]]''<br />
|-<br />
|<code>^E</code> <br />
|''Marks the end of the dialogue.''<br />
|}<br />
<br />
<br />
The specific codes for changing the color of text are:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:center;"| Description<br>.<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:middle;"| Description<br>.<br />
|-<br />
|<br />
|''<code>^Cx</code> changes the text to color <tt>x</tt>''<br />
|<br />
|''<code>x</code> = single hex digit: <tt>0-9</tt>, <tt>A-F</tt>''<br />
|-<br />
|<code>^CA</code> <br />
|<code style="background:#AA0000; color:#55FF55"><b>bright green text color </b></code><br />
|<code>^C2</code> <br />
|<code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
|-<br />
|<code>^CB</code> <br />
|<code style="background:#AA0000; color:#55FFFF"><b>bright cyan text color </b></code><br />
|<code>^C3</code> <br />
|<code style="background:#AA0000; color:#00AAAA"><b>cyan text color </b></code><br />
|-<br />
|<code>^CC</code> <br />
|<code style="background:#AA0000; color:#FF5555"><b>bright red text color </b></code><br />
|<code>^C4</code> <br />
|<code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
|-<br />
|<code>^CD</code> <br />
|<code style="background:#AA0000; color:#FF55FF"><b>bright magenta text color</b></code><br />
|<code>^C5</code> <br />
|<code style="background:#AA0000; color:#AA00AA"><b>magenta text color </b></code><br />
|-<br />
|<code>^CE</code> <br />
|<code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
|<code>^C6</code> <br />
|<code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
|-<br />
|<code>^C9</code> <br />
|<code style="background:#AA0000; color:#5555ff"><b>bright blue text color </b></code><br />
|<code>^C1</code> <br />
|<code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
|-<br />
|<code>^CF</code> <br />
|<code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
|<code>^C7</code> <br />
|<code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
|-<br />
|<code>^C8</code> <br />
|<code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
|<code>^C0</code> <br />
|<code style="background:#AA0000; color:#000000"><b>black text color </b></code><br />
|}<br />
<br />
== Other Texts ==<br />
<br />
Some editable texts, such as level entrance messages, are not found in files within the <tt>'''EGA'''</tt> folder and instead require using a text editor to modify specific source code files located in the <tt>'''../SOURCE/MAKESTR'''</tt> folder. To edit most text files that appear in game open up the <tt>MAKESTR.C</tt> file with a text editor. This file contains Level Names, Level Entrance Texts, In-Game Messages and related texts. <br />
<br />
After editing these files, the game must be recompiled in order to integrate the changes. We'll get to the [[compiling process]] later.<br />
<br />
<br />
== Loading Window ==<br />
<br />
<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
<br />
KeenScr, in combination with TheDraw, is used for editing the loading and closing screen graphics.<br />
<br />
[[Where to find the loading screen files, copy it to keenscr folder]] <br />
<br />
Go to commander prompt and navigate to your <tt>keenscr</tt> folder and then type: <br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will immediately start editing the screen, with the filename keenscr.bin. <br />
<br />
<code>Alt</code>+<code>H</code> will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename [[keenscr.bin]]. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
[[files must be copied back to origin folder. Does this require uGrab or a recompile?]] <br />
<br />
<br />
<br />
<br />
<br />
== Adding Additional Graphics and Text Files ==<br />
Unlike standard Keen Galaxy modding, the number of text and graphics files can be expanded or rearranged in source modding. (This section will go into how to add these things, a later section will go into actually utilizing new stuff)<br />
<br />
=== Images and Sprites ===<br />
<br />
=== Text Files === <br />
<br />
=== Tiles ===<br />
<br />
= Level Editing (MAPHEAD) =<br />
<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
<br />
Open Abiathar and go to <code>File</code> and select <code>Open Project</code>. Within your projects folder you should find a dependency file called <tt>maps.adeps</tt> which you want to choose. This is your pre-setup from where you can start building levels.<br />
<br />
To store modifications press <code>Save</code> under <code>File</code>. The settings for the levels will be written to the <tt>maps.adeps</tt> file, which only contains references and pointers to the real resources files, but doesn’t store any level data on their own. <br />
<br />
Closing Abiathar for the first time, quite a few settings will get saved to the <tt>editor.aconf</tt> config file. Those settings are loaded when Abiathar starts.<br />
<br />
For basic usage, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Using_Abiathar| using Abiathar section] of the patched based modding tutorial.<br />
<br />
== Memory & Technical Limitations ==<br />
<br />
Each level must not exceed 64KiB: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about.<br />
<br />
The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
The greater the variety of tiles used, the more memory is used; each foreground tile consumes 128 bytes, whereas each background tile consumes 160 bytes.<br />
<br />
There is a maximum of 50 sprites visible on-screen at the same time, but not limit for the level as a whole. Each Sprite in the refresh manager is 50 bytes. This is calculated by taking the sprite list entry (34 bytes for each sprite), and adding the erase list entry multiplied by two due to double buffering <code>(8*2=16)</code>; thus: <code>34 + 8 * 2 = 50 bytes</code> per Sprite. The number of Sprites that are in use can be checked using the <code>F10+C</code> cheat code in game.<br />
<br />
Sprites may be placed on top of animating tiles, but a foreground animating tile may not be placed on an animating background tile.<br />
<br />
There is a maximum of 100 different tile animation sequences and 100 animated tiles visible on-screen at the same time.<br />
<br />
The song played during the level will contribute toward the overall byte size of the level.<br />
<br />
In general, when it comes to level design, compromises may need to be made for memory purposes. For example, if you want to use a lot of different graphics in a level then you might have to make the level smaller or use a music track with a smaller file size so the game doesn't run out of memory.<br />
<br />
= Tile Properties = <br />
<br />
[[what is the saving process/files involved]]<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. Consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Changing_Tile_Properties| tile properties section] of the patch based modding tutorial for further instructions.<br />
<br />
<br />
= Music and Sounds (AUDIOT) = <br />
<br />
To alter music and sounds, this chapter will discuss the following files and folders: <tt>AUDIOT.CKS, AUDIOHED.CKS, AUDIO, audio.asnds, Abiathar, MIDI2IMF, IMFCrush, WDC.</tt><br />
<br />
The <tt>AUDIOT.CKS</tt> file functions as a container that stores compressed sub files individually called chunks. Chunks in this container include AdLib music (<tt>*.IMF, *.KMF</tt>), AdLib sound effects (<tt>*AL.SND</tt>) and PC Speaker sound effects (<tt>*PC.SND</tt>). <br />
<br />
The <tt>AUDIOT.CKS</tt> file requires an associated <tt>AUDIOHED.CKS</tt> file which stores the offset location of each each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/AudioT_Format AudioT_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted music and sound files from <tt>AUDIOT.CKS</tt> that can be found in the '''<tt>AUDIO</tt>''' folder. Likewise, a configuration file (<tt>audio.asnds</tt>) [[add audio.asnds to the package]] has been added to the setup. If additional files, such as sound effects or music, are to be added to the game, the configuration file must be updated. The tool [[Abiathar]] is used to read this configuration file and import/export the changed or new files into/from the <tt>AUDIOT.CKS</tt> container.<br />
<br />
== Brief introduction into music and sound ==<br />
<br />
=== PC Sounds ===<br />
<br />
=== AdLib Sounds ===<br />
<br />
=== IMF / KMF Music ===<br />
<br />
IMF/KMF format files are packed at the end of the audio file. As IMF/KMF files contain AdLib music for games that also have AdLib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict. This is done by reserving the OPL's first channel for sound effects, leaving eight remaining channels available for use in IMF files. <br />
<br />
[[more info about this procedure needed]]<br />
<br />
It is advised to perform optimizations on existing IMF files. [[IMFCrush]] removes by default everything that drives the first AdLib/OPL channel. Generally the original IMF file is reduced by roundabout a third by converting to KMF. The reduction depends entirely on the contents of the source file. <br />
(Side note: IMFCrush is also capable of converting songs to a different playback rate, or even truncate songs.)<br />
<br />
== Music Composition ==<br />
<br />
For tips on music composition as well as the conversion process to the IMF format, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Music| music section] of the patch based modding tutorial.<br />
<br />
== Sound Effect Composition ==<br />
<br />
[[create a pre-defined setup that can be downloaded as well to shortcut things and bypass source code incompatibilities WDC has!]]<br />
<br />
WDC is an older modding tool that contains a sound effect design tool. For instructions on how to access and use this tool, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Sound_Effects| sound effects section] of the patch based modding tutorial.<br />
<br />
== Abiathar Setup and Usage == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
[[Image:Abiathar audio-mappings.png |320px|thumb|Abiathar's Audio Mappings tool]]<br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select [[the option to select]]. <br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format).<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
=== Abiathar Configuration File ===<br />
<br />
Abiathar uses <tt>audio.asnds</tt> for importing and exporting the sound and music files. It contains an entry for each song and music file in a certain format.<br />
<br />
A pc speaker sound looks like: <br />
<br />
<code>?046|PC|?046PC.SND|50 </code><br />
<br />
The first part of this entry indicates the offset location of the sound. Next, <code>PC</code> indicates [[???]]. Next is the sound file that will be used at this offset. The last digit defines the sound effect's priority; since the engine can only play one sound effect at a time this number tells it which sound has priority to play. Values can be from 00 to 99 with the higher numbers being higher priority. <br />
<br />
An AdLib sound looks like: <br />
<br />
<code>?098|PC|?098AL.SND|50|6|1,48,79,0,240,96,255,1,0,0,0,0,0 </code><br />
<br />
As you can see, this entry begins in the same manner as a PC speaker sound, right up to the priority value. The additional numbers that occur after are instrument information that can be ignored (the source engine does not actually use these values), however, Abiathar requires placeholder numbers to be included (any values will do). <br />
<br />
[[example of Music entries]]<br />
<br />
=== Additional Music and Sound Effects ===<br />
<br />
Sound effects and music must occur sequentially in the numbered list found in <tt>'''audio.asnds'''</tt>. Beginning with PC speaker sounds, additional sounds must appear after the last PC speaker sound. Then existing AdLib sound entries must be shifted up the numbered list by the number of PC speaker sounds added, followed by additional entries corresponding to the number of new AdLib sounds. The number of of PC spaker sounds and Adlib sounds must equal each other. Lastly, music is shifted up the numbered list by the required amount. The result is a consistent numbered list of pc speaker sounds, AdLib sounds, and music files.<br />
<br />
This process requires a lot of relabeling files, detailed modification to <tt>'''audio.asnds'''</tt>, importing with Abiathar, and modification to and recompiling the source code. With that in mind, it is highly recommended to import all additional sound effects at one time (using placeholders if necessary), to avoid repeatedly having to reorder files and filenames. Adding new music is a similar process, but because the music cluster of chunks appears last in <tt>'''AUDIOT.CKS'''</tt>, it is a simpler task requiring less forethought.<br />
<br />
==== Adding Sound Effects ====<br />
<br />
Begin the process by naming your PC speaker sound effects so that they occur after the final existing PC speaker sound in your '''AUDIO''' folder.<br />
<br />
Next, all AdLib sounds must be renamed so that their numbered order begins after the new final PC speaker sound. [[Automating this process?]]<br />
<br />
Next, your new AdLib sounds should be renamed to occur after the newly ordered final existing AdLib sound. <br />
<br />
Next, all music files must be renamed so that their numbered order begins after the new final AdLib sound.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified in the same manner that the files were renamed: PC speaker sound entries added, Adlib entries renumbered, Adlib entries added, and music entries renumbered.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, and <tt>NUMSNDCHUNKS</tt> to two times the value of <tt>NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
==== Adding Music ====<br />
<br />
Begin by naming your songs so that they occur after the final existing music files in your '''AUDIO''' folder.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified with music entries added for the new songs.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, <tt>NUMMUSIC</tt> to the number of songs, and <tt>NUMSNDCHUNKS</tt> to two times the value of NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
= Source Code Editing =<br />
<br />
Because source code modding provides endless possibilities, only limited by a modder's programming ability, this section will only introduce the most basic steps involved in some fundamental modifications that a modder might want when creating a 'typical' Commander Keen mod. <br />
<br />
[[How to add additional levels]]<br />
<br />
[[How to modify a creature's behavior]]<br />
<br />
[[How to create a new enemy actor]]<br />
<br />
[[How to create a new tile property]]<br />
<br />
<br />
= Compiling the Source Code =<br />
<br />
[[Image:Borland C source code compiling 01.png |320px|thumb|Working with Borland C++ v3.1]]<br />
<br />
[[Image:Borland C source code compiling 02.png |320px|thumb|Compiling, error message]]<br />
<br />
[[Introduction into Borland C++ v.3.1]]<br />
<br />
= Credits For This Tutorial =<br />
<br />
* Written and assembled by [[User:Ceilick|Ceilick]] and [[User:Nisaba|Nisaba]]<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(source_code_based)&diff=46166Keen Galaxy Modding Tutorial (source code based)2022-08-31T15:27:34Z<p>Ceilick: /* Setup */ reorganization, creating file list and their descriptions</p>
<hr />
<div>{{Alert|'''This page is still under construction!'''}}<br />
<br />
This tutorial aims to teach [[Keen:Galaxy Source Modding Package|Keen:Galaxy Source Mod]] modding in terms of what is different from modding without source code. It will primarily cover tool usage and the new options provided by the supplied source code package and its modification. Creating a full source mod requires some basic coding knowledge that this tutorial will not cover, but it will explain where and what needs to be coded and provide limited code examples for common tasks and features. <br />
<br />
For general, introductory Keen Galaxy modding information not covered here, please consult the [[Keen Galaxy Modding Tutorial (patch based)|patch based Keen Galaxy Modding Tutorial]]. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft</tt> <tt>Windows</tt> s based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Downlad the core [[Keen:Galaxy Source Modding Package]]. This bundle contains a source code package with a number of pre-setup tools and files. Make sure to extract all files and keep the pre-defined folder structure. To facilitate modding, this package contains all resources present in their decompressed format.<br />
<br />
== Tools ==<br />
<br />
This is the complete list of tools used for source modding:<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|''Version 2.11.4 Beta 1 or higher is required'' <br />
|-<br />
|[[Borland C++ Compiler]]<br />
|Source Code Compiler <br />
|''Borland 3.1 is used to compile the code; a Borland 3.1 project file ([[SRCMOD.PRJ]]) has been included for this purpose. Borland compilers can be invoked in a 16-bit DOS environment (e.g., DOSBox v0.74 has been successfully used).''<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro Graphic Text Editor <br />
|<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.''<br />
|-<br />
|[[TliExtend]]<br />
|Tileinfo Extension <br />
|''This tool is a command line based tileinfo extension utility for Abiathar.''<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|''Functions as an <tt>EGAGRAPH.CKS</tt> editor. Two batch files are included for easy import and export of graphics.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.''<br />
|<br />
|}<br />
<br />
== Modding Package ==<br />
<br />
The modding package contains, amongst others, the following folders:<br />
<br />
=== Base Folder Name ===<br />
<br />
This folder contains the following files:<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
|-<br />
|audio.asnds<br />
|Abiathar definition file for audio.<br />
|-<br />
|AUDIOHED.CKS<br />
|Container file for audio files.<br />
|-<br />
|AUDIOT.CKS<br />
|Audio pointers.<br />
|-<br />
|ega.def<br />
|UGrab definition file for graphics and text. <br />
|-<br />
|EGAGRAPH.CKS<br />
|Container file for graphics and text files.<br />
|-<br />
|EGAHEAD.CKS<br />
|Graphics and text pointers.<br />
|-<br />
|EGAINFO.BMP<br />
|Graphic for infoplane.<br />
|-<br />
|ega-in.bat<br />
|Batch script to import graphics and text.<br />
|-<br />
|ega-out.bat<br />
|Batch script to export graphics and text.<br />
|-<br />
|MAPHEAD.CKS<br />
|Container file which stores levels.<br />
|-<br />
|maps.adep<br />
|Abiathar definition file for levels.<br />
|-<br />
|MAPTEMP.CKS<br />
|Level pointers and tile properties.<br />
|-<br />
|SRCMOD.EXE<br />
|Game executable. <br />
|}<br />
<br />
=== AUDIO ===<br />
<br />
This folder contains the music and sound effect files in their decompressed format. Compressed, these are stored in the <tt>AUDIOT.CKS</tt> container file.<br />
<br />
=== EGA ===<br />
<br />
This folder contains mainly graphic and text files in their decompressed format. Compressed, these are stored in the <tt>EGAGRAPH.CKS</tt> container file. <br />
<br />
=== SOURCE ===<br />
<br />
This folder contains everything source code related written in the high-level language <tt>C/C++</tt>. <tt>SRCMOD.EXE</tt> is the compiled executable.<br />
<br />
= Engine Information = <br />
<br />
In contrast to classic modding via patches, working with the source code allows much more freedom. Nevertheless, there are some limitations that must be taken into account.<br />
<br />
For several reasons DOS only allows a maximum amount of 640KiB of memory available to programs. Therefore DOS (and maybe some drivers) as well as the game program and most of the game data (levels, music, graphics) must fit into these 640KiB.<br />
<br />
The game engine organizes certain segments into memory blocks with an upper limit of 64KiB. This means that the number of music tracks, sprites and tiles is limited to a certain degree. Realistically music and levels are the only parts (besides, perhaps, the sprite info block) where the 64KiB limit could be problematic.<br />
<br />
Here are some basic limitations:<br />
<br />
*<u><tt>Audio</tt></u>: each sound and each piece of music must not be larger than 64KiB.<br />
<br />
*<u><tt>Levels</tt></u>: also referred to as map-planes, each of these must not exceed 64KiB. For details, see the below section on [[Keen Source Mod Modding Tutorial#Memory_.26_Technical_Limitations|level limitations]].<br />
<br />
*<u><tt>Tilesets</tt></u>: There is no concrete upper limit for the number of tiles a tileset can have. The only requirement is that the MAPHEAD and EGAHEAD must be smaller than 64KiB each in order to be loaded into memory correctly. (Theoretically a little more than 7,200 tiles per tileset are allowed.)<br />
<br />
*<u><tt>Sprites:</tt></u> The maximum number of sprites in the EGAGRAPH file is limited to 3640. If more sprites are inserted, then the data block with the sprite info (width, height, hitbox, shifts, etc.) will be larger than 64KiB.<br />
<br />
'''Note''': Some of this is not set in stone. In ID_RF.H some of these values can be adjusted, but this would then consume more memory.<br />
<br />
<!--<br />
== EGAHEAD ==<br />
<br />
[[Information on the EGAHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
<br />
== MAPHEAD ==<br />
<br />
[[Information on the MAPHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
--><br />
<br />
= Graphics and Texts (EGAGRAPH) =<br />
<br />
The <tt>EGAGRAPH.CKS</tt> file (aslo called the EGA graphics library) functions as a container the stores compressed sub files which are individually called chunks. Chunks in this container include all graphics, demos, fonts, sprites, tiles, texts and other game files. <br />
<br />
The <tt>EGAHEAD.CKS</tt> file contains information about the size of the <tt>EGAGRAPH.CKS</tt> file and the offset location of each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/EGAGraph_Format EGAGraph_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted graphics and text files from <tt>EGAGRAPH.CKS</tt> the can be found in the '''<tt>EGA</tt>''' folder. Likewise, a definitions file (<tt>ega.def</tt>) [[add ega.def to the package]] has been added to the setup. If additional files, such as graphics or sprites, are to be added to the game, the definitions file must be updated. The tool [[uGrab]] is used to read this definition file and import/export the changed or new files into/from the <tt>EGAGRAPH.CKS</tt> container.<br />
<br />
[[Image:Ega-Color-Palette.png|160px|thumb|EGA Color Palette]]<br />
To begin editing graphics and most texts found in the game, go to the '''<tt>EGA</tt>''' folder. You can edit any of the images how you want but must follow two rules: you must use the [[moddingwiki:EGA_Palette|original 16 EGA Keen colours]], and all images must have a width that is a multiple of 8 pixels.<br />
<br />
All the image, text, and other files within '''<tt>EGA</tt>''' are arranged in clusters by file type. The following table gives an overview of each file type, and you can can find a corresponding overview in the <tt>ega.def</tt> definitions file as well.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|CKS_ansi_*.bin<br />
|Final screen <br />
|''Appears after quitting the game.''<br />
|-<br />
|CKS_fon_*.bmp<br />
|Font sheets <br />
|''These fonts are used throughout the game.''<br />
|-<br />
|CKS_pic_*.bmp<br />
|Main menu and help section images<br />
|<br />
|-<br />
|CKS_sprite_*.bmp<br />
|Sprite images <br />
|<br />
|-<br />
|CKS_sprites.txt<br />
|Sprite definition text file<br />
|''Hitboxes and offset values are defined for each sprite.''<br />
|-<br />
|CKS_terminator_*<br />
|Terminator text sequence <br />
|''Appears at the games first start and leads to the title screen.''<br />
|-<br />
|CKS_tile8*.bmp<br />
|Drop-down menu Tilesets <br />
|''These tilesets contain numerous tiles. Each tile has a size of 8x8 pixel.''<br />
|-<br />
|CKS_tile16*.bmp<br />
|Fore- and Background-Tileset <br />
|''These tilesets contain numerous tiles. Each tile has a size of 16x16 pixel.''<br />
|-<br />
|CKS_txt*.txt<br />
|Text sheets<br />
|''Containing story element texts and help section information.''<br />
|-<br />
|CKS_txt_STARWARS.txt<br />
|Scrolling story text<br />
|''The so called Star Wars Story Screen.''<br />
|-<br />
|CKS_DEMO*.CKS<br />
|Demo recordings <br />
|<br />
|}<br />
<br />
== Import and Export Files ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
To import / export the files located in '''EGA''', use <tt>[[uGrab]]</tt>. <tt>uGrab</tt> is an advanced EGAGRAPH editor with a graphical user interface which can not only import / export graphics, but can also add, move or remove sprites in Commander Keen source mods. <br />
<br />
For <tt>uGrab</tt> to work, a definition file is required, which is already included within the Source Code Modding bundle. [[How to manually modify definition file]].<br />
<br />
To begin, open <tt>uGrab</tt> and go to <code>Import</code> and select <code>Import from bitmap folder...</code>. Locate the <tt>ega.def</tt> definition file in your project folder and open it. A dialog pops up that asks you to select the '''EGA''' folder. Do so and press <code>OK</code>. The graphics and text files have now been imported into <tt>uGrab</tt>. <br />
<br />
To import these files into the EGAGRAPH simply go to <code>Export</code> and select <code>Export as EGAGRAPH...</code>. In the following window locate <tt>EGAGRAPH.CKS</tt> file and press <code>Save</code>. <tt>uGrab</tt> will then ask you to select a Huffman Compression Type; choose <code>Best (Slowest)</code>. It will then ask if you want to update the definition file, which you should confirm. The new graphics and text files should now be exported into the game files.<br />
<br />
An alternative to running an instance of <tt>uGrab</tt> is through batch files. The modding package comes with two batch files which can be used to speed up and automate the import / export process significantly. Simply double-click <code>ega-in.bat</code> to import and double-click <code>ega-out.bat</code> to export all files. To learn more about how those batch files operate, simply open them with a text editor such as notepad.<br />
<br />
== Tilesets == <br />
<br />
You can edit tiles in the typical manner, however, the first row of tiles in the foreground tileset (<tt>CKS_tile16m</tt>) is generally reserved to render certain blocking elements. Those are used for debugging reasons and should stay untouched. <br />
<br />
[[Short note about tiles (16x16 pixel) for the novice modder]]<br />
<br />
[[Reminder: inserted corresponding graphics to the tile16m file for the final modding package.]]<br />
<br />
[[example image goes here.]]<br />
<br />
== Sprite Hitboxes ==<br />
<br />
Just like standard modding, <tt>CKS_sprites.txt</tt> is used for establishing Sprite hitboxes. Since we are dealing with a modified version of the source code, the last value in a <tt>CKS_sprites.txt</tt> entry, handling animation frame rate, must stay at 1. Otherwise there will be errors in the rendering. (Desired adjustments need to be taken in the source code)<br />
<br />
== Texts ==<br />
<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
Text files can be edited with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
They employ a formatting code:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting code<br />
! style="text-align:left;"| Description<br />
|-<br />
|<code>^P</code> <br />
|''Marks the beginning of a page.''<br />
|-<br />
|<code>^Gy,x,n</code> <br />
|''Displays a bitmap. The image number <tt>n</tt> used here doesn't match up with the image numbers in your EGA folder; [[OUTDATED? the image shown is the image number plus seven (n + 7)]]. The <tt>x,y</tt> are coordinates which determine where the image appears on the screen. The <tt>^G</tt> command can also use sprites and both types of 16x16 pixel tiles (TILE16 and TILE16M).''<br />
|-<br />
|<code>^Ly,x</code> <br />
|''Following text will be aligned beginning at pixel location <tt>x,y</tt>.''<br />
|-<br />
|<code>^Ty,x,n,t</code> <br />
|''After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap [[OUTDATED? (n + 7)]] at pixel location <tt>x,y</tt> on the screen.''<br />
|-<br />
|<code>^By,x,w,h,c</code> <br />
|''Fills the width-by-height-pixel rectangle at pixel location <tt>x,y</tt> with dimensions of <tt>w,h</tt> and the color <tt>c</tt>. <tt>c</tt> is the hexadecimal color digit, the rest are decimal digits. If the line ends before the parser can find a hex digit, the code will use the background color (for compatibility with Keen 4-6 texts).''<br />
|-<br />
|[[^Mxxx]]<br />
|''[[Starts playing music number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^MOxxx]]<br />
|''[[Plays the music track number]] <tt>xxx</tt> [[only once, without repeating.]]''<br />
|-<br />
|[[^MP]]<br />
|''[[Pauses the current running music track and allows to resume it later.]]''<br />
|-<br />
|[[^MR]]<br />
|''[[Resumes music paused by]] <tt>^MP</tt>.''<br />
|-<br />
|[[^Sxxx]]<br />
|''[[Plays sound number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^W]]<br />
|''[[Waits until the current sound is done (does not update the screen).]]''<br />
|-<br />
|[[^Dttt]]<br />
|''[[Waits]] <tt>ttt</tt> [[tics (screen will be updated)]]''<br />
|-<br />
|[[^Q]] <br />
|''[["quiet" - stops sounds and music.]]''<br />
|-<br />
|[[^H]]<br />
|''[[Shows the high scores in any of the help texts.]]''<br />
|-<br />
|<code>^E</code> <br />
|''Marks the end of the dialogue.''<br />
|}<br />
<br />
<br />
The specific codes for changing the color of text are:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:center;"| Description<br>.<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:middle;"| Description<br>.<br />
|-<br />
|<br />
|''<code>^Cx</code> changes the text to color <tt>x</tt>''<br />
|<br />
|''<code>x</code> = single hex digit: <tt>0-9</tt>, <tt>A-F</tt>''<br />
|-<br />
|<code>^CA</code> <br />
|<code style="background:#AA0000; color:#55FF55"><b>bright green text color </b></code><br />
|<code>^C2</code> <br />
|<code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
|-<br />
|<code>^CB</code> <br />
|<code style="background:#AA0000; color:#55FFFF"><b>bright cyan text color </b></code><br />
|<code>^C3</code> <br />
|<code style="background:#AA0000; color:#00AAAA"><b>cyan text color </b></code><br />
|-<br />
|<code>^CC</code> <br />
|<code style="background:#AA0000; color:#FF5555"><b>bright red text color </b></code><br />
|<code>^C4</code> <br />
|<code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
|-<br />
|<code>^CD</code> <br />
|<code style="background:#AA0000; color:#FF55FF"><b>bright magenta text color</b></code><br />
|<code>^C5</code> <br />
|<code style="background:#AA0000; color:#AA00AA"><b>magenta text color </b></code><br />
|-<br />
|<code>^CE</code> <br />
|<code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
|<code>^C6</code> <br />
|<code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
|-<br />
|<code>^C9</code> <br />
|<code style="background:#AA0000; color:#5555ff"><b>bright blue text color </b></code><br />
|<code>^C1</code> <br />
|<code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
|-<br />
|<code>^CF</code> <br />
|<code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
|<code>^C7</code> <br />
|<code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
|-<br />
|<code>^C8</code> <br />
|<code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
|<code>^C0</code> <br />
|<code style="background:#AA0000; color:#000000"><b>black text color </b></code><br />
|}<br />
<br />
== Other Texts ==<br />
<br />
Some editable texts, such as level entrance messages, are not found in files within the <tt>'''EGA'''</tt> folder and instead require using a text editor to modify specific source code files located in the <tt>'''../SOURCE/MAKESTR'''</tt> folder. To edit most text files that appear in game open up the <tt>MAKESTR.C</tt> file with a text editor. This file contains Level Names, Level Entrance Texts, In-Game Messages and related texts. <br />
<br />
After editing these files, the game must be recompiled in order to integrate the changes. We'll get to the [[compiling process]] later.<br />
<br />
<br />
== Loading Window ==<br />
<br />
<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
<br />
KeenScr, in combination with TheDraw, is used for editing the loading and closing screen graphics.<br />
<br />
[[Where to find the loading screen files, copy it to keenscr folder]] <br />
<br />
Go to commander prompt and navigate to your <tt>keenscr</tt> folder and then type: <br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will immediately start editing the screen, with the filename keenscr.bin. <br />
<br />
<code>Alt</code>+<code>H</code> will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename [[keenscr.bin]]. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
[[files must be copied back to origin folder. Does this require uGrab or a recompile?]] <br />
<br />
<br />
<br />
<br />
<br />
== Adding Additional Graphics and Text Files ==<br />
Unlike standard Keen Galaxy modding, the number of text and graphics files can be expanded or rearranged in source modding. (This section will go into how to add these things, a later section will go into actually utilizing new stuff)<br />
<br />
=== Images and Sprites ===<br />
<br />
=== Text Files === <br />
<br />
=== Tiles ===<br />
<br />
= Level Editing (MAPHEAD) =<br />
<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
<br />
Open Abiathar and go to <code>File</code> and select <code>Open Project</code>. Within your projects folder you should find a dependency file called <tt>maps.adeps</tt> which you want to choose. This is your pre-setup from where you can start building levels.<br />
<br />
To store modifications press <code>Save</code> under <code>File</code>. The settings for the levels will be written to the <tt>maps.adeps</tt> file, which only contains references and pointers to the real resources files, but doesn’t store any level data on their own. <br />
<br />
Closing Abiathar for the first time, quite a few settings will get saved to the <tt>editor.aconf</tt> config file. Those settings are loaded when Abiathar starts.<br />
<br />
For basic usage, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Using_Abiathar| using Abiathar section] of the patched based modding tutorial.<br />
<br />
== Memory & Technical Limitations ==<br />
<br />
Each level must not exceed 64KiB: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about.<br />
<br />
The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
The greater the variety of tiles used, the more memory is used; each foreground tile consumes 128 bytes, whereas each background tile consumes 160 bytes.<br />
<br />
There is a maximum of 50 sprites visible on-screen at the same time, but not limit for the level as a whole. Each Sprite in the refresh manager is 50 bytes. This is calculated by taking the sprite list entry (34 bytes for each sprite), and adding the erase list entry multiplied by two due to double buffering <code>(8*2=16)</code>; thus: <code>34 + 8 * 2 = 50 bytes</code> per Sprite. The number of Sprites that are in use can be checked using the <code>F10+C</code> cheat code in game.<br />
<br />
Sprites may be placed on top of animating tiles, but a foreground animating tile may not be placed on an animating background tile.<br />
<br />
There is a maximum of 100 different tile animation sequences and 100 animated tiles visible on-screen at the same time.<br />
<br />
The song played during the level will contribute toward the overall byte size of the level.<br />
<br />
In general, when it comes to level design, compromises may need to be made for memory purposes. For example, if you want to use a lot of different graphics in a level then you might have to make the level smaller or use a music track with a smaller file size so the game doesn't run out of memory.<br />
<br />
= Tile Properties = <br />
<br />
[[what is the saving process/files involved]]<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. Consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Changing_Tile_Properties| tile properties section] of the patch based modding tutorial for further instructions.<br />
<br />
<br />
= Music and Sounds (AUDIOT) = <br />
<br />
To alter music and sounds, this chapter will discuss the following files and folders: <tt>AUDIOT.CKS, AUDIOHED.CKS, AUDIO, audio.asnds, Abiathar, MIDI2IMF, IMFCrush, WDC.</tt><br />
<br />
The <tt>AUDIOT.CKS</tt> file functions as a container that stores compressed sub files individually called chunks. Chunks in this container include AdLib music (<tt>*.IMF, *.KMF</tt>), AdLib sound effects (<tt>*AL.SND</tt>) and PC Speaker sound effects (<tt>*PC.SND</tt>). <br />
<br />
The <tt>AUDIOT.CKS</tt> file requires an associated <tt>AUDIOHED.CKS</tt> file which stores the offset location of each each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/AudioT_Format AudioT_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted music and sound files from <tt>AUDIOT.CKS</tt> that can be found in the '''<tt>AUDIO</tt>''' folder. Likewise, a configuration file (<tt>audio.asnds</tt>) [[add audio.asnds to the package]] has been added to the setup. If additional files, such as sound effects or music, are to be added to the game, the configuration file must be updated. The tool [[Abiathar]] is used to read this configuration file and import/export the changed or new files into/from the <tt>AUDIOT.CKS</tt> container.<br />
<br />
== Brief introduction into music and sound ==<br />
<br />
=== PC Sounds ===<br />
<br />
=== AdLib Sounds ===<br />
<br />
=== IMF / KMF Music ===<br />
<br />
IMF/KMF format files are packed at the end of the audio file. As IMF/KMF files contain AdLib music for games that also have AdLib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict. This is done by reserving the OPL's first channel for sound effects, leaving eight remaining channels available for use in IMF files. <br />
<br />
[[more info about this procedure needed]]<br />
<br />
It is advised to perform optimizations on existing IMF files. [[IMFCrush]] removes by default everything that drives the first AdLib/OPL channel. Generally the original IMF file is reduced by roundabout a third by converting to KMF. The reduction depends entirely on the contents of the source file. <br />
(Side note: IMFCrush is also capable of converting songs to a different playback rate, or even truncate songs.)<br />
<br />
== Music Composition ==<br />
<br />
For tips on music composition as well as the conversion process to the IMF format, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Music| music section] of the patch based modding tutorial.<br />
<br />
== Sound Effect Composition ==<br />
<br />
[[create a pre-defined setup that can be downloaded as well to shortcut things and bypass source code incompatibilities WDC has!]]<br />
<br />
WDC is an older modding tool that contains a sound effect design tool. For instructions on how to access and use this tool, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Sound_Effects| sound effects section] of the patch based modding tutorial.<br />
<br />
== Abiathar Setup and Usage == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
[[Image:Abiathar audio-mappings.png |320px|thumb|Abiathar's Audio Mappings tool]]<br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select [[the option to select]]. <br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format).<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
=== Abiathar Configuration File ===<br />
<br />
Abiathar uses <tt>audio.asnds</tt> for importing and exporting the sound and music files. It contains an entry for each song and music file in a certain format.<br />
<br />
A pc speaker sound looks like: <br />
<br />
<code>?046|PC|?046PC.SND|50 </code><br />
<br />
The first part of this entry indicates the offset location of the sound. Next, <code>PC</code> indicates [[???]]. Next is the sound file that will be used at this offset. The last digit defines the sound effect's priority; since the engine can only play one sound effect at a time this number tells it which sound has priority to play. Values can be from 00 to 99 with the higher numbers being higher priority. <br />
<br />
An AdLib sound looks like: <br />
<br />
<code>?098|PC|?098AL.SND|50|6|1,48,79,0,240,96,255,1,0,0,0,0,0 </code><br />
<br />
As you can see, this entry begins in the same manner as a PC speaker sound, right up to the priority value. The additional numbers that occur after are instrument information that can be ignored (the source engine does not actually use these values), however, Abiathar requires placeholder numbers to be included (any values will do). <br />
<br />
[[example of Music entries]]<br />
<br />
=== Additional Music and Sound Effects ===<br />
<br />
Sound effects and music must occur sequentially in the numbered list found in <tt>'''audio.asnds'''</tt>. Beginning with PC speaker sounds, additional sounds must appear after the last PC speaker sound. Then existing AdLib sound entries must be shifted up the numbered list by the number of PC speaker sounds added, followed by additional entries corresponding to the number of new AdLib sounds. The number of of PC spaker sounds and Adlib sounds must equal each other. Lastly, music is shifted up the numbered list by the required amount. The result is a consistent numbered list of pc speaker sounds, AdLib sounds, and music files.<br />
<br />
This process requires a lot of relabeling files, detailed modification to <tt>'''audio.asnds'''</tt>, importing with Abiathar, and modification to and recompiling the source code. With that in mind, it is highly recommended to import all additional sound effects at one time (using placeholders if necessary), to avoid repeatedly having to reorder files and filenames. Adding new music is a similar process, but because the music cluster of chunks appears last in <tt>'''AUDIOT.CKS'''</tt>, it is a simpler task requiring less forethought.<br />
<br />
==== Adding Sound Effects ====<br />
<br />
Begin the process by naming your PC speaker sound effects so that they occur after the final existing PC speaker sound in your '''AUDIO''' folder.<br />
<br />
Next, all AdLib sounds must be renamed so that their numbered order begins after the new final PC speaker sound. [[Automating this process?]]<br />
<br />
Next, your new AdLib sounds should be renamed to occur after the newly ordered final existing AdLib sound. <br />
<br />
Next, all music files must be renamed so that their numbered order begins after the new final AdLib sound.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified in the same manner that the files were renamed: PC speaker sound entries added, Adlib entries renumbered, Adlib entries added, and music entries renumbered.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, and <tt>NUMSNDCHUNKS</tt> to two times the value of <tt>NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
==== Adding Music ====<br />
<br />
Begin by naming your songs so that they occur after the final existing music files in your '''AUDIO''' folder.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified with music entries added for the new songs.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, <tt>NUMMUSIC</tt> to the number of songs, and <tt>NUMSNDCHUNKS</tt> to two times the value of NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
= Source Code Editing =<br />
<br />
Because source code modding provides endless possibilities, only limited by a modder's programming ability, this section will only introduce the most basic steps involved in some fundamental modifications that a modder might want when creating a 'typical' Commander Keen mod. <br />
<br />
[[How to add additional levels]]<br />
<br />
[[How to modify a creature's behavior]]<br />
<br />
[[How to create a new enemy actor]]<br />
<br />
[[How to create a new tile property]]<br />
<br />
<br />
= Compiling the Source Code =<br />
<br />
[[Image:Borland C source code compiling 01.png |320px|thumb|Working with Borland C++ v3.1]]<br />
<br />
[[Image:Borland C source code compiling 02.png |320px|thumb|Compiling, error message]]<br />
<br />
[[Introduction into Borland C++ v.3.1]]<br />
<br />
= Credits For This Tutorial =<br />
<br />
* Written and assembled by [[User:Ceilick|Ceilick]] and [[User:Nisaba|Nisaba]]<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(source_code_based)&diff=46165Keen Galaxy Modding Tutorial (source code based)2022-08-31T14:49:26Z<p>Ceilick: /* Modding Package */</p>
<hr />
<div>{{Alert|'''This page is still under construction!'''}}<br />
<br />
This tutorial aims to teach [[Keen:Galaxy Source Modding Package|Keen:Galaxy Source Mod]] modding in terms of what is different from modding without source code. It will primarily cover tool usage and the new options provided by the supplied source code package and its modification. Creating a full source mod requires some basic coding knowledge that this tutorial will not cover, but it will explain where and what needs to be coded and provide limited code examples for common tasks and features. <br />
<br />
For general, introductory Keen Galaxy modding information not covered here, please consult the [[Keen Galaxy Modding Tutorial (patch based)|patch based Keen Galaxy Modding Tutorial]]. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft</tt> <tt>Windows</tt> s based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Downlad the core [[Keen:Galaxy Source Modding Package]]. This bundle contains a source code package with a number of pre-setup tools and files. Make sure to extract all files and keep the pre-defined folder structure. To facilitate modding, this package contains all resources present in their decompressed format.<br />
<br />
== Modding Package ==<br />
<br />
The modding package contains, amongst others, the following folders with resources in their decompressed format: <br />
* The '''[[Base Folder Name]]''' folder contains everything to run the game including the executable and the <tt>MAPHEAD.CKS</tt> container file, which stores the levels.<br />
* The '''AUDIO''' folder contains music and sound effect files that are stored in the games <tt>AUDIOT.CKS</tt> container file. <br />
* The '''EGA''' folder contains mainly graphic and text files that are stored in the games <tt>EGAGRAPH.CKS</tt> container file. <br />
* The '''SOURCE''' folder contains everything source code related written in the high-level language <tt>C/C++</tt> . <tt>SRCMOD.EXE</tt> is the compiled executable. <br />
<br />
The modding packages also contains a few core tools to modify, import, and export those resource files. In brief: <br />
* [[Abiathar]] is used for editing maps (using the <tt>map.adeps</tt> definition file for <tt>MAPTEMP.CKS</tt>). It is also used to create the game audio archive (using the <tt>audio.asnds</tt> definition file for <tt>AUDIOT.CKS</tt>). <br />
* [[uGrab]] functions as an <tt>EGAGRAPH.CKS</tt> editor. For convenience, two batch files (<tt>ega-in.bat</tt>, <tt>ega-out.bat</tt>) are included for easy import and export of graphics. The game archive structure can be altered by editing the <tt>ega.def</tt> definitions file. <br />
* [[Borland 3.1]] is used to compile the code; a Borland 3.1 project file ([[SRCMOD.PRJ]]) has been included for this purpose. Borland compilers can be invoked in a 16-bit DOS environment (e.g., DOSBox v0.74 has been successfully used).<br />
<br />
[[Let's also add a TOOLS, a INFO and a UPLOAD folder]]<br />
<br />
[[Modding folder structure setup goes here]]<br />
<br />
== Tools ==<br />
<br />
This is the complete list of tools used for source modding:<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|''Version 2.11.4 Beta 1 or higher is required''<br />
|-<br />
|[[Borland C++ Compiler]]<br />
|Source Code Compiler <br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro Graphic Text Editor <br />
|<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.''<br />
|-<br />
|[[TliExtend]]<br />
|Tileinfo Extension <br />
|''This tool is a command line based tileinfo extension utility for Abiathar''<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|''Also used for adding additional graphics and texts files.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used''<br />
|<br />
|}<br />
<br />
<!--Additional Tools?--><br />
<br />
= Engine Information = <br />
<br />
In contrast to classic modding via patches, working with the source code allows much more freedom. Nevertheless, there are some limitations that must be taken into account.<br />
<br />
For several reasons DOS only allows a maximum amount of 640KiB of memory available to programs. Therefore DOS (and maybe some drivers) as well as the game program and most of the game data (levels, music, graphics) must fit into these 640KiB.<br />
<br />
The game engine organizes certain segments into memory blocks with an upper limit of 64KiB. This means that the number of music tracks, sprites and tiles is limited to a certain degree. Realistically music and levels are the only parts (besides, perhaps, the sprite info block) where the 64KiB limit could be problematic.<br />
<br />
Here are some basic limitations:<br />
<br />
*<u><tt>Audio</tt></u>: each sound and each piece of music must not be larger than 64KiB.<br />
<br />
*<u><tt>Levels</tt></u>: also referred to as map-planes, each of these must not exceed 64KiB. For details, see the below section on [[Keen Source Mod Modding Tutorial#Memory_.26_Technical_Limitations|level limitations]].<br />
<br />
*<u><tt>Tilesets</tt></u>: There is no concrete upper limit for the number of tiles a tileset can have. The only requirement is that the MAPHEAD and EGAHEAD must be smaller than 64KiB each in order to be loaded into memory correctly. (Theoretically a little more than 7,200 tiles per tileset are allowed.)<br />
<br />
*<u><tt>Sprites:</tt></u> The maximum number of sprites in the EGAGRAPH file is limited to 3640. If more sprites are inserted, then the data block with the sprite info (width, height, hitbox, shifts, etc.) will be larger than 64KiB.<br />
<br />
'''Note''': Some of this is not set in stone. In ID_RF.H some of these values can be adjusted, but this would then consume more memory.<br />
<br />
<!--<br />
== EGAHEAD ==<br />
<br />
[[Information on the EGAHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
<br />
== MAPHEAD ==<br />
<br />
[[Information on the MAPHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
--><br />
<br />
= Graphics and Texts (EGAGRAPH) =<br />
<br />
The <tt>EGAGRAPH.CKS</tt> file (aslo called the EGA graphics library) functions as a container the stores compressed sub files which are individually called chunks. Chunks in this container include all graphics, demos, fonts, sprites, tiles, texts and other game files. <br />
<br />
The <tt>EGAHEAD.CKS</tt> file contains information about the size of the <tt>EGAGRAPH.CKS</tt> file and the offset location of each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/EGAGraph_Format EGAGraph_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted graphics and text files from <tt>EGAGRAPH.CKS</tt> the can be found in the '''<tt>EGA</tt>''' folder. Likewise, a definitions file (<tt>ega.def</tt>) [[add ega.def to the package]] has been added to the setup. If additional files, such as graphics or sprites, are to be added to the game, the definitions file must be updated. The tool [[uGrab]] is used to read this definition file and import/export the changed or new files into/from the <tt>EGAGRAPH.CKS</tt> container.<br />
<br />
[[Image:Ega-Color-Palette.png|160px|thumb|EGA Color Palette]]<br />
To begin editing graphics and most texts found in the game, go to the '''<tt>EGA</tt>''' folder. You can edit any of the images how you want but must follow two rules: you must use the [[moddingwiki:EGA_Palette|original 16 EGA Keen colours]], and all images must have a width that is a multiple of 8 pixels.<br />
<br />
All the image, text, and other files within '''<tt>EGA</tt>''' are arranged in clusters by file type. The following table gives an overview of each file type, and you can can find a corresponding overview in the <tt>ega.def</tt> definitions file as well.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|CKS_ansi_*.bin<br />
|Final screen <br />
|''Appears after quitting the game.''<br />
|-<br />
|CKS_fon_*.bmp<br />
|Font sheets <br />
|''These fonts are used throughout the game.''<br />
|-<br />
|CKS_pic_*.bmp<br />
|Main menu and help section images<br />
|<br />
|-<br />
|CKS_sprite_*.bmp<br />
|Sprite images <br />
|<br />
|-<br />
|CKS_sprites.txt<br />
|Sprite definition text file<br />
|''Hitboxes and offset values are defined for each sprite.''<br />
|-<br />
|CKS_terminator_*<br />
|Terminator text sequence <br />
|''Appears at the games first start and leads to the title screen.''<br />
|-<br />
|CKS_tile8*.bmp<br />
|Drop-down menu Tilesets <br />
|''These tilesets contain numerous tiles. Each tile has a size of 8x8 pixel.''<br />
|-<br />
|CKS_tile16*.bmp<br />
|Fore- and Background-Tileset <br />
|''These tilesets contain numerous tiles. Each tile has a size of 16x16 pixel.''<br />
|-<br />
|CKS_txt*.txt<br />
|Text sheets<br />
|''Containing story element texts and help section information.''<br />
|-<br />
|CKS_txt_STARWARS.txt<br />
|Scrolling story text<br />
|''The so called Star Wars Story Screen.''<br />
|-<br />
|CKS_DEMO*.CKS<br />
|Demo recordings <br />
|<br />
|}<br />
<br />
== Import and Export Files ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
To import / export the files located in '''EGA''', use <tt>[[uGrab]]</tt>. <tt>uGrab</tt> is an advanced EGAGRAPH editor with a graphical user interface which can not only import / export graphics, but can also add, move or remove sprites in Commander Keen source mods. <br />
<br />
For <tt>uGrab</tt> to work, a definition file is required, which is already included within the Source Code Modding bundle. [[How to manually modify definition file]].<br />
<br />
To begin, open <tt>uGrab</tt> and go to <code>Import</code> and select <code>Import from bitmap folder...</code>. Locate the <tt>ega.def</tt> definition file in your project folder and open it. A dialog pops up that asks you to select the '''EGA''' folder. Do so and press <code>OK</code>. The graphics and text files have now been imported into <tt>uGrab</tt>. <br />
<br />
To import these files into the EGAGRAPH simply go to <code>Export</code> and select <code>Export as EGAGRAPH...</code>. In the following window locate <tt>EGAGRAPH.CKS</tt> file and press <code>Save</code>. <tt>uGrab</tt> will then ask you to select a Huffman Compression Type; choose <code>Best (Slowest)</code>. It will then ask if you want to update the definition file, which you should confirm. The new graphics and text files should now be exported into the game files.<br />
<br />
An alternative to running an instance of <tt>uGrab</tt> is through batch files. The modding package comes with two batch files which can be used to speed up and automate the import / export process significantly. Simply double-click <code>ega-in.bat</code> to import and double-click <code>ega-out.bat</code> to export all files. To learn more about how those batch files operate, simply open them with a text editor such as notepad.<br />
<br />
== Tilesets == <br />
<br />
You can edit tiles in the typical manner, however, the first row of tiles in the foreground tileset (<tt>CKS_tile16m</tt>) is generally reserved to render certain blocking elements. Those are used for debugging reasons and should stay untouched. <br />
<br />
[[Short note about tiles (16x16 pixel) for the novice modder]]<br />
<br />
[[Reminder: inserted corresponding graphics to the tile16m file for the final modding package.]]<br />
<br />
[[example image goes here.]]<br />
<br />
== Sprite Hitboxes ==<br />
<br />
Just like standard modding, <tt>CKS_sprites.txt</tt> is used for establishing Sprite hitboxes. Since we are dealing with a modified version of the source code, the last value in a <tt>CKS_sprites.txt</tt> entry, handling animation frame rate, must stay at 1. Otherwise there will be errors in the rendering. (Desired adjustments need to be taken in the source code)<br />
<br />
== Texts ==<br />
<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
Text files can be edited with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
They employ a formatting code:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting code<br />
! style="text-align:left;"| Description<br />
|-<br />
|<code>^P</code> <br />
|''Marks the beginning of a page.''<br />
|-<br />
|<code>^Gy,x,n</code> <br />
|''Displays a bitmap. The image number <tt>n</tt> used here doesn't match up with the image numbers in your EGA folder; [[OUTDATED? the image shown is the image number plus seven (n + 7)]]. The <tt>x,y</tt> are coordinates which determine where the image appears on the screen. The <tt>^G</tt> command can also use sprites and both types of 16x16 pixel tiles (TILE16 and TILE16M).''<br />
|-<br />
|<code>^Ly,x</code> <br />
|''Following text will be aligned beginning at pixel location <tt>x,y</tt>.''<br />
|-<br />
|<code>^Ty,x,n,t</code> <br />
|''After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap [[OUTDATED? (n + 7)]] at pixel location <tt>x,y</tt> on the screen.''<br />
|-<br />
|<code>^By,x,w,h,c</code> <br />
|''Fills the width-by-height-pixel rectangle at pixel location <tt>x,y</tt> with dimensions of <tt>w,h</tt> and the color <tt>c</tt>. <tt>c</tt> is the hexadecimal color digit, the rest are decimal digits. If the line ends before the parser can find a hex digit, the code will use the background color (for compatibility with Keen 4-6 texts).''<br />
|-<br />
|[[^Mxxx]]<br />
|''[[Starts playing music number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^MOxxx]]<br />
|''[[Plays the music track number]] <tt>xxx</tt> [[only once, without repeating.]]''<br />
|-<br />
|[[^MP]]<br />
|''[[Pauses the current running music track and allows to resume it later.]]''<br />
|-<br />
|[[^MR]]<br />
|''[[Resumes music paused by]] <tt>^MP</tt>.''<br />
|-<br />
|[[^Sxxx]]<br />
|''[[Plays sound number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^W]]<br />
|''[[Waits until the current sound is done (does not update the screen).]]''<br />
|-<br />
|[[^Dttt]]<br />
|''[[Waits]] <tt>ttt</tt> [[tics (screen will be updated)]]''<br />
|-<br />
|[[^Q]] <br />
|''[["quiet" - stops sounds and music.]]''<br />
|-<br />
|[[^H]]<br />
|''[[Shows the high scores in any of the help texts.]]''<br />
|-<br />
|<code>^E</code> <br />
|''Marks the end of the dialogue.''<br />
|}<br />
<br />
<br />
The specific codes for changing the color of text are:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:center;"| Description<br>.<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:middle;"| Description<br>.<br />
|-<br />
|<br />
|''<code>^Cx</code> changes the text to color <tt>x</tt>''<br />
|<br />
|''<code>x</code> = single hex digit: <tt>0-9</tt>, <tt>A-F</tt>''<br />
|-<br />
|<code>^CA</code> <br />
|<code style="background:#AA0000; color:#55FF55"><b>bright green text color </b></code><br />
|<code>^C2</code> <br />
|<code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
|-<br />
|<code>^CB</code> <br />
|<code style="background:#AA0000; color:#55FFFF"><b>bright cyan text color </b></code><br />
|<code>^C3</code> <br />
|<code style="background:#AA0000; color:#00AAAA"><b>cyan text color </b></code><br />
|-<br />
|<code>^CC</code> <br />
|<code style="background:#AA0000; color:#FF5555"><b>bright red text color </b></code><br />
|<code>^C4</code> <br />
|<code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
|-<br />
|<code>^CD</code> <br />
|<code style="background:#AA0000; color:#FF55FF"><b>bright magenta text color</b></code><br />
|<code>^C5</code> <br />
|<code style="background:#AA0000; color:#AA00AA"><b>magenta text color </b></code><br />
|-<br />
|<code>^CE</code> <br />
|<code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
|<code>^C6</code> <br />
|<code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
|-<br />
|<code>^C9</code> <br />
|<code style="background:#AA0000; color:#5555ff"><b>bright blue text color </b></code><br />
|<code>^C1</code> <br />
|<code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
|-<br />
|<code>^CF</code> <br />
|<code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
|<code>^C7</code> <br />
|<code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
|-<br />
|<code>^C8</code> <br />
|<code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
|<code>^C0</code> <br />
|<code style="background:#AA0000; color:#000000"><b>black text color </b></code><br />
|}<br />
<br />
== Other Texts ==<br />
<br />
Some editable texts, such as level entrance messages, are not found in files within the <tt>'''EGA'''</tt> folder and instead require using a text editor to modify specific source code files located in the <tt>'''../SOURCE/MAKESTR'''</tt> folder. To edit most text files that appear in game open up the <tt>MAKESTR.C</tt> file with a text editor. This file contains Level Names, Level Entrance Texts, In-Game Messages and related texts. <br />
<br />
After editing these files, the game must be recompiled in order to integrate the changes. We'll get to the [[compiling process]] later.<br />
<br />
<br />
== Loading Window ==<br />
<br />
<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
<br />
KeenScr, in combination with TheDraw, is used for editing the loading and closing screen graphics.<br />
<br />
[[Where to find the loading screen files, copy it to keenscr folder]] <br />
<br />
Go to commander prompt and navigate to your <tt>keenscr</tt> folder and then type: <br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will immediately start editing the screen, with the filename keenscr.bin. <br />
<br />
<code>Alt</code>+<code>H</code> will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename [[keenscr.bin]]. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
[[files must be copied back to origin folder. Does this require uGrab or a recompile?]] <br />
<br />
<br />
<br />
<br />
<br />
== Adding Additional Graphics and Text Files ==<br />
Unlike standard Keen Galaxy modding, the number of text and graphics files can be expanded or rearranged in source modding. (This section will go into how to add these things, a later section will go into actually utilizing new stuff)<br />
<br />
=== Images and Sprites ===<br />
<br />
=== Text Files === <br />
<br />
=== Tiles ===<br />
<br />
= Level Editing (MAPHEAD) =<br />
<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
<br />
Open Abiathar and go to <code>File</code> and select <code>Open Project</code>. Within your projects folder you should find a dependency file called <tt>maps.adeps</tt> which you want to choose. This is your pre-setup from where you can start building levels.<br />
<br />
To store modifications press <code>Save</code> under <code>File</code>. The settings for the levels will be written to the <tt>maps.adeps</tt> file, which only contains references and pointers to the real resources files, but doesn’t store any level data on their own. <br />
<br />
Closing Abiathar for the first time, quite a few settings will get saved to the <tt>editor.aconf</tt> config file. Those settings are loaded when Abiathar starts.<br />
<br />
For basic usage, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Using_Abiathar| using Abiathar section] of the patched based modding tutorial.<br />
<br />
== Memory & Technical Limitations ==<br />
<br />
Each level must not exceed 64KiB: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about.<br />
<br />
The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
The greater the variety of tiles used, the more memory is used; each foreground tile consumes 128 bytes, whereas each background tile consumes 160 bytes.<br />
<br />
There is a maximum of 50 sprites visible on-screen at the same time, but not limit for the level as a whole. Each Sprite in the refresh manager is 50 bytes. This is calculated by taking the sprite list entry (34 bytes for each sprite), and adding the erase list entry multiplied by two due to double buffering <code>(8*2=16)</code>; thus: <code>34 + 8 * 2 = 50 bytes</code> per Sprite. The number of Sprites that are in use can be checked using the <code>F10+C</code> cheat code in game.<br />
<br />
Sprites may be placed on top of animating tiles, but a foreground animating tile may not be placed on an animating background tile.<br />
<br />
There is a maximum of 100 different tile animation sequences and 100 animated tiles visible on-screen at the same time.<br />
<br />
The song played during the level will contribute toward the overall byte size of the level.<br />
<br />
In general, when it comes to level design, compromises may need to be made for memory purposes. For example, if you want to use a lot of different graphics in a level then you might have to make the level smaller or use a music track with a smaller file size so the game doesn't run out of memory.<br />
<br />
= Tile Properties = <br />
<br />
[[what is the saving process/files involved]]<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. Consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Changing_Tile_Properties| tile properties section] of the patch based modding tutorial for further instructions.<br />
<br />
<br />
= Music and Sounds (AUDIOT) = <br />
<br />
To alter music and sounds, this chapter will discuss the following files and folders: <tt>AUDIOT.CKS, AUDIOHED.CKS, AUDIO, audio.asnds, Abiathar, MIDI2IMF, IMFCrush, WDC.</tt><br />
<br />
The <tt>AUDIOT.CKS</tt> file functions as a container that stores compressed sub files individually called chunks. Chunks in this container include AdLib music (<tt>*.IMF, *.KMF</tt>), AdLib sound effects (<tt>*AL.SND</tt>) and PC Speaker sound effects (<tt>*PC.SND</tt>). <br />
<br />
The <tt>AUDIOT.CKS</tt> file requires an associated <tt>AUDIOHED.CKS</tt> file which stores the offset location of each each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/AudioT_Format AudioT_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted music and sound files from <tt>AUDIOT.CKS</tt> that can be found in the '''<tt>AUDIO</tt>''' folder. Likewise, a configuration file (<tt>audio.asnds</tt>) [[add audio.asnds to the package]] has been added to the setup. If additional files, such as sound effects or music, are to be added to the game, the configuration file must be updated. The tool [[Abiathar]] is used to read this configuration file and import/export the changed or new files into/from the <tt>AUDIOT.CKS</tt> container.<br />
<br />
== Brief introduction into music and sound ==<br />
<br />
=== PC Sounds ===<br />
<br />
=== AdLib Sounds ===<br />
<br />
=== IMF / KMF Music ===<br />
<br />
IMF/KMF format files are packed at the end of the audio file. As IMF/KMF files contain AdLib music for games that also have AdLib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict. This is done by reserving the OPL's first channel for sound effects, leaving eight remaining channels available for use in IMF files. <br />
<br />
[[more info about this procedure needed]]<br />
<br />
It is advised to perform optimizations on existing IMF files. [[IMFCrush]] removes by default everything that drives the first AdLib/OPL channel. Generally the original IMF file is reduced by roundabout a third by converting to KMF. The reduction depends entirely on the contents of the source file. <br />
(Side note: IMFCrush is also capable of converting songs to a different playback rate, or even truncate songs.)<br />
<br />
== Music Composition ==<br />
<br />
For tips on music composition as well as the conversion process to the IMF format, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Music| music section] of the patch based modding tutorial.<br />
<br />
== Sound Effect Composition ==<br />
<br />
[[create a pre-defined setup that can be downloaded as well to shortcut things and bypass source code incompatibilities WDC has!]]<br />
<br />
WDC is an older modding tool that contains a sound effect design tool. For instructions on how to access and use this tool, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Sound_Effects| sound effects section] of the patch based modding tutorial.<br />
<br />
== Abiathar Setup and Usage == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
[[Image:Abiathar audio-mappings.png |320px|thumb|Abiathar's Audio Mappings tool]]<br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select [[the option to select]]. <br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format).<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
=== Abiathar Configuration File ===<br />
<br />
Abiathar uses <tt>audio.asnds</tt> for importing and exporting the sound and music files. It contains an entry for each song and music file in a certain format.<br />
<br />
A pc speaker sound looks like: <br />
<br />
<code>?046|PC|?046PC.SND|50 </code><br />
<br />
The first part of this entry indicates the offset location of the sound. Next, <code>PC</code> indicates [[???]]. Next is the sound file that will be used at this offset. The last digit defines the sound effect's priority; since the engine can only play one sound effect at a time this number tells it which sound has priority to play. Values can be from 00 to 99 with the higher numbers being higher priority. <br />
<br />
An AdLib sound looks like: <br />
<br />
<code>?098|PC|?098AL.SND|50|6|1,48,79,0,240,96,255,1,0,0,0,0,0 </code><br />
<br />
As you can see, this entry begins in the same manner as a PC speaker sound, right up to the priority value. The additional numbers that occur after are instrument information that can be ignored (the source engine does not actually use these values), however, Abiathar requires placeholder numbers to be included (any values will do). <br />
<br />
[[example of Music entries]]<br />
<br />
=== Additional Music and Sound Effects ===<br />
<br />
Sound effects and music must occur sequentially in the numbered list found in <tt>'''audio.asnds'''</tt>. Beginning with PC speaker sounds, additional sounds must appear after the last PC speaker sound. Then existing AdLib sound entries must be shifted up the numbered list by the number of PC speaker sounds added, followed by additional entries corresponding to the number of new AdLib sounds. The number of of PC spaker sounds and Adlib sounds must equal each other. Lastly, music is shifted up the numbered list by the required amount. The result is a consistent numbered list of pc speaker sounds, AdLib sounds, and music files.<br />
<br />
This process requires a lot of relabeling files, detailed modification to <tt>'''audio.asnds'''</tt>, importing with Abiathar, and modification to and recompiling the source code. With that in mind, it is highly recommended to import all additional sound effects at one time (using placeholders if necessary), to avoid repeatedly having to reorder files and filenames. Adding new music is a similar process, but because the music cluster of chunks appears last in <tt>'''AUDIOT.CKS'''</tt>, it is a simpler task requiring less forethought.<br />
<br />
==== Adding Sound Effects ====<br />
<br />
Begin the process by naming your PC speaker sound effects so that they occur after the final existing PC speaker sound in your '''AUDIO''' folder.<br />
<br />
Next, all AdLib sounds must be renamed so that their numbered order begins after the new final PC speaker sound. [[Automating this process?]]<br />
<br />
Next, your new AdLib sounds should be renamed to occur after the newly ordered final existing AdLib sound. <br />
<br />
Next, all music files must be renamed so that their numbered order begins after the new final AdLib sound.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified in the same manner that the files were renamed: PC speaker sound entries added, Adlib entries renumbered, Adlib entries added, and music entries renumbered.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, and <tt>NUMSNDCHUNKS</tt> to two times the value of <tt>NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
==== Adding Music ====<br />
<br />
Begin by naming your songs so that they occur after the final existing music files in your '''AUDIO''' folder.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified with music entries added for the new songs.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, <tt>NUMMUSIC</tt> to the number of songs, and <tt>NUMSNDCHUNKS</tt> to two times the value of NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
= Source Code Editing =<br />
<br />
Because source code modding provides endless possibilities, only limited by a modder's programming ability, this section will only introduce the most basic steps involved in some fundamental modifications that a modder might want when creating a 'typical' Commander Keen mod. <br />
<br />
[[How to add additional levels]]<br />
<br />
[[How to modify a creature's behavior]]<br />
<br />
[[How to create a new enemy actor]]<br />
<br />
[[How to create a new tile property]]<br />
<br />
<br />
= Compiling the Source Code =<br />
<br />
[[Image:Borland C source code compiling 01.png |320px|thumb|Working with Borland C++ v3.1]]<br />
<br />
[[Image:Borland C source code compiling 02.png |320px|thumb|Compiling, error message]]<br />
<br />
[[Introduction into Borland C++ v.3.1]]<br />
<br />
= Credits For This Tutorial =<br />
<br />
* Written and assembled by [[User:Ceilick|Ceilick]] and [[User:Nisaba|Nisaba]]<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(source_code_based)&diff=46164Keen Galaxy Modding Tutorial (source code based)2022-08-31T14:49:04Z<p>Ceilick: /* Modding Package */ base folder</p>
<hr />
<div>{{Alert|'''This page is still under construction!'''}}<br />
<br />
This tutorial aims to teach [[Keen:Galaxy Source Modding Package|Keen:Galaxy Source Mod]] modding in terms of what is different from modding without source code. It will primarily cover tool usage and the new options provided by the supplied source code package and its modification. Creating a full source mod requires some basic coding knowledge that this tutorial will not cover, but it will explain where and what needs to be coded and provide limited code examples for common tasks and features. <br />
<br />
For general, introductory Keen Galaxy modding information not covered here, please consult the [[Keen Galaxy Modding Tutorial (patch based)|patch based Keen Galaxy Modding Tutorial]]. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft</tt> <tt>Windows</tt> s based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Downlad the core [[Keen:Galaxy Source Modding Package]]. This bundle contains a source code package with a number of pre-setup tools and files. Make sure to extract all files and keep the pre-defined folder structure. To facilitate modding, this package contains all resources present in their decompressed format.<br />
<br />
== Modding Package ==<br />
<br />
The modding package contains, amongst others, the following folders with resources in their decompressed format: <br />
* The '''[[Base Folder Name]]''' folder contains everything to run the game including the executable and the <tt>MAPHEAD.CKS</tt> container file, which stores the levels.]]<br />
* The '''AUDIO''' folder contains music and sound effect files that are stored in the games <tt>AUDIOT.CKS</tt> container file. <br />
* The '''EGA''' folder contains mainly graphic and text files that are stored in the games <tt>EGAGRAPH.CKS</tt> container file. <br />
* The '''SOURCE''' folder contains everything source code related written in the high-level language <tt>C/C++</tt> . <tt>SRCMOD.EXE</tt> is the compiled executable. <br />
<br />
The modding packages also contains a few core tools to modify, import, and export those resource files. In brief: <br />
* [[Abiathar]] is used for editing maps (using the <tt>map.adeps</tt> definition file for <tt>MAPTEMP.CKS</tt>). It is also used to create the game audio archive (using the <tt>audio.asnds</tt> definition file for <tt>AUDIOT.CKS</tt>). <br />
* [[uGrab]] functions as an <tt>EGAGRAPH.CKS</tt> editor. For convenience, two batch files (<tt>ega-in.bat</tt>, <tt>ega-out.bat</tt>) are included for easy import and export of graphics. The game archive structure can be altered by editing the <tt>ega.def</tt> definitions file. <br />
* [[Borland 3.1]] is used to compile the code; a Borland 3.1 project file ([[SRCMOD.PRJ]]) has been included for this purpose. Borland compilers can be invoked in a 16-bit DOS environment (e.g., DOSBox v0.74 has been successfully used).<br />
<br />
[[Let's also add a TOOLS, a INFO and a UPLOAD folder]]<br />
<br />
[[Modding folder structure setup goes here]]<br />
<br />
== Tools ==<br />
<br />
This is the complete list of tools used for source modding:<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|''Version 2.11.4 Beta 1 or higher is required''<br />
|-<br />
|[[Borland C++ Compiler]]<br />
|Source Code Compiler <br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro Graphic Text Editor <br />
|<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.''<br />
|-<br />
|[[TliExtend]]<br />
|Tileinfo Extension <br />
|''This tool is a command line based tileinfo extension utility for Abiathar''<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|''Also used for adding additional graphics and texts files.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used''<br />
|<br />
|}<br />
<br />
<!--Additional Tools?--><br />
<br />
= Engine Information = <br />
<br />
In contrast to classic modding via patches, working with the source code allows much more freedom. Nevertheless, there are some limitations that must be taken into account.<br />
<br />
For several reasons DOS only allows a maximum amount of 640KiB of memory available to programs. Therefore DOS (and maybe some drivers) as well as the game program and most of the game data (levels, music, graphics) must fit into these 640KiB.<br />
<br />
The game engine organizes certain segments into memory blocks with an upper limit of 64KiB. This means that the number of music tracks, sprites and tiles is limited to a certain degree. Realistically music and levels are the only parts (besides, perhaps, the sprite info block) where the 64KiB limit could be problematic.<br />
<br />
Here are some basic limitations:<br />
<br />
*<u><tt>Audio</tt></u>: each sound and each piece of music must not be larger than 64KiB.<br />
<br />
*<u><tt>Levels</tt></u>: also referred to as map-planes, each of these must not exceed 64KiB. For details, see the below section on [[Keen Source Mod Modding Tutorial#Memory_.26_Technical_Limitations|level limitations]].<br />
<br />
*<u><tt>Tilesets</tt></u>: There is no concrete upper limit for the number of tiles a tileset can have. The only requirement is that the MAPHEAD and EGAHEAD must be smaller than 64KiB each in order to be loaded into memory correctly. (Theoretically a little more than 7,200 tiles per tileset are allowed.)<br />
<br />
*<u><tt>Sprites:</tt></u> The maximum number of sprites in the EGAGRAPH file is limited to 3640. If more sprites are inserted, then the data block with the sprite info (width, height, hitbox, shifts, etc.) will be larger than 64KiB.<br />
<br />
'''Note''': Some of this is not set in stone. In ID_RF.H some of these values can be adjusted, but this would then consume more memory.<br />
<br />
<!--<br />
== EGAHEAD ==<br />
<br />
[[Information on the EGAHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
<br />
== MAPHEAD ==<br />
<br />
[[Information on the MAPHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
--><br />
<br />
= Graphics and Texts (EGAGRAPH) =<br />
<br />
The <tt>EGAGRAPH.CKS</tt> file (aslo called the EGA graphics library) functions as a container the stores compressed sub files which are individually called chunks. Chunks in this container include all graphics, demos, fonts, sprites, tiles, texts and other game files. <br />
<br />
The <tt>EGAHEAD.CKS</tt> file contains information about the size of the <tt>EGAGRAPH.CKS</tt> file and the offset location of each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/EGAGraph_Format EGAGraph_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted graphics and text files from <tt>EGAGRAPH.CKS</tt> the can be found in the '''<tt>EGA</tt>''' folder. Likewise, a definitions file (<tt>ega.def</tt>) [[add ega.def to the package]] has been added to the setup. If additional files, such as graphics or sprites, are to be added to the game, the definitions file must be updated. The tool [[uGrab]] is used to read this definition file and import/export the changed or new files into/from the <tt>EGAGRAPH.CKS</tt> container.<br />
<br />
[[Image:Ega-Color-Palette.png|160px|thumb|EGA Color Palette]]<br />
To begin editing graphics and most texts found in the game, go to the '''<tt>EGA</tt>''' folder. You can edit any of the images how you want but must follow two rules: you must use the [[moddingwiki:EGA_Palette|original 16 EGA Keen colours]], and all images must have a width that is a multiple of 8 pixels.<br />
<br />
All the image, text, and other files within '''<tt>EGA</tt>''' are arranged in clusters by file type. The following table gives an overview of each file type, and you can can find a corresponding overview in the <tt>ega.def</tt> definitions file as well.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|CKS_ansi_*.bin<br />
|Final screen <br />
|''Appears after quitting the game.''<br />
|-<br />
|CKS_fon_*.bmp<br />
|Font sheets <br />
|''These fonts are used throughout the game.''<br />
|-<br />
|CKS_pic_*.bmp<br />
|Main menu and help section images<br />
|<br />
|-<br />
|CKS_sprite_*.bmp<br />
|Sprite images <br />
|<br />
|-<br />
|CKS_sprites.txt<br />
|Sprite definition text file<br />
|''Hitboxes and offset values are defined for each sprite.''<br />
|-<br />
|CKS_terminator_*<br />
|Terminator text sequence <br />
|''Appears at the games first start and leads to the title screen.''<br />
|-<br />
|CKS_tile8*.bmp<br />
|Drop-down menu Tilesets <br />
|''These tilesets contain numerous tiles. Each tile has a size of 8x8 pixel.''<br />
|-<br />
|CKS_tile16*.bmp<br />
|Fore- and Background-Tileset <br />
|''These tilesets contain numerous tiles. Each tile has a size of 16x16 pixel.''<br />
|-<br />
|CKS_txt*.txt<br />
|Text sheets<br />
|''Containing story element texts and help section information.''<br />
|-<br />
|CKS_txt_STARWARS.txt<br />
|Scrolling story text<br />
|''The so called Star Wars Story Screen.''<br />
|-<br />
|CKS_DEMO*.CKS<br />
|Demo recordings <br />
|<br />
|}<br />
<br />
== Import and Export Files ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
To import / export the files located in '''EGA''', use <tt>[[uGrab]]</tt>. <tt>uGrab</tt> is an advanced EGAGRAPH editor with a graphical user interface which can not only import / export graphics, but can also add, move or remove sprites in Commander Keen source mods. <br />
<br />
For <tt>uGrab</tt> to work, a definition file is required, which is already included within the Source Code Modding bundle. [[How to manually modify definition file]].<br />
<br />
To begin, open <tt>uGrab</tt> and go to <code>Import</code> and select <code>Import from bitmap folder...</code>. Locate the <tt>ega.def</tt> definition file in your project folder and open it. A dialog pops up that asks you to select the '''EGA''' folder. Do so and press <code>OK</code>. The graphics and text files have now been imported into <tt>uGrab</tt>. <br />
<br />
To import these files into the EGAGRAPH simply go to <code>Export</code> and select <code>Export as EGAGRAPH...</code>. In the following window locate <tt>EGAGRAPH.CKS</tt> file and press <code>Save</code>. <tt>uGrab</tt> will then ask you to select a Huffman Compression Type; choose <code>Best (Slowest)</code>. It will then ask if you want to update the definition file, which you should confirm. The new graphics and text files should now be exported into the game files.<br />
<br />
An alternative to running an instance of <tt>uGrab</tt> is through batch files. The modding package comes with two batch files which can be used to speed up and automate the import / export process significantly. Simply double-click <code>ega-in.bat</code> to import and double-click <code>ega-out.bat</code> to export all files. To learn more about how those batch files operate, simply open them with a text editor such as notepad.<br />
<br />
== Tilesets == <br />
<br />
You can edit tiles in the typical manner, however, the first row of tiles in the foreground tileset (<tt>CKS_tile16m</tt>) is generally reserved to render certain blocking elements. Those are used for debugging reasons and should stay untouched. <br />
<br />
[[Short note about tiles (16x16 pixel) for the novice modder]]<br />
<br />
[[Reminder: inserted corresponding graphics to the tile16m file for the final modding package.]]<br />
<br />
[[example image goes here.]]<br />
<br />
== Sprite Hitboxes ==<br />
<br />
Just like standard modding, <tt>CKS_sprites.txt</tt> is used for establishing Sprite hitboxes. Since we are dealing with a modified version of the source code, the last value in a <tt>CKS_sprites.txt</tt> entry, handling animation frame rate, must stay at 1. Otherwise there will be errors in the rendering. (Desired adjustments need to be taken in the source code)<br />
<br />
== Texts ==<br />
<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
Text files can be edited with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
They employ a formatting code:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting code<br />
! style="text-align:left;"| Description<br />
|-<br />
|<code>^P</code> <br />
|''Marks the beginning of a page.''<br />
|-<br />
|<code>^Gy,x,n</code> <br />
|''Displays a bitmap. The image number <tt>n</tt> used here doesn't match up with the image numbers in your EGA folder; [[OUTDATED? the image shown is the image number plus seven (n + 7)]]. The <tt>x,y</tt> are coordinates which determine where the image appears on the screen. The <tt>^G</tt> command can also use sprites and both types of 16x16 pixel tiles (TILE16 and TILE16M).''<br />
|-<br />
|<code>^Ly,x</code> <br />
|''Following text will be aligned beginning at pixel location <tt>x,y</tt>.''<br />
|-<br />
|<code>^Ty,x,n,t</code> <br />
|''After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap [[OUTDATED? (n + 7)]] at pixel location <tt>x,y</tt> on the screen.''<br />
|-<br />
|<code>^By,x,w,h,c</code> <br />
|''Fills the width-by-height-pixel rectangle at pixel location <tt>x,y</tt> with dimensions of <tt>w,h</tt> and the color <tt>c</tt>. <tt>c</tt> is the hexadecimal color digit, the rest are decimal digits. If the line ends before the parser can find a hex digit, the code will use the background color (for compatibility with Keen 4-6 texts).''<br />
|-<br />
|[[^Mxxx]]<br />
|''[[Starts playing music number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^MOxxx]]<br />
|''[[Plays the music track number]] <tt>xxx</tt> [[only once, without repeating.]]''<br />
|-<br />
|[[^MP]]<br />
|''[[Pauses the current running music track and allows to resume it later.]]''<br />
|-<br />
|[[^MR]]<br />
|''[[Resumes music paused by]] <tt>^MP</tt>.''<br />
|-<br />
|[[^Sxxx]]<br />
|''[[Plays sound number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^W]]<br />
|''[[Waits until the current sound is done (does not update the screen).]]''<br />
|-<br />
|[[^Dttt]]<br />
|''[[Waits]] <tt>ttt</tt> [[tics (screen will be updated)]]''<br />
|-<br />
|[[^Q]] <br />
|''[["quiet" - stops sounds and music.]]''<br />
|-<br />
|[[^H]]<br />
|''[[Shows the high scores in any of the help texts.]]''<br />
|-<br />
|<code>^E</code> <br />
|''Marks the end of the dialogue.''<br />
|}<br />
<br />
<br />
The specific codes for changing the color of text are:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:center;"| Description<br>.<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:middle;"| Description<br>.<br />
|-<br />
|<br />
|''<code>^Cx</code> changes the text to color <tt>x</tt>''<br />
|<br />
|''<code>x</code> = single hex digit: <tt>0-9</tt>, <tt>A-F</tt>''<br />
|-<br />
|<code>^CA</code> <br />
|<code style="background:#AA0000; color:#55FF55"><b>bright green text color </b></code><br />
|<code>^C2</code> <br />
|<code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
|-<br />
|<code>^CB</code> <br />
|<code style="background:#AA0000; color:#55FFFF"><b>bright cyan text color </b></code><br />
|<code>^C3</code> <br />
|<code style="background:#AA0000; color:#00AAAA"><b>cyan text color </b></code><br />
|-<br />
|<code>^CC</code> <br />
|<code style="background:#AA0000; color:#FF5555"><b>bright red text color </b></code><br />
|<code>^C4</code> <br />
|<code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
|-<br />
|<code>^CD</code> <br />
|<code style="background:#AA0000; color:#FF55FF"><b>bright magenta text color</b></code><br />
|<code>^C5</code> <br />
|<code style="background:#AA0000; color:#AA00AA"><b>magenta text color </b></code><br />
|-<br />
|<code>^CE</code> <br />
|<code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
|<code>^C6</code> <br />
|<code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
|-<br />
|<code>^C9</code> <br />
|<code style="background:#AA0000; color:#5555ff"><b>bright blue text color </b></code><br />
|<code>^C1</code> <br />
|<code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
|-<br />
|<code>^CF</code> <br />
|<code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
|<code>^C7</code> <br />
|<code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
|-<br />
|<code>^C8</code> <br />
|<code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
|<code>^C0</code> <br />
|<code style="background:#AA0000; color:#000000"><b>black text color </b></code><br />
|}<br />
<br />
== Other Texts ==<br />
<br />
Some editable texts, such as level entrance messages, are not found in files within the <tt>'''EGA'''</tt> folder and instead require using a text editor to modify specific source code files located in the <tt>'''../SOURCE/MAKESTR'''</tt> folder. To edit most text files that appear in game open up the <tt>MAKESTR.C</tt> file with a text editor. This file contains Level Names, Level Entrance Texts, In-Game Messages and related texts. <br />
<br />
After editing these files, the game must be recompiled in order to integrate the changes. We'll get to the [[compiling process]] later.<br />
<br />
<br />
== Loading Window ==<br />
<br />
<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
<br />
KeenScr, in combination with TheDraw, is used for editing the loading and closing screen graphics.<br />
<br />
[[Where to find the loading screen files, copy it to keenscr folder]] <br />
<br />
Go to commander prompt and navigate to your <tt>keenscr</tt> folder and then type: <br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will immediately start editing the screen, with the filename keenscr.bin. <br />
<br />
<code>Alt</code>+<code>H</code> will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename [[keenscr.bin]]. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
[[files must be copied back to origin folder. Does this require uGrab or a recompile?]] <br />
<br />
<br />
<br />
<br />
<br />
== Adding Additional Graphics and Text Files ==<br />
Unlike standard Keen Galaxy modding, the number of text and graphics files can be expanded or rearranged in source modding. (This section will go into how to add these things, a later section will go into actually utilizing new stuff)<br />
<br />
=== Images and Sprites ===<br />
<br />
=== Text Files === <br />
<br />
=== Tiles ===<br />
<br />
= Level Editing (MAPHEAD) =<br />
<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
<br />
Open Abiathar and go to <code>File</code> and select <code>Open Project</code>. Within your projects folder you should find a dependency file called <tt>maps.adeps</tt> which you want to choose. This is your pre-setup from where you can start building levels.<br />
<br />
To store modifications press <code>Save</code> under <code>File</code>. The settings for the levels will be written to the <tt>maps.adeps</tt> file, which only contains references and pointers to the real resources files, but doesn’t store any level data on their own. <br />
<br />
Closing Abiathar for the first time, quite a few settings will get saved to the <tt>editor.aconf</tt> config file. Those settings are loaded when Abiathar starts.<br />
<br />
For basic usage, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Using_Abiathar| using Abiathar section] of the patched based modding tutorial.<br />
<br />
== Memory & Technical Limitations ==<br />
<br />
Each level must not exceed 64KiB: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about.<br />
<br />
The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
The greater the variety of tiles used, the more memory is used; each foreground tile consumes 128 bytes, whereas each background tile consumes 160 bytes.<br />
<br />
There is a maximum of 50 sprites visible on-screen at the same time, but not limit for the level as a whole. Each Sprite in the refresh manager is 50 bytes. This is calculated by taking the sprite list entry (34 bytes for each sprite), and adding the erase list entry multiplied by two due to double buffering <code>(8*2=16)</code>; thus: <code>34 + 8 * 2 = 50 bytes</code> per Sprite. The number of Sprites that are in use can be checked using the <code>F10+C</code> cheat code in game.<br />
<br />
Sprites may be placed on top of animating tiles, but a foreground animating tile may not be placed on an animating background tile.<br />
<br />
There is a maximum of 100 different tile animation sequences and 100 animated tiles visible on-screen at the same time.<br />
<br />
The song played during the level will contribute toward the overall byte size of the level.<br />
<br />
In general, when it comes to level design, compromises may need to be made for memory purposes. For example, if you want to use a lot of different graphics in a level then you might have to make the level smaller or use a music track with a smaller file size so the game doesn't run out of memory.<br />
<br />
= Tile Properties = <br />
<br />
[[what is the saving process/files involved]]<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. Consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Changing_Tile_Properties| tile properties section] of the patch based modding tutorial for further instructions.<br />
<br />
<br />
= Music and Sounds (AUDIOT) = <br />
<br />
To alter music and sounds, this chapter will discuss the following files and folders: <tt>AUDIOT.CKS, AUDIOHED.CKS, AUDIO, audio.asnds, Abiathar, MIDI2IMF, IMFCrush, WDC.</tt><br />
<br />
The <tt>AUDIOT.CKS</tt> file functions as a container that stores compressed sub files individually called chunks. Chunks in this container include AdLib music (<tt>*.IMF, *.KMF</tt>), AdLib sound effects (<tt>*AL.SND</tt>) and PC Speaker sound effects (<tt>*PC.SND</tt>). <br />
<br />
The <tt>AUDIOT.CKS</tt> file requires an associated <tt>AUDIOHED.CKS</tt> file which stores the offset location of each each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/AudioT_Format AudioT_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted music and sound files from <tt>AUDIOT.CKS</tt> that can be found in the '''<tt>AUDIO</tt>''' folder. Likewise, a configuration file (<tt>audio.asnds</tt>) [[add audio.asnds to the package]] has been added to the setup. If additional files, such as sound effects or music, are to be added to the game, the configuration file must be updated. The tool [[Abiathar]] is used to read this configuration file and import/export the changed or new files into/from the <tt>AUDIOT.CKS</tt> container.<br />
<br />
== Brief introduction into music and sound ==<br />
<br />
=== PC Sounds ===<br />
<br />
=== AdLib Sounds ===<br />
<br />
=== IMF / KMF Music ===<br />
<br />
IMF/KMF format files are packed at the end of the audio file. As IMF/KMF files contain AdLib music for games that also have AdLib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict. This is done by reserving the OPL's first channel for sound effects, leaving eight remaining channels available for use in IMF files. <br />
<br />
[[more info about this procedure needed]]<br />
<br />
It is advised to perform optimizations on existing IMF files. [[IMFCrush]] removes by default everything that drives the first AdLib/OPL channel. Generally the original IMF file is reduced by roundabout a third by converting to KMF. The reduction depends entirely on the contents of the source file. <br />
(Side note: IMFCrush is also capable of converting songs to a different playback rate, or even truncate songs.)<br />
<br />
== Music Composition ==<br />
<br />
For tips on music composition as well as the conversion process to the IMF format, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Music| music section] of the patch based modding tutorial.<br />
<br />
== Sound Effect Composition ==<br />
<br />
[[create a pre-defined setup that can be downloaded as well to shortcut things and bypass source code incompatibilities WDC has!]]<br />
<br />
WDC is an older modding tool that contains a sound effect design tool. For instructions on how to access and use this tool, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Sound_Effects| sound effects section] of the patch based modding tutorial.<br />
<br />
== Abiathar Setup and Usage == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
[[Image:Abiathar audio-mappings.png |320px|thumb|Abiathar's Audio Mappings tool]]<br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select [[the option to select]]. <br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format).<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
=== Abiathar Configuration File ===<br />
<br />
Abiathar uses <tt>audio.asnds</tt> for importing and exporting the sound and music files. It contains an entry for each song and music file in a certain format.<br />
<br />
A pc speaker sound looks like: <br />
<br />
<code>?046|PC|?046PC.SND|50 </code><br />
<br />
The first part of this entry indicates the offset location of the sound. Next, <code>PC</code> indicates [[???]]. Next is the sound file that will be used at this offset. The last digit defines the sound effect's priority; since the engine can only play one sound effect at a time this number tells it which sound has priority to play. Values can be from 00 to 99 with the higher numbers being higher priority. <br />
<br />
An AdLib sound looks like: <br />
<br />
<code>?098|PC|?098AL.SND|50|6|1,48,79,0,240,96,255,1,0,0,0,0,0 </code><br />
<br />
As you can see, this entry begins in the same manner as a PC speaker sound, right up to the priority value. The additional numbers that occur after are instrument information that can be ignored (the source engine does not actually use these values), however, Abiathar requires placeholder numbers to be included (any values will do). <br />
<br />
[[example of Music entries]]<br />
<br />
=== Additional Music and Sound Effects ===<br />
<br />
Sound effects and music must occur sequentially in the numbered list found in <tt>'''audio.asnds'''</tt>. Beginning with PC speaker sounds, additional sounds must appear after the last PC speaker sound. Then existing AdLib sound entries must be shifted up the numbered list by the number of PC speaker sounds added, followed by additional entries corresponding to the number of new AdLib sounds. The number of of PC spaker sounds and Adlib sounds must equal each other. Lastly, music is shifted up the numbered list by the required amount. The result is a consistent numbered list of pc speaker sounds, AdLib sounds, and music files.<br />
<br />
This process requires a lot of relabeling files, detailed modification to <tt>'''audio.asnds'''</tt>, importing with Abiathar, and modification to and recompiling the source code. With that in mind, it is highly recommended to import all additional sound effects at one time (using placeholders if necessary), to avoid repeatedly having to reorder files and filenames. Adding new music is a similar process, but because the music cluster of chunks appears last in <tt>'''AUDIOT.CKS'''</tt>, it is a simpler task requiring less forethought.<br />
<br />
==== Adding Sound Effects ====<br />
<br />
Begin the process by naming your PC speaker sound effects so that they occur after the final existing PC speaker sound in your '''AUDIO''' folder.<br />
<br />
Next, all AdLib sounds must be renamed so that their numbered order begins after the new final PC speaker sound. [[Automating this process?]]<br />
<br />
Next, your new AdLib sounds should be renamed to occur after the newly ordered final existing AdLib sound. <br />
<br />
Next, all music files must be renamed so that their numbered order begins after the new final AdLib sound.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified in the same manner that the files were renamed: PC speaker sound entries added, Adlib entries renumbered, Adlib entries added, and music entries renumbered.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, and <tt>NUMSNDCHUNKS</tt> to two times the value of <tt>NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
==== Adding Music ====<br />
<br />
Begin by naming your songs so that they occur after the final existing music files in your '''AUDIO''' folder.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified with music entries added for the new songs.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, <tt>NUMMUSIC</tt> to the number of songs, and <tt>NUMSNDCHUNKS</tt> to two times the value of NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
= Source Code Editing =<br />
<br />
Because source code modding provides endless possibilities, only limited by a modder's programming ability, this section will only introduce the most basic steps involved in some fundamental modifications that a modder might want when creating a 'typical' Commander Keen mod. <br />
<br />
[[How to add additional levels]]<br />
<br />
[[How to modify a creature's behavior]]<br />
<br />
[[How to create a new enemy actor]]<br />
<br />
[[How to create a new tile property]]<br />
<br />
<br />
= Compiling the Source Code =<br />
<br />
[[Image:Borland C source code compiling 01.png |320px|thumb|Working with Borland C++ v3.1]]<br />
<br />
[[Image:Borland C source code compiling 02.png |320px|thumb|Compiling, error message]]<br />
<br />
[[Introduction into Borland C++ v.3.1]]<br />
<br />
= Credits For This Tutorial =<br />
<br />
* Written and assembled by [[User:Ceilick|Ceilick]] and [[User:Nisaba|Nisaba]]<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(source_code_based)&diff=46163Keen Galaxy Modding Tutorial (source code based)2022-08-31T14:36:01Z<p>Ceilick: /* Engine Information */ removing reference to a chunk before it's defined in the next section</p>
<hr />
<div>{{Alert|'''This page is still under construction!'''}}<br />
<br />
This tutorial aims to teach [[Keen:Galaxy Source Modding Package|Keen:Galaxy Source Mod]] modding in terms of what is different from modding without source code. It will primarily cover tool usage and the new options provided by the supplied source code package and its modification. Creating a full source mod requires some basic coding knowledge that this tutorial will not cover, but it will explain where and what needs to be coded and provide limited code examples for common tasks and features. <br />
<br />
For general, introductory Keen Galaxy modding information not covered here, please consult the [[Keen Galaxy Modding Tutorial (patch based)|patch based Keen Galaxy Modding Tutorial]]. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft</tt> <tt>Windows</tt> s based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Downlad the core [[Keen:Galaxy Source Modding Package]]. This bundle contains a source code package with a number of pre-setup tools and files. Make sure to extract all files and keep the pre-defined folder structure. To facilitate modding, this package contains all resources present in their decompressed format.<br />
<br />
== Modding Package ==<br />
<br />
The modding package contains (amongst others) three sub-directories which are '''AUDIO''', '''EGA''' and '''SOURCE'''. They present all resources in their decompressed format. <br />
* The '''AUDIO''' folder contains music files and sound effects that are stored in the games <tt>AUDIOT.CKS</tt> container file. <br />
* The '''EGA''' folder contains mainly graphic and text files that are stored in the games <tt>EGAGRAPH.CKS</tt> container file. <br />
* The '''SOURCE''' folder contains everything source code related written in the high-level language <tt>C/C++</tt> . <tt>SRCMOD.EXE</tt> is the compiled executable. <br />
<br />
The modding packages also contains a few core tools to modify, import, and export those resource files. In brief: <br />
* [[Abiathar]] is used for editing maps (using the <tt>map.adeps</tt> definition file for <tt>MAPTEMP.CKS</tt>). It is also used to create the game audio archive (using the <tt>audio.asnds</tt> definition file for <tt>AUDIOT.CKS</tt>). <br />
* [[uGrab]] functions as an <tt>EGAGRAPH.CKS</tt> editor. For convenience, two batch files (<tt>ega-in.bat</tt>, <tt>ega-out.bat</tt>) are included for easy import and export of graphics. The game archive structure can be altered by editing the <tt>ega.def</tt> definitions file. <br />
* [[Borland 3.1]] is used to compile the code; a Borland 3.1 project file ([[SRCMOD.PRJ]]) has been included for this purpose. Borland compilers can be invoked in a 16-bit DOS environment (e.g., DOSBox v0.74 has been successfully used).<br />
<br />
[[Let's also add a TOOLS, a INFO and a UPLOAD folder]]<br />
<br />
[[Modding folder structure setup goes here]]<br />
<br />
== Tools ==<br />
<br />
This is the complete list of tools used for source modding:<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|''Version 2.11.4 Beta 1 or higher is required''<br />
|-<br />
|[[Borland C++ Compiler]]<br />
|Source Code Compiler <br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro Graphic Text Editor <br />
|<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.''<br />
|-<br />
|[[TliExtend]]<br />
|Tileinfo Extension <br />
|''This tool is a command line based tileinfo extension utility for Abiathar''<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|''Also used for adding additional graphics and texts files.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used''<br />
|<br />
|}<br />
<br />
<!--Additional Tools?--><br />
<br />
= Engine Information = <br />
<br />
In contrast to classic modding via patches, working with the source code allows much more freedom. Nevertheless, there are some limitations that must be taken into account.<br />
<br />
For several reasons DOS only allows a maximum amount of 640KiB of memory available to programs. Therefore DOS (and maybe some drivers) as well as the game program and most of the game data (levels, music, graphics) must fit into these 640KiB.<br />
<br />
The game engine organizes certain segments into memory blocks with an upper limit of 64KiB. This means that the number of music tracks, sprites and tiles is limited to a certain degree. Realistically music and levels are the only parts (besides, perhaps, the sprite info block) where the 64KiB limit could be problematic.<br />
<br />
Here are some basic limitations:<br />
<br />
*<u><tt>Audio</tt></u>: each sound and each piece of music must not be larger than 64KiB.<br />
<br />
*<u><tt>Levels</tt></u>: also referred to as map-planes, each of these must not exceed 64KiB. For details, see the below section on [[Keen Source Mod Modding Tutorial#Memory_.26_Technical_Limitations|level limitations]].<br />
<br />
*<u><tt>Tilesets</tt></u>: There is no concrete upper limit for the number of tiles a tileset can have. The only requirement is that the MAPHEAD and EGAHEAD must be smaller than 64KiB each in order to be loaded into memory correctly. (Theoretically a little more than 7,200 tiles per tileset are allowed.)<br />
<br />
*<u><tt>Sprites:</tt></u> The maximum number of sprites in the EGAGRAPH file is limited to 3640. If more sprites are inserted, then the data block with the sprite info (width, height, hitbox, shifts, etc.) will be larger than 64KiB.<br />
<br />
'''Note''': Some of this is not set in stone. In ID_RF.H some of these values can be adjusted, but this would then consume more memory.<br />
<br />
<!--<br />
== EGAHEAD ==<br />
<br />
[[Information on the EGAHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
<br />
== MAPHEAD ==<br />
<br />
[[Information on the MAPHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
--><br />
<br />
= Graphics and Texts (EGAGRAPH) =<br />
<br />
The <tt>EGAGRAPH.CKS</tt> file (aslo called the EGA graphics library) functions as a container the stores compressed sub files which are individually called chunks. Chunks in this container include all graphics, demos, fonts, sprites, tiles, texts and other game files. <br />
<br />
The <tt>EGAHEAD.CKS</tt> file contains information about the size of the <tt>EGAGRAPH.CKS</tt> file and the offset location of each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/EGAGraph_Format EGAGraph_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted graphics and text files from <tt>EGAGRAPH.CKS</tt> the can be found in the '''<tt>EGA</tt>''' folder. Likewise, a definitions file (<tt>ega.def</tt>) [[add ega.def to the package]] has been added to the setup. If additional files, such as graphics or sprites, are to be added to the game, the definitions file must be updated. The tool [[uGrab]] is used to read this definition file and import/export the changed or new files into/from the <tt>EGAGRAPH.CKS</tt> container.<br />
<br />
[[Image:Ega-Color-Palette.png|160px|thumb|EGA Color Palette]]<br />
To begin editing graphics and most texts found in the game, go to the '''<tt>EGA</tt>''' folder. You can edit any of the images how you want but must follow two rules: you must use the [[moddingwiki:EGA_Palette|original 16 EGA Keen colours]], and all images must have a width that is a multiple of 8 pixels.<br />
<br />
All the image, text, and other files within '''<tt>EGA</tt>''' are arranged in clusters by file type. The following table gives an overview of each file type, and you can can find a corresponding overview in the <tt>ega.def</tt> definitions file as well.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|CKS_ansi_*.bin<br />
|Final screen <br />
|''Appears after quitting the game.''<br />
|-<br />
|CKS_fon_*.bmp<br />
|Font sheets <br />
|''These fonts are used throughout the game.''<br />
|-<br />
|CKS_pic_*.bmp<br />
|Main menu and help section images<br />
|<br />
|-<br />
|CKS_sprite_*.bmp<br />
|Sprite images <br />
|<br />
|-<br />
|CKS_sprites.txt<br />
|Sprite definition text file<br />
|''Hitboxes and offset values are defined for each sprite.''<br />
|-<br />
|CKS_terminator_*<br />
|Terminator text sequence <br />
|''Appears at the games first start and leads to the title screen.''<br />
|-<br />
|CKS_tile8*.bmp<br />
|Drop-down menu Tilesets <br />
|''These tilesets contain numerous tiles. Each tile has a size of 8x8 pixel.''<br />
|-<br />
|CKS_tile16*.bmp<br />
|Fore- and Background-Tileset <br />
|''These tilesets contain numerous tiles. Each tile has a size of 16x16 pixel.''<br />
|-<br />
|CKS_txt*.txt<br />
|Text sheets<br />
|''Containing story element texts and help section information.''<br />
|-<br />
|CKS_txt_STARWARS.txt<br />
|Scrolling story text<br />
|''The so called Star Wars Story Screen.''<br />
|-<br />
|CKS_DEMO*.CKS<br />
|Demo recordings <br />
|<br />
|}<br />
<br />
== Import and Export Files ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
To import / export the files located in '''EGA''', use <tt>[[uGrab]]</tt>. <tt>uGrab</tt> is an advanced EGAGRAPH editor with a graphical user interface which can not only import / export graphics, but can also add, move or remove sprites in Commander Keen source mods. <br />
<br />
For <tt>uGrab</tt> to work, a definition file is required, which is already included within the Source Code Modding bundle. [[How to manually modify definition file]].<br />
<br />
To begin, open <tt>uGrab</tt> and go to <code>Import</code> and select <code>Import from bitmap folder...</code>. Locate the <tt>ega.def</tt> definition file in your project folder and open it. A dialog pops up that asks you to select the '''EGA''' folder. Do so and press <code>OK</code>. The graphics and text files have now been imported into <tt>uGrab</tt>. <br />
<br />
To import these files into the EGAGRAPH simply go to <code>Export</code> and select <code>Export as EGAGRAPH...</code>. In the following window locate <tt>EGAGRAPH.CKS</tt> file and press <code>Save</code>. <tt>uGrab</tt> will then ask you to select a Huffman Compression Type; choose <code>Best (Slowest)</code>. It will then ask if you want to update the definition file, which you should confirm. The new graphics and text files should now be exported into the game files.<br />
<br />
An alternative to running an instance of <tt>uGrab</tt> is through batch files. The modding package comes with two batch files which can be used to speed up and automate the import / export process significantly. Simply double-click <code>ega-in.bat</code> to import and double-click <code>ega-out.bat</code> to export all files. To learn more about how those batch files operate, simply open them with a text editor such as notepad.<br />
<br />
== Tilesets == <br />
<br />
You can edit tiles in the typical manner, however, the first row of tiles in the foreground tileset (<tt>CKS_tile16m</tt>) is generally reserved to render certain blocking elements. Those are used for debugging reasons and should stay untouched. <br />
<br />
[[Short note about tiles (16x16 pixel) for the novice modder]]<br />
<br />
[[Reminder: inserted corresponding graphics to the tile16m file for the final modding package.]]<br />
<br />
[[example image goes here.]]<br />
<br />
== Sprite Hitboxes ==<br />
<br />
Just like standard modding, <tt>CKS_sprites.txt</tt> is used for establishing Sprite hitboxes. Since we are dealing with a modified version of the source code, the last value in a <tt>CKS_sprites.txt</tt> entry, handling animation frame rate, must stay at 1. Otherwise there will be errors in the rendering. (Desired adjustments need to be taken in the source code)<br />
<br />
== Texts ==<br />
<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
Text files can be edited with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
They employ a formatting code:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting code<br />
! style="text-align:left;"| Description<br />
|-<br />
|<code>^P</code> <br />
|''Marks the beginning of a page.''<br />
|-<br />
|<code>^Gy,x,n</code> <br />
|''Displays a bitmap. The image number <tt>n</tt> used here doesn't match up with the image numbers in your EGA folder; [[OUTDATED? the image shown is the image number plus seven (n + 7)]]. The <tt>x,y</tt> are coordinates which determine where the image appears on the screen. The <tt>^G</tt> command can also use sprites and both types of 16x16 pixel tiles (TILE16 and TILE16M).''<br />
|-<br />
|<code>^Ly,x</code> <br />
|''Following text will be aligned beginning at pixel location <tt>x,y</tt>.''<br />
|-<br />
|<code>^Ty,x,n,t</code> <br />
|''After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap [[OUTDATED? (n + 7)]] at pixel location <tt>x,y</tt> on the screen.''<br />
|-<br />
|<code>^By,x,w,h,c</code> <br />
|''Fills the width-by-height-pixel rectangle at pixel location <tt>x,y</tt> with dimensions of <tt>w,h</tt> and the color <tt>c</tt>. <tt>c</tt> is the hexadecimal color digit, the rest are decimal digits. If the line ends before the parser can find a hex digit, the code will use the background color (for compatibility with Keen 4-6 texts).''<br />
|-<br />
|[[^Mxxx]]<br />
|''[[Starts playing music number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^MOxxx]]<br />
|''[[Plays the music track number]] <tt>xxx</tt> [[only once, without repeating.]]''<br />
|-<br />
|[[^MP]]<br />
|''[[Pauses the current running music track and allows to resume it later.]]''<br />
|-<br />
|[[^MR]]<br />
|''[[Resumes music paused by]] <tt>^MP</tt>.''<br />
|-<br />
|[[^Sxxx]]<br />
|''[[Plays sound number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^W]]<br />
|''[[Waits until the current sound is done (does not update the screen).]]''<br />
|-<br />
|[[^Dttt]]<br />
|''[[Waits]] <tt>ttt</tt> [[tics (screen will be updated)]]''<br />
|-<br />
|[[^Q]] <br />
|''[["quiet" - stops sounds and music.]]''<br />
|-<br />
|[[^H]]<br />
|''[[Shows the high scores in any of the help texts.]]''<br />
|-<br />
|<code>^E</code> <br />
|''Marks the end of the dialogue.''<br />
|}<br />
<br />
<br />
The specific codes for changing the color of text are:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:center;"| Description<br>.<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:middle;"| Description<br>.<br />
|-<br />
|<br />
|''<code>^Cx</code> changes the text to color <tt>x</tt>''<br />
|<br />
|''<code>x</code> = single hex digit: <tt>0-9</tt>, <tt>A-F</tt>''<br />
|-<br />
|<code>^CA</code> <br />
|<code style="background:#AA0000; color:#55FF55"><b>bright green text color </b></code><br />
|<code>^C2</code> <br />
|<code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
|-<br />
|<code>^CB</code> <br />
|<code style="background:#AA0000; color:#55FFFF"><b>bright cyan text color </b></code><br />
|<code>^C3</code> <br />
|<code style="background:#AA0000; color:#00AAAA"><b>cyan text color </b></code><br />
|-<br />
|<code>^CC</code> <br />
|<code style="background:#AA0000; color:#FF5555"><b>bright red text color </b></code><br />
|<code>^C4</code> <br />
|<code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
|-<br />
|<code>^CD</code> <br />
|<code style="background:#AA0000; color:#FF55FF"><b>bright magenta text color</b></code><br />
|<code>^C5</code> <br />
|<code style="background:#AA0000; color:#AA00AA"><b>magenta text color </b></code><br />
|-<br />
|<code>^CE</code> <br />
|<code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
|<code>^C6</code> <br />
|<code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
|-<br />
|<code>^C9</code> <br />
|<code style="background:#AA0000; color:#5555ff"><b>bright blue text color </b></code><br />
|<code>^C1</code> <br />
|<code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
|-<br />
|<code>^CF</code> <br />
|<code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
|<code>^C7</code> <br />
|<code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
|-<br />
|<code>^C8</code> <br />
|<code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
|<code>^C0</code> <br />
|<code style="background:#AA0000; color:#000000"><b>black text color </b></code><br />
|}<br />
<br />
== Other Texts ==<br />
<br />
Some editable texts, such as level entrance messages, are not found in files within the <tt>'''EGA'''</tt> folder and instead require using a text editor to modify specific source code files located in the <tt>'''../SOURCE/MAKESTR'''</tt> folder. To edit most text files that appear in game open up the <tt>MAKESTR.C</tt> file with a text editor. This file contains Level Names, Level Entrance Texts, In-Game Messages and related texts. <br />
<br />
After editing these files, the game must be recompiled in order to integrate the changes. We'll get to the [[compiling process]] later.<br />
<br />
<br />
== Loading Window ==<br />
<br />
<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
<br />
KeenScr, in combination with TheDraw, is used for editing the loading and closing screen graphics.<br />
<br />
[[Where to find the loading screen files, copy it to keenscr folder]] <br />
<br />
Go to commander prompt and navigate to your <tt>keenscr</tt> folder and then type: <br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will immediately start editing the screen, with the filename keenscr.bin. <br />
<br />
<code>Alt</code>+<code>H</code> will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename [[keenscr.bin]]. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
[[files must be copied back to origin folder. Does this require uGrab or a recompile?]] <br />
<br />
<br />
<br />
<br />
<br />
== Adding Additional Graphics and Text Files ==<br />
Unlike standard Keen Galaxy modding, the number of text and graphics files can be expanded or rearranged in source modding. (This section will go into how to add these things, a later section will go into actually utilizing new stuff)<br />
<br />
=== Images and Sprites ===<br />
<br />
=== Text Files === <br />
<br />
=== Tiles ===<br />
<br />
= Level Editing (MAPHEAD) =<br />
<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
<br />
Open Abiathar and go to <code>File</code> and select <code>Open Project</code>. Within your projects folder you should find a dependency file called <tt>maps.adeps</tt> which you want to choose. This is your pre-setup from where you can start building levels.<br />
<br />
To store modifications press <code>Save</code> under <code>File</code>. The settings for the levels will be written to the <tt>maps.adeps</tt> file, which only contains references and pointers to the real resources files, but doesn’t store any level data on their own. <br />
<br />
Closing Abiathar for the first time, quite a few settings will get saved to the <tt>editor.aconf</tt> config file. Those settings are loaded when Abiathar starts.<br />
<br />
For basic usage, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Using_Abiathar| using Abiathar section] of the patched based modding tutorial.<br />
<br />
== Memory & Technical Limitations ==<br />
<br />
Each level must not exceed 64KiB: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about.<br />
<br />
The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
The greater the variety of tiles used, the more memory is used; each foreground tile consumes 128 bytes, whereas each background tile consumes 160 bytes.<br />
<br />
There is a maximum of 50 sprites visible on-screen at the same time, but not limit for the level as a whole. Each Sprite in the refresh manager is 50 bytes. This is calculated by taking the sprite list entry (34 bytes for each sprite), and adding the erase list entry multiplied by two due to double buffering <code>(8*2=16)</code>; thus: <code>34 + 8 * 2 = 50 bytes</code> per Sprite. The number of Sprites that are in use can be checked using the <code>F10+C</code> cheat code in game.<br />
<br />
Sprites may be placed on top of animating tiles, but a foreground animating tile may not be placed on an animating background tile.<br />
<br />
There is a maximum of 100 different tile animation sequences and 100 animated tiles visible on-screen at the same time.<br />
<br />
The song played during the level will contribute toward the overall byte size of the level.<br />
<br />
In general, when it comes to level design, compromises may need to be made for memory purposes. For example, if you want to use a lot of different graphics in a level then you might have to make the level smaller or use a music track with a smaller file size so the game doesn't run out of memory.<br />
<br />
= Tile Properties = <br />
<br />
[[what is the saving process/files involved]]<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. Consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Changing_Tile_Properties| tile properties section] of the patch based modding tutorial for further instructions.<br />
<br />
<br />
= Music and Sounds (AUDIOT) = <br />
<br />
To alter music and sounds, this chapter will discuss the following files and folders: <tt>AUDIOT.CKS, AUDIOHED.CKS, AUDIO, audio.asnds, Abiathar, MIDI2IMF, IMFCrush, WDC.</tt><br />
<br />
The <tt>AUDIOT.CKS</tt> file functions as a container that stores compressed sub files individually called chunks. Chunks in this container include AdLib music (<tt>*.IMF, *.KMF</tt>), AdLib sound effects (<tt>*AL.SND</tt>) and PC Speaker sound effects (<tt>*PC.SND</tt>). <br />
<br />
The <tt>AUDIOT.CKS</tt> file requires an associated <tt>AUDIOHED.CKS</tt> file which stores the offset location of each each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/AudioT_Format AudioT_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted music and sound files from <tt>AUDIOT.CKS</tt> that can be found in the '''<tt>AUDIO</tt>''' folder. Likewise, a configuration file (<tt>audio.asnds</tt>) [[add audio.asnds to the package]] has been added to the setup. If additional files, such as sound effects or music, are to be added to the game, the configuration file must be updated. The tool [[Abiathar]] is used to read this configuration file and import/export the changed or new files into/from the <tt>AUDIOT.CKS</tt> container.<br />
<br />
== Brief introduction into music and sound ==<br />
<br />
=== PC Sounds ===<br />
<br />
=== AdLib Sounds ===<br />
<br />
=== IMF / KMF Music ===<br />
<br />
IMF/KMF format files are packed at the end of the audio file. As IMF/KMF files contain AdLib music for games that also have AdLib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict. This is done by reserving the OPL's first channel for sound effects, leaving eight remaining channels available for use in IMF files. <br />
<br />
[[more info about this procedure needed]]<br />
<br />
It is advised to perform optimizations on existing IMF files. [[IMFCrush]] removes by default everything that drives the first AdLib/OPL channel. Generally the original IMF file is reduced by roundabout a third by converting to KMF. The reduction depends entirely on the contents of the source file. <br />
(Side note: IMFCrush is also capable of converting songs to a different playback rate, or even truncate songs.)<br />
<br />
== Music Composition ==<br />
<br />
For tips on music composition as well as the conversion process to the IMF format, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Music| music section] of the patch based modding tutorial.<br />
<br />
== Sound Effect Composition ==<br />
<br />
[[create a pre-defined setup that can be downloaded as well to shortcut things and bypass source code incompatibilities WDC has!]]<br />
<br />
WDC is an older modding tool that contains a sound effect design tool. For instructions on how to access and use this tool, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Sound_Effects| sound effects section] of the patch based modding tutorial.<br />
<br />
== Abiathar Setup and Usage == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
[[Image:Abiathar audio-mappings.png |320px|thumb|Abiathar's Audio Mappings tool]]<br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select [[the option to select]]. <br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format).<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
=== Abiathar Configuration File ===<br />
<br />
Abiathar uses <tt>audio.asnds</tt> for importing and exporting the sound and music files. It contains an entry for each song and music file in a certain format.<br />
<br />
A pc speaker sound looks like: <br />
<br />
<code>?046|PC|?046PC.SND|50 </code><br />
<br />
The first part of this entry indicates the offset location of the sound. Next, <code>PC</code> indicates [[???]]. Next is the sound file that will be used at this offset. The last digit defines the sound effect's priority; since the engine can only play one sound effect at a time this number tells it which sound has priority to play. Values can be from 00 to 99 with the higher numbers being higher priority. <br />
<br />
An AdLib sound looks like: <br />
<br />
<code>?098|PC|?098AL.SND|50|6|1,48,79,0,240,96,255,1,0,0,0,0,0 </code><br />
<br />
As you can see, this entry begins in the same manner as a PC speaker sound, right up to the priority value. The additional numbers that occur after are instrument information that can be ignored (the source engine does not actually use these values), however, Abiathar requires placeholder numbers to be included (any values will do). <br />
<br />
[[example of Music entries]]<br />
<br />
=== Additional Music and Sound Effects ===<br />
<br />
Sound effects and music must occur sequentially in the numbered list found in <tt>'''audio.asnds'''</tt>. Beginning with PC speaker sounds, additional sounds must appear after the last PC speaker sound. Then existing AdLib sound entries must be shifted up the numbered list by the number of PC speaker sounds added, followed by additional entries corresponding to the number of new AdLib sounds. The number of of PC spaker sounds and Adlib sounds must equal each other. Lastly, music is shifted up the numbered list by the required amount. The result is a consistent numbered list of pc speaker sounds, AdLib sounds, and music files.<br />
<br />
This process requires a lot of relabeling files, detailed modification to <tt>'''audio.asnds'''</tt>, importing with Abiathar, and modification to and recompiling the source code. With that in mind, it is highly recommended to import all additional sound effects at one time (using placeholders if necessary), to avoid repeatedly having to reorder files and filenames. Adding new music is a similar process, but because the music cluster of chunks appears last in <tt>'''AUDIOT.CKS'''</tt>, it is a simpler task requiring less forethought.<br />
<br />
==== Adding Sound Effects ====<br />
<br />
Begin the process by naming your PC speaker sound effects so that they occur after the final existing PC speaker sound in your '''AUDIO''' folder.<br />
<br />
Next, all AdLib sounds must be renamed so that their numbered order begins after the new final PC speaker sound. [[Automating this process?]]<br />
<br />
Next, your new AdLib sounds should be renamed to occur after the newly ordered final existing AdLib sound. <br />
<br />
Next, all music files must be renamed so that their numbered order begins after the new final AdLib sound.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified in the same manner that the files were renamed: PC speaker sound entries added, Adlib entries renumbered, Adlib entries added, and music entries renumbered.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, and <tt>NUMSNDCHUNKS</tt> to two times the value of <tt>NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
==== Adding Music ====<br />
<br />
Begin by naming your songs so that they occur after the final existing music files in your '''AUDIO''' folder.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified with music entries added for the new songs.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, <tt>NUMMUSIC</tt> to the number of songs, and <tt>NUMSNDCHUNKS</tt> to two times the value of NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
= Source Code Editing =<br />
<br />
Because source code modding provides endless possibilities, only limited by a modder's programming ability, this section will only introduce the most basic steps involved in some fundamental modifications that a modder might want when creating a 'typical' Commander Keen mod. <br />
<br />
[[How to add additional levels]]<br />
<br />
[[How to modify a creature's behavior]]<br />
<br />
[[How to create a new enemy actor]]<br />
<br />
[[How to create a new tile property]]<br />
<br />
<br />
= Compiling the Source Code =<br />
<br />
[[Image:Borland C source code compiling 01.png |320px|thumb|Working with Borland C++ v3.1]]<br />
<br />
[[Image:Borland C source code compiling 02.png |320px|thumb|Compiling, error message]]<br />
<br />
[[Introduction into Borland C++ v.3.1]]<br />
<br />
= Credits For This Tutorial =<br />
<br />
* Written and assembled by [[User:Ceilick|Ceilick]] and [[User:Nisaba|Nisaba]]<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=User:Ceilick&diff=46162User:Ceilick2022-08-31T14:26:06Z<p>Ceilick: tutorials, other formatting</p>
<hr />
<div>'''Ceilick''' is an active keener and one of the administrators of the [https://pckf.com/index.php Public Commander Keen Forum] and the [http://www.keenmodding.org/ Keen:Modding forum]. He has created a number of Keen Vorticons mods and is the mastermind behind the unofficial [[The_Universe_Is_Toast_(MOD_Trilogy)|The Universe is Toast]] galaxy mod series. He has contributed significantly to the multiplayer [[Netkeen]], as well as a variety of other fangame and modding projects.<br />
<br />
<span style="font-size:150%">'''Upcoming Mod Projects'''</span><br />
<br />
'''[[Operation Station Infiltration]]'''<br />
<br />
Episode 2 of a source mod, levelpack trilogy in which Keen returns to the familiar setting of an Omegamatic like space station! Featuring an all new story, levels, an expanded cast of Keen 5 enemies, and other graphical additions to the Keen 5 tile set.<br />
<br />
'''[[Aliens and Their Just Desserts]]'''<br />
<br />
Episode 3 of a source mod trilogy in which Keen returns to the familiar setting of Fribbulus Xax! Featuring an all new story, levels, an expanded cast of Keen 6 enemies, and other graphical additions to the Keen 6 tile set.<br />
<br />
'''[[Sign of the Vool]]'''<br />
<br />
A source mod, standalone episode in which Keen must face the sinister Vool on the dreaded planet Yuggossus.<br />
<br />
<span style="font-size:150%">'''Keen Vorticons Mods'''</span><br />
<br />
'''Invasion of the Yorps'''<br />
<br />
In this series Commander Keen must stop the brainwashed Yorps from causing havoc across the galaxy!<br />
<br />
*[[Crash on Gobo III]] (2002)<br />
*[[Planet Destruction]] (2003)<br />
*[[Tribulation of the Yorps]] (abandoned by Ceilick in 2003, completed by [[User:Tulip|Tulip]] and others in 2009)<br />
<br />
'''Decree of the Skree'''<br />
<br />
In this series Commander Keen must stop an evil threat which involves the Gargs, the Shikadi, and a new alien race, the Skree!<br />
<br />
*[[Kidnapped Keen]] (2004)<br />
*[[Zapping the Zot]] (2004)<br />
*[[Return of the Guardians]] (2005)<br />
<br />
'''The Adventures of the Oracle Janitor'''<br />
<br />
This comedic, one-level mod series sees the player as the Oracle Janitor on his hilarious missions to rescue Commander Keen from peril!<br />
<br />
*[[The Adventures of The Oracle Janitor]] (2005)<br />
*[[Oracle_Janitor_2|Mystery of the Monastery]] (2005)<br />
*[[Oracle Janitor 3|Space Pirate Trouble]] (2005)<br />
<br />
'''Standalone Episodes'''<br />
*[[The Perilous Pursuit]] is an out of this world chase in which Commander Keen pursues Mortimer across a mysterious planet! (2005)<br />
*[[Story Land]] is a fairy tail adventure in which Commander Keen must rescue a princess from the evil wizard Merlock! (2005)<br />
*[[Episode Z]] is a sequel to [[Episode X]] by [[User:XkyRauh|Xky Rauh]] and [[Episode Y]] by Grelphy, concluding an exciting interpretation of The Universe is Toast! (2009)<br />
*[[Shadow Jack]] is an alpha demo in which the protagonist Shadow Jack must navigate the realm of darkness. (2014)<br />
*[[Ye Olde Pirate Modde]] is a nautical quest featuring treasure hunting and Voticon pirate swashbuckling! (abandoned by Ceilick in 2012, completed by [[User:Levellass|Levellass]] in 2013)<br />
<br />
<span style="font-size:150%">'''Keen Dreams Mods'''</span><br />
*[[Commander Keen Xmas 2010]] features Commander Keen in a dream like quest to save Christmas from the evil Bad Elf! (2011) (Co-authored with [[User:Levellass|Levellass]] and [[User:Szemigi|Szemi]])<br />
*[[Keen Dreams Plus]] is an enhanced version of Keen Dreams, telling the same story but featuring new enemies, levels, and more! (2011)<br />
<br />
<span style="font-size:150%">'''Keen Galaxy Mods'''</span><br />
<br />
'''The Unofficial The Universe is Toast'''<br />
<br />
In this cosmic trilogy Commander Keen battles his nemesis Mortimer McMire over the fate of the universe!<br />
<br />
*[[The Keys of Krodacia]] (2006)<br />
*[[Dead in the Desert]] (2009)<br />
*[[Battle of the Brains]] (2011) (Co-Authored with [[User:Mink|Mink]] and [[User:Tulip|Tulip]])<br />
<br />
<span style="font-size:150%">'''Keen Galaxy Source Mods'''</span><br />
<br />
'''The New Adventures of Commander Keen'''<br />
<br />
In this nostalgic trilogy Commander Keen revisits Gnosticus IV, a Shikadi space station, and Fribbulus Xax on a quest to rescue his pet Yorp!<br />
<br />
*[[Return to the Shadowlands]] (2021)<br />
*[[Operation Station Infiltration]] (TBD)<br />
*[[Aliens and Their Just Desserts]] (TBD)<br />
<br />
<span style="font-size:150%">'''Other Projects'''</span><br />
*[[Netkeen]] is a fangame in which 2-4 players go head to head in stunning multiplayer action! (2011) (A project by [[User:Lemm|Lemm]] in which Ceilick provided graphics, levels, multi-episode support, and general assistance in testing and content management)<br />
*[[Keen Crisis Earth]] is an abandoned Bio Menace mod featuring an adult Commander Keen battling an alien invasion! (2012) (Co-Authored with [[User:Paramultart|Paramultart]] and NY00123)<br />
<br />
<span style="font-size:150%">'''Articles and Tutorials'''</span><br />
*Ceilick began the [[Keen Galaxy Modding Tutorial (patch based)]] in 2011 as a guide to modding for complete beginners. It has seen various updates over the years, most recently in 2022. In the advent of source code based Keen modding, it remains a valuable first course which teaches modding and tool fundamentals that can be carried forward to source based projects.<br />
<br />
*Ceilick and [[User:Nisaba|Nisaba]] began the [[Keen Galaxy Modding Tutorial (source code based)]] in 2021 as a guide for advanced modders wishing to utilize [[User:Lemm|Lemm's]] [[Keen:Galaxy Source Modding Package]] or similar Keen Galaxy source code recreations. <br />
<br />
<br />
<br />
<br />
== My Mods ==<br />
<br />
{{MyMods}}</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46141Keen Galaxy Modding Tutorial (patch based)2022-08-30T21:49:40Z<p>Ceilick: organizing</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)| Keen Galaxy source based modding]], which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package]. This package is set up to provide a folder structure ideal for learning modding using Keen 4 and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community. Make sure to extract all files and keep the pre-defined folder structure. <br />
<br />
* '''Note''': Alternative to using the modding package, you can create your own. Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>. Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. Download all tools to the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''Be advised that several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds.<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
== CKPatch & Unlzexe Setup ==<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
== EGA Folder Setup ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up <tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into <tt>uGrab</tt>.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open ,tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving <tt>uGrab</tt> into your <tt>"Keen4mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), use the tool <tt>The Neural Stunner</tt>, which can be found in your <tt>"Tools"</tt> folder. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open <tt>Abiathar</tt> and go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will help walk you through the creation of your project dependency file. <br />
<br />
1. Select <code>Start from template</code> and the episode from the drop-down list. <br />
<br />
2. Select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>'''GAMEMAPS.CK4'''</tt> and <tt>'''MAPHEAD.CK4'''</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset from your <tt>"EGA"</tt> folder (<tt>'''ck4_tile16.bmp'''</tt>). For the masked, select the foreground tileset (<tt>'''ck4_tile16m.bmp'''</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code>.<br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created <tt>Abiathar project file</tt> (.adepts file). From this point forward, whenever you open <tt>Abiathar</tt>, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In <tt>Abiathar</tt> one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the keygem holder tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by Abiathar when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-down menus determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
One major useful shortcut is the copy and paste feature. Use the <code>C</code> key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the <code>X</code> key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for importing and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
You can compose music using your choice of software; as long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
Be advised, however, that your MIDI will need to be converted to the IMF format, which is extremely limited in range compared to MIDI. Both IMFCreator and MIDI2IMF can be used for converting music, and both are suggested since they can produce different sounding results. It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]].<br />
<br />
Lastly, your IMF song will need optimizing with IMFCrush for memory purposes (this process does not typically result in any noticeable loss in sound quality).<br />
<br />
=== Composition Tips ===<br />
<br />
*If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
*If your instrument track is too quiet and it is already set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
*Keep percussion parts as simple as possible since it impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure: [SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
*A tip from Bobby Prince: On the subject of percussion, to circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases.<br />
<br />
*Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
*Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (parts drop out randomly and inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr. M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
*Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In <tt>IMFCreator</tt> it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a MIDI track to the IMF format. To do this simply drag and drop your MIDI file onto <tt>'''mid2imf.exe'''</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that <tt>MIDI2IMF</tt> is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
<tt>IMFCreator</tt> is another program for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into <tt>IMFCreator</tt> and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
<tt>IMFCrush</tt>, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
<tt>IMF Player</tt> can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>'''imfplay.exe'''</tt>. Then drag and drop <tt>'''imfplay.exe'''</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with <tt>IMFCrush</tt>, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. For Keen 4, these range from <tt>'''sound156.IMF'''</tt> to <tt>'''sound161.IMF'''</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specifically the files: <tt>'''Audio.ck4'''</tt>, <tt>'''Egagraph.ck4'''</tt>, <tt>'''Gamemaps.ck4'''</tt>, and <tt>'''Keen4e.exe'''</tt>.<br />
* '''Note:''' Make sure this version of the <tt>'''keen4e.exe'''</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>'''WDC.exe'''</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it <tt>'''keen4project'''</tt> and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <tt>no map code file</tt> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>"AUDIO"</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
The DOS loading and closing windows are modified with <tt>KeenScr</tt> and <tt>TheDraw</tt>.<br />
<br />
To begin, go to your <tt>"EGA"</tt> folder and look for the file <tt>'''ck4_ansi_endgame.bin'''</tt>. Copy this to your <tt>"keenscr"</tt> folder in <tt>"Tools"</tt> and then rename it to <tt>'''4msc0000.bin'''</tt>.<br />
<br />
Load <tt>'''KEENSCR.EXE'''</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename <tt>'''keenscr.bin'''</tt>. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>'''4msc0000.bin'''</tt> back into your <tt>"EGA"</tt> folder. Rename <tt>'''4msc0000.bin'''</tt> back to <tt>'''ck4_ansi_endgame.bin'''</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>'''CK4LOAD.BIN'''</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin<br />
<br />
%patchfile $20cd7 ck5load.bin<br />
<br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46140Keen Galaxy Modding Tutorial (patch based)2022-08-30T20:49:07Z<p>Ceilick: /* Tools */</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)| Keen Galaxy source based modding]], which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package]. This package is set up to provide a folder structure ideal for learning modding using Keen 4 and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community. Make sure to extract all files and keep the pre-defined folder structure. <br />
<br />
* '''Note''': Alternative to using the modding package, you can create your own. Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>. Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. Download all tools to the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''Be advised that several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds.<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up <tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into <tt>uGrab</tt>.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open ,tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving <tt>uGrab</tt> into your <tt>"Keen4mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), use the tool <tt>The Neural Stunner</tt>, which can be found in your <tt>"Tools"</tt> folder. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open <tt>Abiathar</tt> and go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will help walk you through the creation of your project dependency file. <br />
<br />
1. Select <code>Start from template</code> and the episode from the drop-down list. <br />
<br />
2. Select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>'''GAMEMAPS.CK4'''</tt> and <tt>'''MAPHEAD.CK4'''</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset from your <tt>"EGA"</tt> folder (<tt>'''ck4_tile16.bmp'''</tt>). For the masked, select the foreground tileset (<tt>'''ck4_tile16m.bmp'''</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code>.<br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created <tt>Abiathar project file</tt> (.adepts file). From this point forward, whenever you open <tt>Abiathar</tt>, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In <tt>Abiathar</tt> one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the keygem holder tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by Abiathar when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-down menus determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
One major useful shortcut is the copy and paste feature. Use the <code>C</code> key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the <code>X</code> key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for importing and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
You can compose music using your choice of software; as long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
Be advised, however, that your MIDI will need to be converted to the IMF format, which is extremely limited in range compared to MIDI. Both IMFCreator and MIDI2IMF can be used for converting music, and both are suggested since they can produce different sounding results. It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]].<br />
<br />
Lastly, your IMF song will need optimizing with IMFCrush for memory purposes (this process does not typically result in any noticeable loss in sound quality).<br />
<br />
=== Composition Tips ===<br />
<br />
*If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
*If your instrument track is too quiet and it is already set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
*Keep percussion parts as simple as possible since it impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure: [SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
*A tip from Bobby Prince: On the subject of percussion, to circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases.<br />
<br />
*Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
*Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (parts drop out randomly and inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr. M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
*Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In <tt>IMFCreator</tt> it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a MIDI track to the IMF format. To do this simply drag and drop your MIDI file onto <tt>'''mid2imf.exe'''</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that <tt>MIDI2IMF</tt> is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
<tt>IMFCreator</tt> is another program for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into <tt>IMFCreator</tt> and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
<tt>IMFCrush</tt>, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
<tt>IMF Player</tt> can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>'''imfplay.exe'''</tt>. Then drag and drop <tt>'''imfplay.exe'''</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with <tt>IMFCrush</tt>, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. For Keen 4, these range from <tt>'''sound156.IMF'''</tt> to <tt>'''sound161.IMF'''</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specifically the files: <tt>'''Audio.ck4'''</tt>, <tt>'''Egagraph.ck4'''</tt>, <tt>'''Gamemaps.ck4'''</tt>, and <tt>'''Keen4e.exe'''</tt>.<br />
* '''Note:''' Make sure this version of the <tt>'''keen4e.exe'''</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>'''WDC.exe'''</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it <tt>'''keen4project'''</tt> and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <tt>no map code file</tt> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>"AUDIO"</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
The DOS loading and closing windows are modified with <tt>KeenScr</tt> and <tt>TheDraw</tt>.<br />
<br />
To begin, go to your <tt>"EGA"</tt> folder and look for the file <tt>'''ck4_ansi_endgame.bin'''</tt>. Copy this to your <tt>"keenscr"</tt> folder in <tt>"Tools"</tt> and then rename it to <tt>'''4msc0000.bin'''</tt>.<br />
<br />
Load <tt>'''KEENSCR.EXE'''</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename <tt>'''keenscr.bin'''</tt>. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>'''4msc0000.bin'''</tt> back into your <tt>"EGA"</tt> folder. Rename <tt>'''4msc0000.bin'''</tt> back to <tt>'''ck4_ansi_endgame.bin'''</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>'''CK4LOAD.BIN'''</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin<br />
<br />
%patchfile $20cd7 ck5load.bin<br />
<br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46139Keen Galaxy Modding Tutorial (patch based)2022-08-30T20:47:48Z<p>Ceilick: /* Tools */</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)| Keen Galaxy source based modding]], which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package]. This package is set up to provide a folder structure ideal for learning modding using Keen 4 and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community. Make sure to extract all files and keep the pre-defined folder structure. <br />
<br />
* '''Note''': Alternative to using the modding package, you can create your own. Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>. Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. Download all tools to the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up <tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into <tt>uGrab</tt>.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open ,tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving <tt>uGrab</tt> into your <tt>"Keen4mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), use the tool <tt>The Neural Stunner</tt>, which can be found in your <tt>"Tools"</tt> folder. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open <tt>Abiathar</tt> and go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will help walk you through the creation of your project dependency file. <br />
<br />
1. Select <code>Start from template</code> and the episode from the drop-down list. <br />
<br />
2. Select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>'''GAMEMAPS.CK4'''</tt> and <tt>'''MAPHEAD.CK4'''</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset from your <tt>"EGA"</tt> folder (<tt>'''ck4_tile16.bmp'''</tt>). For the masked, select the foreground tileset (<tt>'''ck4_tile16m.bmp'''</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code>.<br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created <tt>Abiathar project file</tt> (.adepts file). From this point forward, whenever you open <tt>Abiathar</tt>, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In <tt>Abiathar</tt> one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the keygem holder tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by Abiathar when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-down menus determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
One major useful shortcut is the copy and paste feature. Use the <code>C</code> key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the <code>X</code> key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for importing and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
You can compose music using your choice of software; as long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
Be advised, however, that your MIDI will need to be converted to the IMF format, which is extremely limited in range compared to MIDI. Both IMFCreator and MIDI2IMF can be used for converting music, and both are suggested since they can produce different sounding results. It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]].<br />
<br />
Lastly, your IMF song will need optimizing with IMFCrush for memory purposes (this process does not typically result in any noticeable loss in sound quality).<br />
<br />
=== Composition Tips ===<br />
<br />
*If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
*If your instrument track is too quiet and it is already set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
*Keep percussion parts as simple as possible since it impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure: [SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
*A tip from Bobby Prince: On the subject of percussion, to circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases.<br />
<br />
*Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
*Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (parts drop out randomly and inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr. M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
*Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In <tt>IMFCreator</tt> it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a MIDI track to the IMF format. To do this simply drag and drop your MIDI file onto <tt>'''mid2imf.exe'''</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that <tt>MIDI2IMF</tt> is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
<tt>IMFCreator</tt> is another program for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into <tt>IMFCreator</tt> and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
<tt>IMFCrush</tt>, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
<tt>IMF Player</tt> can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>'''imfplay.exe'''</tt>. Then drag and drop <tt>'''imfplay.exe'''</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with <tt>IMFCrush</tt>, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. For Keen 4, these range from <tt>'''sound156.IMF'''</tt> to <tt>'''sound161.IMF'''</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specifically the files: <tt>'''Audio.ck4'''</tt>, <tt>'''Egagraph.ck4'''</tt>, <tt>'''Gamemaps.ck4'''</tt>, and <tt>'''Keen4e.exe'''</tt>.<br />
* '''Note:''' Make sure this version of the <tt>'''keen4e.exe'''</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>'''WDC.exe'''</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it <tt>'''keen4project'''</tt> and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <tt>no map code file</tt> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>"AUDIO"</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
The DOS loading and closing windows are modified with <tt>KeenScr</tt> and <tt>TheDraw</tt>.<br />
<br />
To begin, go to your <tt>"EGA"</tt> folder and look for the file <tt>'''ck4_ansi_endgame.bin'''</tt>. Copy this to your <tt>"keenscr"</tt> folder in <tt>"Tools"</tt> and then rename it to <tt>'''4msc0000.bin'''</tt>.<br />
<br />
Load <tt>'''KEENSCR.EXE'''</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename <tt>'''keenscr.bin'''</tt>. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>'''4msc0000.bin'''</tt> back into your <tt>"EGA"</tt> folder. Rename <tt>'''4msc0000.bin'''</tt> back to <tt>'''ck4_ansi_endgame.bin'''</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>'''CK4LOAD.BIN'''</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin<br />
<br />
%patchfile $20cd7 ck5load.bin<br />
<br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46138Keen Galaxy Modding Tutorial (patch based)2022-08-30T20:47:05Z<p>Ceilick: /* Setting Up Files and Folders */ reworked setup intro</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)| Keen Galaxy source based modding]], which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package]. This package is set up to provide a folder structure ideal for learning modding using Keen 4 and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community. Make sure to extract all files and keep the pre-defined folder structure. <br />
<br />
* '''Note''': Alternative to using the modding package, you can create your own. Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>. Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. Download all tools to the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up <tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into <tt>uGrab</tt>.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open ,tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving <tt>uGrab</tt> into your <tt>"Keen4mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), use the tool <tt>The Neural Stunner</tt>, which can be found in your <tt>"Tools"</tt> folder. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open <tt>Abiathar</tt> and go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will help walk you through the creation of your project dependency file. <br />
<br />
1. Select <code>Start from template</code> and the episode from the drop-down list. <br />
<br />
2. Select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>'''GAMEMAPS.CK4'''</tt> and <tt>'''MAPHEAD.CK4'''</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset from your <tt>"EGA"</tt> folder (<tt>'''ck4_tile16.bmp'''</tt>). For the masked, select the foreground tileset (<tt>'''ck4_tile16m.bmp'''</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code>.<br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created <tt>Abiathar project file</tt> (.adepts file). From this point forward, whenever you open <tt>Abiathar</tt>, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In <tt>Abiathar</tt> one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the keygem holder tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by Abiathar when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-down menus determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
One major useful shortcut is the copy and paste feature. Use the <code>C</code> key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the <code>X</code> key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for importing and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
You can compose music using your choice of software; as long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
Be advised, however, that your MIDI will need to be converted to the IMF format, which is extremely limited in range compared to MIDI. Both IMFCreator and MIDI2IMF can be used for converting music, and both are suggested since they can produce different sounding results. It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]].<br />
<br />
Lastly, your IMF song will need optimizing with IMFCrush for memory purposes (this process does not typically result in any noticeable loss in sound quality).<br />
<br />
=== Composition Tips ===<br />
<br />
*If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
*If your instrument track is too quiet and it is already set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
*Keep percussion parts as simple as possible since it impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure: [SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
*A tip from Bobby Prince: On the subject of percussion, to circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases.<br />
<br />
*Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
*Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (parts drop out randomly and inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr. M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
*Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In <tt>IMFCreator</tt> it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a MIDI track to the IMF format. To do this simply drag and drop your MIDI file onto <tt>'''mid2imf.exe'''</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that <tt>MIDI2IMF</tt> is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
<tt>IMFCreator</tt> is another program for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into <tt>IMFCreator</tt> and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
<tt>IMFCrush</tt>, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
<tt>IMF Player</tt> can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>'''imfplay.exe'''</tt>. Then drag and drop <tt>'''imfplay.exe'''</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with <tt>IMFCrush</tt>, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. For Keen 4, these range from <tt>'''sound156.IMF'''</tt> to <tt>'''sound161.IMF'''</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specifically the files: <tt>'''Audio.ck4'''</tt>, <tt>'''Egagraph.ck4'''</tt>, <tt>'''Gamemaps.ck4'''</tt>, and <tt>'''Keen4e.exe'''</tt>.<br />
* '''Note:''' Make sure this version of the <tt>'''keen4e.exe'''</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>'''WDC.exe'''</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it <tt>'''keen4project'''</tt> and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <tt>no map code file</tt> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>"AUDIO"</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
The DOS loading and closing windows are modified with <tt>KeenScr</tt> and <tt>TheDraw</tt>.<br />
<br />
To begin, go to your <tt>"EGA"</tt> folder and look for the file <tt>'''ck4_ansi_endgame.bin'''</tt>. Copy this to your <tt>"keenscr"</tt> folder in <tt>"Tools"</tt> and then rename it to <tt>'''4msc0000.bin'''</tt>.<br />
<br />
Load <tt>'''KEENSCR.EXE'''</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename <tt>'''keenscr.bin'''</tt>. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>'''4msc0000.bin'''</tt> back into your <tt>"EGA"</tt> folder. Rename <tt>'''4msc0000.bin'''</tt> back to <tt>'''ck4_ansi_endgame.bin'''</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>'''CK4LOAD.BIN'''</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin<br />
<br />
%patchfile $20cd7 ck5load.bin<br />
<br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(source_code_based)&diff=46137Keen Galaxy Modding Tutorial (source code based)2022-08-30T17:43:50Z<p>Ceilick: /* Additional Music and Sound Effects */ .asnds step, formatting</p>
<hr />
<div>{{Alert|'''This page is still under construction!'''}}<br />
<br />
This tutorial aims to teach [[Keen:Galaxy Source Modding Package|Keen:Galaxy Source Mod]] modding in terms of what is different from modding without source code. It will primarily cover tool usage and the new options provided by the supplied source code package and its modification. Creating a full source mod requires some basic coding knowledge that this tutorial will not cover, but it will explain where and what needs to be coded and provide limited code examples for common tasks and features. <br />
<br />
For general, introductory Keen Galaxy modding information not covered here, please consult the [[Keen Galaxy Modding Tutorial (patch based)|patch based Keen Galaxy Modding Tutorial]]. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft</tt> <tt>Windows</tt> s based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Downlad the core [[Keen:Galaxy Source Modding Package]]. This bundle contains a source code package with a number of pre-setup tools and files. Make sure to extract all files and keep the pre-defined folder structure. To facilitate modding, this package contains all resources present in their decompressed format.<br />
<br />
== Modding Package ==<br />
<br />
The modding package contains (amongst others) three sub-directories which are '''AUDIO''', '''EGA''' and '''SOURCE'''. They present all resources in their decompressed format. <br />
* The '''AUDIO''' folder contains music files and sound effects that are stored in the games <tt>AUDIOT.CKS</tt> container file. <br />
* The '''EGA''' folder contains mainly graphic and text files that are stored in the games <tt>EGAGRAPH.CKS</tt> container file. <br />
* The '''SOURCE''' folder contains everything source code related written in the high-level language <tt>C/C++</tt> . <tt>SRCMOD.EXE</tt> is the compiled executable. <br />
<br />
The modding packages also contains a few core tools to modify, import, and export those resource files. In brief: <br />
* [[Abiathar]] is used for editing maps (using the <tt>map.adeps</tt> definition file for <tt>MAPTEMP.CKS</tt>). It is also used to create the game audio archive (using the <tt>audio.asnds</tt> definition file for <tt>AUDIOT.CKS</tt>). <br />
* [[uGrab]] functions as an <tt>EGAGRAPH.CKS</tt> editor. For convenience, two batch files (<tt>ega-in.bat</tt>, <tt>ega-out.bat</tt>) are included for easy import and export of graphics. The game archive structure can be altered by editing the <tt>ega.def</tt> definitions file. <br />
* [[Borland 3.1]] is used to compile the code; a Borland 3.1 project file ([[SRCMOD.PRJ]]) has been included for this purpose. Borland compilers can be invoked in a 16-bit DOS environment (e.g., DOSBox v0.74 has been successfully used).<br />
<br />
[[Let's also add a TOOLS, a INFO and a UPLOAD folder]]<br />
<br />
[[Modding folder structure setup goes here]]<br />
<br />
== Tools ==<br />
<br />
This is the complete list of tools used for source modding:<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|''Version 2.11.4 Beta 1 or higher is required''<br />
|-<br />
|[[Borland C++ Compiler]]<br />
|Source Code Compiler <br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro Graphic Text Editor <br />
|<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.''<br />
|-<br />
|[[TliExtend]]<br />
|Tileinfo Extension <br />
|''This tool is a command line based tileinfo extension utility for Abiathar''<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|''Also used for adding additional graphics and texts files.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used''<br />
|<br />
|}<br />
<br />
<!--Additional Tools?--><br />
<br />
= Engine Information = <br />
<br />
In contrast to classic modding via patches, working with the source code allows much more freedom. Nevertheless, there are some limitations that must be taken into account.<br />
<br />
For several reasons DOS only allows a maximum amount of 640KiB of memory available to programs. Therefore DOS (and maybe some drivers) as well as the game program and most of the game data (levels, music, graphics) must fit into these 640KiB.<br />
<br />
The game engine organizes certain segments into memory blocks with an upper limit of 64KiB. This means that the number of music tracks, sprites or tiles is limited to a certain degree. Realistically music and levels are the only parts (besides, perhaps, the sprite info block) where the 64KiB limit per chunk could be problematic.<br />
<br />
Here are some basic limitations:<br />
<br />
*<u><tt>Audio</tt></u>: each sound and each piece of music must not be larger than 64KiB.<br />
<br />
*<u><tt>Levels</tt></u>: also referred to as map-planes, each of these must not exceed 64KiB. For details, see the below section on [[Keen Source Mod Modding Tutorial#Memory_.26_Technical_Limitations|level limitations]].<br />
<br />
*<u><tt>Tilesets</tt></u>: There is no concrete upper limit for the number of tiles a tileset can have. The only requirement is that the MAPHEAD and EGAHEAD must be smaller than 64KiB each in order to be loaded into memory correctly. (Theoretically a little more than 7,200 tiles per tileset are allowed.)<br />
<br />
*<u><tt>Sprites:</tt></u> The maximum number of sprites in the EGAGRAPH file is limited to 3640. If more sprites are inserted, then the data block with the sprite info (width, height, hitbox, shifts, etc.) will be larger than 64KiB.<br />
<br />
'''Note''': Some of this is not set in stone. In ID_RF.H some of these values can be adjusted, but this would then consume more memory.<br />
<br />
<!--<br />
== EGAHEAD ==<br />
<br />
[[Information on the EGAHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
<br />
== MAPHEAD ==<br />
<br />
[[Information on the MAPHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
--><br />
<br />
= Graphics and Texts (EGAGRAPH) =<br />
<br />
The <tt>EGAGRAPH.CKS</tt> file (aslo called the EGA graphics library) functions as a container the stores compressed sub files which are individually called chunks. Chunks in this container include all graphics, demos, fonts, sprites, tiles, texts and other game files. <br />
<br />
The <tt>EGAHEAD.CKS</tt> file contains information about the size of the <tt>EGAGRAPH.CKS</tt> file and the offset location of each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/EGAGraph_Format EGAGraph_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted graphics and text files from <tt>EGAGRAPH.CKS</tt> the can be found in the '''<tt>EGA</tt>''' folder. Likewise, a definitions file (<tt>ega.def</tt>) [[add ega.def to the package]] has been added to the setup. If additional files, such as graphics or sprites, are to be added to the game, the definitions file must be updated. The tool [[uGrab]] is used to read this definition file and import/export the changed or new files into/from the <tt>EGAGRAPH.CKS</tt> container.<br />
<br />
[[Image:Ega-Color-Palette.png|160px|thumb|EGA Color Palette]]<br />
To begin editing graphics and most texts found in the game, go to the '''<tt>EGA</tt>''' folder. You can edit any of the images how you want but must follow two rules: you must use the [[moddingwiki:EGA_Palette|original 16 EGA Keen colours]], and all images must have a width that is a multiple of 8 pixels.<br />
<br />
All the image, text, and other files within '''<tt>EGA</tt>''' are arranged in clusters by file type. The following table gives an overview of each file type, and you can can find a corresponding overview in the <tt>ega.def</tt> definitions file as well.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|CKS_ansi_*.bin<br />
|Final screen <br />
|''Appears after quitting the game.''<br />
|-<br />
|CKS_fon_*.bmp<br />
|Font sheets <br />
|''These fonts are used throughout the game.''<br />
|-<br />
|CKS_pic_*.bmp<br />
|Main menu and help section images<br />
|<br />
|-<br />
|CKS_sprite_*.bmp<br />
|Sprite images <br />
|<br />
|-<br />
|CKS_sprites.txt<br />
|Sprite definition text file<br />
|''Hitboxes and offset values are defined for each sprite.''<br />
|-<br />
|CKS_terminator_*<br />
|Terminator text sequence <br />
|''Appears at the games first start and leads to the title screen.''<br />
|-<br />
|CKS_tile8*.bmp<br />
|Drop-down menu Tilesets <br />
|''These tilesets contain numerous tiles. Each tile has a size of 8x8 pixel.''<br />
|-<br />
|CKS_tile16*.bmp<br />
|Fore- and Background-Tileset <br />
|''These tilesets contain numerous tiles. Each tile has a size of 16x16 pixel.''<br />
|-<br />
|CKS_txt*.txt<br />
|Text sheets<br />
|''Containing story element texts and help section information.''<br />
|-<br />
|CKS_txt_STARWARS.txt<br />
|Scrolling story text<br />
|''The so called Star Wars Story Screen.''<br />
|-<br />
|CKS_DEMO*.CKS<br />
|Demo recordings <br />
|<br />
|}<br />
<br />
== Import and Export Files ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
To import / export the files located in '''EGA''', use <tt>[[uGrab]]</tt>. <tt>uGrab</tt> is an advanced EGAGRAPH editor with a graphical user interface which can not only import / export graphics, but can also add, move or remove sprites in Commander Keen source mods. <br />
<br />
For <tt>uGrab</tt> to work, a definition file is required, which is already included within the Source Code Modding bundle. [[How to manually modify definition file]].<br />
<br />
To begin, open <tt>uGrab</tt> and go to <code>Import</code> and select <code>Import from bitmap folder...</code>. Locate the <tt>ega.def</tt> definition file in your project folder and open it. A dialog pops up that asks you to select the '''EGA''' folder. Do so and press <code>OK</code>. The graphics and text files have now been imported into <tt>uGrab</tt>. <br />
<br />
To import these files into the EGAGRAPH simply go to <code>Export</code> and select <code>Export as EGAGRAPH...</code>. In the following window locate <tt>EGAGRAPH.CKS</tt> file and press <code>Save</code>. <tt>uGrab</tt> will then ask you to select a Huffman Compression Type; choose <code>Best (Slowest)</code>. It will then ask if you want to update the definition file, which you should confirm. The new graphics and text files should now be exported into the game files.<br />
<br />
An alternative to running an instance of <tt>uGrab</tt> is through batch files. The modding package comes with two batch files which can be used to speed up and automate the import / export process significantly. Simply double-click <code>ega-in.bat</code> to import and double-click <code>ega-out.bat</code> to export all files. To learn more about how those batch files operate, simply open them with a text editor such as notepad.<br />
<br />
== Tilesets == <br />
<br />
You can edit tiles in the typical manner, however, the first row of tiles in the foreground tileset (<tt>CKS_tile16m</tt>) is generally reserved to render certain blocking elements. Those are used for debugging reasons and should stay untouched. <br />
<br />
[[Short note about tiles (16x16 pixel) for the novice modder]]<br />
<br />
[[Reminder: inserted corresponding graphics to the tile16m file for the final modding package.]]<br />
<br />
[[example image goes here.]]<br />
<br />
== Sprite Hitboxes ==<br />
<br />
Just like standard modding, <tt>CKS_sprites.txt</tt> is used for establishing Sprite hitboxes. Since we are dealing with a modified version of the source code, the last value in a <tt>CKS_sprites.txt</tt> entry, handling animation frame rate, must stay at 1. Otherwise there will be errors in the rendering. (Desired adjustments need to be taken in the source code)<br />
<br />
== Texts ==<br />
<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
Text files can be edited with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
They employ a formatting code:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting code<br />
! style="text-align:left;"| Description<br />
|-<br />
|<code>^P</code> <br />
|''Marks the beginning of a page.''<br />
|-<br />
|<code>^Gy,x,n</code> <br />
|''Displays a bitmap. The image number <tt>n</tt> used here doesn't match up with the image numbers in your EGA folder; [[OUTDATED? the image shown is the image number plus seven (n + 7)]]. The <tt>x,y</tt> are coordinates which determine where the image appears on the screen. The <tt>^G</tt> command can also use sprites and both types of 16x16 pixel tiles (TILE16 and TILE16M).''<br />
|-<br />
|<code>^Ly,x</code> <br />
|''Following text will be aligned beginning at pixel location <tt>x,y</tt>.''<br />
|-<br />
|<code>^Ty,x,n,t</code> <br />
|''After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap [[OUTDATED? (n + 7)]] at pixel location <tt>x,y</tt> on the screen.''<br />
|-<br />
|<code>^By,x,w,h,c</code> <br />
|''Fills the width-by-height-pixel rectangle at pixel location <tt>x,y</tt> with dimensions of <tt>w,h</tt> and the color <tt>c</tt>. <tt>c</tt> is the hexadecimal color digit, the rest are decimal digits. If the line ends before the parser can find a hex digit, the code will use the background color (for compatibility with Keen 4-6 texts).''<br />
|-<br />
|[[^Mxxx]]<br />
|''[[Starts playing music number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^MOxxx]]<br />
|''[[Plays the music track number]] <tt>xxx</tt> [[only once, without repeating.]]''<br />
|-<br />
|[[^MP]]<br />
|''[[Pauses the current running music track and allows to resume it later.]]''<br />
|-<br />
|[[^MR]]<br />
|''[[Resumes music paused by]] <tt>^MP</tt>.''<br />
|-<br />
|[[^Sxxx]]<br />
|''[[Plays sound number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^W]]<br />
|''[[Waits until the current sound is done (does not update the screen).]]''<br />
|-<br />
|[[^Dttt]]<br />
|''[[Waits]] <tt>ttt</tt> [[tics (screen will be updated)]]''<br />
|-<br />
|[[^Q]] <br />
|''[["quiet" - stops sounds and music.]]''<br />
|-<br />
|[[^H]]<br />
|''[[Shows the high scores in any of the help texts.]]''<br />
|-<br />
|<code>^E</code> <br />
|''Marks the end of the dialogue.''<br />
|}<br />
<br />
<br />
The specific codes for changing the color of text are:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:center;"| Description<br>.<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:middle;"| Description<br>.<br />
|-<br />
|<br />
|''<code>^Cx</code> changes the text to color <tt>x</tt>''<br />
|<br />
|''<code>x</code> = single hex digit: <tt>0-9</tt>, <tt>A-F</tt>''<br />
|-<br />
|<code>^CA</code> <br />
|<code style="background:#AA0000; color:#55FF55"><b>bright green text color </b></code><br />
|<code>^C2</code> <br />
|<code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
|-<br />
|<code>^CB</code> <br />
|<code style="background:#AA0000; color:#55FFFF"><b>bright cyan text color </b></code><br />
|<code>^C3</code> <br />
|<code style="background:#AA0000; color:#00AAAA"><b>cyan text color </b></code><br />
|-<br />
|<code>^CC</code> <br />
|<code style="background:#AA0000; color:#FF5555"><b>bright red text color </b></code><br />
|<code>^C4</code> <br />
|<code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
|-<br />
|<code>^CD</code> <br />
|<code style="background:#AA0000; color:#FF55FF"><b>bright magenta text color</b></code><br />
|<code>^C5</code> <br />
|<code style="background:#AA0000; color:#AA00AA"><b>magenta text color </b></code><br />
|-<br />
|<code>^CE</code> <br />
|<code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
|<code>^C6</code> <br />
|<code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
|-<br />
|<code>^C9</code> <br />
|<code style="background:#AA0000; color:#5555ff"><b>bright blue text color </b></code><br />
|<code>^C1</code> <br />
|<code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
|-<br />
|<code>^CF</code> <br />
|<code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
|<code>^C7</code> <br />
|<code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
|-<br />
|<code>^C8</code> <br />
|<code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
|<code>^C0</code> <br />
|<code style="background:#AA0000; color:#000000"><b>black text color </b></code><br />
|}<br />
<br />
== Other Texts ==<br />
<br />
Some editable texts, such as level entrance messages, are not found in files within the <tt>'''EGA'''</tt> folder and instead require using a text editor to modify specific source code files located in the <tt>'''../SOURCE/MAKESTR'''</tt> folder. To edit most text files that appear in game open up the <tt>MAKESTR.C</tt> file with a text editor. This file contains Level Names, Level Entrance Texts, In-Game Messages and related texts. <br />
<br />
After editing these files, the game must be recompiled in order to integrate the changes. We'll get to the [[compiling process]] later.<br />
<br />
<br />
== Loading Window ==<br />
<br />
<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
<br />
KeenScr, in combination with TheDraw, is used for editing the loading and closing screen graphics.<br />
<br />
[[Where to find the loading screen files, copy it to keenscr folder]] <br />
<br />
Go to commander prompt and navigate to your <tt>keenscr</tt> folder and then type: <br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will immediately start editing the screen, with the filename keenscr.bin. <br />
<br />
<code>Alt</code>+<code>H</code> will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename [[keenscr.bin]]. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
[[files must be copied back to origin folder. Does this require uGrab or a recompile?]] <br />
<br />
<br />
<br />
<br />
<br />
== Adding Additional Graphics and Text Files ==<br />
Unlike standard Keen Galaxy modding, the number of text and graphics files can be expanded or rearranged in source modding. (This section will go into how to add these things, a later section will go into actually utilizing new stuff)<br />
<br />
=== Images and Sprites ===<br />
<br />
=== Text Files === <br />
<br />
=== Tiles ===<br />
<br />
= Level Editing (MAPHEAD) =<br />
<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
<br />
Open Abiathar and go to <code>File</code> and select <code>Open Project</code>. Within your projects folder you should find a dependency file called <tt>maps.adeps</tt> which you want to choose. This is your pre-setup from where you can start building levels.<br />
<br />
To store modifications press <code>Save</code> under <code>File</code>. The settings for the levels will be written to the <tt>maps.adeps</tt> file, which only contains references and pointers to the real resources files, but doesn’t store any level data on their own. <br />
<br />
Closing Abiathar for the first time, quite a few settings will get saved to the <tt>editor.aconf</tt> config file. Those settings are loaded when Abiathar starts.<br />
<br />
For basic usage, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Using_Abiathar| using Abiathar section] of the patched based modding tutorial.<br />
<br />
== Memory & Technical Limitations ==<br />
<br />
Each level must not exceed 64KiB: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about.<br />
<br />
The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
The greater the variety of tiles used, the more memory is used; each foreground tile consumes 128 bytes, whereas each background tile consumes 160 bytes.<br />
<br />
There is a maximum of 50 sprites visible on-screen at the same time, but not limit for the level as a whole. Each Sprite in the refresh manager is 50 bytes. This is calculated by taking the sprite list entry (34 bytes for each sprite), and adding the erase list entry multiplied by two due to double buffering <code>(8*2=16)</code>; thus: <code>34 + 8 * 2 = 50 bytes</code> per Sprite. The number of Sprites that are in use can be checked using the <code>F10+C</code> cheat code in game.<br />
<br />
Sprites may be placed on top of animating tiles, but a foreground animating tile may not be placed on an animating background tile.<br />
<br />
There is a maximum of 100 different tile animation sequences and 100 animated tiles visible on-screen at the same time.<br />
<br />
The song played during the level will contribute toward the overall byte size of the level.<br />
<br />
In general, when it comes to level design, compromises may need to be made for memory purposes. For example, if you want to use a lot of different graphics in a level then you might have to make the level smaller or use a music track with a smaller file size so the game doesn't run out of memory.<br />
<br />
= Tile Properties = <br />
<br />
[[what is the saving process/files involved]]<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. Consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Changing_Tile_Properties| tile properties section] of the patch based modding tutorial for further instructions.<br />
<br />
<br />
= Music and Sounds (AUDIOT) = <br />
<br />
To alter music and sounds, this chapter will discuss the following files and folders: <tt>AUDIOT.CKS, AUDIOHED.CKS, AUDIO, audio.asnds, Abiathar, MIDI2IMF, IMFCrush, WDC.</tt><br />
<br />
The <tt>AUDIOT.CKS</tt> file functions as a container that stores compressed sub files individually called chunks. Chunks in this container include AdLib music (<tt>*.IMF, *.KMF</tt>), AdLib sound effects (<tt>*AL.SND</tt>) and PC Speaker sound effects (<tt>*PC.SND</tt>). <br />
<br />
The <tt>AUDIOT.CKS</tt> file requires an associated <tt>AUDIOHED.CKS</tt> file which stores the offset location of each each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/AudioT_Format AudioT_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted music and sound files from <tt>AUDIOT.CKS</tt> that can be found in the '''<tt>AUDIO</tt>''' folder. Likewise, a configuration file (<tt>audio.asnds</tt>) [[add audio.asnds to the package]] has been added to the setup. If additional files, such as sound effects or music, are to be added to the game, the configuration file must be updated. The tool [[Abiathar]] is used to read this configuration file and import/export the changed or new files into/from the <tt>AUDIOT.CKS</tt> container.<br />
<br />
== Brief introduction into music and sound ==<br />
<br />
=== PC Sounds ===<br />
<br />
=== AdLib Sounds ===<br />
<br />
=== IMF / KMF Music ===<br />
<br />
IMF/KMF format files are packed at the end of the audio file. As IMF/KMF files contain AdLib music for games that also have AdLib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict. This is done by reserving the OPL's first channel for sound effects, leaving eight remaining channels available for use in IMF files. <br />
<br />
[[more info about this procedure needed]]<br />
<br />
It is advised to perform optimizations on existing IMF files. [[IMFCrush]] removes by default everything that drives the first AdLib/OPL channel. Generally the original IMF file is reduced by roundabout a third by converting to KMF. The reduction depends entirely on the contents of the source file. <br />
(Side note: IMFCrush is also capable of converting songs to a different playback rate, or even truncate songs.)<br />
<br />
== Music Composition ==<br />
<br />
For tips on music composition as well as the conversion process to the IMF format, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Music| music section] of the patch based modding tutorial.<br />
<br />
== Sound Effect Composition ==<br />
<br />
[[create a pre-defined setup that can be downloaded as well to shortcut things and bypass source code incompatibilities WDC has!]]<br />
<br />
WDC is an older modding tool that contains a sound effect design tool. For instructions on how to access and use this tool, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Sound_Effects| sound effects section] of the patch based modding tutorial.<br />
<br />
== Abiathar Setup and Usage == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
[[Image:Abiathar audio-mappings.png |320px|thumb|Abiathar's Audio Mappings tool]]<br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select [[the option to select]]. <br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format).<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
=== Abiathar Configuration File ===<br />
<br />
Abiathar uses <tt>audio.asnds</tt> for importing and exporting the sound and music files. It contains an entry for each song and music file in a certain format.<br />
<br />
A pc speaker sound looks like: <br />
<br />
<code>?046|PC|?046PC.SND|50 </code><br />
<br />
The first part of this entry indicates the offset location of the sound. Next, <code>PC</code> indicates [[???]]. Next is the sound file that will be used at this offset. The last digit defines the sound effect's priority; since the engine can only play one sound effect at a time this number tells it which sound has priority to play. Values can be from 00 to 99 with the higher numbers being higher priority. <br />
<br />
An AdLib sound looks like: <br />
<br />
<code>?098|PC|?098AL.SND|50|6|1,48,79,0,240,96,255,1,0,0,0,0,0 </code><br />
<br />
As you can see, this entry begins in the same manner as a PC speaker sound, right up to the priority value. The additional numbers that occur after are instrument information that can be ignored (the source engine does not actually use these values), however, Abiathar requires placeholder numbers to be included (any values will do). <br />
<br />
[[example of Music entries]]<br />
<br />
=== Additional Music and Sound Effects ===<br />
<br />
Sound effects and music must occur sequentially in the numbered list found in <tt>'''audio.asnds'''</tt>. Beginning with PC speaker sounds, additional sounds must appear after the last PC speaker sound. Then existing AdLib sound entries must be shifted up the numbered list by the number of PC speaker sounds added, followed by additional entries corresponding to the number of new AdLib sounds. The number of of PC spaker sounds and Adlib sounds must equal each other. Lastly, music is shifted up the numbered list by the required amount. The result is a consistent numbered list of pc speaker sounds, AdLib sounds, and music files.<br />
<br />
This process requires a lot of relabeling files, detailed modification to <tt>'''audio.asnds'''</tt>, importing with Abiathar, and modification to and recompiling the source code. With that in mind, it is highly recommended to import all additional sound effects at one time (using placeholders if necessary), to avoid repeatedly having to reorder files and filenames. Adding new music is a similar process, but because the music cluster of chunks appears last in <tt>'''AUDIOT.CKS'''</tt>, it is a simpler task requiring less forethought.<br />
<br />
==== Adding Sound Effects ====<br />
<br />
Begin the process by naming your PC speaker sound effects so that they occur after the final existing PC speaker sound in your '''AUDIO''' folder.<br />
<br />
Next, all AdLib sounds must be renamed so that their numbered order begins after the new final PC speaker sound. [[Automating this process?]]<br />
<br />
Next, your new AdLib sounds should be renamed to occur after the newly ordered final existing AdLib sound. <br />
<br />
Next, all music files must be renamed so that their numbered order begins after the new final AdLib sound.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified in the same manner that the files were renamed: PC speaker sound entries added, Adlib entries renumbered, Adlib entries added, and music entries renumbered.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, and <tt>NUMSNDCHUNKS</tt> to two times the value of <tt>NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
==== Adding Music ====<br />
<br />
Begin by naming your songs so that they occur after the final existing music files in your '''AUDIO''' folder.<br />
<br />
Next, <tt>'''audio.asnds'''</tt> will need to be modified with music entries added for the new songs.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>'''AUDIOCKS.H'''</tt> must be updated to reflect the new sound effect and musical totals. In <tt>'''AUDIOCKS.H'''</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, <tt>NUMMUSIC</tt> to the number of songs, and <tt>NUMSNDCHUNKS</tt> to two times the value of NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
= Source Code Editing =<br />
<br />
Because source code modding provides endless possibilities, only limited by a modder's programming ability, this section will only introduce the most basic steps involved in some fundamental modifications that a modder might want when creating a 'typical' Commander Keen mod. <br />
<br />
[[How to add additional levels]]<br />
<br />
[[How to modify a creature's behavior]]<br />
<br />
[[How to create a new enemy actor]]<br />
<br />
[[How to create a new tile property]]<br />
<br />
<br />
= Compiling the Source Code =<br />
<br />
[[Image:Borland C source code compiling 01.png |320px|thumb|Working with Borland C++ v3.1]]<br />
<br />
[[Image:Borland C source code compiling 02.png |320px|thumb|Compiling, error message]]<br />
<br />
[[Introduction into Borland C++ v.3.1]]<br />
<br />
= Credits For This Tutorial =<br />
<br />
* Written and assembled by [[User:Ceilick|Ceilick]] and [[User:Nisaba|Nisaba]]<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(source_code_based)&diff=46136Keen Galaxy Modding Tutorial (source code based)2022-08-29T23:47:25Z<p>Ceilick: tile properties</p>
<hr />
<div>{{Alert|'''This page is still under construction!'''}}<br />
<br />
This tutorial aims to teach [[Keen:Galaxy Source Modding Package|Keen:Galaxy Source Mod]] modding in terms of what is different from modding without source code. It will primarily cover tool usage and the new options provided by the supplied source code package and its modification. Creating a full source mod requires some basic coding knowledge that this tutorial will not cover, but it will explain where and what needs to be coded and provide limited code examples for common tasks and features. <br />
<br />
For general, introductory Keen Galaxy modding information not covered here, please consult the [[Keen Galaxy Modding Tutorial (patch based)|patch based Keen Galaxy Modding Tutorial]]. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft</tt> <tt>Windows</tt> s based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Downlad the core [[Keen:Galaxy Source Modding Package]]. This bundle contains a source code package with a number of pre-setup tools and files. Make sure to extract all files and keep the pre-defined folder structure. To facilitate modding, this package contains all resources present in their decompressed format.<br />
<br />
== Modding Package ==<br />
<br />
The modding package contains (amongst others) three sub-directories which are '''AUDIO''', '''EGA''' and '''SOURCE'''. They present all resources in their decompressed format. <br />
* The '''AUDIO''' folder contains music files and sound effects that are stored in the games <tt>AUDIOT.CKS</tt> container file. <br />
* The '''EGA''' folder contains mainly graphic and text files that are stored in the games <tt>EGAGRAPH.CKS</tt> container file. <br />
* The '''SOURCE''' folder contains everything source code related written in the high-level language <tt>C/C++</tt> . <tt>SRCMOD.EXE</tt> is the compiled executable. <br />
<br />
The modding packages also contains a few core tools to modify, import, and export those resource files. In brief: <br />
* [[Abiathar]] is used for editing maps (using the <tt>map.adeps</tt> definition file for <tt>MAPTEMP.CKS</tt>). It is also used to create the game audio archive (using the <tt>audio.asnds</tt> definition file for <tt>AUDIOT.CKS</tt>). <br />
* [[uGrab]] functions as an <tt>EGAGRAPH.CKS</tt> editor. For convenience, two batch files (<tt>ega-in.bat</tt>, <tt>ega-out.bat</tt>) are included for easy import and export of graphics. The game archive structure can be altered by editing the <tt>ega.def</tt> definitions file. <br />
* [[Borland 3.1]] is used to compile the code; a Borland 3.1 project file ([[SRCMOD.PRJ]]) has been included for this purpose. Borland compilers can be invoked in a 16-bit DOS environment (e.g., DOSBox v0.74 has been successfully used).<br />
<br />
[[Let's also add a TOOLS, a INFO and a UPLOAD folder]]<br />
<br />
[[Modding folder structure setup goes here]]<br />
<br />
== Tools ==<br />
<br />
This is the complete list of tools used for source modding:<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|''Version 2.11.4 Beta 1 or higher is required''<br />
|-<br />
|[[Borland C++ Compiler]]<br />
|Source Code Compiler <br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro Graphic Text Editor <br />
|<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.''<br />
|-<br />
|[[TliExtend]]<br />
|Tileinfo Extension <br />
|''This tool is a command line based tileinfo extension utility for Abiathar''<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|''Also used for adding additional graphics and texts files.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used''<br />
|<br />
|}<br />
<br />
<!--Additional Tools?--><br />
<br />
= Engine Information = <br />
<br />
In contrast to classic modding via patches, working with the source code allows much more freedom. Nevertheless, there are some limitations that must be taken into account.<br />
<br />
For several reasons DOS only allows a maximum amount of 640KiB of memory available to programs. Therefore DOS (and maybe some drivers) as well as the game program and most of the game data (levels, music, graphics) must fit into these 640KiB.<br />
<br />
The game engine organizes certain segments into memory blocks with an upper limit of 64KiB. This means that the number of music tracks, sprites or tiles is limited to a certain degree. Realistically music and levels are the only parts (besides, perhaps, the sprite info block) where the 64KiB limit per chunk could be problematic.<br />
<br />
Here are some basic limitations:<br />
<br />
*<u><tt>Audio</tt></u>: each sound and each piece of music must not be larger than 64KiB.<br />
<br />
*<u><tt>Levels</tt></u>: also referred to as map-planes, each of these must not exceed 64KiB. For details, see the below section on [[Keen Source Mod Modding Tutorial#Memory_.26_Technical_Limitations|level limitations]].<br />
<br />
*<u><tt>Tilesets</tt></u>: There is no concrete upper limit for the number of tiles a tileset can have. The only requirement is that the MAPHEAD and EGAHEAD must be smaller than 64KiB each in order to be loaded into memory correctly. (Theoretically a little more than 7,200 tiles per tileset are allowed.)<br />
<br />
*<u><tt>Sprites:</tt></u> The maximum number of sprites in the EGAGRAPH file is limited to 3640. If more sprites are inserted, then the data block with the sprite info (width, height, hitbox, shifts, etc.) will be larger than 64KiB.<br />
<br />
'''Note''': Some of this is not set in stone. In ID_RF.H some of these values can be adjusted, but this would then consume more memory.<br />
<br />
<!--<br />
== EGAHEAD ==<br />
<br />
[[Information on the EGAHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
<br />
== MAPHEAD ==<br />
<br />
[[Information on the MAPHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
--><br />
<br />
= Graphics and Texts (EGAGRAPH) =<br />
<br />
The <tt>EGAGRAPH.CKS</tt> file (aslo called the EGA graphics library) functions as a container the stores compressed sub files which are individually called chunks. Chunks in this container include all graphics, demos, fonts, sprites, tiles, texts and other game files. <br />
<br />
The <tt>EGAHEAD.CKS</tt> file contains information about the size of the <tt>EGAGRAPH.CKS</tt> file and the offset location of each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/EGAGraph_Format EGAGraph_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted graphics and text files from <tt>EGAGRAPH.CKS</tt> the can be found in the '''<tt>EGA</tt>''' folder. Likewise, a definitions file (<tt>ega.def</tt>) [[add ega.def to the package]] has been added to the setup. If additional files, such as graphics or sprites, are to be added to the game, the definitions file must be updated. The tool [[uGrab]] is used to read this definition file and import/export the changed or new files into/from the <tt>EGAGRAPH.CKS</tt> container.<br />
<br />
[[Image:Ega-Color-Palette.png|160px|thumb|EGA Color Palette]]<br />
To begin editing graphics and most texts found in the game, go to the '''<tt>EGA</tt>''' folder. You can edit any of the images how you want but must follow two rules: you must use the [[moddingwiki:EGA_Palette|original 16 EGA Keen colours]], and all images must have a width that is a multiple of 8 pixels.<br />
<br />
All the image, text, and other files within '''<tt>EGA</tt>''' are arranged in clusters by file type. The following table gives an overview of each file type, and you can can find a corresponding overview in the <tt>ega.def</tt> definitions file as well.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|CKS_ansi_*.bin<br />
|Final screen <br />
|''Appears after quitting the game.''<br />
|-<br />
|CKS_fon_*.bmp<br />
|Font sheets <br />
|''These fonts are used throughout the game.''<br />
|-<br />
|CKS_pic_*.bmp<br />
|Main menu and help section images<br />
|<br />
|-<br />
|CKS_sprite_*.bmp<br />
|Sprite images <br />
|<br />
|-<br />
|CKS_sprites.txt<br />
|Sprite definition text file<br />
|''Hitboxes and offset values are defined for each sprite.''<br />
|-<br />
|CKS_terminator_*<br />
|Terminator text sequence <br />
|''Appears at the games first start and leads to the title screen.''<br />
|-<br />
|CKS_tile8*.bmp<br />
|Drop-down menu Tilesets <br />
|''These tilesets contain numerous tiles. Each tile has a size of 8x8 pixel.''<br />
|-<br />
|CKS_tile16*.bmp<br />
|Fore- and Background-Tileset <br />
|''These tilesets contain numerous tiles. Each tile has a size of 16x16 pixel.''<br />
|-<br />
|CKS_txt*.txt<br />
|Text sheets<br />
|''Containing story element texts and help section information.''<br />
|-<br />
|CKS_txt_STARWARS.txt<br />
|Scrolling story text<br />
|''The so called Star Wars Story Screen.''<br />
|-<br />
|CKS_DEMO*.CKS<br />
|Demo recordings <br />
|<br />
|}<br />
<br />
== Import and Export Files ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
To import / export the files located in '''EGA''', use <tt>[[uGrab]]</tt>. <tt>uGrab</tt> is an advanced EGAGRAPH editor with a graphical user interface which can not only import / export graphics, but can also add, move or remove sprites in Commander Keen source mods. <br />
<br />
For <tt>uGrab</tt> to work, a definition file is required, which is already included within the Source Code Modding bundle. [[How to manually modify definition file]].<br />
<br />
To begin, open <tt>uGrab</tt> and go to <code>Import</code> and select <code>Import from bitmap folder...</code>. Locate the <tt>ega.def</tt> definition file in your project folder and open it. A dialog pops up that asks you to select the '''EGA''' folder. Do so and press <code>OK</code>. The graphics and text files have now been imported into <tt>uGrab</tt>. <br />
<br />
To import these files into the EGAGRAPH simply go to <code>Export</code> and select <code>Export as EGAGRAPH...</code>. In the following window locate <tt>EGAGRAPH.CKS</tt> file and press <code>Save</code>. <tt>uGrab</tt> will then ask you to select a Huffman Compression Type; choose <code>Best (Slowest)</code>. It will then ask if you want to update the definition file, which you should confirm. The new graphics and text files should now be exported into the game files.<br />
<br />
An alternative to running an instance of <tt>uGrab</tt> is through batch files. The modding package comes with two batch files which can be used to speed up and automate the import / export process significantly. Simply double-click <code>ega-in.bat</code> to import and double-click <code>ega-out.bat</code> to export all files. To learn more about how those batch files operate, simply open them with a text editor such as notepad.<br />
<br />
== Tilesets == <br />
<br />
You can edit tiles in the typical manner, however, the first row of tiles in the foreground tileset (<tt>CKS_tile16m</tt>) is generally reserved to render certain blocking elements. Those are used for debugging reasons and should stay untouched. <br />
<br />
[[Short note about tiles (16x16 pixel) for the novice modder]]<br />
<br />
[[Reminder: inserted corresponding graphics to the tile16m file for the final modding package.]]<br />
<br />
[[example image goes here.]]<br />
<br />
== Sprite Hitboxes ==<br />
<br />
Just like standard modding, <tt>CKS_sprites.txt</tt> is used for establishing Sprite hitboxes. Since we are dealing with a modified version of the source code, the last value in a <tt>CKS_sprites.txt</tt> entry, handling animation frame rate, must stay at 1. Otherwise there will be errors in the rendering. (Desired adjustments need to be taken in the source code)<br />
<br />
== Texts ==<br />
<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
Text files can be edited with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
They employ a formatting code:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting code<br />
! style="text-align:left;"| Description<br />
|-<br />
|<code>^P</code> <br />
|''Marks the beginning of a page.''<br />
|-<br />
|<code>^Gy,x,n</code> <br />
|''Displays a bitmap. The image number <tt>n</tt> used here doesn't match up with the image numbers in your EGA folder; [[OUTDATED? the image shown is the image number plus seven (n + 7)]]. The <tt>x,y</tt> are coordinates which determine where the image appears on the screen. The <tt>^G</tt> command can also use sprites and both types of 16x16 pixel tiles (TILE16 and TILE16M).''<br />
|-<br />
|<code>^Ly,x</code> <br />
|''Following text will be aligned beginning at pixel location <tt>x,y</tt>.''<br />
|-<br />
|<code>^Ty,x,n,t</code> <br />
|''After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap [[OUTDATED? (n + 7)]] at pixel location <tt>x,y</tt> on the screen.''<br />
|-<br />
|<code>^By,x,w,h,c</code> <br />
|''Fills the width-by-height-pixel rectangle at pixel location <tt>x,y</tt> with dimensions of <tt>w,h</tt> and the color <tt>c</tt>. <tt>c</tt> is the hexadecimal color digit, the rest are decimal digits. If the line ends before the parser can find a hex digit, the code will use the background color (for compatibility with Keen 4-6 texts).''<br />
|-<br />
|[[^Mxxx]]<br />
|''[[Starts playing music number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^MOxxx]]<br />
|''[[Plays the music track number]] <tt>xxx</tt> [[only once, without repeating.]]''<br />
|-<br />
|[[^MP]]<br />
|''[[Pauses the current running music track and allows to resume it later.]]''<br />
|-<br />
|[[^MR]]<br />
|''[[Resumes music paused by]] <tt>^MP</tt>.''<br />
|-<br />
|[[^Sxxx]]<br />
|''[[Plays sound number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^W]]<br />
|''[[Waits until the current sound is done (does not update the screen).]]''<br />
|-<br />
|[[^Dttt]]<br />
|''[[Waits]] <tt>ttt</tt> [[tics (screen will be updated)]]''<br />
|-<br />
|[[^Q]] <br />
|''[["quiet" - stops sounds and music.]]''<br />
|-<br />
|[[^H]]<br />
|''[[Shows the high scores in any of the help texts.]]''<br />
|-<br />
|<code>^E</code> <br />
|''Marks the end of the dialogue.''<br />
|}<br />
<br />
<br />
The specific codes for changing the color of text are:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:center;"| Description<br>.<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:middle;"| Description<br>.<br />
|-<br />
|<br />
|''<code>^Cx</code> changes the text to color <tt>x</tt>''<br />
|<br />
|''<code>x</code> = single hex digit: <tt>0-9</tt>, <tt>A-F</tt>''<br />
|-<br />
|<code>^CA</code> <br />
|<code style="background:#AA0000; color:#55FF55"><b>bright green text color </b></code><br />
|<code>^C2</code> <br />
|<code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
|-<br />
|<code>^CB</code> <br />
|<code style="background:#AA0000; color:#55FFFF"><b>bright cyan text color </b></code><br />
|<code>^C3</code> <br />
|<code style="background:#AA0000; color:#00AAAA"><b>cyan text color </b></code><br />
|-<br />
|<code>^CC</code> <br />
|<code style="background:#AA0000; color:#FF5555"><b>bright red text color </b></code><br />
|<code>^C4</code> <br />
|<code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
|-<br />
|<code>^CD</code> <br />
|<code style="background:#AA0000; color:#FF55FF"><b>bright magenta text color</b></code><br />
|<code>^C5</code> <br />
|<code style="background:#AA0000; color:#AA00AA"><b>magenta text color </b></code><br />
|-<br />
|<code>^CE</code> <br />
|<code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
|<code>^C6</code> <br />
|<code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
|-<br />
|<code>^C9</code> <br />
|<code style="background:#AA0000; color:#5555ff"><b>bright blue text color </b></code><br />
|<code>^C1</code> <br />
|<code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
|-<br />
|<code>^CF</code> <br />
|<code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
|<code>^C7</code> <br />
|<code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
|-<br />
|<code>^C8</code> <br />
|<code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
|<code>^C0</code> <br />
|<code style="background:#AA0000; color:#000000"><b>black text color </b></code><br />
|}<br />
<br />
== Other Texts ==<br />
<br />
Some editable texts, such as level entrance messages, are not found in files within the <tt>'''EGA'''</tt> folder and instead require using a text editor to modify specific source code files located in the <tt>'''../SOURCE/MAKESTR'''</tt> folder. To edit most text files that appear in game open up the <tt>MAKESTR.C</tt> file with a text editor. This file contains Level Names, Level Entrance Texts, In-Game Messages and related texts. <br />
<br />
After editing these files, the game must be recompiled in order to integrate the changes. We'll get to the [[compiling process]] later.<br />
<br />
<br />
== Loading Window ==<br />
<br />
<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
<br />
KeenScr, in combination with TheDraw, is used for editing the loading and closing screen graphics.<br />
<br />
[[Where to find the loading screen files, copy it to keenscr folder]] <br />
<br />
Go to commander prompt and navigate to your <tt>keenscr</tt> folder and then type: <br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will immediately start editing the screen, with the filename keenscr.bin. <br />
<br />
<code>Alt</code>+<code>H</code> will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename [[keenscr.bin]]. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
[[files must be copied back to origin folder. Does this require uGrab or a recompile?]] <br />
<br />
<br />
<br />
<br />
<br />
== Adding Additional Graphics and Text Files ==<br />
Unlike standard Keen Galaxy modding, the number of text and graphics files can be expanded or rearranged in source modding. (This section will go into how to add these things, a later section will go into actually utilizing new stuff)<br />
<br />
=== Images and Sprites ===<br />
<br />
=== Text Files === <br />
<br />
=== Tiles ===<br />
<br />
= Level Editing (MAPHEAD) =<br />
<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
<br />
Open Abiathar and go to <code>File</code> and select <code>Open Project</code>. Within your projects folder you should find a dependency file called <tt>maps.adeps</tt> which you want to choose. This is your pre-setup from where you can start building levels.<br />
<br />
To store modifications press <code>Save</code> under <code>File</code>. The settings for the levels will be written to the <tt>maps.adeps</tt> file, which only contains references and pointers to the real resources files, but doesn’t store any level data on their own. <br />
<br />
Closing Abiathar for the first time, quite a few settings will get saved to the <tt>editor.aconf</tt> config file. Those settings are loaded when Abiathar starts.<br />
<br />
For basic usage, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Using_Abiathar| using Abiathar section] of the patched based modding tutorial.<br />
<br />
== Memory & Technical Limitations ==<br />
<br />
Each level must not exceed 64KiB: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about.<br />
<br />
The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
The greater the variety of tiles used, the more memory is used; each foreground tile consumes 128 bytes, whereas each background tile consumes 160 bytes.<br />
<br />
There is a maximum of 50 sprites visible on-screen at the same time, but not limit for the level as a whole. Each Sprite in the refresh manager is 50 bytes. This is calculated by taking the sprite list entry (34 bytes for each sprite), and adding the erase list entry multiplied by two due to double buffering <code>(8*2=16)</code>; thus: <code>34 + 8 * 2 = 50 bytes</code> per Sprite. The number of Sprites that are in use can be checked using the <code>F10+C</code> cheat code in game.<br />
<br />
Sprites may be placed on top of animating tiles, but a foreground animating tile may not be placed on an animating background tile.<br />
<br />
There is a maximum of 100 different tile animation sequences and 100 animated tiles visible on-screen at the same time.<br />
<br />
The song played during the level will contribute toward the overall byte size of the level.<br />
<br />
In general, when it comes to level design, compromises may need to be made for memory purposes. For example, if you want to use a lot of different graphics in a level then you might have to make the level smaller or use a music track with a smaller file size so the game doesn't run out of memory.<br />
<br />
= Tile Properties = <br />
<br />
[[what is the saving process/files involved]]<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. Consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Changing_Tile_Properties| tile properties section] of the patch based modding tutorial for further instructions.<br />
<br />
<br />
= Music and Sounds (AUDIOT) = <br />
<br />
To alter music and sounds, this chapter will discuss the following files and folders: <tt>AUDIOT.CKS, AUDIOHED.CKS, AUDIO, audio.asnds, Abiathar, MIDI2IMF, IMFCrush, WDC.</tt><br />
<br />
The <tt>AUDIOT.CKS</tt> file functions as a container that stores compressed sub files individually called chunks. Chunks in this container include AdLib music (<tt>*.IMF, *.KMF</tt>), AdLib sound effects (<tt>*AL.SND</tt>) and PC Speaker sound effects (<tt>*PC.SND</tt>). <br />
<br />
The <tt>AUDIOT.CKS</tt> file requires an associated <tt>AUDIOHED.CKS</tt> file which stores the offset location of each each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/AudioT_Format AudioT_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted music and sound files from <tt>AUDIOT.CKS</tt> that can be found in the '''<tt>AUDIO</tt>''' folder. Likewise, a configuration file (<tt>audio.asnds</tt>) [[add audio.asnds to the package]] has been added to the setup. If additional files, such as sound effects or music, are to be added to the game, the configuration file must be updated. The tool [[Abiathar]] is used to read this configuration file and import/export the changed or new files into/from the <tt>AUDIOT.CKS</tt> container.<br />
<br />
== Brief introduction into music and sound ==<br />
<br />
=== PC Sounds ===<br />
<br />
=== AdLib Sounds ===<br />
<br />
=== IMF / KMF Music ===<br />
<br />
IMF/KMF format files are packed at the end of the audio file. As IMF/KMF files contain AdLib music for games that also have AdLib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict. This is done by reserving the OPL's first channel for sound effects, leaving eight remaining channels available for use in IMF files. <br />
<br />
[[more info about this procedure needed]]<br />
<br />
It is advised to perform optimizations on existing IMF files. [[IMFCrush]] removes by default everything that drives the first AdLib/OPL channel. Generally the original IMF file is reduced by roundabout a third by converting to KMF. The reduction depends entirely on the contents of the source file. <br />
(Side note: IMFCrush is also capable of converting songs to a different playback rate, or even truncate songs.)<br />
<br />
== Music Composition ==<br />
<br />
For tips on music composition as well as the conversion process to the IMF format, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Music| music section] of the patch based modding tutorial.<br />
<br />
== Sound Effect Composition ==<br />
<br />
[[create a pre-defined setup that can be downloaded as well to shortcut things and bypass source code incompatibilities WDC has!]]<br />
<br />
WDC is an older modding tool that contains a sound effect design tool. For instructions on how to access and use this tool, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Sound_Effects| sound effects section] of the patch based modding tutorial.<br />
<br />
== Abiathar Setup and Usage == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
[[Image:Abiathar audio-mappings.png |320px|thumb|Abiathar's Audio Mappings tool]]<br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select [[the option to select]]. <br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format).<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
=== Abiathar Configuration File ===<br />
<br />
Abiathar uses <tt>audio.asnds</tt> for importing and exporting the sound and music files. It contains an entry for each song and music file in a certain format.<br />
<br />
A pc speaker sound looks like: <br />
<br />
<code>?046|PC|?046PC.SND|50 </code><br />
<br />
The first part of this entry indicates the offset location of the sound. Next, <code>PC</code> indicates [[???]]. Next is the sound file that will be used at this offset. The last digit defines the sound effect's priority; since the engine can only play one sound effect at a time this number tells it which sound has priority to play. Values can be from 00 to 99 with the higher numbers being higher priority. <br />
<br />
An AdLib sound looks like: <br />
<br />
<code>?098|PC|?098AL.SND|50|6|1,48,79,0,240,96,255,1,0,0,0,0,0 </code><br />
<br />
As you can see, this entry begins in the same manner as a PC speaker sound, right up to the priority value. The additional numbers that occur after are instrument information that can be ignored (the source engine does not actually use these values), however, Abiathar requires placeholder numbers to be included (any values will do). <br />
<br />
[[example of Music entries]]<br />
<br />
=== Additional Music and Sound Effects ===<br />
<br />
Sound effects and music must occur sequentially in the <tt>audio.asnds</tt> numbered list. Beginning with PC speaker sounds, additional sounds must appear after the last PC speaker sound. Then existing AdLib sound entries must be shifted up the numbered list by the number of PC speaker sounds added, followed by additional entries corresponding to the number of new AdLib sounds. The number of of PC spaker sounds and Adlib sounds must equal each other. Lastly, music is shifted up the numbered list by the required amount. The result is a consistent numbered list of pc speaker sounds, AdLib sounds, and music files.<br />
<br />
This process requires a lot of relabeling files, detailed modification to <tt>audio.asnds</tt>, importing with Abiathar, and modification to and recompiling the source code. With that in mind, it is highly recommended to import all additional sound effects at one time (using placeholders if necessary), to avoid repeatedly having to reorder files and filenames. Adding new music is a similar process, but because the music cluster of chunks appears last in <tt>AUDIOT.CKS</tt>, it is a simpler task requiring less forethought.<br />
<br />
==== Adding Sound Effects ====<br />
<br />
Begin the process by naming your PC speaker sound effects so that they occur after the final existing PC speaker sound in your '''AUDIO''' folder.<br />
<br />
Next, all AdLib sounds must be renamed so that their numbered order begins after the new final PC speaker sound. [[Automating this process?]]<br />
<br />
Next, your new AdLib sounds should be renamed to occur after the newly ordered final existing AdLib sound. <br />
<br />
Next, all music files must be renamed so that their numbered order begins after the new final AdLib sound.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>AUDIOCKS.H</tt> must be updated to reflect the new sound effect and musical totals. In <tt>AUDIOCKS.H</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, and <tt>NUMSNDCHUNKS</tt> to two times the value of <tt>NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
==== Adding Music ====<br />
<br />
Begin by naming your songs so that they occur after the final existing music files in your '''AUDIO''' folder.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>AUDIOCKS.H</tt> must be updated to reflect the new sound effect and musical totals. In <tt>AUDIOCKS.H</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, <tt>NUMMUSIC</tt> to the number of songs, and <tt>NUMSNDCHUNKS</tt> to two times the value of NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
= Source Code Editing =<br />
<br />
Because source code modding provides endless possibilities, only limited by a modder's programming ability, this section will only introduce the most basic steps involved in some fundamental modifications that a modder might want when creating a 'typical' Commander Keen mod. <br />
<br />
[[How to add additional levels]]<br />
<br />
[[How to modify a creature's behavior]]<br />
<br />
[[How to create a new enemy actor]]<br />
<br />
[[How to create a new tile property]]<br />
<br />
<br />
= Compiling the Source Code =<br />
<br />
[[Image:Borland C source code compiling 01.png |320px|thumb|Working with Borland C++ v3.1]]<br />
<br />
[[Image:Borland C source code compiling 02.png |320px|thumb|Compiling, error message]]<br />
<br />
[[Introduction into Borland C++ v.3.1]]<br />
<br />
= Credits For This Tutorial =<br />
<br />
* Written and assembled by [[User:Ceilick|Ceilick]] and [[User:Nisaba|Nisaba]]<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(source_code_based)&diff=46135Keen Galaxy Modding Tutorial (source code based)2022-08-29T23:27:10Z<p>Ceilick: /* Level Editing (MAPHEAD) */ reference to patch based tutorial</p>
<hr />
<div>{{Alert|'''This page is still under construction!'''}}<br />
<br />
This tutorial aims to teach [[Keen:Galaxy Source Modding Package|Keen:Galaxy Source Mod]] modding in terms of what is different from modding without source code. It will primarily cover tool usage and the new options provided by the supplied source code package and its modification. Creating a full source mod requires some basic coding knowledge that this tutorial will not cover, but it will explain where and what needs to be coded and provide limited code examples for common tasks and features. <br />
<br />
For general, introductory Keen Galaxy modding information not covered here, please consult the [[Keen Galaxy Modding Tutorial (patch based)|patch based Keen Galaxy Modding Tutorial]]. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft</tt> <tt>Windows</tt> s based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Downlad the core [[Keen:Galaxy Source Modding Package]]. This bundle contains a source code package with a number of pre-setup tools and files. Make sure to extract all files and keep the pre-defined folder structure. To facilitate modding, this package contains all resources present in their decompressed format.<br />
<br />
== Modding Package ==<br />
<br />
The modding package contains (amongst others) three sub-directories which are '''AUDIO''', '''EGA''' and '''SOURCE'''. They present all resources in their decompressed format. <br />
* The '''AUDIO''' folder contains music files and sound effects that are stored in the games <tt>AUDIOT.CKS</tt> container file. <br />
* The '''EGA''' folder contains mainly graphic and text files that are stored in the games <tt>EGAGRAPH.CKS</tt> container file. <br />
* The '''SOURCE''' folder contains everything source code related written in the high-level language <tt>C/C++</tt> . <tt>SRCMOD.EXE</tt> is the compiled executable. <br />
<br />
The modding packages also contains a few core tools to modify, import, and export those resource files. In brief: <br />
* [[Abiathar]] is used for editing maps (using the <tt>map.adeps</tt> definition file for <tt>MAPTEMP.CKS</tt>). It is also used to create the game audio archive (using the <tt>audio.asnds</tt> definition file for <tt>AUDIOT.CKS</tt>). <br />
* [[uGrab]] functions as an <tt>EGAGRAPH.CKS</tt> editor. For convenience, two batch files (<tt>ega-in.bat</tt>, <tt>ega-out.bat</tt>) are included for easy import and export of graphics. The game archive structure can be altered by editing the <tt>ega.def</tt> definitions file. <br />
* [[Borland 3.1]] is used to compile the code; a Borland 3.1 project file ([[SRCMOD.PRJ]]) has been included for this purpose. Borland compilers can be invoked in a 16-bit DOS environment (e.g., DOSBox v0.74 has been successfully used).<br />
<br />
[[Let's also add a TOOLS, a INFO and a UPLOAD folder]]<br />
<br />
[[Modding folder structure setup goes here]]<br />
<br />
== Tools ==<br />
<br />
This is the complete list of tools used for source modding:<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|''Version 2.11.4 Beta 1 or higher is required''<br />
|-<br />
|[[Borland C++ Compiler]]<br />
|Source Code Compiler <br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro Graphic Text Editor <br />
|<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.''<br />
|-<br />
|[[TliExtend]]<br />
|Tileinfo Extension <br />
|''This tool is a command line based tileinfo extension utility for Abiathar''<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|''Also used for adding additional graphics and texts files.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used''<br />
|<br />
|}<br />
<br />
<!--Additional Tools?--><br />
<br />
= Engine Information = <br />
<br />
In contrast to classic modding via patches, working with the source code allows much more freedom. Nevertheless, there are some limitations that must be taken into account.<br />
<br />
For several reasons DOS only allows a maximum amount of 640KiB of memory available to programs. Therefore DOS (and maybe some drivers) as well as the game program and most of the game data (levels, music, graphics) must fit into these 640KiB.<br />
<br />
The game engine organizes certain segments into memory blocks with an upper limit of 64KiB. This means that the number of music tracks, sprites or tiles is limited to a certain degree. Realistically music and levels are the only parts (besides, perhaps, the sprite info block) where the 64KiB limit per chunk could be problematic.<br />
<br />
Here are some basic limitations:<br />
<br />
*<u><tt>Audio</tt></u>: each sound and each piece of music must not be larger than 64KiB.<br />
<br />
*<u><tt>Levels</tt></u>: also referred to as map-planes, each of these must not exceed 64KiB. For details, see the below section on [[Keen Source Mod Modding Tutorial#Memory_.26_Technical_Limitations|level limitations]].<br />
<br />
*<u><tt>Tilesets</tt></u>: There is no concrete upper limit for the number of tiles a tileset can have. The only requirement is that the MAPHEAD and EGAHEAD must be smaller than 64KiB each in order to be loaded into memory correctly. (Theoretically a little more than 7,200 tiles per tileset are allowed.)<br />
<br />
*<u><tt>Sprites:</tt></u> The maximum number of sprites in the EGAGRAPH file is limited to 3640. If more sprites are inserted, then the data block with the sprite info (width, height, hitbox, shifts, etc.) will be larger than 64KiB.<br />
<br />
'''Note''': Some of this is not set in stone. In ID_RF.H some of these values can be adjusted, but this would then consume more memory.<br />
<br />
<!--<br />
== EGAHEAD ==<br />
<br />
[[Information on the EGAHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
<br />
== MAPHEAD ==<br />
<br />
[[Information on the MAPHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
--><br />
<br />
= Graphics and Texts (EGAGRAPH) =<br />
<br />
The <tt>EGAGRAPH.CKS</tt> file (aslo called the EGA graphics library) functions as a container the stores compressed sub files which are individually called chunks. Chunks in this container include all graphics, demos, fonts, sprites, tiles, texts and other game files. <br />
<br />
The <tt>EGAHEAD.CKS</tt> file contains information about the size of the <tt>EGAGRAPH.CKS</tt> file and the offset location of each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/EGAGraph_Format EGAGraph_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted graphics and text files from <tt>EGAGRAPH.CKS</tt> the can be found in the '''<tt>EGA</tt>''' folder. Likewise, a definitions file (<tt>ega.def</tt>) [[add ega.def to the package]] has been added to the setup. If additional files, such as graphics or sprites, are to be added to the game, the definitions file must be updated. The tool [[uGrab]] is used to read this definition file and import/export the changed or new files into/from the <tt>EGAGRAPH.CKS</tt> container.<br />
<br />
[[Image:Ega-Color-Palette.png|160px|thumb|EGA Color Palette]]<br />
To begin editing graphics and most texts found in the game, go to the '''<tt>EGA</tt>''' folder. You can edit any of the images how you want but must follow two rules: you must use the [[moddingwiki:EGA_Palette|original 16 EGA Keen colours]], and all images must have a width that is a multiple of 8 pixels.<br />
<br />
All the image, text, and other files within '''<tt>EGA</tt>''' are arranged in clusters by file type. The following table gives an overview of each file type, and you can can find a corresponding overview in the <tt>ega.def</tt> definitions file as well.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|CKS_ansi_*.bin<br />
|Final screen <br />
|''Appears after quitting the game.''<br />
|-<br />
|CKS_fon_*.bmp<br />
|Font sheets <br />
|''These fonts are used throughout the game.''<br />
|-<br />
|CKS_pic_*.bmp<br />
|Main menu and help section images<br />
|<br />
|-<br />
|CKS_sprite_*.bmp<br />
|Sprite images <br />
|<br />
|-<br />
|CKS_sprites.txt<br />
|Sprite definition text file<br />
|''Hitboxes and offset values are defined for each sprite.''<br />
|-<br />
|CKS_terminator_*<br />
|Terminator text sequence <br />
|''Appears at the games first start and leads to the title screen.''<br />
|-<br />
|CKS_tile8*.bmp<br />
|Drop-down menu Tilesets <br />
|''These tilesets contain numerous tiles. Each tile has a size of 8x8 pixel.''<br />
|-<br />
|CKS_tile16*.bmp<br />
|Fore- and Background-Tileset <br />
|''These tilesets contain numerous tiles. Each tile has a size of 16x16 pixel.''<br />
|-<br />
|CKS_txt*.txt<br />
|Text sheets<br />
|''Containing story element texts and help section information.''<br />
|-<br />
|CKS_txt_STARWARS.txt<br />
|Scrolling story text<br />
|''The so called Star Wars Story Screen.''<br />
|-<br />
|CKS_DEMO*.CKS<br />
|Demo recordings <br />
|<br />
|}<br />
<br />
== Import and Export Files ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
To import / export the files located in '''EGA''', use <tt>[[uGrab]]</tt>. <tt>uGrab</tt> is an advanced EGAGRAPH editor with a graphical user interface which can not only import / export graphics, but can also add, move or remove sprites in Commander Keen source mods. <br />
<br />
For <tt>uGrab</tt> to work, a definition file is required, which is already included within the Source Code Modding bundle. [[How to manually modify definition file]].<br />
<br />
To begin, open <tt>uGrab</tt> and go to <code>Import</code> and select <code>Import from bitmap folder...</code>. Locate the <tt>ega.def</tt> definition file in your project folder and open it. A dialog pops up that asks you to select the '''EGA''' folder. Do so and press <code>OK</code>. The graphics and text files have now been imported into <tt>uGrab</tt>. <br />
<br />
To import these files into the EGAGRAPH simply go to <code>Export</code> and select <code>Export as EGAGRAPH...</code>. In the following window locate <tt>EGAGRAPH.CKS</tt> file and press <code>Save</code>. <tt>uGrab</tt> will then ask you to select a Huffman Compression Type; choose <code>Best (Slowest)</code>. It will then ask if you want to update the definition file, which you should confirm. The new graphics and text files should now be exported into the game files.<br />
<br />
An alternative to running an instance of <tt>uGrab</tt> is through batch files. The modding package comes with two batch files which can be used to speed up and automate the import / export process significantly. Simply double-click <code>ega-in.bat</code> to import and double-click <code>ega-out.bat</code> to export all files. To learn more about how those batch files operate, simply open them with a text editor such as notepad.<br />
<br />
== Tilesets == <br />
<br />
You can edit tiles in the typical manner, however, the first row of tiles in the foreground tileset (<tt>CKS_tile16m</tt>) is generally reserved to render certain blocking elements. Those are used for debugging reasons and should stay untouched. <br />
<br />
[[Short note about tiles (16x16 pixel) for the novice modder]]<br />
<br />
[[Reminder: inserted corresponding graphics to the tile16m file for the final modding package.]]<br />
<br />
[[example image goes here.]]<br />
<br />
== Sprite Hitboxes ==<br />
<br />
Just like standard modding, <tt>CKS_sprites.txt</tt> is used for establishing Sprite hitboxes. Since we are dealing with a modified version of the source code, the last value in a <tt>CKS_sprites.txt</tt> entry, handling animation frame rate, must stay at 1. Otherwise there will be errors in the rendering. (Desired adjustments need to be taken in the source code)<br />
<br />
== Texts ==<br />
<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
Text files can be edited with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
They employ a formatting code:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting code<br />
! style="text-align:left;"| Description<br />
|-<br />
|<code>^P</code> <br />
|''Marks the beginning of a page.''<br />
|-<br />
|<code>^Gy,x,n</code> <br />
|''Displays a bitmap. The image number <tt>n</tt> used here doesn't match up with the image numbers in your EGA folder; [[OUTDATED? the image shown is the image number plus seven (n + 7)]]. The <tt>x,y</tt> are coordinates which determine where the image appears on the screen. The <tt>^G</tt> command can also use sprites and both types of 16x16 pixel tiles (TILE16 and TILE16M).''<br />
|-<br />
|<code>^Ly,x</code> <br />
|''Following text will be aligned beginning at pixel location <tt>x,y</tt>.''<br />
|-<br />
|<code>^Ty,x,n,t</code> <br />
|''After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap [[OUTDATED? (n + 7)]] at pixel location <tt>x,y</tt> on the screen.''<br />
|-<br />
|<code>^By,x,w,h,c</code> <br />
|''Fills the width-by-height-pixel rectangle at pixel location <tt>x,y</tt> with dimensions of <tt>w,h</tt> and the color <tt>c</tt>. <tt>c</tt> is the hexadecimal color digit, the rest are decimal digits. If the line ends before the parser can find a hex digit, the code will use the background color (for compatibility with Keen 4-6 texts).''<br />
|-<br />
|[[^Mxxx]]<br />
|''[[Starts playing music number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^MOxxx]]<br />
|''[[Plays the music track number]] <tt>xxx</tt> [[only once, without repeating.]]''<br />
|-<br />
|[[^MP]]<br />
|''[[Pauses the current running music track and allows to resume it later.]]''<br />
|-<br />
|[[^MR]]<br />
|''[[Resumes music paused by]] <tt>^MP</tt>.''<br />
|-<br />
|[[^Sxxx]]<br />
|''[[Plays sound number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^W]]<br />
|''[[Waits until the current sound is done (does not update the screen).]]''<br />
|-<br />
|[[^Dttt]]<br />
|''[[Waits]] <tt>ttt</tt> [[tics (screen will be updated)]]''<br />
|-<br />
|[[^Q]] <br />
|''[["quiet" - stops sounds and music.]]''<br />
|-<br />
|[[^H]]<br />
|''[[Shows the high scores in any of the help texts.]]''<br />
|-<br />
|<code>^E</code> <br />
|''Marks the end of the dialogue.''<br />
|}<br />
<br />
<br />
The specific codes for changing the color of text are:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:center;"| Description<br>.<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:middle;"| Description<br>.<br />
|-<br />
|<br />
|''<code>^Cx</code> changes the text to color <tt>x</tt>''<br />
|<br />
|''<code>x</code> = single hex digit: <tt>0-9</tt>, <tt>A-F</tt>''<br />
|-<br />
|<code>^CA</code> <br />
|<code style="background:#AA0000; color:#55FF55"><b>bright green text color </b></code><br />
|<code>^C2</code> <br />
|<code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
|-<br />
|<code>^CB</code> <br />
|<code style="background:#AA0000; color:#55FFFF"><b>bright cyan text color </b></code><br />
|<code>^C3</code> <br />
|<code style="background:#AA0000; color:#00AAAA"><b>cyan text color </b></code><br />
|-<br />
|<code>^CC</code> <br />
|<code style="background:#AA0000; color:#FF5555"><b>bright red text color </b></code><br />
|<code>^C4</code> <br />
|<code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
|-<br />
|<code>^CD</code> <br />
|<code style="background:#AA0000; color:#FF55FF"><b>bright magenta text color</b></code><br />
|<code>^C5</code> <br />
|<code style="background:#AA0000; color:#AA00AA"><b>magenta text color </b></code><br />
|-<br />
|<code>^CE</code> <br />
|<code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
|<code>^C6</code> <br />
|<code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
|-<br />
|<code>^C9</code> <br />
|<code style="background:#AA0000; color:#5555ff"><b>bright blue text color </b></code><br />
|<code>^C1</code> <br />
|<code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
|-<br />
|<code>^CF</code> <br />
|<code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
|<code>^C7</code> <br />
|<code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
|-<br />
|<code>^C8</code> <br />
|<code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
|<code>^C0</code> <br />
|<code style="background:#AA0000; color:#000000"><b>black text color </b></code><br />
|}<br />
<br />
== Other Texts ==<br />
<br />
Some editable texts, such as level entrance messages, are not found in files within the <tt>'''EGA'''</tt> folder and instead require using a text editor to modify specific source code files located in the <tt>'''../SOURCE/MAKESTR'''</tt> folder. To edit most text files that appear in game open up the <tt>MAKESTR.C</tt> file with a text editor. This file contains Level Names, Level Entrance Texts, In-Game Messages and related texts. <br />
<br />
After editing these files, the game must be recompiled in order to integrate the changes. We'll get to the [[compiling process]] later.<br />
<br />
<br />
== Loading Window ==<br />
<br />
<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
<br />
KeenScr, in combination with TheDraw, is used for editing the loading and closing screen graphics.<br />
<br />
[[Where to find the loading screen files, copy it to keenscr folder]] <br />
<br />
Go to commander prompt and navigate to your <tt>keenscr</tt> folder and then type: <br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will immediately start editing the screen, with the filename keenscr.bin. <br />
<br />
<code>Alt</code>+<code>H</code> will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename [[keenscr.bin]]. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
[[files must be copied back to origin folder. Does this require uGrab or a recompile?]] <br />
<br />
<br />
<br />
<br />
<br />
== Adding Additional Graphics and Text Files ==<br />
Unlike standard Keen Galaxy modding, the number of text and graphics files can be expanded or rearranged in source modding. (This section will go into how to add these things, a later section will go into actually utilizing new stuff)<br />
<br />
=== Images and Sprites ===<br />
<br />
=== Text Files === <br />
<br />
=== Tiles ===<br />
<br />
= Level Editing (MAPHEAD) =<br />
<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
<br />
Open Abiathar and go to <code>File</code> and select <code>Open Project</code>. Within your projects folder you should find a dependency file called <tt>maps.adeps</tt> which you want to choose. This is your pre-setup from where you can start building levels.<br />
<br />
To store modifications press <code>Save</code> under <code>File</code>. The settings for the levels will be written to the <tt>maps.adeps</tt> file, which only contains references and pointers to the real resources files, but doesn’t store any level data on their own. <br />
<br />
Closing Abiathar for the first time, quite a few settings will get saved to the <tt>editor.aconf</tt> config file. Those settings are loaded when Abiathar starts.<br />
<br />
For basic usage, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Using_Abiathar| using Abiathar section] of the patched based modding tutorial.<br />
<br />
== Memory & Technical Limitations ==<br />
<br />
Each level must not exceed 64KiB: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about.<br />
<br />
The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
The greater the variety of tiles used, the more memory is used; each foreground tile consumes 128 bytes, whereas each background tile consumes 160 bytes.<br />
<br />
There is a maximum of 50 sprites visible on-screen at the same time, but not limit for the level as a whole. Each Sprite in the refresh manager is 50 bytes. This is calculated by taking the sprite list entry (34 bytes for each sprite), and adding the erase list entry multiplied by two due to double buffering <code>(8*2=16)</code>; thus: <code>34 + 8 * 2 = 50 bytes</code> per Sprite. The number of Sprites that are in use can be checked using the <code>F10+C</code> cheat code in game.<br />
<br />
Sprites may be placed on top of animating tiles, but a foreground animating tile may not be placed on an animating background tile.<br />
<br />
There is a maximum of 100 different tile animation sequences and 100 animated tiles visible on-screen at the same time.<br />
<br />
The song played during the level will contribute toward the overall byte size of the level.<br />
<br />
In general, when it comes to level design, compromises may need to be made for memory purposes. For example, if you want to use a lot of different graphics in a level then you might have to make the level smaller or use a music track with a smaller file size so the game doesn't run out of memory.<br />
<br />
= Music and Sounds (AUDIOT) = <br />
<br />
To alter music and sounds, this chapter will discuss the following files and folders: <tt>AUDIOT.CKS, AUDIOHED.CKS, AUDIO, audio.asnds, Abiathar, MIDI2IMF, IMFCrush, WDC.</tt><br />
<br />
The <tt>AUDIOT.CKS</tt> file functions as a container that stores compressed sub files individually called chunks. Chunks in this container include AdLib music (<tt>*.IMF, *.KMF</tt>), AdLib sound effects (<tt>*AL.SND</tt>) and PC Speaker sound effects (<tt>*PC.SND</tt>). <br />
<br />
The <tt>AUDIOT.CKS</tt> file requires an associated <tt>AUDIOHED.CKS</tt> file which stores the offset location of each each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/AudioT_Format AudioT_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted music and sound files from <tt>AUDIOT.CKS</tt> that can be found in the '''<tt>AUDIO</tt>''' folder. Likewise, a configuration file (<tt>audio.asnds</tt>) [[add audio.asnds to the package]] has been added to the setup. If additional files, such as sound effects or music, are to be added to the game, the configuration file must be updated. The tool [[Abiathar]] is used to read this configuration file and import/export the changed or new files into/from the <tt>AUDIOT.CKS</tt> container.<br />
<br />
== Brief introduction into music and sound ==<br />
<br />
=== PC Sounds ===<br />
<br />
=== AdLib Sounds ===<br />
<br />
=== IMF / KMF Music ===<br />
<br />
IMF/KMF format files are packed at the end of the audio file. As IMF/KMF files contain AdLib music for games that also have AdLib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict. This is done by reserving the OPL's first channel for sound effects, leaving eight remaining channels available for use in IMF files. <br />
<br />
[[more info about this procedure needed]]<br />
<br />
It is advised to perform optimizations on existing IMF files. [[IMFCrush]] removes by default everything that drives the first AdLib/OPL channel. Generally the original IMF file is reduced by roundabout a third by converting to KMF. The reduction depends entirely on the contents of the source file. <br />
(Side note: IMFCrush is also capable of converting songs to a different playback rate, or even truncate songs.)<br />
<br />
== Music Composition ==<br />
<br />
For tips on music composition as well as the conversion process to the IMF format, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Music| music section] of the patch based modding tutorial.<br />
<br />
== Sound Effect Composition ==<br />
<br />
[[create a pre-defined setup that can be downloaded as well to shortcut things and bypass source code incompatibilities WDC has!]]<br />
<br />
WDC is an older modding tool that contains a sound effect design tool. For instructions on how to access and use this tool, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Sound_Effects| sound effects section] of the patch based modding tutorial.<br />
<br />
== Abiathar Setup and Usage == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
[[Image:Abiathar audio-mappings.png |320px|thumb|Abiathar's Audio Mappings tool]]<br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select [[the option to select]]. <br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format).<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
=== Abiathar Configuration File ===<br />
<br />
Abiathar uses <tt>audio.asnds</tt> for importing and exporting the sound and music files. It contains an entry for each song and music file in a certain format.<br />
<br />
A pc speaker sound looks like: <br />
<br />
<code>?046|PC|?046PC.SND|50 </code><br />
<br />
The first part of this entry indicates the offset location of the sound. Next, <code>PC</code> indicates [[???]]. Next is the sound file that will be used at this offset. The last digit defines the sound effect's priority; since the engine can only play one sound effect at a time this number tells it which sound has priority to play. Values can be from 00 to 99 with the higher numbers being higher priority. <br />
<br />
An AdLib sound looks like: <br />
<br />
<code>?098|PC|?098AL.SND|50|6|1,48,79,0,240,96,255,1,0,0,0,0,0 </code><br />
<br />
As you can see, this entry begins in the same manner as a PC speaker sound, right up to the priority value. The additional numbers that occur after are instrument information that can be ignored (the source engine does not actually use these values), however, Abiathar requires placeholder numbers to be included (any values will do). <br />
<br />
[[example of Music entries]]<br />
<br />
=== Additional Music and Sound Effects ===<br />
<br />
Sound effects and music must occur sequentially in the <tt>audio.asnds</tt> numbered list. Beginning with PC speaker sounds, additional sounds must appear after the last PC speaker sound. Then existing AdLib sound entries must be shifted up the numbered list by the number of PC speaker sounds added, followed by additional entries corresponding to the number of new AdLib sounds. The number of of PC spaker sounds and Adlib sounds must equal each other. Lastly, music is shifted up the numbered list by the required amount. The result is a consistent numbered list of pc speaker sounds, AdLib sounds, and music files.<br />
<br />
This process requires a lot of relabeling files, detailed modification to <tt>audio.asnds</tt>, importing with Abiathar, and modification to and recompiling the source code. With that in mind, it is highly recommended to import all additional sound effects at one time (using placeholders if necessary), to avoid repeatedly having to reorder files and filenames. Adding new music is a similar process, but because the music cluster of chunks appears last in <tt>AUDIOT.CKS</tt>, it is a simpler task requiring less forethought.<br />
<br />
==== Adding Sound Effects ====<br />
<br />
Begin the process by naming your PC speaker sound effects so that they occur after the final existing PC speaker sound in your '''AUDIO''' folder.<br />
<br />
Next, all AdLib sounds must be renamed so that their numbered order begins after the new final PC speaker sound. [[Automating this process?]]<br />
<br />
Next, your new AdLib sounds should be renamed to occur after the newly ordered final existing AdLib sound. <br />
<br />
Next, all music files must be renamed so that their numbered order begins after the new final AdLib sound.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>AUDIOCKS.H</tt> must be updated to reflect the new sound effect and musical totals. In <tt>AUDIOCKS.H</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, and <tt>NUMSNDCHUNKS</tt> to two times the value of <tt>NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
==== Adding Music ====<br />
<br />
Begin by naming your songs so that they occur after the final existing music files in your '''AUDIO''' folder.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>AUDIOCKS.H</tt> must be updated to reflect the new sound effect and musical totals. In <tt>AUDIOCKS.H</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, <tt>NUMMUSIC</tt> to the number of songs, and <tt>NUMSNDCHUNKS</tt> to two times the value of NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
= Source Code Editing =<br />
<br />
Because source code modding provides endless possibilities, only limited by a modder's programming ability, this section will only introduce the most basic steps involved in some fundamental modifications that a modder might want when creating a 'typical' Commander Keen mod. <br />
<br />
[[How to add additional levels]]<br />
<br />
[[How to modify a creature's behavior]]<br />
<br />
[[How to create a new enemy actor]]<br />
<br />
[[How to create a new tile property]]<br />
<br />
<br />
= Compiling the Source Code =<br />
<br />
[[Image:Borland C source code compiling 01.png |320px|thumb|Working with Borland C++ v3.1]]<br />
<br />
[[Image:Borland C source code compiling 02.png |320px|thumb|Compiling, error message]]<br />
<br />
[[Introduction into Borland C++ v.3.1]]<br />
<br />
= Credits For This Tutorial =<br />
<br />
* Written and assembled by [[User:Ceilick|Ceilick]] and [[User:Nisaba|Nisaba]]<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(source_code_based)&diff=46134Keen Galaxy Modding Tutorial (source code based)2022-08-29T23:22:35Z<p>Ceilick: /* Abiathar Setup and Usage */ reorganizing</p>
<hr />
<div>{{Alert|'''This page is still under construction!'''}}<br />
<br />
This tutorial aims to teach [[Keen:Galaxy Source Modding Package|Keen:Galaxy Source Mod]] modding in terms of what is different from modding without source code. It will primarily cover tool usage and the new options provided by the supplied source code package and its modification. Creating a full source mod requires some basic coding knowledge that this tutorial will not cover, but it will explain where and what needs to be coded and provide limited code examples for common tasks and features. <br />
<br />
For general, introductory Keen Galaxy modding information not covered here, please consult the [[Keen Galaxy Modding Tutorial (patch based)|patch based Keen Galaxy Modding Tutorial]]. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft</tt> <tt>Windows</tt> s based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Downlad the core [[Keen:Galaxy Source Modding Package]]. This bundle contains a source code package with a number of pre-setup tools and files. Make sure to extract all files and keep the pre-defined folder structure. To facilitate modding, this package contains all resources present in their decompressed format.<br />
<br />
== Modding Package ==<br />
<br />
The modding package contains (amongst others) three sub-directories which are '''AUDIO''', '''EGA''' and '''SOURCE'''. They present all resources in their decompressed format. <br />
* The '''AUDIO''' folder contains music files and sound effects that are stored in the games <tt>AUDIOT.CKS</tt> container file. <br />
* The '''EGA''' folder contains mainly graphic and text files that are stored in the games <tt>EGAGRAPH.CKS</tt> container file. <br />
* The '''SOURCE''' folder contains everything source code related written in the high-level language <tt>C/C++</tt> . <tt>SRCMOD.EXE</tt> is the compiled executable. <br />
<br />
The modding packages also contains a few core tools to modify, import, and export those resource files. In brief: <br />
* [[Abiathar]] is used for editing maps (using the <tt>map.adeps</tt> definition file for <tt>MAPTEMP.CKS</tt>). It is also used to create the game audio archive (using the <tt>audio.asnds</tt> definition file for <tt>AUDIOT.CKS</tt>). <br />
* [[uGrab]] functions as an <tt>EGAGRAPH.CKS</tt> editor. For convenience, two batch files (<tt>ega-in.bat</tt>, <tt>ega-out.bat</tt>) are included for easy import and export of graphics. The game archive structure can be altered by editing the <tt>ega.def</tt> definitions file. <br />
* [[Borland 3.1]] is used to compile the code; a Borland 3.1 project file ([[SRCMOD.PRJ]]) has been included for this purpose. Borland compilers can be invoked in a 16-bit DOS environment (e.g., DOSBox v0.74 has been successfully used).<br />
<br />
[[Let's also add a TOOLS, a INFO and a UPLOAD folder]]<br />
<br />
[[Modding folder structure setup goes here]]<br />
<br />
== Tools ==<br />
<br />
This is the complete list of tools used for source modding:<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|''Version 2.11.4 Beta 1 or higher is required''<br />
|-<br />
|[[Borland C++ Compiler]]<br />
|Source Code Compiler <br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro Graphic Text Editor <br />
|<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.''<br />
|-<br />
|[[TliExtend]]<br />
|Tileinfo Extension <br />
|''This tool is a command line based tileinfo extension utility for Abiathar''<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|''Also used for adding additional graphics and texts files.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used''<br />
|<br />
|}<br />
<br />
<!--Additional Tools?--><br />
<br />
= Engine Information = <br />
<br />
In contrast to classic modding via patches, working with the source code allows much more freedom. Nevertheless, there are some limitations that must be taken into account.<br />
<br />
For several reasons DOS only allows a maximum amount of 640KiB of memory available to programs. Therefore DOS (and maybe some drivers) as well as the game program and most of the game data (levels, music, graphics) must fit into these 640KiB.<br />
<br />
The game engine organizes certain segments into memory blocks with an upper limit of 64KiB. This means that the number of music tracks, sprites or tiles is limited to a certain degree. Realistically music and levels are the only parts (besides, perhaps, the sprite info block) where the 64KiB limit per chunk could be problematic.<br />
<br />
Here are some basic limitations:<br />
<br />
*<u><tt>Audio</tt></u>: each sound and each piece of music must not be larger than 64KiB.<br />
<br />
*<u><tt>Levels</tt></u>: also referred to as map-planes, each of these must not exceed 64KiB. For details, see the below section on [[Keen Source Mod Modding Tutorial#Memory_.26_Technical_Limitations|level limitations]].<br />
<br />
*<u><tt>Tilesets</tt></u>: There is no concrete upper limit for the number of tiles a tileset can have. The only requirement is that the MAPHEAD and EGAHEAD must be smaller than 64KiB each in order to be loaded into memory correctly. (Theoretically a little more than 7,200 tiles per tileset are allowed.)<br />
<br />
*<u><tt>Sprites:</tt></u> The maximum number of sprites in the EGAGRAPH file is limited to 3640. If more sprites are inserted, then the data block with the sprite info (width, height, hitbox, shifts, etc.) will be larger than 64KiB.<br />
<br />
'''Note''': Some of this is not set in stone. In ID_RF.H some of these values can be adjusted, but this would then consume more memory.<br />
<br />
<!--<br />
== EGAHEAD ==<br />
<br />
[[Information on the EGAHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
<br />
== MAPHEAD ==<br />
<br />
[[Information on the MAPHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
--><br />
<br />
= Graphics and Texts (EGAGRAPH) =<br />
<br />
The <tt>EGAGRAPH.CKS</tt> file (aslo called the EGA graphics library) functions as a container the stores compressed sub files which are individually called chunks. Chunks in this container include all graphics, demos, fonts, sprites, tiles, texts and other game files. <br />
<br />
The <tt>EGAHEAD.CKS</tt> file contains information about the size of the <tt>EGAGRAPH.CKS</tt> file and the offset location of each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/EGAGraph_Format EGAGraph_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted graphics and text files from <tt>EGAGRAPH.CKS</tt> the can be found in the '''<tt>EGA</tt>''' folder. Likewise, a definitions file (<tt>ega.def</tt>) [[add ega.def to the package]] has been added to the setup. If additional files, such as graphics or sprites, are to be added to the game, the definitions file must be updated. The tool [[uGrab]] is used to read this definition file and import/export the changed or new files into/from the <tt>EGAGRAPH.CKS</tt> container.<br />
<br />
[[Image:Ega-Color-Palette.png|160px|thumb|EGA Color Palette]]<br />
To begin editing graphics and most texts found in the game, go to the '''<tt>EGA</tt>''' folder. You can edit any of the images how you want but must follow two rules: you must use the [[moddingwiki:EGA_Palette|original 16 EGA Keen colours]], and all images must have a width that is a multiple of 8 pixels.<br />
<br />
All the image, text, and other files within '''<tt>EGA</tt>''' are arranged in clusters by file type. The following table gives an overview of each file type, and you can can find a corresponding overview in the <tt>ega.def</tt> definitions file as well.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|CKS_ansi_*.bin<br />
|Final screen <br />
|''Appears after quitting the game.''<br />
|-<br />
|CKS_fon_*.bmp<br />
|Font sheets <br />
|''These fonts are used throughout the game.''<br />
|-<br />
|CKS_pic_*.bmp<br />
|Main menu and help section images<br />
|<br />
|-<br />
|CKS_sprite_*.bmp<br />
|Sprite images <br />
|<br />
|-<br />
|CKS_sprites.txt<br />
|Sprite definition text file<br />
|''Hitboxes and offset values are defined for each sprite.''<br />
|-<br />
|CKS_terminator_*<br />
|Terminator text sequence <br />
|''Appears at the games first start and leads to the title screen.''<br />
|-<br />
|CKS_tile8*.bmp<br />
|Drop-down menu Tilesets <br />
|''These tilesets contain numerous tiles. Each tile has a size of 8x8 pixel.''<br />
|-<br />
|CKS_tile16*.bmp<br />
|Fore- and Background-Tileset <br />
|''These tilesets contain numerous tiles. Each tile has a size of 16x16 pixel.''<br />
|-<br />
|CKS_txt*.txt<br />
|Text sheets<br />
|''Containing story element texts and help section information.''<br />
|-<br />
|CKS_txt_STARWARS.txt<br />
|Scrolling story text<br />
|''The so called Star Wars Story Screen.''<br />
|-<br />
|CKS_DEMO*.CKS<br />
|Demo recordings <br />
|<br />
|}<br />
<br />
== Import and Export Files ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
To import / export the files located in '''EGA''', use <tt>[[uGrab]]</tt>. <tt>uGrab</tt> is an advanced EGAGRAPH editor with a graphical user interface which can not only import / export graphics, but can also add, move or remove sprites in Commander Keen source mods. <br />
<br />
For <tt>uGrab</tt> to work, a definition file is required, which is already included within the Source Code Modding bundle. [[How to manually modify definition file]].<br />
<br />
To begin, open <tt>uGrab</tt> and go to <code>Import</code> and select <code>Import from bitmap folder...</code>. Locate the <tt>ega.def</tt> definition file in your project folder and open it. A dialog pops up that asks you to select the '''EGA''' folder. Do so and press <code>OK</code>. The graphics and text files have now been imported into <tt>uGrab</tt>. <br />
<br />
To import these files into the EGAGRAPH simply go to <code>Export</code> and select <code>Export as EGAGRAPH...</code>. In the following window locate <tt>EGAGRAPH.CKS</tt> file and press <code>Save</code>. <tt>uGrab</tt> will then ask you to select a Huffman Compression Type; choose <code>Best (Slowest)</code>. It will then ask if you want to update the definition file, which you should confirm. The new graphics and text files should now be exported into the game files.<br />
<br />
An alternative to running an instance of <tt>uGrab</tt> is through batch files. The modding package comes with two batch files which can be used to speed up and automate the import / export process significantly. Simply double-click <code>ega-in.bat</code> to import and double-click <code>ega-out.bat</code> to export all files. To learn more about how those batch files operate, simply open them with a text editor such as notepad.<br />
<br />
== Tilesets == <br />
<br />
You can edit tiles in the typical manner, however, the first row of tiles in the foreground tileset (<tt>CKS_tile16m</tt>) is generally reserved to render certain blocking elements. Those are used for debugging reasons and should stay untouched. <br />
<br />
[[Short note about tiles (16x16 pixel) for the novice modder]]<br />
<br />
[[Reminder: inserted corresponding graphics to the tile16m file for the final modding package.]]<br />
<br />
[[example image goes here.]]<br />
<br />
== Sprite Hitboxes ==<br />
<br />
Just like standard modding, <tt>CKS_sprites.txt</tt> is used for establishing Sprite hitboxes. Since we are dealing with a modified version of the source code, the last value in a <tt>CKS_sprites.txt</tt> entry, handling animation frame rate, must stay at 1. Otherwise there will be errors in the rendering. (Desired adjustments need to be taken in the source code)<br />
<br />
== Texts ==<br />
<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
Text files can be edited with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
They employ a formatting code:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting code<br />
! style="text-align:left;"| Description<br />
|-<br />
|<code>^P</code> <br />
|''Marks the beginning of a page.''<br />
|-<br />
|<code>^Gy,x,n</code> <br />
|''Displays a bitmap. The image number <tt>n</tt> used here doesn't match up with the image numbers in your EGA folder; [[OUTDATED? the image shown is the image number plus seven (n + 7)]]. The <tt>x,y</tt> are coordinates which determine where the image appears on the screen. The <tt>^G</tt> command can also use sprites and both types of 16x16 pixel tiles (TILE16 and TILE16M).''<br />
|-<br />
|<code>^Ly,x</code> <br />
|''Following text will be aligned beginning at pixel location <tt>x,y</tt>.''<br />
|-<br />
|<code>^Ty,x,n,t</code> <br />
|''After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap [[OUTDATED? (n + 7)]] at pixel location <tt>x,y</tt> on the screen.''<br />
|-<br />
|<code>^By,x,w,h,c</code> <br />
|''Fills the width-by-height-pixel rectangle at pixel location <tt>x,y</tt> with dimensions of <tt>w,h</tt> and the color <tt>c</tt>. <tt>c</tt> is the hexadecimal color digit, the rest are decimal digits. If the line ends before the parser can find a hex digit, the code will use the background color (for compatibility with Keen 4-6 texts).''<br />
|-<br />
|[[^Mxxx]]<br />
|''[[Starts playing music number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^MOxxx]]<br />
|''[[Plays the music track number]] <tt>xxx</tt> [[only once, without repeating.]]''<br />
|-<br />
|[[^MP]]<br />
|''[[Pauses the current running music track and allows to resume it later.]]''<br />
|-<br />
|[[^MR]]<br />
|''[[Resumes music paused by]] <tt>^MP</tt>.''<br />
|-<br />
|[[^Sxxx]]<br />
|''[[Plays sound number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^W]]<br />
|''[[Waits until the current sound is done (does not update the screen).]]''<br />
|-<br />
|[[^Dttt]]<br />
|''[[Waits]] <tt>ttt</tt> [[tics (screen will be updated)]]''<br />
|-<br />
|[[^Q]] <br />
|''[["quiet" - stops sounds and music.]]''<br />
|-<br />
|[[^H]]<br />
|''[[Shows the high scores in any of the help texts.]]''<br />
|-<br />
|<code>^E</code> <br />
|''Marks the end of the dialogue.''<br />
|}<br />
<br />
<br />
The specific codes for changing the color of text are:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:center;"| Description<br>.<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:middle;"| Description<br>.<br />
|-<br />
|<br />
|''<code>^Cx</code> changes the text to color <tt>x</tt>''<br />
|<br />
|''<code>x</code> = single hex digit: <tt>0-9</tt>, <tt>A-F</tt>''<br />
|-<br />
|<code>^CA</code> <br />
|<code style="background:#AA0000; color:#55FF55"><b>bright green text color </b></code><br />
|<code>^C2</code> <br />
|<code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
|-<br />
|<code>^CB</code> <br />
|<code style="background:#AA0000; color:#55FFFF"><b>bright cyan text color </b></code><br />
|<code>^C3</code> <br />
|<code style="background:#AA0000; color:#00AAAA"><b>cyan text color </b></code><br />
|-<br />
|<code>^CC</code> <br />
|<code style="background:#AA0000; color:#FF5555"><b>bright red text color </b></code><br />
|<code>^C4</code> <br />
|<code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
|-<br />
|<code>^CD</code> <br />
|<code style="background:#AA0000; color:#FF55FF"><b>bright magenta text color</b></code><br />
|<code>^C5</code> <br />
|<code style="background:#AA0000; color:#AA00AA"><b>magenta text color </b></code><br />
|-<br />
|<code>^CE</code> <br />
|<code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
|<code>^C6</code> <br />
|<code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
|-<br />
|<code>^C9</code> <br />
|<code style="background:#AA0000; color:#5555ff"><b>bright blue text color </b></code><br />
|<code>^C1</code> <br />
|<code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
|-<br />
|<code>^CF</code> <br />
|<code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
|<code>^C7</code> <br />
|<code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
|-<br />
|<code>^C8</code> <br />
|<code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
|<code>^C0</code> <br />
|<code style="background:#AA0000; color:#000000"><b>black text color </b></code><br />
|}<br />
<br />
== Other Texts ==<br />
<br />
Some editable texts, such as level entrance messages, are not found in files within the <tt>'''EGA'''</tt> folder and instead require using a text editor to modify specific source code files located in the <tt>'''../SOURCE/MAKESTR'''</tt> folder. To edit most text files that appear in game open up the <tt>MAKESTR.C</tt> file with a text editor. This file contains Level Names, Level Entrance Texts, In-Game Messages and related texts. <br />
<br />
After editing these files, the game must be recompiled in order to integrate the changes. We'll get to the [[compiling process]] later.<br />
<br />
<br />
== Loading Window ==<br />
<br />
<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
<br />
KeenScr, in combination with TheDraw, is used for editing the loading and closing screen graphics.<br />
<br />
[[Where to find the loading screen files, copy it to keenscr folder]] <br />
<br />
Go to commander prompt and navigate to your <tt>keenscr</tt> folder and then type: <br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will immediately start editing the screen, with the filename keenscr.bin. <br />
<br />
<code>Alt</code>+<code>H</code> will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename [[keenscr.bin]]. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
[[files must be copied back to origin folder. Does this require uGrab or a recompile?]] <br />
<br />
<br />
<br />
<br />
<br />
== Adding Additional Graphics and Text Files ==<br />
Unlike standard Keen Galaxy modding, the number of text and graphics files can be expanded or rearranged in source modding. (This section will go into how to add these things, a later section will go into actually utilizing new stuff)<br />
<br />
=== Images and Sprites ===<br />
<br />
=== Text Files === <br />
<br />
=== Tiles ===<br />
<br />
= Level Editing (MAPHEAD) =<br />
<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
<br />
To create and edit levels in source mods, [[Abiathar]] is essential. Abiathar comes with a [https://abiathar.keenmodding.org/AbiatharHelp.pdf documentation/help file] which is strongly recommended. It contains advanced information this tutorial cannot match. [[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined. To learn how to use this feature rich tool you can also head over to [[Abiathar|Abiathar's main page]]. <br />
<br />
== Setting up Abiathar ==<br />
<br />
Open Abiathar and go to <code>File</code> and select <code>Open Project</code>. Within your projects folder you should find a dependency file called <tt>maps.adeps</tt> which you want to choose. This is your pre-setup from where you can start building levels.<br />
<br />
To store modifications press <code>Save</code> under <code>File</code>. The settings for the levels will be written to the <tt>maps.adeps</tt> file, which only contains references and pointers to the real resources files, but doesn’t store any level data on their own. <br />
<br />
Closing Abiathar for the first time, quite a few settings will get saved to the <tt>editor.aconf</tt> config file. Those settings are loaded when Abiathar starts.<br />
<br />
Once some work has been done on a level set, it is advisable to test them in-game. <br />
[[let's talk about this briefly]]<br />
<br />
== Memory & Technical Limitations ==<br />
<br />
Each level must not exceed 64KiB: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about.<br />
<br />
The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
The greater the variety of tiles used, the more memory is used; each foreground tile consumes 128 bytes, whereas each background tile consumes 160 bytes.<br />
<br />
There is a maximum of 50 sprites visible on-screen at the same time, but not limit for the level as a whole. Each Sprite in the refresh manager is 50 bytes. This is calculated by taking the sprite list entry (34 bytes for each sprite), and adding the erase list entry multiplied by two due to double buffering <code>(8*2=16)</code>; thus: <code>34 + 8 * 2 = 50 bytes</code> per Sprite. The number of Sprites that are in use can be checked using the <code>F10+C</code> cheat code in game.<br />
<br />
Sprites may be placed on top of animating tiles, but a foreground animating tile may not be placed on an animating background tile.<br />
<br />
There is a maximum of 100 different tile animation sequences and 100 animated tiles visible on-screen at the same time.<br />
<br />
The song played during the level will contribute toward the overall byte size of the level.<br />
<br />
In general, when it comes to level design, compromises may need to be made for memory purposes. For example, if you want to use a lot of different graphics in a level then you might have to make the level smaller or use a music track with a smaller file size so the game doesn't run out of memory.<br />
<br />
= Music and Sounds (AUDIOT) = <br />
<br />
To alter music and sounds, this chapter will discuss the following files and folders: <tt>AUDIOT.CKS, AUDIOHED.CKS, AUDIO, audio.asnds, Abiathar, MIDI2IMF, IMFCrush, WDC.</tt><br />
<br />
The <tt>AUDIOT.CKS</tt> file functions as a container that stores compressed sub files individually called chunks. Chunks in this container include AdLib music (<tt>*.IMF, *.KMF</tt>), AdLib sound effects (<tt>*AL.SND</tt>) and PC Speaker sound effects (<tt>*PC.SND</tt>). <br />
<br />
The <tt>AUDIOT.CKS</tt> file requires an associated <tt>AUDIOHED.CKS</tt> file which stores the offset location of each each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/AudioT_Format AudioT_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted music and sound files from <tt>AUDIOT.CKS</tt> that can be found in the '''<tt>AUDIO</tt>''' folder. Likewise, a configuration file (<tt>audio.asnds</tt>) [[add audio.asnds to the package]] has been added to the setup. If additional files, such as sound effects or music, are to be added to the game, the configuration file must be updated. The tool [[Abiathar]] is used to read this configuration file and import/export the changed or new files into/from the <tt>AUDIOT.CKS</tt> container.<br />
<br />
== Brief introduction into music and sound ==<br />
<br />
=== PC Sounds ===<br />
<br />
=== AdLib Sounds ===<br />
<br />
=== IMF / KMF Music ===<br />
<br />
IMF/KMF format files are packed at the end of the audio file. As IMF/KMF files contain AdLib music for games that also have AdLib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict. This is done by reserving the OPL's first channel for sound effects, leaving eight remaining channels available for use in IMF files. <br />
<br />
[[more info about this procedure needed]]<br />
<br />
It is advised to perform optimizations on existing IMF files. [[IMFCrush]] removes by default everything that drives the first AdLib/OPL channel. Generally the original IMF file is reduced by roundabout a third by converting to KMF. The reduction depends entirely on the contents of the source file. <br />
(Side note: IMFCrush is also capable of converting songs to a different playback rate, or even truncate songs.)<br />
<br />
== Music Composition ==<br />
<br />
For tips on music composition as well as the conversion process to the IMF format, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Music| music section] of the patch based modding tutorial.<br />
<br />
== Sound Effect Composition ==<br />
<br />
[[create a pre-defined setup that can be downloaded as well to shortcut things and bypass source code incompatibilities WDC has!]]<br />
<br />
WDC is an older modding tool that contains a sound effect design tool. For instructions on how to access and use this tool, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Sound_Effects| sound effects section] of the patch based modding tutorial.<br />
<br />
== Abiathar Setup and Usage == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
[[Image:Abiathar audio-mappings.png |320px|thumb|Abiathar's Audio Mappings tool]]<br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select [[the option to select]]. <br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format).<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
=== Abiathar Configuration File ===<br />
<br />
Abiathar uses <tt>audio.asnds</tt> for importing and exporting the sound and music files. It contains an entry for each song and music file in a certain format.<br />
<br />
A pc speaker sound looks like: <br />
<br />
<code>?046|PC|?046PC.SND|50 </code><br />
<br />
The first part of this entry indicates the offset location of the sound. Next, <code>PC</code> indicates [[???]]. Next is the sound file that will be used at this offset. The last digit defines the sound effect's priority; since the engine can only play one sound effect at a time this number tells it which sound has priority to play. Values can be from 00 to 99 with the higher numbers being higher priority. <br />
<br />
An AdLib sound looks like: <br />
<br />
<code>?098|PC|?098AL.SND|50|6|1,48,79,0,240,96,255,1,0,0,0,0,0 </code><br />
<br />
As you can see, this entry begins in the same manner as a PC speaker sound, right up to the priority value. The additional numbers that occur after are instrument information that can be ignored (the source engine does not actually use these values), however, Abiathar requires placeholder numbers to be included (any values will do). <br />
<br />
[[example of Music entries]]<br />
<br />
=== Additional Music and Sound Effects ===<br />
<br />
Sound effects and music must occur sequentially in the <tt>audio.asnds</tt> numbered list. Beginning with PC speaker sounds, additional sounds must appear after the last PC speaker sound. Then existing AdLib sound entries must be shifted up the numbered list by the number of PC speaker sounds added, followed by additional entries corresponding to the number of new AdLib sounds. The number of of PC spaker sounds and Adlib sounds must equal each other. Lastly, music is shifted up the numbered list by the required amount. The result is a consistent numbered list of pc speaker sounds, AdLib sounds, and music files.<br />
<br />
This process requires a lot of relabeling files, detailed modification to <tt>audio.asnds</tt>, importing with Abiathar, and modification to and recompiling the source code. With that in mind, it is highly recommended to import all additional sound effects at one time (using placeholders if necessary), to avoid repeatedly having to reorder files and filenames. Adding new music is a similar process, but because the music cluster of chunks appears last in <tt>AUDIOT.CKS</tt>, it is a simpler task requiring less forethought.<br />
<br />
==== Adding Sound Effects ====<br />
<br />
Begin the process by naming your PC speaker sound effects so that they occur after the final existing PC speaker sound in your '''AUDIO''' folder.<br />
<br />
Next, all AdLib sounds must be renamed so that their numbered order begins after the new final PC speaker sound. [[Automating this process?]]<br />
<br />
Next, your new AdLib sounds should be renamed to occur after the newly ordered final existing AdLib sound. <br />
<br />
Next, all music files must be renamed so that their numbered order begins after the new final AdLib sound.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>AUDIOCKS.H</tt> must be updated to reflect the new sound effect and musical totals. In <tt>AUDIOCKS.H</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, and <tt>NUMSNDCHUNKS</tt> to two times the value of <tt>NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
==== Adding Music ====<br />
<br />
Begin by naming your songs so that they occur after the final existing music files in your '''AUDIO''' folder.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>AUDIOCKS.H</tt> must be updated to reflect the new sound effect and musical totals. In <tt>AUDIOCKS.H</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, <tt>NUMMUSIC</tt> to the number of songs, and <tt>NUMSNDCHUNKS</tt> to two times the value of NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
= Source Code Editing =<br />
<br />
Because source code modding provides endless possibilities, only limited by a modder's programming ability, this section will only introduce the most basic steps involved in some fundamental modifications that a modder might want when creating a 'typical' Commander Keen mod. <br />
<br />
[[How to add additional levels]]<br />
<br />
[[How to modify a creature's behavior]]<br />
<br />
[[How to create a new enemy actor]]<br />
<br />
[[How to create a new tile property]]<br />
<br />
<br />
= Compiling the Source Code =<br />
<br />
[[Image:Borland C source code compiling 01.png |320px|thumb|Working with Borland C++ v3.1]]<br />
<br />
[[Image:Borland C source code compiling 02.png |320px|thumb|Compiling, error message]]<br />
<br />
[[Introduction into Borland C++ v.3.1]]<br />
<br />
= Credits For This Tutorial =<br />
<br />
* Written and assembled by [[User:Ceilick|Ceilick]] and [[User:Nisaba|Nisaba]]<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(source_code_based)&diff=46133Keen Galaxy Modding Tutorial (source code based)2022-08-29T23:11:33Z<p>Ceilick: /* Music and Sounds (AUDIOT) */ organization, removing redundant info from patch based tutorial</p>
<hr />
<div>{{Alert|'''This page is still under construction!'''}}<br />
<br />
This tutorial aims to teach [[Keen:Galaxy Source Modding Package|Keen:Galaxy Source Mod]] modding in terms of what is different from modding without source code. It will primarily cover tool usage and the new options provided by the supplied source code package and its modification. Creating a full source mod requires some basic coding knowledge that this tutorial will not cover, but it will explain where and what needs to be coded and provide limited code examples for common tasks and features. <br />
<br />
For general, introductory Keen Galaxy modding information not covered here, please consult the [[Keen Galaxy Modding Tutorial (patch based)|patch based Keen Galaxy Modding Tutorial]]. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft</tt> <tt>Windows</tt> s based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Downlad the core [[Keen:Galaxy Source Modding Package]]. This bundle contains a source code package with a number of pre-setup tools and files. Make sure to extract all files and keep the pre-defined folder structure. To facilitate modding, this package contains all resources present in their decompressed format.<br />
<br />
== Modding Package ==<br />
<br />
The modding package contains (amongst others) three sub-directories which are '''AUDIO''', '''EGA''' and '''SOURCE'''. They present all resources in their decompressed format. <br />
* The '''AUDIO''' folder contains music files and sound effects that are stored in the games <tt>AUDIOT.CKS</tt> container file. <br />
* The '''EGA''' folder contains mainly graphic and text files that are stored in the games <tt>EGAGRAPH.CKS</tt> container file. <br />
* The '''SOURCE''' folder contains everything source code related written in the high-level language <tt>C/C++</tt> . <tt>SRCMOD.EXE</tt> is the compiled executable. <br />
<br />
The modding packages also contains a few core tools to modify, import, and export those resource files. In brief: <br />
* [[Abiathar]] is used for editing maps (using the <tt>map.adeps</tt> definition file for <tt>MAPTEMP.CKS</tt>). It is also used to create the game audio archive (using the <tt>audio.asnds</tt> definition file for <tt>AUDIOT.CKS</tt>). <br />
* [[uGrab]] functions as an <tt>EGAGRAPH.CKS</tt> editor. For convenience, two batch files (<tt>ega-in.bat</tt>, <tt>ega-out.bat</tt>) are included for easy import and export of graphics. The game archive structure can be altered by editing the <tt>ega.def</tt> definitions file. <br />
* [[Borland 3.1]] is used to compile the code; a Borland 3.1 project file ([[SRCMOD.PRJ]]) has been included for this purpose. Borland compilers can be invoked in a 16-bit DOS environment (e.g., DOSBox v0.74 has been successfully used).<br />
<br />
[[Let's also add a TOOLS, a INFO and a UPLOAD folder]]<br />
<br />
[[Modding folder structure setup goes here]]<br />
<br />
== Tools ==<br />
<br />
This is the complete list of tools used for source modding:<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|''Version 2.11.4 Beta 1 or higher is required''<br />
|-<br />
|[[Borland C++ Compiler]]<br />
|Source Code Compiler <br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro Graphic Text Editor <br />
|<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.''<br />
|-<br />
|[[TliExtend]]<br />
|Tileinfo Extension <br />
|''This tool is a command line based tileinfo extension utility for Abiathar''<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|''Also used for adding additional graphics and texts files.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used''<br />
|<br />
|}<br />
<br />
<!--Additional Tools?--><br />
<br />
= Engine Information = <br />
<br />
In contrast to classic modding via patches, working with the source code allows much more freedom. Nevertheless, there are some limitations that must be taken into account.<br />
<br />
For several reasons DOS only allows a maximum amount of 640KiB of memory available to programs. Therefore DOS (and maybe some drivers) as well as the game program and most of the game data (levels, music, graphics) must fit into these 640KiB.<br />
<br />
The game engine organizes certain segments into memory blocks with an upper limit of 64KiB. This means that the number of music tracks, sprites or tiles is limited to a certain degree. Realistically music and levels are the only parts (besides, perhaps, the sprite info block) where the 64KiB limit per chunk could be problematic.<br />
<br />
Here are some basic limitations:<br />
<br />
*<u><tt>Audio</tt></u>: each sound and each piece of music must not be larger than 64KiB.<br />
<br />
*<u><tt>Levels</tt></u>: also referred to as map-planes, each of these must not exceed 64KiB. For details, see the below section on [[Keen Source Mod Modding Tutorial#Memory_.26_Technical_Limitations|level limitations]].<br />
<br />
*<u><tt>Tilesets</tt></u>: There is no concrete upper limit for the number of tiles a tileset can have. The only requirement is that the MAPHEAD and EGAHEAD must be smaller than 64KiB each in order to be loaded into memory correctly. (Theoretically a little more than 7,200 tiles per tileset are allowed.)<br />
<br />
*<u><tt>Sprites:</tt></u> The maximum number of sprites in the EGAGRAPH file is limited to 3640. If more sprites are inserted, then the data block with the sprite info (width, height, hitbox, shifts, etc.) will be larger than 64KiB.<br />
<br />
'''Note''': Some of this is not set in stone. In ID_RF.H some of these values can be adjusted, but this would then consume more memory.<br />
<br />
<!--<br />
== EGAHEAD ==<br />
<br />
[[Information on the EGAHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
<br />
== MAPHEAD ==<br />
<br />
[[Information on the MAPHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
--><br />
<br />
= Graphics and Texts (EGAGRAPH) =<br />
<br />
The <tt>EGAGRAPH.CKS</tt> file (aslo called the EGA graphics library) functions as a container the stores compressed sub files which are individually called chunks. Chunks in this container include all graphics, demos, fonts, sprites, tiles, texts and other game files. <br />
<br />
The <tt>EGAHEAD.CKS</tt> file contains information about the size of the <tt>EGAGRAPH.CKS</tt> file and the offset location of each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/EGAGraph_Format EGAGraph_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted graphics and text files from <tt>EGAGRAPH.CKS</tt> the can be found in the '''<tt>EGA</tt>''' folder. Likewise, a definitions file (<tt>ega.def</tt>) [[add ega.def to the package]] has been added to the setup. If additional files, such as graphics or sprites, are to be added to the game, the definitions file must be updated. The tool [[uGrab]] is used to read this definition file and import/export the changed or new files into/from the <tt>EGAGRAPH.CKS</tt> container.<br />
<br />
[[Image:Ega-Color-Palette.png|160px|thumb|EGA Color Palette]]<br />
To begin editing graphics and most texts found in the game, go to the '''<tt>EGA</tt>''' folder. You can edit any of the images how you want but must follow two rules: you must use the [[moddingwiki:EGA_Palette|original 16 EGA Keen colours]], and all images must have a width that is a multiple of 8 pixels.<br />
<br />
All the image, text, and other files within '''<tt>EGA</tt>''' are arranged in clusters by file type. The following table gives an overview of each file type, and you can can find a corresponding overview in the <tt>ega.def</tt> definitions file as well.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|CKS_ansi_*.bin<br />
|Final screen <br />
|''Appears after quitting the game.''<br />
|-<br />
|CKS_fon_*.bmp<br />
|Font sheets <br />
|''These fonts are used throughout the game.''<br />
|-<br />
|CKS_pic_*.bmp<br />
|Main menu and help section images<br />
|<br />
|-<br />
|CKS_sprite_*.bmp<br />
|Sprite images <br />
|<br />
|-<br />
|CKS_sprites.txt<br />
|Sprite definition text file<br />
|''Hitboxes and offset values are defined for each sprite.''<br />
|-<br />
|CKS_terminator_*<br />
|Terminator text sequence <br />
|''Appears at the games first start and leads to the title screen.''<br />
|-<br />
|CKS_tile8*.bmp<br />
|Drop-down menu Tilesets <br />
|''These tilesets contain numerous tiles. Each tile has a size of 8x8 pixel.''<br />
|-<br />
|CKS_tile16*.bmp<br />
|Fore- and Background-Tileset <br />
|''These tilesets contain numerous tiles. Each tile has a size of 16x16 pixel.''<br />
|-<br />
|CKS_txt*.txt<br />
|Text sheets<br />
|''Containing story element texts and help section information.''<br />
|-<br />
|CKS_txt_STARWARS.txt<br />
|Scrolling story text<br />
|''The so called Star Wars Story Screen.''<br />
|-<br />
|CKS_DEMO*.CKS<br />
|Demo recordings <br />
|<br />
|}<br />
<br />
== Import and Export Files ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
To import / export the files located in '''EGA''', use <tt>[[uGrab]]</tt>. <tt>uGrab</tt> is an advanced EGAGRAPH editor with a graphical user interface which can not only import / export graphics, but can also add, move or remove sprites in Commander Keen source mods. <br />
<br />
For <tt>uGrab</tt> to work, a definition file is required, which is already included within the Source Code Modding bundle. [[How to manually modify definition file]].<br />
<br />
To begin, open <tt>uGrab</tt> and go to <code>Import</code> and select <code>Import from bitmap folder...</code>. Locate the <tt>ega.def</tt> definition file in your project folder and open it. A dialog pops up that asks you to select the '''EGA''' folder. Do so and press <code>OK</code>. The graphics and text files have now been imported into <tt>uGrab</tt>. <br />
<br />
To import these files into the EGAGRAPH simply go to <code>Export</code> and select <code>Export as EGAGRAPH...</code>. In the following window locate <tt>EGAGRAPH.CKS</tt> file and press <code>Save</code>. <tt>uGrab</tt> will then ask you to select a Huffman Compression Type; choose <code>Best (Slowest)</code>. It will then ask if you want to update the definition file, which you should confirm. The new graphics and text files should now be exported into the game files.<br />
<br />
An alternative to running an instance of <tt>uGrab</tt> is through batch files. The modding package comes with two batch files which can be used to speed up and automate the import / export process significantly. Simply double-click <code>ega-in.bat</code> to import and double-click <code>ega-out.bat</code> to export all files. To learn more about how those batch files operate, simply open them with a text editor such as notepad.<br />
<br />
== Tilesets == <br />
<br />
You can edit tiles in the typical manner, however, the first row of tiles in the foreground tileset (<tt>CKS_tile16m</tt>) is generally reserved to render certain blocking elements. Those are used for debugging reasons and should stay untouched. <br />
<br />
[[Short note about tiles (16x16 pixel) for the novice modder]]<br />
<br />
[[Reminder: inserted corresponding graphics to the tile16m file for the final modding package.]]<br />
<br />
[[example image goes here.]]<br />
<br />
== Sprite Hitboxes ==<br />
<br />
Just like standard modding, <tt>CKS_sprites.txt</tt> is used for establishing Sprite hitboxes. Since we are dealing with a modified version of the source code, the last value in a <tt>CKS_sprites.txt</tt> entry, handling animation frame rate, must stay at 1. Otherwise there will be errors in the rendering. (Desired adjustments need to be taken in the source code)<br />
<br />
== Texts ==<br />
<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
Text files can be edited with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
They employ a formatting code:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting code<br />
! style="text-align:left;"| Description<br />
|-<br />
|<code>^P</code> <br />
|''Marks the beginning of a page.''<br />
|-<br />
|<code>^Gy,x,n</code> <br />
|''Displays a bitmap. The image number <tt>n</tt> used here doesn't match up with the image numbers in your EGA folder; [[OUTDATED? the image shown is the image number plus seven (n + 7)]]. The <tt>x,y</tt> are coordinates which determine where the image appears on the screen. The <tt>^G</tt> command can also use sprites and both types of 16x16 pixel tiles (TILE16 and TILE16M).''<br />
|-<br />
|<code>^Ly,x</code> <br />
|''Following text will be aligned beginning at pixel location <tt>x,y</tt>.''<br />
|-<br />
|<code>^Ty,x,n,t</code> <br />
|''After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap [[OUTDATED? (n + 7)]] at pixel location <tt>x,y</tt> on the screen.''<br />
|-<br />
|<code>^By,x,w,h,c</code> <br />
|''Fills the width-by-height-pixel rectangle at pixel location <tt>x,y</tt> with dimensions of <tt>w,h</tt> and the color <tt>c</tt>. <tt>c</tt> is the hexadecimal color digit, the rest are decimal digits. If the line ends before the parser can find a hex digit, the code will use the background color (for compatibility with Keen 4-6 texts).''<br />
|-<br />
|[[^Mxxx]]<br />
|''[[Starts playing music number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^MOxxx]]<br />
|''[[Plays the music track number]] <tt>xxx</tt> [[only once, without repeating.]]''<br />
|-<br />
|[[^MP]]<br />
|''[[Pauses the current running music track and allows to resume it later.]]''<br />
|-<br />
|[[^MR]]<br />
|''[[Resumes music paused by]] <tt>^MP</tt>.''<br />
|-<br />
|[[^Sxxx]]<br />
|''[[Plays sound number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^W]]<br />
|''[[Waits until the current sound is done (does not update the screen).]]''<br />
|-<br />
|[[^Dttt]]<br />
|''[[Waits]] <tt>ttt</tt> [[tics (screen will be updated)]]''<br />
|-<br />
|[[^Q]] <br />
|''[["quiet" - stops sounds and music.]]''<br />
|-<br />
|[[^H]]<br />
|''[[Shows the high scores in any of the help texts.]]''<br />
|-<br />
|<code>^E</code> <br />
|''Marks the end of the dialogue.''<br />
|}<br />
<br />
<br />
The specific codes for changing the color of text are:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:center;"| Description<br>.<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:middle;"| Description<br>.<br />
|-<br />
|<br />
|''<code>^Cx</code> changes the text to color <tt>x</tt>''<br />
|<br />
|''<code>x</code> = single hex digit: <tt>0-9</tt>, <tt>A-F</tt>''<br />
|-<br />
|<code>^CA</code> <br />
|<code style="background:#AA0000; color:#55FF55"><b>bright green text color </b></code><br />
|<code>^C2</code> <br />
|<code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
|-<br />
|<code>^CB</code> <br />
|<code style="background:#AA0000; color:#55FFFF"><b>bright cyan text color </b></code><br />
|<code>^C3</code> <br />
|<code style="background:#AA0000; color:#00AAAA"><b>cyan text color </b></code><br />
|-<br />
|<code>^CC</code> <br />
|<code style="background:#AA0000; color:#FF5555"><b>bright red text color </b></code><br />
|<code>^C4</code> <br />
|<code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
|-<br />
|<code>^CD</code> <br />
|<code style="background:#AA0000; color:#FF55FF"><b>bright magenta text color</b></code><br />
|<code>^C5</code> <br />
|<code style="background:#AA0000; color:#AA00AA"><b>magenta text color </b></code><br />
|-<br />
|<code>^CE</code> <br />
|<code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
|<code>^C6</code> <br />
|<code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
|-<br />
|<code>^C9</code> <br />
|<code style="background:#AA0000; color:#5555ff"><b>bright blue text color </b></code><br />
|<code>^C1</code> <br />
|<code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
|-<br />
|<code>^CF</code> <br />
|<code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
|<code>^C7</code> <br />
|<code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
|-<br />
|<code>^C8</code> <br />
|<code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
|<code>^C0</code> <br />
|<code style="background:#AA0000; color:#000000"><b>black text color </b></code><br />
|}<br />
<br />
== Other Texts ==<br />
<br />
Some editable texts, such as level entrance messages, are not found in files within the <tt>'''EGA'''</tt> folder and instead require using a text editor to modify specific source code files located in the <tt>'''../SOURCE/MAKESTR'''</tt> folder. To edit most text files that appear in game open up the <tt>MAKESTR.C</tt> file with a text editor. This file contains Level Names, Level Entrance Texts, In-Game Messages and related texts. <br />
<br />
After editing these files, the game must be recompiled in order to integrate the changes. We'll get to the [[compiling process]] later.<br />
<br />
<br />
== Loading Window ==<br />
<br />
<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
<br />
KeenScr, in combination with TheDraw, is used for editing the loading and closing screen graphics.<br />
<br />
[[Where to find the loading screen files, copy it to keenscr folder]] <br />
<br />
Go to commander prompt and navigate to your <tt>keenscr</tt> folder and then type: <br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will immediately start editing the screen, with the filename keenscr.bin. <br />
<br />
<code>Alt</code>+<code>H</code> will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename [[keenscr.bin]]. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
[[files must be copied back to origin folder. Does this require uGrab or a recompile?]] <br />
<br />
<br />
<br />
<br />
<br />
== Adding Additional Graphics and Text Files ==<br />
Unlike standard Keen Galaxy modding, the number of text and graphics files can be expanded or rearranged in source modding. (This section will go into how to add these things, a later section will go into actually utilizing new stuff)<br />
<br />
=== Images and Sprites ===<br />
<br />
=== Text Files === <br />
<br />
=== Tiles ===<br />
<br />
= Level Editing (MAPHEAD) =<br />
<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
<br />
To create and edit levels in source mods, [[Abiathar]] is essential. Abiathar comes with a [https://abiathar.keenmodding.org/AbiatharHelp.pdf documentation/help file] which is strongly recommended. It contains advanced information this tutorial cannot match. [[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined. To learn how to use this feature rich tool you can also head over to [[Abiathar|Abiathar's main page]]. <br />
<br />
== Setting up Abiathar ==<br />
<br />
Open Abiathar and go to <code>File</code> and select <code>Open Project</code>. Within your projects folder you should find a dependency file called <tt>maps.adeps</tt> which you want to choose. This is your pre-setup from where you can start building levels.<br />
<br />
To store modifications press <code>Save</code> under <code>File</code>. The settings for the levels will be written to the <tt>maps.adeps</tt> file, which only contains references and pointers to the real resources files, but doesn’t store any level data on their own. <br />
<br />
Closing Abiathar for the first time, quite a few settings will get saved to the <tt>editor.aconf</tt> config file. Those settings are loaded when Abiathar starts.<br />
<br />
Once some work has been done on a level set, it is advisable to test them in-game. <br />
[[let's talk about this briefly]]<br />
<br />
== Memory & Technical Limitations ==<br />
<br />
Each level must not exceed 64KiB: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about.<br />
<br />
The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
The greater the variety of tiles used, the more memory is used; each foreground tile consumes 128 bytes, whereas each background tile consumes 160 bytes.<br />
<br />
There is a maximum of 50 sprites visible on-screen at the same time, but not limit for the level as a whole. Each Sprite in the refresh manager is 50 bytes. This is calculated by taking the sprite list entry (34 bytes for each sprite), and adding the erase list entry multiplied by two due to double buffering <code>(8*2=16)</code>; thus: <code>34 + 8 * 2 = 50 bytes</code> per Sprite. The number of Sprites that are in use can be checked using the <code>F10+C</code> cheat code in game.<br />
<br />
Sprites may be placed on top of animating tiles, but a foreground animating tile may not be placed on an animating background tile.<br />
<br />
There is a maximum of 100 different tile animation sequences and 100 animated tiles visible on-screen at the same time.<br />
<br />
The song played during the level will contribute toward the overall byte size of the level.<br />
<br />
In general, when it comes to level design, compromises may need to be made for memory purposes. For example, if you want to use a lot of different graphics in a level then you might have to make the level smaller or use a music track with a smaller file size so the game doesn't run out of memory.<br />
<br />
= Music and Sounds (AUDIOT) = <br />
<br />
To alter music and sounds, this chapter will discuss the following files and folders: <tt>AUDIOT.CKS, AUDIOHED.CKS, AUDIO, audio.asnds, Abiathar, MIDI2IMF, IMFCrush, WDC.</tt><br />
<br />
The <tt>AUDIOT.CKS</tt> file functions as a container that stores compressed sub files individually called chunks. Chunks in this container include AdLib music (<tt>*.IMF, *.KMF</tt>), AdLib sound effects (<tt>*AL.SND</tt>) and PC Speaker sound effects (<tt>*PC.SND</tt>). <br />
<br />
The <tt>AUDIOT.CKS</tt> file requires an associated <tt>AUDIOHED.CKS</tt> file which stores the offset location of each each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/AudioT_Format AudioT_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted music and sound files from <tt>AUDIOT.CKS</tt> that can be found in the '''<tt>AUDIO</tt>''' folder. Likewise, a configuration file (<tt>audio.asnds</tt>) [[add audio.asnds to the package]] has been added to the setup. If additional files, such as sound effects or music, are to be added to the game, the configuration file must be updated. The tool [[Abiathar]] is used to read this configuration file and import/export the changed or new files into/from the <tt>AUDIOT.CKS</tt> container.<br />
<br />
== Brief introduction into music and sound ==<br />
<br />
=== PC Sounds ===<br />
<br />
=== AdLib Sounds ===<br />
<br />
=== IMF / KMF Music ===<br />
<br />
IMF/KMF format files are packed at the end of the audio file. As IMF/KMF files contain AdLib music for games that also have AdLib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict. This is done by reserving the OPL's first channel for sound effects, leaving eight remaining channels available for use in IMF files. <br />
<br />
[[more info about this procedure needed]]<br />
<br />
It is advised to perform optimizations on existing IMF files. [[IMFCrush]] removes by default everything that drives the first AdLib/OPL channel. Generally the original IMF file is reduced by roundabout a third by converting to KMF. The reduction depends entirely on the contents of the source file. <br />
(Side note: IMFCrush is also capable of converting songs to a different playback rate, or even truncate songs.)<br />
<br />
== Music Composition ==<br />
<br />
For tips on music composition as well as the conversion process to the IMF format, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Music| music section] of the patch based modding tutorial.<br />
<br />
== Sound Effect Composition ==<br />
<br />
[[create a pre-defined setup that can be downloaded as well to shortcut things and bypass source code incompatibilities WDC has!]]<br />
<br />
WDC is an older modding tool that contains a sound effect design tool. For instructions on how to access and use this tool, consult the [https://keenwiki.shikadi.net/wiki/Keen_Galaxy_Modding_Tutorial_(patch_based)#Sound_Effects| sound effects section] of the patch based modding tutorial.<br />
<br />
== Abiathar Setup and Usage == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
[[Image:Abiathar audio-mappings.png |320px|thumb|Abiathar's Audio Mappings tool]]<br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select [[the option to select]]. <br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format).<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
=== Abiathar Configuration File ===<br />
<br />
Abiathar uses <tt>audio.asnds</tt> for importing and exporting the sound and music files. It contains an entry for each song and music file in a certain format.<br />
<br />
A pc speaker sound looks like: <br />
<br />
<code>?046|PC|?046PC.SND|50 </code><br />
<br />
The first part of this entry indicates the offset location of the sound. Next, <code>PC</code> indicates [[???]]. Next is the sound file that will be used at this offset. The last digit defines the sound effect's priority; since the engine can only play one sound effect at a time this number tells it which sound has priority to play. Values can be from 00 to 99 with the higher numbers being higher priority. <br />
<br />
An AdLib sound looks like: <br />
<br />
<code>?098|PC|?098AL.SND|50|6|1,48,79,0,240,96,255,1,0,0,0,0,0 </code><br />
<br />
As you can see, this entry begins in the same manner as a PC speaker sound, right up to the priority value. The additional numbers that occur after are instrument information that can be ignored (the source engine does not actually use these values), however, Abiathar requires placeholder numbers to be included (any values will do). <br />
<br />
[[example of Music entries]]<br />
<br />
=== Additional Music and Sound Effects ===<br />
<br />
Adding new sound effects requires a lot of relabeling files, modification to <tt>audio.asnds</tt>, importing with Abiathar, and modification to and recompiling the source code. It is highly recommended to import all additional sound effects at one time (using placeholders if necessary), to avoid repeatedly having to reorder files and filenames. <br />
<br />
* '''Note''': For each sound effect, there must be both a PC speaker and AdLib version of the sound.<br />
<br />
Adding new music is a similar process, but because the music cluster of chunks appears last in <tt>AUDIOT.CKS</tt>, it is a simpler task.<br />
<br />
==== Adding Sound Effects ====<br />
<br />
Sound effects must occur sequentially in the <tt>audio.asnds</tt> numbered list. Beginning with PC speaker sounds, additional sounds must appear after the last PC speaker sound. Then, accordingly, existing AdLib sound entries must be shifted up the numbered list by the number of PC speaker sounds added, followed by additional entries corresponding to the number of new AdLib sounds (remember, the number of sounds in each format must equal each other). Lastly, music is shifted up the numbered list by the same amount. The result is a consistent numbered list of pc speaker sounds, AdLib sounds, and music files.<br />
<br />
Begin the process by naming your PC speaker sound effects so that they occur after the final existing PC speaker sound in your '''AUDIO''' folder.<br />
<br />
Next, all AdLib sounds must be renamed so that their numbered order begins after the new final PC speaker sound. [[Automating this process?]]<br />
<br />
Next, your new AdLib sounds should be renamed to occur after the newly ordered final existing AdLib sound. <br />
<br />
Next, all music files must be renamed so that their numbered order begins after the new final AdLib sound.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>AUDIOCKS.H</tt> must be updated to reflect the new sound effect and musical totals. In <tt>AUDIOCKS.H</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, and <tt>NUMSNDCHUNKS</tt> to two times the value of <tt>NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
==== Adding Music ====<br />
<br />
Begin by naming your songs so that they occur after the final existing music files in your '''AUDIO''' folder.<br />
<br />
Next, import the new files using Abiathar's import process.<br />
<br />
<tt>AUDIOCKS.H</tt> must be updated to reflect the new sound effect and musical totals. In <tt>AUDIOCKS.H</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, <tt>NUMMUSIC</tt> to the number of songs, and <tt>NUMSNDCHUNKS</tt> to two times the value of NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
Lastly, recompile the code.<br />
<br />
= Source Code Editing =<br />
<br />
Because source code modding provides endless possibilities, only limited by a modder's programming ability, this section will only introduce the most basic steps involved in some fundamental modifications that a modder might want when creating a 'typical' Commander Keen mod. <br />
<br />
[[How to add additional levels]]<br />
<br />
[[How to modify a creature's behavior]]<br />
<br />
[[How to create a new enemy actor]]<br />
<br />
[[How to create a new tile property]]<br />
<br />
<br />
= Compiling the Source Code =<br />
<br />
[[Image:Borland C source code compiling 01.png |320px|thumb|Working with Borland C++ v3.1]]<br />
<br />
[[Image:Borland C source code compiling 02.png |320px|thumb|Compiling, error message]]<br />
<br />
[[Introduction into Borland C++ v.3.1]]<br />
<br />
= Credits For This Tutorial =<br />
<br />
* Written and assembled by [[User:Ceilick|Ceilick]] and [[User:Nisaba|Nisaba]]<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46132Keen Galaxy Modding Tutorial (patch based)2022-08-29T22:35:11Z<p>Ceilick: /* Setup */ image</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)| Keen Galaxy source based modding]], which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up <tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into <tt>uGrab</tt>.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open ,tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving <tt>uGrab</tt> into your <tt>"Keen4mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), use the tool <tt>The Neural Stunner</tt>, which can be found in your <tt>"Tools"</tt> folder. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open <tt>Abiathar</tt> and go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will help walk you through the creation of your project dependency file. <br />
<br />
1. Select <code>Start from template</code> and the episode from the drop-down list. <br />
<br />
2. Select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>'''GAMEMAPS.CK4'''</tt> and <tt>'''MAPHEAD.CK4'''</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset from your <tt>"EGA"</tt> folder (<tt>'''ck4_tile16.bmp'''</tt>). For the masked, select the foreground tileset (<tt>'''ck4_tile16m.bmp'''</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code>.<br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created <tt>Abiathar project file</tt> (.adepts file). From this point forward, whenever you open <tt>Abiathar</tt>, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In <tt>Abiathar</tt> one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the keygem holder tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by Abiathar when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-down menus determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
One major useful shortcut is the copy and paste feature. Use the <code>C</code> key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the <code>X</code> key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for importing and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
You can compose music using your choice of software; as long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
Be advised, however, that your MIDI will need to be converted to the IMF format, which is extremely limited in range compared to MIDI. Both IMFCreator and MIDI2IMF can be used for converting music, and both are suggested since they can produce different sounding results. It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]].<br />
<br />
Lastly, your IMF song will need optimizing with IMFCrush for memory purposes (this process does not typically result in any noticeable loss in sound quality).<br />
<br />
=== Composition Tips ===<br />
<br />
*If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
*If your instrument track is too quiet and it is already set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
*Keep percussion parts as simple as possible since it impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure: [SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
*A tip from Bobby Prince: On the subject of percussion, to circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases.<br />
<br />
*Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
*Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (parts drop out randomly and inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr. M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
*Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In <tt>IMFCreator</tt> it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a MIDI track to the IMF format. To do this simply drag and drop your MIDI file onto <tt>'''mid2imf.exe'''</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that <tt>MIDI2IMF</tt> is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
<tt>IMFCreator</tt> is another program for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into <tt>IMFCreator</tt> and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
<tt>IMFCrush</tt>, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
<tt>IMF Player</tt> can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>'''imfplay.exe'''</tt>. Then drag and drop <tt>'''imfplay.exe'''</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with <tt>IMFCrush</tt>, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. For Keen 4, these range from <tt>'''sound156.IMF'''</tt> to <tt>'''sound161.IMF'''</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specifically the files: <tt>'''Audio.ck4'''</tt>, <tt>'''Egagraph.ck4'''</tt>, <tt>'''Gamemaps.ck4'''</tt>, and <tt>'''Keen4e.exe'''</tt>.<br />
* '''Note:''' Make sure this version of the <tt>'''keen4e.exe'''</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>'''WDC.exe'''</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it <tt>'''keen4project'''</tt> and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <tt>no map code file</tt> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>"AUDIO"</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
The DOS loading and closing windows are modified with <tt>KeenScr</tt> and <tt>TheDraw</tt>.<br />
<br />
To begin, go to your <tt>"EGA"</tt> folder and look for the file <tt>'''ck4_ansi_endgame.bin'''</tt>. Copy this to your <tt>"keenscr"</tt> folder in <tt>"Tools"</tt> and then rename it to <tt>'''4msc0000.bin'''</tt>.<br />
<br />
Load <tt>'''KEENSCR.EXE'''</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename <tt>'''keenscr.bin'''</tt>. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>'''4msc0000.bin'''</tt> back into your <tt>"EGA"</tt> folder. Rename <tt>'''4msc0000.bin'''</tt> back to <tt>'''ck4_ansi_endgame.bin'''</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>'''CK4LOAD.BIN'''</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin<br />
<br />
%patchfile $20cd7 ck5load.bin<br />
<br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46131Keen Galaxy Modding Tutorial (patch based)2022-08-29T22:27:32Z<p>Ceilick: /* Music and Sounds */ grammar</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)| Keen Galaxy source based modding]], which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up <tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into <tt>uGrab</tt>.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open ,tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving <tt>uGrab</tt> into your <tt>"Keen4mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), use the tool <tt>The Neural Stunner</tt>, which can be found in your <tt>"Tools"</tt> folder. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open <tt>Abiathar</tt> and go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will help walk you through the creation of your project dependency file. <br />
<br />
1. Select <code>Start from template</code> and the episode from the drop-down list. <br />
<br />
2. Select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>'''GAMEMAPS.CK4'''</tt> and <tt>'''MAPHEAD.CK4'''</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset from your <tt>"EGA"</tt> folder (<tt>'''ck4_tile16.bmp'''</tt>). For the masked, select the foreground tileset (<tt>'''ck4_tile16m.bmp'''</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code>.<br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created <tt>Abiathar project file</tt> (.adepts file). From this point forward, whenever you open <tt>Abiathar</tt>, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In <tt>Abiathar</tt> one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the keygem holder tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by Abiathar when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-down menus determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
One major useful shortcut is the copy and paste feature. Use the <code>C</code> key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the <code>X</code> key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for importing and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
You can compose music using your choice of software; as long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
Be advised, however, that your MIDI will need to be converted to the IMF format, which is extremely limited in range compared to MIDI. Both IMFCreator and MIDI2IMF can be used for converting music, and both are suggested since they can produce different sounding results. It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]].<br />
<br />
Lastly, your IMF song will need optimizing with IMFCrush for memory purposes (this process does not typically result in any noticeable loss in sound quality).<br />
<br />
=== Composition Tips ===<br />
<br />
*If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
*If your instrument track is too quiet and it is already set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
*Keep percussion parts as simple as possible since it impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure: [SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
*A tip from Bobby Prince: On the subject of percussion, to circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases.<br />
<br />
*Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
*Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (parts drop out randomly and inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr. M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
*Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In <tt>IMFCreator</tt> it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a MIDI track to the IMF format. To do this simply drag and drop your MIDI file onto <tt>'''mid2imf.exe'''</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that <tt>MIDI2IMF</tt> is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
<tt>IMFCreator</tt> is another program for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into <tt>IMFCreator</tt> and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
<tt>IMFCrush</tt>, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
<tt>IMF Player</tt> can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>'''imfplay.exe'''</tt>. Then drag and drop <tt>'''imfplay.exe'''</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with <tt>IMFCrush</tt>, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. For Keen 4, these range from <tt>'''sound156.IMF'''</tt> to <tt>'''sound161.IMF'''</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specifically the files: <tt>'''Audio.ck4'''</tt>, <tt>'''Egagraph.ck4'''</tt>, <tt>'''Gamemaps.ck4'''</tt>, and <tt>'''Keen4e.exe'''</tt>.<br />
* '''Note:''' Make sure this version of the <tt>'''keen4e.exe'''</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>'''WDC.exe'''</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it <tt>'''keen4project'''</tt> and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <tt>no map code file</tt> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>"AUDIO"</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
The DOS loading and closing windows are modified with <tt>KeenScr</tt> and <tt>TheDraw</tt>.<br />
<br />
To begin, go to your <tt>"EGA"</tt> folder and look for the file <tt>'''ck4_ansi_endgame.bin'''</tt>. Copy this to your <tt>"keenscr"</tt> folder in <tt>"Tools"</tt> and then rename it to <tt>'''4msc0000.bin'''</tt>.<br />
<br />
Load <tt>'''KEENSCR.EXE'''</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename <tt>'''keenscr.bin'''</tt>. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>'''4msc0000.bin'''</tt> back into your <tt>"EGA"</tt> folder. Rename <tt>'''4msc0000.bin'''</tt> back to <tt>'''ck4_ansi_endgame.bin'''</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>'''CK4LOAD.BIN'''</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin<br />
<br />
%patchfile $20cd7 ck5load.bin<br />
<br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46130Keen Galaxy Modding Tutorial (patch based)2022-08-28T18:39:05Z<p>Ceilick: wording</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)| Keen Galaxy source based modding]], which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up <tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into <tt>uGrab</tt>.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open ,tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving <tt>uGrab</tt> into your <tt>"Keen4mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), use the tool <tt>The Neural Stunner</tt>, which can be found in your <tt>"Tools"</tt> folder. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open <tt>Abiathar</tt> and go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will help walk you through the creation of your project dependency file. <br />
<br />
1. Select <code>Start from template</code> and the episode from the drop-down list. <br />
<br />
2. Select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>'''GAMEMAPS.CK4'''</tt> and <tt>'''MAPHEAD.CK4'''</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset from your <tt>"EGA"</tt> folder (<tt>'''ck4_tile16.bmp'''</tt>). For the masked, select the foreground tileset (<tt>'''ck4_tile16m.bmp'''</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code>.<br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created <tt>Abiathar project file</tt> (.adepts file). From this point forward, whenever you open <tt>Abiathar</tt>, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In <tt>Abiathar</tt> one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the keygem holder tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by Abiathar when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-down menus determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
One major useful shortcut is the copy and paste feature. Use the <code>C</code> key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the <code>X</code> key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for import and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
You can compose music using your choice of software; as long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
Be advised, however, that your MIDI will need to be converted to the IMF format, which is extremely limited in range compared to MIDI. Both IMFCreator and MIDI2IMF can be used for converting music, and both are suggested since they can produce different sounding results. It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]].<br />
<br />
Lastly, your IMF song will need optimizing with IMFCrush for memory purposes (this process does not typically result in any noticeable loss in sound quality).<br />
<br />
=== Composition Tips ===<br />
<br />
*If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
*If your instrument track is too quiet and it is already set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
*Keep percussion parts as simple as possible since it impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure: [SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
*A tip from Bobby Prince: On the subject of percussion, to circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases.<br />
<br />
*Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
*Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (parts drop out randomly and inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr. M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
*Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In <tt>IMFCreator</tt> it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a MIDI track to the IMF format. To do this simply drag and drop your MIDI file onto <tt>'''mid2imf.exe'''</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that <tt>MIDI2IMF</tt> is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
<tt>IMFCreator</tt> is another program for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into <tt>IMFCreator</tt> and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
<tt>IMFCrush</tt>, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
<tt>IMF Player</tt> can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>'''imfplay.exe'''</tt>. Then drag and drop <tt>'''imfplay.exe'''</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with <tt>IMFCrush</tt>, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. For Keen 4, these range from <tt>'''sound156.IMF'''</tt> to <tt>'''sound161.IMF'''</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specifically the files: <tt>'''Audio.ck4'''</tt>, <tt>'''Egagraph.ck4'''</tt>, <tt>'''Gamemaps.ck4'''</tt>, and <tt>'''Keen4e.exe'''</tt>.<br />
* '''Note:''' Make sure this version of the <tt>'''keen4e.exe'''</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>'''WDC.exe'''</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it <tt>'''keen4project'''</tt> and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <tt>no map code file</tt> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>"AUDIO"</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
The DOS loading and closing windows are modified with <tt>KeenScr</tt> and <tt>TheDraw</tt>.<br />
<br />
To begin, go to your <tt>"EGA"</tt> folder and look for the file <tt>'''ck4_ansi_endgame.bin'''</tt>. Copy this to your <tt>"keenscr"</tt> folder in <tt>"Tools"</tt> and then rename it to <tt>'''4msc0000.bin'''</tt>.<br />
<br />
Load <tt>'''KEENSCR.EXE'''</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename <tt>'''keenscr.bin'''</tt>. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>'''4msc0000.bin'''</tt> back into your <tt>"EGA"</tt> folder. Rename <tt>'''4msc0000.bin'''</tt> back to <tt>'''ck4_ansi_endgame.bin'''</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>'''CK4LOAD.BIN'''</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin<br />
<br />
%patchfile $20cd7 ck5load.bin<br />
<br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(source_code_based)&diff=46129Keen Galaxy Modding Tutorial (source code based)2022-08-28T15:12:01Z<p>Ceilick: reason to consult patch based tutorial</p>
<hr />
<div>{{Alert|'''This page is still under construction!'''}}<br />
<br />
This tutorial aims to teach [[Keen:Galaxy Source Modding Package|Keen:Galaxy Source Mod]] modding in terms of what is different from modding without source code. It will primarily cover tool usage and the new options provided by the supplied source code package and its modification. Creating a full source mod requires some basic coding knowledge that this tutorial will not cover, but it will explain where and what needs to be coded and provide limited code examples for common tasks and features. <br />
<br />
For general, introductory Keen Galaxy modding information not covered here, please consult the [[Keen Galaxy Modding Tutorial (patch based)|patch based Keen Galaxy Modding Tutorial]]. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft</tt> <tt>Windows</tt> s based tools and script/batch files.<br />
<br />
= Setup =<br />
<br />
Downlad the core [[Keen:Galaxy Source Modding Package]]. This bundle contains a source code package with a number of pre-setup tools and files. Make sure to extract all files and keep the pre-defined folder structure. To facilitate modding, this package contains all resources present in their decompressed format.<br />
<br />
== Modding Package ==<br />
<br />
The modding package contains (amongst others) three sub-directories which are '''AUDIO''', '''EGA''' and '''SOURCE'''. They present all resources in their decompressed format. <br />
* The '''AUDIO''' folder contains music files and sound effects that are stored in the games <tt>AUDIOT.CKS</tt> container file. <br />
* The '''EGA''' folder contains mainly graphic and text files that are stored in the games <tt>EGAGRAPH.CKS</tt> container file. <br />
* The '''SOURCE''' folder contains everything source code related written in the high-level language <tt>C/C++</tt> . <tt>SRCMOD.EXE</tt> is the compiled executable. <br />
<br />
The modding packages also contains a few core tools to modify, import, and export those resource files. In brief: <br />
* [[Abiathar]] is used for editing maps (using the <tt>map.adeps</tt> definition file for <tt>MAPTEMP.CKS</tt>). It is also used to create the game audio archive (using the <tt>audio.asnds</tt> definition file for <tt>AUDIOT.CKS</tt>). <br />
* [[uGrab]] functions as an <tt>EGAGRAPH.CKS</tt> editor. For convenience, two batch files (<tt>ega-in.bat</tt>, <tt>ega-out.bat</tt>) are included for easy import and export of graphics. The game archive structure can be altered by editing the <tt>ega.def</tt> definitions file. <br />
* [[Borland 3.1]] is used to compile the code; a Borland 3.1 project file ([[SRCMOD.PRJ]]) has been included for this purpose. Borland compilers can be invoked in a 16-bit DOS environment (e.g., DOSBox v0.74 has been successfully used).<br />
<br />
[[Let's also add a TOOLS, a INFO and a UPLOAD folder]]<br />
<br />
[[Modding folder structure setup goes here]]<br />
<br />
== Tools ==<br />
<br />
This is the complete list of tools used for source modding:<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|''Version 2.11.4 Beta 1 or higher is required''<br />
|-<br />
|[[Borland C++ Compiler]]<br />
|Source Code Compiler <br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro Graphic Text Editor <br />
|<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.''<br />
|-<br />
|[[TliExtend]]<br />
|Tileinfo Extension <br />
|''This tool is a command line based tileinfo extension utility for Abiathar''<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|''Also used for adding additional graphics and texts files.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used''<br />
|<br />
|}<br />
<br />
<!--Additional Tools?--><br />
<br />
= Engine Information = <br />
<br />
In contrast to classic modding via patches, working with the source code allows much more freedom. Nevertheless, there are some limitations that must be taken into account.<br />
<br />
For several reasons DOS only allows a maximum amount of 640KiB of memory available to programs. Therefore DOS (and maybe some drivers) as well as the game program and most of the game data (levels, music, graphics) must fit into these 640KiB.<br />
<br />
The game engine organizes certain segments into memory blocks with an upper limit of 64KiB. This means that the number of music tracks, sprites or tiles is limited to a certain degree. Realistically music and levels are the only parts (besides, perhaps, the sprite info block) where the 64KiB limit per chunk could be problematic.<br />
<br />
Here are some basic limitations:<br />
<br />
*<u><tt>Audio</tt></u>: each sound and each piece of music must not be larger than 64KiB.<br />
<br />
*<u><tt>Levels</tt></u>: also referred to as map-planes, each of these must not exceed 64KiB. For details, see the below section on [[Keen Source Mod Modding Tutorial#Memory_.26_Technical_Limitations|level limitations]].<br />
<br />
*<u><tt>Tilesets</tt></u>: There is no concrete upper limit for the number of tiles a tileset can have. The only requirement is that the MAPHEAD and EGAHEAD must be smaller than 64KiB each in order to be loaded into memory correctly. (Theoretically a little more than 7,200 tiles per tileset are allowed.)<br />
<br />
*<u><tt>Sprites:</tt></u> The maximum number of sprites in the EGAGRAPH file is limited to 3640. If more sprites are inserted, then the data block with the sprite info (width, height, hitbox, shifts, etc.) will be larger than 64KiB.<br />
<br />
'''Note''': Some of this is not set in stone. In ID_RF.H some of these values can be adjusted, but this would then consume more memory.<br />
<br />
<!--<br />
== EGAHEAD ==<br />
<br />
[[Information on the EGAHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
<br />
== MAPHEAD ==<br />
<br />
[[Information on the MAPHEAD: what it is, what the limitation is, why you should be aware of the limitation (details on how to measure against the limitation in relevant sections)]]<br />
--><br />
<br />
= Graphics and Texts (EGAGRAPH) =<br />
<br />
The <tt>EGAGRAPH.CKS</tt> file (aslo called the EGA graphics library) functions as a container the stores compressed sub files which are individually called chunks. Chunks in this container include all graphics, demos, fonts, sprites, tiles, texts and other game files. <br />
<br />
The <tt>EGAHEAD.CKS</tt> file contains information about the size of the <tt>EGAGRAPH.CKS</tt> file and the offset location of each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/EGAGraph_Format EGAGraph_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted graphics and text files from <tt>EGAGRAPH.CKS</tt> the can be found in the '''<tt>EGA</tt>''' folder. Likewise, a definitions file (<tt>ega.def</tt>) [[add ega.def to the package]] has been added to the setup. If additional files, such as graphics or sprites, are to be added to the game, the definitions file must be updated. The tool [[uGrab]] is used to read this definition file and import/export the changed or new files into/from the <tt>EGAGRAPH.CKS</tt> container.<br />
<br />
[[Image:Ega-Color-Palette.png|160px|thumb|EGA Color Palette]]<br />
To begin editing graphics and most texts found in the game, go to the '''<tt>EGA</tt>''' folder. You can edit any of the images how you want but must follow two rules: you must use the [[moddingwiki:EGA_Palette|original 16 EGA Keen colours]], and all images must have a width that is a multiple of 8 pixels.<br />
<br />
All the image, text, and other files within '''<tt>EGA</tt>''' are arranged in clusters by file type. The following table gives an overview of each file type, and you can can find a corresponding overview in the <tt>ega.def</tt> definitions file as well.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| File Name<br />
! style="text-align:left;"| Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|CKS_ansi_*.bin<br />
|Final screen <br />
|''Appears after quitting the game.''<br />
|-<br />
|CKS_fon_*.bmp<br />
|Font sheets <br />
|''These fonts are used throughout the game.''<br />
|-<br />
|CKS_pic_*.bmp<br />
|Main menu and help section images<br />
|<br />
|-<br />
|CKS_sprite_*.bmp<br />
|Sprite images <br />
|<br />
|-<br />
|CKS_sprites.txt<br />
|Sprite definition text file<br />
|''Hitboxes and offset values are defined for each sprite.''<br />
|-<br />
|CKS_terminator_*<br />
|Terminator text sequence <br />
|''Appears at the games first start and leads to the title screen.''<br />
|-<br />
|CKS_tile8*.bmp<br />
|Drop-down menu Tilesets <br />
|''These tilesets contain numerous tiles. Each tile has a size of 8x8 pixel.''<br />
|-<br />
|CKS_tile16*.bmp<br />
|Fore- and Background-Tileset <br />
|''These tilesets contain numerous tiles. Each tile has a size of 16x16 pixel.''<br />
|-<br />
|CKS_txt*.txt<br />
|Text sheets<br />
|''Containing story element texts and help section information.''<br />
|-<br />
|CKS_txt_STARWARS.txt<br />
|Scrolling story text<br />
|''The so called Star Wars Story Screen.''<br />
|-<br />
|CKS_DEMO*.CKS<br />
|Demo recordings <br />
|<br />
|}<br />
<br />
== Import and Export Files ==<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
To import / export the files located in '''EGA''', use <tt>[[uGrab]]</tt>. <tt>uGrab</tt> is an advanced EGAGRAPH editor with a graphical user interface which can not only import / export graphics, but can also add, move or remove sprites in Commander Keen source mods. <br />
<br />
For <tt>uGrab</tt> to work, a definition file is required, which is already included within the Source Code Modding bundle. [[How to manually modify definition file]].<br />
<br />
To begin, open <tt>uGrab</tt> and go to <code>Import</code> and select <code>Import from bitmap folder...</code>. Locate the <tt>ega.def</tt> definition file in your project folder and open it. A dialog pops up that asks you to select the '''EGA''' folder. Do so and press <code>OK</code>. The graphics and text files have now been imported into <tt>uGrab</tt>. <br />
<br />
To import these files into the EGAGRAPH simply go to <code>Export</code> and select <code>Export as EGAGRAPH...</code>. In the following window locate <tt>EGAGRAPH.CKS</tt> file and press <code>Save</code>. <tt>uGrab</tt> will then ask you to select a Huffman Compression Type; choose <code>Best (Slowest)</code>. It will then ask if you want to update the definition file, which you should confirm. The new graphics and text files should now be exported into the game files.<br />
<br />
An alternative to running an instance of <tt>uGrab</tt> is through batch files. The modding package comes with two batch files which can be used to speed up and automate the import / export process significantly. Simply double-click <code>ega-in.bat</code> to import and double-click <code>ega-out.bat</code> to export all files. To learn more about how those batch files operate, simply open them with a text editor such as notepad.<br />
<br />
== Tilesets == <br />
<br />
You can edit tiles in the typical manner, however, the first row of tiles in the foreground tileset (<tt>CKS_tile16m</tt>) is generally reserved to render certain blocking elements. Those are used for debugging reasons and should stay untouched. <br />
<br />
[[Short note about tiles (16x16 pixel) for the novice modder]]<br />
<br />
[[Reminder: inserted corresponding graphics to the tile16m file for the final modding package.]]<br />
<br />
[[example image goes here.]]<br />
<br />
== Sprite Hitboxes ==<br />
<br />
Just like standard modding, <tt>CKS_sprites.txt</tt> is used for establishing Sprite hitboxes. Since we are dealing with a modified version of the source code, the last value in a <tt>CKS_sprites.txt</tt> entry, handling animation frame rate, must stay at 1. Otherwise there will be errors in the rendering. (Desired adjustments need to be taken in the source code)<br />
<br />
== Texts ==<br />
<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
Text files can be edited with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
They employ a formatting code:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting code<br />
! style="text-align:left;"| Description<br />
|-<br />
|<code>^P</code> <br />
|''Marks the beginning of a page.''<br />
|-<br />
|<code>^Gy,x,n</code> <br />
|''Displays a bitmap. The image number <tt>n</tt> used here doesn't match up with the image numbers in your EGA folder; [[OUTDATED? the image shown is the image number plus seven (n + 7)]]. The <tt>x,y</tt> are coordinates which determine where the image appears on the screen. The <tt>^G</tt> command can also use sprites and both types of 16x16 pixel tiles (TILE16 and TILE16M).''<br />
|-<br />
|<code>^Ly,x</code> <br />
|''Following text will be aligned beginning at pixel location <tt>x,y</tt>.''<br />
|-<br />
|<code>^Ty,x,n,t</code> <br />
|''After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap [[OUTDATED? (n + 7)]] at pixel location <tt>x,y</tt> on the screen.''<br />
|-<br />
|<code>^By,x,w,h,c</code> <br />
|''Fills the width-by-height-pixel rectangle at pixel location <tt>x,y</tt> with dimensions of <tt>w,h</tt> and the color <tt>c</tt>. <tt>c</tt> is the hexadecimal color digit, the rest are decimal digits. If the line ends before the parser can find a hex digit, the code will use the background color (for compatibility with Keen 4-6 texts).''<br />
|-<br />
|[[^Mxxx]]<br />
|''[[Starts playing music number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^MOxxx]]<br />
|''[[Plays the music track number]] <tt>xxx</tt> [[only once, without repeating.]]''<br />
|-<br />
|[[^MP]]<br />
|''[[Pauses the current running music track and allows to resume it later.]]''<br />
|-<br />
|[[^MR]]<br />
|''[[Resumes music paused by]] <tt>^MP</tt>.''<br />
|-<br />
|[[^Sxxx]]<br />
|''[[Plays sound number]] <tt>xxx</tt>.''<br />
|-<br />
|[[^W]]<br />
|''[[Waits until the current sound is done (does not update the screen).]]''<br />
|-<br />
|[[^Dttt]]<br />
|''[[Waits]] <tt>ttt</tt> [[tics (screen will be updated)]]''<br />
|-<br />
|[[^Q]] <br />
|''[["quiet" - stops sounds and music.]]''<br />
|-<br />
|[[^H]]<br />
|''[[Shows the high scores in any of the help texts.]]''<br />
|-<br />
|<code>^E</code> <br />
|''Marks the end of the dialogue.''<br />
|}<br />
<br />
<br />
The specific codes for changing the color of text are:<br />
<br />
{| class="wikitable"<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:center;"| Description<br>.<br />
! style="text-align:left:20px;"| Formatting<br>code<br />
! style="text-align:middle;"| Description<br>.<br />
|-<br />
|<br />
|''<code>^Cx</code> changes the text to color <tt>x</tt>''<br />
|<br />
|''<code>x</code> = single hex digit: <tt>0-9</tt>, <tt>A-F</tt>''<br />
|-<br />
|<code>^CA</code> <br />
|<code style="background:#AA0000; color:#55FF55"><b>bright green text color </b></code><br />
|<code>^C2</code> <br />
|<code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
|-<br />
|<code>^CB</code> <br />
|<code style="background:#AA0000; color:#55FFFF"><b>bright cyan text color </b></code><br />
|<code>^C3</code> <br />
|<code style="background:#AA0000; color:#00AAAA"><b>cyan text color </b></code><br />
|-<br />
|<code>^CC</code> <br />
|<code style="background:#AA0000; color:#FF5555"><b>bright red text color </b></code><br />
|<code>^C4</code> <br />
|<code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
|-<br />
|<code>^CD</code> <br />
|<code style="background:#AA0000; color:#FF55FF"><b>bright magenta text color</b></code><br />
|<code>^C5</code> <br />
|<code style="background:#AA0000; color:#AA00AA"><b>magenta text color </b></code><br />
|-<br />
|<code>^CE</code> <br />
|<code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
|<code>^C6</code> <br />
|<code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
|-<br />
|<code>^C9</code> <br />
|<code style="background:#AA0000; color:#5555ff"><b>bright blue text color </b></code><br />
|<code>^C1</code> <br />
|<code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
|-<br />
|<code>^CF</code> <br />
|<code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
|<code>^C7</code> <br />
|<code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
|-<br />
|<code>^C8</code> <br />
|<code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
|<code>^C0</code> <br />
|<code style="background:#AA0000; color:#000000"><b>black text color </b></code><br />
|}<br />
<br />
== Other Texts ==<br />
<br />
Some editable texts, such as level entrance messages, are not found in files within the <tt>'''EGA'''</tt> folder and instead require using a text editor to modify specific source code files located in the <tt>'''../SOURCE/MAKESTR'''</tt> folder. To edit most text files that appear in game open up the <tt>MAKESTR.C</tt> file with a text editor. This file contains Level Names, Level Entrance Texts, In-Game Messages and related texts. <br />
<br />
After editing these files, the game must be recompiled in order to integrate the changes. We'll get to the [[compiling process]] later.<br />
<br />
<br />
== Loading Window ==<br />
<br />
<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
<br />
KeenScr, in combination with TheDraw, is used for editing the loading and closing screen graphics.<br />
<br />
[[Where to find the loading screen files, copy it to keenscr folder]] <br />
<br />
Go to commander prompt and navigate to your <tt>keenscr</tt> folder and then type: <br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will immediately start editing the screen, with the filename keenscr.bin. <br />
<br />
<code>Alt</code>+<code>H</code> will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename [[keenscr.bin]]. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
[[files must be copied back to origin folder. Does this require uGrab or a recompile?]] <br />
<br />
<br />
<br />
<br />
<br />
== Adding Additional Graphics and Text Files ==<br />
Unlike standard Keen Galaxy modding, the number of text and graphics files can be expanded or rearranged in source modding. (This section will go into how to add these things, a later section will go into actually utilizing new stuff)<br />
<br />
=== Images and Sprites ===<br />
<br />
=== Text Files === <br />
<br />
=== Tiles ===<br />
<br />
= Level Editing (MAPHEAD) =<br />
<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
<br />
To create and edit levels in source mods, [[Abiathar]] is essential. Abiathar comes with a [https://abiathar.keenmodding.org/AbiatharHelp.pdf documentation/help file] which is strongly recommended. It contains advanced information this tutorial cannot match. [[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined. To learn how to use this feature rich tool you can also head over to [[Abiathar|Abiathar's main page]]. <br />
<br />
== Setting up Abiathar ==<br />
<br />
Open Abiathar and go to <code>File</code> and select <code>Open Project</code>. Within your projects folder you should find a dependency file called <tt>maps.adeps</tt> which you want to choose. This is your pre-setup from where you can start building levels.<br />
<br />
To store modifications press <code>Save</code> under <code>File</code>. The settings for the levels will be written to the <tt>maps.adeps</tt> file, which only contains references and pointers to the real resources files, but doesn’t store any level data on their own. <br />
<br />
Closing Abiathar for the first time, quite a few settings will get saved to the <tt>editor.aconf</tt> config file. Those settings are loaded when Abiathar starts.<br />
<br />
Once some work has been done on a level set, it is advisable to test them in-game. <br />
[[let's talk about this briefly]]<br />
<br />
== Memory & Technical Limitations ==<br />
<br />
Each level must not exceed 64KiB: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about.<br />
<br />
The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
The greater the variety of tiles used, the more memory is used; each foreground tile consumes 128 bytes, whereas each background tile consumes 160 bytes.<br />
<br />
There is a maximum of 50 sprites visible on-screen at the same time, but not limit for the level as a whole. Each Sprite in the refresh manager is 50 bytes. This is calculated by taking the sprite list entry (34 bytes for each sprite), and adding the erase list entry multiplied by two due to double buffering <code>(8*2=16)</code>; thus: <code>34 + 8 * 2 = 50 bytes</code> per Sprite. The number of Sprites that are in use can be checked using the <code>F10+C</code> cheat code in game.<br />
<br />
Sprites may be placed on top of animating tiles, but a foreground animating tile may not be placed on an animating background tile.<br />
<br />
There is a maximum of 100 different tile animation sequences and 100 animated tiles visible on-screen at the same time.<br />
<br />
The song played during the level will contribute toward the overall byte size of the level.<br />
<br />
In general, when it comes to level design, compromises may need to be made for memory purposes. For example, if you want to use a lot of different graphics in a level then you might have to make the level smaller or use a music track with a smaller file size so the game doesn't run out of memory.<br />
<br />
= Music and Sounds (AUDIOT) = <br />
<br />
To alter music and sounds, this chapter will discuss the following files and folders: <tt>AUDIOT.CKS, AUDIOHED.CKS, AUDIO, audio.asnds, Abiathar, MIDI2IMF, IMFCrush, WDC.</tt><br />
<br />
The <tt>AUDIOT.CKS</tt> file functions as a container that stores compressed sub files individually called chunks. Chunks in this container include AdLib music (<tt>*.IMF, *.KMF</tt>), AdLib sound effects (<tt>*AL.SND</tt>) and PC Speaker sound effects (<tt>*PC.SND</tt>). <br />
<br />
The <tt>AUDIOT.CKS</tt> file requires an associated <tt>AUDIOHED.CKS</tt> file which stores the offset location of each each chunk. (For further reading, the moddingwiki page about [https://moddingwiki.shikadi.net/wiki/AudioT_Format AudioT_Format] holds more technical in-depth info.)<br />
<br />
The modding package already comes with a standard set of extracted music and sound files from <tt>AUDIOT.CKS</tt> that can be found in the '''<tt>AUDIO</tt>''' folder. Likewise, a configuration file (<tt>audio.asnds</tt>) [[add audio.asnds to the package]] has been added to the setup. If additional files, such as sound effects or music, are to be added to the game, the configuration file must be updated. The tool [[Abiathar]] is used to read this configuration file and import/export the changed or new files into/from the <tt>AUDIOT.CKS</tt> container.<br />
<br />
== Brief introduction into music and sound ==<br />
<br />
=== PC Sounds ===<br />
<br />
=== AdLib Sounds ===<br />
<br />
=== IMF / KMF Music ===<br />
<br />
IMF/KMF format files are packed at the end of the audio file. As IMF/KMF files contain AdLib music for games that also have AdLib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict. This is done by reserving the OPL's first channel for sound effects, leaving eight remaining channels available for use in IMF files. <br />
<br />
[[more info about this procedure needed]]<br />
<br />
It is advised to perform optimizations on existing IMF files. [[IMFCrush]] removes by default everything that drives the first AdLib/OPL channel. Generally the original IMF file is reduced by roundabout a third by converting to KMF. The reduction depends entirely on the contents of the source file. <br />
(Side note: IMFCrush is also capable of converting songs to a different playback rate, or even truncate songs.)<br />
<br />
== Additional Music and Sound Effects ==<br />
<br />
Adding new sound effects requires a lot of relabeling files, modification to <tt>audio.asnds</tt>, importing with Abiathar, and modification to and recompiling the source code. It is highly recommended to import all additional sound effects at one time (using placeholders if necessary), to avoid repeatedly having to reorder files and filenames. <br />
<br />
* '''Note''': For each sound effect, there must be both a PC speaker and AdLib version of the sound.<br />
<br />
Adding new music is a similar task, but because the music cluster of chunks appears last in <tt>AUDIOT.CKS</tt>, it is a simpler task.<br />
<br />
To begin, it's important to understand the definitions file, <tt>audio.asnds</tt>, that Abiathar uses for importing and exporting the sound and music files. Each song and music file has an entry in a certain format within <tt>audio.asnds</tt>.<br />
<br />
A pc speaker sound looks like: <br />
<br />
<code>?046|PC|?046PC.SND|50 </code><br />
<br />
The first part of this entry indicates the offset location of the sound. Next, <code>PC</code> indicates [[???]]. Next is the sound file that will be used at this offset. The last digit defines the sound effect's priority; since the engine can only play one sound effect at a time this number tells it which sound has priority to play. Values can be from 00 to 99 with the higher numbers being higher priority. <br />
<br />
An AdLib sound looks like: <br />
<br />
<code>?098|PC|?098AL.SND|50|6|1,48,79,0,240,96,255,1,0,0,0,0,0 </code><br />
<br />
As you can see, this entry begins in the same manner as a PC speaker sound, right up to the priority value. The additional numbers that occur after are instrument information that can be ignored (the source engine does not actually use these values), however, Abiathar requires placeholder numbers to be included (any values will do). <br />
<br />
[[Image:Abiathar audio-resources.png |320px|thumb|Abiathar's Audio Resources tool]]<br />
<br />
[[Image:Abiathar audio-mappings.png |320px|thumb|Abiathar's Audio Mappings tool]]<br />
<br />
<br />
[[example of Music entries]]<br />
<br />
=== Adding Sound Effects ===<br />
<br />
Sound effects must occur sequentially in the <tt>audio.asnds</tt> numbered list. Beginning with PC speaker sounds, additional sounds must appear after the last PC speaker sound. Then, accordingly, existing AdLib sound entries must be shifted up the numbered list by the number of PC speaker sounds added, followed by additional entries corresponding to the number of new AdLib sounds (remember, the number of sounds in each format must equal each other). Lastly, music is shifted up the numbered list by the same amount. The result is a consistent numbered list of pc speaker sounds, AdLib sounds, and music files.<br />
<br />
Begin the process by naming your PC speaker sound effects so that they occur after the final existing PC speaker sound in your '''AUDIO''' folder.<br />
<br />
Next, all AdLib sounds must be renamed so that their numbered order begins after the new final PC speaker sound. [[Automating this process?]]<br />
<br />
Next, your new AdLib sounds should be renamed to occur after the newly ordered final existing AdLib sound. <br />
<br />
Next, all music files must be renamed so that their numbered order begins after the new final AdLib sound.<br />
<br />
[[Abiathar Import Process]]<br />
<br />
<tt>AUDIOCKS.H</tt> must be updated to reflect the new sound effect and musical totals. In <tt>AUDIOCKS.H</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, and <tt>NUMSNDCHUNKS</tt> to two times the value of <tt>NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
=== Adding Music ===<br />
<br />
Begin by naming your songs so that they occur after the final existing music files in your '''AUDIO''' folder.<br />
<br />
[[Abiathar Import Process]]<br />
<br />
<tt>AUDIOCKS.H</tt> must be updated to reflect the new sound effect and musical totals. In <tt>AUDIOCKS.H</tt> you will update: <tt>NUMSOUNDS</tt> to the total number of PC speaker (or AdLib, but not both) sounds, <tt>NUMMUSIC</tt> to the number of songs, and <tt>NUMSNDCHUNKS</tt> to two times the value of NUMSOUNDS</tt> (reflecting both PC speaker and AdLib sounds) plus the value of <tt>NUMMUSIC</tt>.<br />
<br />
For example, if <tt>NUMSOUNDS</tt> = 70 and <tt>NUMMUSIC</tt> = 5, then <tt>NUMSNDCHUNKS</tt> = 145.<br />
<br />
== Creating and Editing Sound Effects ==<br />
<br />
[[create a pre-defined setup that can be downloaded as well to shortcut things and bypass source code incompatibilities WDC has!]]<br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, [[open up X]] <br />
<br />
''go to the new <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specfically the files: <tt>Audio.ck4</tt>, <tt>Egagraph.ck4</tt>, <tt>Gamemaps.ck4</tt>, and <tt>Keen4e.exe</tt>.<br />
* '''Note:''' Make sure this version of the <tt>keen4e.exe</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>WDC.exe</tt>. After is loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it "keen4project" and save it to you <tt>WDC</tt> folder.''<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <code>no map code file</code> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
You should now see the Keen 4 world map. You'll be using only one part of <tt>WDC</tt>, however, so go to <code>View</code> and select either <code>PC Sounds</code> or <code>AdLib Sounds</code>. <br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
WDC will then load it's sound editor. There are various tabs for effecting how the sound is played, and the main area allows you to use your mouse and 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. <br />
<br />
After you've saved some sounds, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <code>sounds</code> folder you created when setting up <tt>Keenwave</tt>. You can do this by listening and finding the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the sounds folder. This is easy for PC speaker sounds, but since <tt>Keenwave</tt> doesn't separate the PC speaker sounds from the AdLib, you'll have to locate the last PC Speaker sound and then begin counting again from 1 in order to match the AdLib sound list in <tt>WDC</tt> to that in your sounds folder.<br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then run <tt>Keenwave</tt> to import your new sound effect.<br />
<br />
== Music Composition ==<br />
<br />
Compose your music using your choice of software. As long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Music will be converted from midi to the IMF format. <br />
<br />
=== Converting Midis ===<br />
<br />
[[Using MIDI2IMF for conversion]]<br />
<br />
[[Using IMFCrush and the KMF format advantages]]<br />
<br />
<br />
=== Composition Tips ===<br />
<br />
It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]]. <br />
<br />
* '''Note''' if you are using a sheet-music editor such as Finale: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
* '''Note''' If your instrument track is too quiet ''and'' it is set to maximum volume, try manually adjusting the note velocites to be higher. I know that <tt>FLStudio</tt> is capable of doing this; I'm sure other studio software packages are capable of this, too. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
* '''Note''' Keep percussion parts as simple as possible. It impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure:<br />
<br />
[SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
Don't be shy about using chords and complex structures -- especially if your percussion line is nonexistent or very simple.<br />
<br />
Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (ie- parts drop out randomly ''and'' inconsistently), and songs that exceed the filesize limits. [[Mr. M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
On the subject of percussion: To circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases. (Credit for this tip goes to Bobby Prince)<br />
<br />
On the topic of modding instrument patches: Don't be afraid to tweak patches! It's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback of your song for the changes to take effect<br />
<br />
(6) Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
As with editing the patch set, you MUST stop and re-start playback of your song for the changes to take effect.<br />
<br />
= Source Code Editing =<br />
<br />
Because source code modding provides endless possibilities, only limited by a modder's programming ability, this section will only introduce the most basic steps involved in some fundamental modifications that a modder might want when creating a 'typical' Commander Keen mod. <br />
<br />
[[How to add additional levels]]<br />
<br />
[[How to modify a creature's behavior]]<br />
<br />
[[How to create a new enemy actor]]<br />
<br />
[[How to create a new tile property]]<br />
<br />
<br />
= Compiling the Source Code =<br />
<br />
[[Image:Borland C source code compiling 01.png |320px|thumb|Working with Borland C++ v3.1]]<br />
<br />
[[Image:Borland C source code compiling 02.png |320px|thumb|Compiling, error message]]<br />
<br />
[[Introduction into Borland C++ v.3.1]]<br />
<br />
= Credits For This Tutorial =<br />
<br />
* Written and assembled by [[User:Ceilick|Ceilick]] and [[User:Nisaba|Nisaba]]<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46128Keen Galaxy Modding Tutorial (patch based)2022-08-28T14:58:29Z<p>Ceilick: /* Loading Window */ formatting, wording</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)|Keen:Galaxy Source Mod]] modding, which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up <tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into <tt>uGrab</tt>.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open ,tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving <tt>uGrab</tt> into your <tt>"Keen4mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), use the tool <tt>The Neural Stunner</tt>, which can be found in your <tt>"Tools"</tt> folder. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open <tt>Abiathar</tt> and go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will help walk you through the creation of your project dependency file. <br />
<br />
1. Select <code>Start from template</code> and the episode from the drop-down list. <br />
<br />
2. Select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>'''GAMEMAPS.CK4'''</tt> and <tt>'''MAPHEAD.CK4'''</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset from your <tt>"EGA"</tt> folder (<tt>'''ck4_tile16.bmp'''</tt>). For the masked, select the foreground tileset (<tt>'''ck4_tile16m.bmp'''</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code>.<br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created <tt>Abiathar project file</tt> (.adepts file). From this point forward, whenever you open <tt>Abiathar</tt>, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In <tt>Abiathar</tt> one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the keygem holder tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by Abiathar when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-down menus determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
One major useful shortcut is the copy and paste feature. Use the <code>C</code> key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the <code>X</code> key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for import and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
You can compose music using your choice of software; as long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
Be advised, however, that your MIDI will need to be converted to the IMF format, which is extremely limited in range compared to MIDI. Both IMFCreator and MIDI2IMF can be used for converting music, and both are suggested since they can produce different sounding results. It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]].<br />
<br />
Lastly, your IMF song will need optimizing with IMFCrush for memory purposes (this process does not typically result in any noticeable loss in sound quality).<br />
<br />
=== Composition Tips ===<br />
<br />
*If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
*If your instrument track is too quiet and it is already set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
*Keep percussion parts as simple as possible since it impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure: [SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
*A tip from Bobby Prince: On the subject of percussion, to circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases.<br />
<br />
*Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
*Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (parts drop out randomly and inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr. M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
*Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In <tt>IMFCreator</tt> it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a MIDI track to the IMF format. To do this simply drag and drop your MIDI file onto <tt>'''mid2imf.exe'''</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that <tt>MIDI2IMF</tt> is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
<tt>IMFCreator</tt> is another program for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into <tt>IMFCreator</tt> and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
<tt>IMFCrush</tt>, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
<tt>IMF Player</tt> can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>'''imfplay.exe'''</tt>. Then drag and drop <tt>'''imfplay.exe'''</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with <tt>IMFCrush</tt>, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. For Keen 4, these range from <tt>'''sound156.IMF'''</tt> to <tt>'''sound161.IMF'''</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specifically the files: <tt>'''Audio.ck4'''</tt>, <tt>'''Egagraph.ck4'''</tt>, <tt>'''Gamemaps.ck4'''</tt>, and <tt>'''Keen4e.exe'''</tt>.<br />
* '''Note:''' Make sure this version of the <tt>'''keen4e.exe'''</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>'''WDC.exe'''</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it <tt>'''keen4project'''</tt> and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <tt>no map code file</tt> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>"AUDIO"</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
The DOS loading and closing windows are modified with <tt>KeenScr</tt> and <tt>TheDraw</tt>.<br />
<br />
To begin, go to your <tt>"EGA"</tt> folder and look for the file <tt>'''ck4_ansi_endgame.bin'''</tt>. Copy this to your <tt>"keenscr"</tt> folder in <tt>"Tools"</tt> and then rename it to <tt>'''4msc0000.bin'''</tt>.<br />
<br />
Load <tt>'''KEENSCR.EXE'''</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename <tt>'''keenscr.bin'''</tt>. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>'''4msc0000.bin'''</tt> back into your <tt>"EGA"</tt> folder. Rename <tt>'''4msc0000.bin'''</tt> back to <tt>'''ck4_ansi_endgame.bin'''</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>'''CK4LOAD.BIN'''</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin<br />
<br />
%patchfile $20cd7 ck5load.bin<br />
<br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46127Keen Galaxy Modding Tutorial (patch based)2022-08-28T14:54:06Z<p>Ceilick: /* Sound Effects */ formatting, wording</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)|Keen:Galaxy Source Mod]] modding, which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up <tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into <tt>uGrab</tt>.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open ,tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving <tt>uGrab</tt> into your <tt>"Keen4mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), use the tool <tt>The Neural Stunner</tt>, which can be found in your <tt>"Tools"</tt> folder. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open <tt>Abiathar</tt> and go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will help walk you through the creation of your project dependency file. <br />
<br />
1. Select <code>Start from template</code> and the episode from the drop-down list. <br />
<br />
2. Select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>'''GAMEMAPS.CK4'''</tt> and <tt>'''MAPHEAD.CK4'''</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset from your <tt>"EGA"</tt> folder (<tt>'''ck4_tile16.bmp'''</tt>). For the masked, select the foreground tileset (<tt>'''ck4_tile16m.bmp'''</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code>.<br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created <tt>Abiathar project file</tt> (.adepts file). From this point forward, whenever you open <tt>Abiathar</tt>, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In <tt>Abiathar</tt> one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the keygem holder tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by Abiathar when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-down menus determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
One major useful shortcut is the copy and paste feature. Use the <code>C</code> key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the <code>X</code> key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for import and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
You can compose music using your choice of software; as long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
Be advised, however, that your MIDI will need to be converted to the IMF format, which is extremely limited in range compared to MIDI. Both IMFCreator and MIDI2IMF can be used for converting music, and both are suggested since they can produce different sounding results. It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]].<br />
<br />
Lastly, your IMF song will need optimizing with IMFCrush for memory purposes (this process does not typically result in any noticeable loss in sound quality).<br />
<br />
=== Composition Tips ===<br />
<br />
*If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
*If your instrument track is too quiet and it is already set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
*Keep percussion parts as simple as possible since it impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure: [SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
*A tip from Bobby Prince: On the subject of percussion, to circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases.<br />
<br />
*Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
*Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (parts drop out randomly and inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr. M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
*Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In <tt>IMFCreator</tt> it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a MIDI track to the IMF format. To do this simply drag and drop your MIDI file onto <tt>'''mid2imf.exe'''</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that <tt>MIDI2IMF</tt> is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
<tt>IMFCreator</tt> is another program for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into <tt>IMFCreator</tt> and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
<tt>IMFCrush</tt>, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
<tt>IMF Player</tt> can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>'''imfplay.exe'''</tt>. Then drag and drop <tt>'''imfplay.exe'''</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with <tt>IMFCrush</tt>, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. For Keen 4, these range from <tt>'''sound156.IMF'''</tt> to <tt>'''sound161.IMF'''</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specifically the files: <tt>'''Audio.ck4'''</tt>, <tt>'''Egagraph.ck4'''</tt>, <tt>'''Gamemaps.ck4'''</tt>, and <tt>'''Keen4e.exe'''</tt>.<br />
* '''Note:''' Make sure this version of the <tt>'''keen4e.exe'''</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>'''WDC.exe'''</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it <tt>'''keen4project'''</tt> and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <tt>no map code file</tt> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>"AUDIO"</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
Go to your <tt>EGA</tt> folder and look for the file <tt>ck4_ansi_endgame.bin</tt>. Copy this to your <tt>keenscr</tt> folder and then rename it to <tt>4msc0000.bin</tt>.<br />
<br />
Load <tt>KEENSCR.EXE</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename keenscr.bin. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>4msc0000.bin</tt> back into your <tt>EGA</tt> folder. Rename <tt>4msc0000.bin</tt> back to <tt>ck4_ansi_endgame.bin</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>CK4LOAD.BIN</tt> into your <tt>Keen4mod</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin <br />
%patchfile $20cd7 ck5load.bin <br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46126Keen Galaxy Modding Tutorial (patch based)2022-08-28T14:49:22Z<p>Ceilick: /* Music */ formatting, wording</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)|Keen:Galaxy Source Mod]] modding, which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up <tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into <tt>uGrab</tt>.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open ,tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving <tt>uGrab</tt> into your <tt>"Keen4mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), use the tool <tt>The Neural Stunner</tt>, which can be found in your <tt>"Tools"</tt> folder. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open <tt>Abiathar</tt> and go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will help walk you through the creation of your project dependency file. <br />
<br />
1. Select <code>Start from template</code> and the episode from the drop-down list. <br />
<br />
2. Select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>'''GAMEMAPS.CK4'''</tt> and <tt>'''MAPHEAD.CK4'''</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset from your <tt>"EGA"</tt> folder (<tt>'''ck4_tile16.bmp'''</tt>). For the masked, select the foreground tileset (<tt>'''ck4_tile16m.bmp'''</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code>.<br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created <tt>Abiathar project file</tt> (.adepts file). From this point forward, whenever you open <tt>Abiathar</tt>, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In <tt>Abiathar</tt> one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the keygem holder tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by Abiathar when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-down menus determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
One major useful shortcut is the copy and paste feature. Use the <code>C</code> key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the <code>X</code> key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for import and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
You can compose music using your choice of software; as long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
Be advised, however, that your MIDI will need to be converted to the IMF format, which is extremely limited in range compared to MIDI. Both IMFCreator and MIDI2IMF can be used for converting music, and both are suggested since they can produce different sounding results. It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]].<br />
<br />
Lastly, your IMF song will need optimizing with IMFCrush for memory purposes (this process does not typically result in any noticeable loss in sound quality).<br />
<br />
=== Composition Tips ===<br />
<br />
*If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
*If your instrument track is too quiet and it is already set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
*Keep percussion parts as simple as possible since it impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure: [SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
*A tip from Bobby Prince: On the subject of percussion, to circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases.<br />
<br />
*Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
*Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (parts drop out randomly and inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr. M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
*Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In <tt>IMFCreator</tt> it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a MIDI track to the IMF format. To do this simply drag and drop your MIDI file onto <tt>'''mid2imf.exe'''</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that <tt>MIDI2IMF</tt> is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
<tt>IMFCreator</tt> is another program for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into <tt>IMFCreator</tt> and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
<tt>IMFCrush</tt>, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
<tt>IMF Player</tt> can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>'''imfplay.exe'''</tt>. Then drag and drop <tt>'''imfplay.exe'''</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with <tt>IMFCrush</tt>, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>"AUDIO"</tt> folder of your <tt>"Keen4mod"</tt> folder. For Keen 4, these range from <tt>'''sound156.IMF'''</tt> to <tt>'''sound161.IMF'''</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open <tt>Abiathar</tt> and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>'''audio.asnds'''</tt> file. <tt>Abiathar</tt> should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the new <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specfically the files: <tt>Audio.ck4</tt>, <tt>Egagraph.ck4</tt>, <tt>Gamemaps.ck4</tt>, and <tt>Keen4e.exe</tt>.<br />
* '''Note:''' Make sure this version of the <tt>keen4e.exe</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>WDC.exe</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it "keen4project" and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <code>no map code file</code> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>AUDIO</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
Go to your <tt>EGA</tt> folder and look for the file <tt>ck4_ansi_endgame.bin</tt>. Copy this to your <tt>keenscr</tt> folder and then rename it to <tt>4msc0000.bin</tt>.<br />
<br />
Load <tt>KEENSCR.EXE</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename keenscr.bin. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>4msc0000.bin</tt> back into your <tt>EGA</tt> folder. Rename <tt>4msc0000.bin</tt> back to <tt>ck4_ansi_endgame.bin</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>CK4LOAD.BIN</tt> into your <tt>Keen4mod</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin <br />
%patchfile $20cd7 ck5load.bin <br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46125Keen Galaxy Modding Tutorial (patch based)2022-08-28T14:32:27Z<p>Ceilick: /* Tile Properties */ wording, formatting</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)|Keen:Galaxy Source Mod]] modding, which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up <tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into <tt>uGrab</tt>.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open ,tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving <tt>uGrab</tt> into your <tt>"Keen4mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), use the tool <tt>The Neural Stunner</tt>, which can be found in your <tt>"Tools"</tt> folder. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open <tt>Abiathar</tt> and go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will help walk you through the creation of your project dependency file. <br />
<br />
1. Select <code>Start from template</code> and the episode from the drop-down list. <br />
<br />
2. Select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>'''GAMEMAPS.CK4'''</tt> and <tt>'''MAPHEAD.CK4'''</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset from your <tt>"EGA"</tt> folder (<tt>'''ck4_tile16.bmp'''</tt>). For the masked, select the foreground tileset (<tt>'''ck4_tile16m.bmp'''</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code>.<br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created <tt>Abiathar project file</tt> (.adepts file). From this point forward, whenever you open <tt>Abiathar</tt>, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In <tt>Abiathar</tt> one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the keygem holder tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by Abiathar when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
<tt>Abiathar</tt> comes with a built in tile properties tool used to modify tile properties. To access it in <tt>Abiathar</tt>, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-down menus determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
One major useful shortcut is the copy and paste feature. Use the <code>C</code> key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the <code>X</code> key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for import and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
Compose your music using your choice of software. As long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Then your MIDI will need to be converted to the IMF format using either MIDI2IMF or IMFCreator. Both tools are suggested since they can produce different sounding end results. Lastly, your IMF song will need optimizing with IMFCrush.<br />
<br />
=== Composition Tips ===<br />
<br />
Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]]. <br />
<br />
If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
If your instrument track is too quiet ''and'' it is set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
Keep percussion parts as simple as possible. It impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure:<br />
<br />
[SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (ie- parts drop out randomly ''and'' inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr.M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
On the subject of percussion: To circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases. (Credit for this tip goes to Bobby Prince)<br />
<br />
Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In IMF Creator it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a midi track to the IMF format, which is used by Keen Galaxy games. To do this simply drag and drop your MIDI file onto <tt>mid2imf.exe</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that MIDI2IMF is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
IMFCreator is an older alternative to MIDI2IMF for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into IMF Creator and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
IMFCrush, similar to MIDI2IMF, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
IMF Player can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>imfplay.exe</tt>. Then drag and drop <tt>imfplay.exe</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with IMFCrush, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. For Keen 4, these range from <tt>sound156.IMF</tt> to <tt>sound161.IMF</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the new <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specfically the files: <tt>Audio.ck4</tt>, <tt>Egagraph.ck4</tt>, <tt>Gamemaps.ck4</tt>, and <tt>Keen4e.exe</tt>.<br />
* '''Note:''' Make sure this version of the <tt>keen4e.exe</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>WDC.exe</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it "keen4project" and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <code>no map code file</code> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>AUDIO</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
Go to your <tt>EGA</tt> folder and look for the file <tt>ck4_ansi_endgame.bin</tt>. Copy this to your <tt>keenscr</tt> folder and then rename it to <tt>4msc0000.bin</tt>.<br />
<br />
Load <tt>KEENSCR.EXE</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename keenscr.bin. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>4msc0000.bin</tt> back into your <tt>EGA</tt> folder. Rename <tt>4msc0000.bin</tt> back to <tt>ck4_ansi_endgame.bin</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>CK4LOAD.BIN</tt> into your <tt>Keen4mod</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin <br />
%patchfile $20cd7 ck5load.bin <br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46124Keen Galaxy Modding Tutorial (patch based)2022-08-28T14:28:23Z<p>Ceilick: /* Level Editing */ formatting, wording</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)|Keen:Galaxy Source Mod]] modding, which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up <tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into <tt>uGrab</tt>.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open ,tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving <tt>uGrab</tt> into your <tt>"Keen4mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), use the tool <tt>The Neural Stunner</tt>, which can be found in your <tt>"Tools"</tt> folder. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
<tt>Abiathar</tt> is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
[[User:Fleexy|Fleexy]], the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open <tt>Abiathar</tt> and go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will help walk you through the creation of your project dependency file. <br />
<br />
1. Select <code>Start from template</code> and the episode from the drop-down list. <br />
<br />
2. Select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>'''GAMEMAPS.CK4'''</tt> and <tt>'''MAPHEAD.CK4'''</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset from your <tt>"EGA"</tt> folder (<tt>'''ck4_tile16.bmp'''</tt>). For the masked, select the foreground tileset (<tt>'''ck4_tile16m.bmp'''</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code>.<br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created <tt>Abiathar project file</tt> (.adepts file). From this point forward, whenever you open <tt>Abiathar</tt>, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In <tt>Abiathar</tt> one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the keygem holder tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by Abiathar when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
Abiathar comes with a built in ''Tile Properties tool'' used to modify tile properties. To access it from Abiathar, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-downs determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
On major useful feature is the copy and paste feature. Use the C key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the X key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for import and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
Compose your music using your choice of software. As long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Then your MIDI will need to be converted to the IMF format using either MIDI2IMF or IMFCreator. Both tools are suggested since they can produce different sounding end results. Lastly, your IMF song will need optimizing with IMFCrush.<br />
<br />
=== Composition Tips ===<br />
<br />
Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]]. <br />
<br />
If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
If your instrument track is too quiet ''and'' it is set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
Keep percussion parts as simple as possible. It impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure:<br />
<br />
[SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (ie- parts drop out randomly ''and'' inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr.M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
On the subject of percussion: To circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases. (Credit for this tip goes to Bobby Prince)<br />
<br />
Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In IMF Creator it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a midi track to the IMF format, which is used by Keen Galaxy games. To do this simply drag and drop your MIDI file onto <tt>mid2imf.exe</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that MIDI2IMF is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
IMFCreator is an older alternative to MIDI2IMF for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into IMF Creator and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
IMFCrush, similar to MIDI2IMF, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
IMF Player can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>imfplay.exe</tt>. Then drag and drop <tt>imfplay.exe</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with IMFCrush, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. For Keen 4, these range from <tt>sound156.IMF</tt> to <tt>sound161.IMF</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the new <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specfically the files: <tt>Audio.ck4</tt>, <tt>Egagraph.ck4</tt>, <tt>Gamemaps.ck4</tt>, and <tt>Keen4e.exe</tt>.<br />
* '''Note:''' Make sure this version of the <tt>keen4e.exe</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>WDC.exe</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it "keen4project" and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <code>no map code file</code> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>AUDIO</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
Go to your <tt>EGA</tt> folder and look for the file <tt>ck4_ansi_endgame.bin</tt>. Copy this to your <tt>keenscr</tt> folder and then rename it to <tt>4msc0000.bin</tt>.<br />
<br />
Load <tt>KEENSCR.EXE</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename keenscr.bin. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>4msc0000.bin</tt> back into your <tt>EGA</tt> folder. Rename <tt>4msc0000.bin</tt> back to <tt>ck4_ansi_endgame.bin</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>CK4LOAD.BIN</tt> into your <tt>Keen4mod</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin <br />
%patchfile $20cd7 ck5load.bin <br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46123Keen Galaxy Modding Tutorial (patch based)2022-08-28T14:15:45Z<p>Ceilick: /* Importing Graphics and Texts */</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)|Keen:Galaxy Source Mod]] modding, which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up <tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into <tt>uGrab</tt>.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open ,tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving <tt>uGrab</tt> into your <tt>"Keen4mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), use the tool <tt>The Neural Stunner</tt>, which can be found in your <tt>"Tools"</tt> folder. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
Abiather is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
Fleexy, the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open Abiathar with the defaults. Go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will walk you through the creation of your dependency file (project). <br />
<br />
1. Select <code>Start from template</code> and your episode from the drop-down list. <br />
<br />
2. In the next window, select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>GAMEMAPS.CK4</tt> and <tt>MAPHEAD.CK4</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset (<tt>ck4_tile16.bmp</tt>). For the masked, select the foreground tileset (<tt>ck4_tile16m.bmp</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code><br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created Abiathar project file. From this point forward, whenever you open Abiathar, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In Abiathar one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map in <tt>Abiathar</tt> with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by [[Abiathar]] when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
Abiathar comes with a built in ''Tile Properties tool'' used to modify tile properties. To access it from Abiathar, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-downs determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
On major useful feature is the copy and paste feature. Use the C key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the X key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for import and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
Compose your music using your choice of software. As long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Then your MIDI will need to be converted to the IMF format using either MIDI2IMF or IMFCreator. Both tools are suggested since they can produce different sounding end results. Lastly, your IMF song will need optimizing with IMFCrush.<br />
<br />
=== Composition Tips ===<br />
<br />
Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]]. <br />
<br />
If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
If your instrument track is too quiet ''and'' it is set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
Keep percussion parts as simple as possible. It impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure:<br />
<br />
[SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (ie- parts drop out randomly ''and'' inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr.M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
On the subject of percussion: To circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases. (Credit for this tip goes to Bobby Prince)<br />
<br />
Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In IMF Creator it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a midi track to the IMF format, which is used by Keen Galaxy games. To do this simply drag and drop your MIDI file onto <tt>mid2imf.exe</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that MIDI2IMF is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
IMFCreator is an older alternative to MIDI2IMF for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into IMF Creator and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
IMFCrush, similar to MIDI2IMF, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
IMF Player can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>imfplay.exe</tt>. Then drag and drop <tt>imfplay.exe</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with IMFCrush, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. For Keen 4, these range from <tt>sound156.IMF</tt> to <tt>sound161.IMF</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the new <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specfically the files: <tt>Audio.ck4</tt>, <tt>Egagraph.ck4</tt>, <tt>Gamemaps.ck4</tt>, and <tt>Keen4e.exe</tt>.<br />
* '''Note:''' Make sure this version of the <tt>keen4e.exe</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>WDC.exe</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it "keen4project" and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <code>no map code file</code> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>AUDIO</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
Go to your <tt>EGA</tt> folder and look for the file <tt>ck4_ansi_endgame.bin</tt>. Copy this to your <tt>keenscr</tt> folder and then rename it to <tt>4msc0000.bin</tt>.<br />
<br />
Load <tt>KEENSCR.EXE</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename keenscr.bin. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>4msc0000.bin</tt> back into your <tt>EGA</tt> folder. Rename <tt>4msc0000.bin</tt> back to <tt>ck4_ansi_endgame.bin</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>CK4LOAD.BIN</tt> into your <tt>Keen4mod</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin <br />
%patchfile $20cd7 ck5load.bin <br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46122Keen Galaxy Modding Tutorial (patch based)2022-08-28T14:14:53Z<p>Ceilick: /* EGA Folder Setup */</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)|Keen:Galaxy Source Mod]] modding, which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up <tt>uGrab</tt> and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into <tt>uGrab</tt>.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open uGrab and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving uGrab into your <tt>"Keen4Mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4Mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), use the tool <tt>The Neural Stunner</tt>, which can be found in your <tt>"Tools"</tt> folder. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
Abiather is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
Fleexy, the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open Abiathar with the defaults. Go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will walk you through the creation of your dependency file (project). <br />
<br />
1. Select <code>Start from template</code> and your episode from the drop-down list. <br />
<br />
2. In the next window, select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>GAMEMAPS.CK4</tt> and <tt>MAPHEAD.CK4</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset (<tt>ck4_tile16.bmp</tt>). For the masked, select the foreground tileset (<tt>ck4_tile16m.bmp</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code><br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created Abiathar project file. From this point forward, whenever you open Abiathar, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In Abiathar one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map in <tt>Abiathar</tt> with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by [[Abiathar]] when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
Abiathar comes with a built in ''Tile Properties tool'' used to modify tile properties. To access it from Abiathar, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-downs determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
On major useful feature is the copy and paste feature. Use the C key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the X key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for import and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
Compose your music using your choice of software. As long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Then your MIDI will need to be converted to the IMF format using either MIDI2IMF or IMFCreator. Both tools are suggested since they can produce different sounding end results. Lastly, your IMF song will need optimizing with IMFCrush.<br />
<br />
=== Composition Tips ===<br />
<br />
Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]]. <br />
<br />
If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
If your instrument track is too quiet ''and'' it is set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
Keep percussion parts as simple as possible. It impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure:<br />
<br />
[SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (ie- parts drop out randomly ''and'' inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr.M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
On the subject of percussion: To circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases. (Credit for this tip goes to Bobby Prince)<br />
<br />
Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In IMF Creator it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a midi track to the IMF format, which is used by Keen Galaxy games. To do this simply drag and drop your MIDI file onto <tt>mid2imf.exe</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that MIDI2IMF is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
IMFCreator is an older alternative to MIDI2IMF for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into IMF Creator and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
IMFCrush, similar to MIDI2IMF, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
IMF Player can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>imfplay.exe</tt>. Then drag and drop <tt>imfplay.exe</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with IMFCrush, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. For Keen 4, these range from <tt>sound156.IMF</tt> to <tt>sound161.IMF</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the new <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specfically the files: <tt>Audio.ck4</tt>, <tt>Egagraph.ck4</tt>, <tt>Gamemaps.ck4</tt>, and <tt>Keen4e.exe</tt>.<br />
* '''Note:''' Make sure this version of the <tt>keen4e.exe</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>WDC.exe</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it "keen4project" and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <code>no map code file</code> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>AUDIO</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
Go to your <tt>EGA</tt> folder and look for the file <tt>ck4_ansi_endgame.bin</tt>. Copy this to your <tt>keenscr</tt> folder and then rename it to <tt>4msc0000.bin</tt>.<br />
<br />
Load <tt>KEENSCR.EXE</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename keenscr.bin. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>4msc0000.bin</tt> back into your <tt>EGA</tt> folder. Rename <tt>4msc0000.bin</tt> back to <tt>ck4_ansi_endgame.bin</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>CK4LOAD.BIN</tt> into your <tt>Keen4mod</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin <br />
%patchfile $20cd7 ck5load.bin <br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46121Keen Galaxy Modding Tutorial (patch based)2022-08-28T14:14:08Z<p>Ceilick: /* Patching Essentials */</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)|Keen:Galaxy Source Mod]] modding, which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up uGrab and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open uGrab and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving uGrab into your <tt>"Keen4Mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4Mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), use the tool <tt>The Neural Stunner</tt>, which can be found in your <tt>"Tools"</tt> folder. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
Abiather is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
Fleexy, the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open Abiathar with the defaults. Go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will walk you through the creation of your dependency file (project). <br />
<br />
1. Select <code>Start from template</code> and your episode from the drop-down list. <br />
<br />
2. In the next window, select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>GAMEMAPS.CK4</tt> and <tt>MAPHEAD.CK4</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset (<tt>ck4_tile16.bmp</tt>). For the masked, select the foreground tileset (<tt>ck4_tile16m.bmp</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code><br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created Abiathar project file. From this point forward, whenever you open Abiathar, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In Abiathar one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map in <tt>Abiathar</tt> with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by [[Abiathar]] when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
Abiathar comes with a built in ''Tile Properties tool'' used to modify tile properties. To access it from Abiathar, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-downs determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
On major useful feature is the copy and paste feature. Use the C key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the X key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for import and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
Compose your music using your choice of software. As long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Then your MIDI will need to be converted to the IMF format using either MIDI2IMF or IMFCreator. Both tools are suggested since they can produce different sounding end results. Lastly, your IMF song will need optimizing with IMFCrush.<br />
<br />
=== Composition Tips ===<br />
<br />
Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]]. <br />
<br />
If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
If your instrument track is too quiet ''and'' it is set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
Keep percussion parts as simple as possible. It impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure:<br />
<br />
[SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (ie- parts drop out randomly ''and'' inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr.M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
On the subject of percussion: To circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases. (Credit for this tip goes to Bobby Prince)<br />
<br />
Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In IMF Creator it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a midi track to the IMF format, which is used by Keen Galaxy games. To do this simply drag and drop your MIDI file onto <tt>mid2imf.exe</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that MIDI2IMF is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
IMFCreator is an older alternative to MIDI2IMF for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into IMF Creator and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
IMFCrush, similar to MIDI2IMF, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
IMF Player can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>imfplay.exe</tt>. Then drag and drop <tt>imfplay.exe</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with IMFCrush, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. For Keen 4, these range from <tt>sound156.IMF</tt> to <tt>sound161.IMF</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the new <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specfically the files: <tt>Audio.ck4</tt>, <tt>Egagraph.ck4</tt>, <tt>Gamemaps.ck4</tt>, and <tt>Keen4e.exe</tt>.<br />
* '''Note:''' Make sure this version of the <tt>keen4e.exe</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>WDC.exe</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it "keen4project" and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <code>no map code file</code> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>AUDIO</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
Go to your <tt>EGA</tt> folder and look for the file <tt>ck4_ansi_endgame.bin</tt>. Copy this to your <tt>keenscr</tt> folder and then rename it to <tt>4msc0000.bin</tt>.<br />
<br />
Load <tt>KEENSCR.EXE</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename keenscr.bin. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>4msc0000.bin</tt> back into your <tt>EGA</tt> folder. Rename <tt>4msc0000.bin</tt> back to <tt>ck4_ansi_endgame.bin</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>CK4LOAD.BIN</tt> into your <tt>Keen4mod</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin <br />
%patchfile $20cd7 ck5load.bin <br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46120Keen Galaxy Modding Tutorial (patch based)2022-08-28T14:12:39Z<p>Ceilick: /* Patching Essentials */</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)|Keen:Galaxy Source Mod]] modding, which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up uGrab and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open uGrab and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving uGrab into your <tt>"Keen4Mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4Mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), use <tt>'''The Neural Stunner'''</tt>, which can be found in your <tt>"Tools"</tt> folder. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
Abiather is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
Fleexy, the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open Abiathar with the defaults. Go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will walk you through the creation of your dependency file (project). <br />
<br />
1. Select <code>Start from template</code> and your episode from the drop-down list. <br />
<br />
2. In the next window, select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>GAMEMAPS.CK4</tt> and <tt>MAPHEAD.CK4</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset (<tt>ck4_tile16.bmp</tt>). For the masked, select the foreground tileset (<tt>ck4_tile16m.bmp</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code><br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created Abiathar project file. From this point forward, whenever you open Abiathar, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In Abiathar one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map in <tt>Abiathar</tt> with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by [[Abiathar]] when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
Abiathar comes with a built in ''Tile Properties tool'' used to modify tile properties. To access it from Abiathar, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-downs determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
On major useful feature is the copy and paste feature. Use the C key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the X key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for import and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
Compose your music using your choice of software. As long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Then your MIDI will need to be converted to the IMF format using either MIDI2IMF or IMFCreator. Both tools are suggested since they can produce different sounding end results. Lastly, your IMF song will need optimizing with IMFCrush.<br />
<br />
=== Composition Tips ===<br />
<br />
Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]]. <br />
<br />
If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
If your instrument track is too quiet ''and'' it is set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
Keep percussion parts as simple as possible. It impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure:<br />
<br />
[SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (ie- parts drop out randomly ''and'' inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr.M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
On the subject of percussion: To circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases. (Credit for this tip goes to Bobby Prince)<br />
<br />
Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In IMF Creator it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a midi track to the IMF format, which is used by Keen Galaxy games. To do this simply drag and drop your MIDI file onto <tt>mid2imf.exe</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that MIDI2IMF is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
IMFCreator is an older alternative to MIDI2IMF for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into IMF Creator and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
IMFCrush, similar to MIDI2IMF, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
IMF Player can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>imfplay.exe</tt>. Then drag and drop <tt>imfplay.exe</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with IMFCrush, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. For Keen 4, these range from <tt>sound156.IMF</tt> to <tt>sound161.IMF</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the new <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specfically the files: <tt>Audio.ck4</tt>, <tt>Egagraph.ck4</tt>, <tt>Gamemaps.ck4</tt>, and <tt>Keen4e.exe</tt>.<br />
* '''Note:''' Make sure this version of the <tt>keen4e.exe</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>WDC.exe</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it "keen4project" and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <code>no map code file</code> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>AUDIO</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
Go to your <tt>EGA</tt> folder and look for the file <tt>ck4_ansi_endgame.bin</tt>. Copy this to your <tt>keenscr</tt> folder and then rename it to <tt>4msc0000.bin</tt>.<br />
<br />
Load <tt>KEENSCR.EXE</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename keenscr.bin. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>4msc0000.bin</tt> back into your <tt>EGA</tt> folder. Rename <tt>4msc0000.bin</tt> back to <tt>ck4_ansi_endgame.bin</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>CK4LOAD.BIN</tt> into your <tt>Keen4mod</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin <br />
%patchfile $20cd7 ck5load.bin <br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46119Keen Galaxy Modding Tutorial (patch based)2022-08-28T14:11:37Z<p>Ceilick: /* Importing Graphics and Texts */</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)|Keen:Galaxy Source Mod]] modding, which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up uGrab and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open uGrab and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving uGrab into your <tt>"Keen4Mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4Mod"</tt> folder and name it something like <tt>'''EGA-Import'''</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>'''EGA-Import.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), run <tt>The Neural Stunner</tt>. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
Abiather is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
Fleexy, the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open Abiathar with the defaults. Go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will walk you through the creation of your dependency file (project). <br />
<br />
1. Select <code>Start from template</code> and your episode from the drop-down list. <br />
<br />
2. In the next window, select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>GAMEMAPS.CK4</tt> and <tt>MAPHEAD.CK4</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset (<tt>ck4_tile16.bmp</tt>). For the masked, select the foreground tileset (<tt>ck4_tile16m.bmp</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code><br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created Abiathar project file. From this point forward, whenever you open Abiathar, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In Abiathar one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map in <tt>Abiathar</tt> with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by [[Abiathar]] when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
Abiathar comes with a built in ''Tile Properties tool'' used to modify tile properties. To access it from Abiathar, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-downs determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
On major useful feature is the copy and paste feature. Use the C key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the X key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for import and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
Compose your music using your choice of software. As long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Then your MIDI will need to be converted to the IMF format using either MIDI2IMF or IMFCreator. Both tools are suggested since they can produce different sounding end results. Lastly, your IMF song will need optimizing with IMFCrush.<br />
<br />
=== Composition Tips ===<br />
<br />
Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]]. <br />
<br />
If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
If your instrument track is too quiet ''and'' it is set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
Keep percussion parts as simple as possible. It impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure:<br />
<br />
[SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (ie- parts drop out randomly ''and'' inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr.M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
On the subject of percussion: To circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases. (Credit for this tip goes to Bobby Prince)<br />
<br />
Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In IMF Creator it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a midi track to the IMF format, which is used by Keen Galaxy games. To do this simply drag and drop your MIDI file onto <tt>mid2imf.exe</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that MIDI2IMF is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
IMFCreator is an older alternative to MIDI2IMF for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into IMF Creator and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
IMFCrush, similar to MIDI2IMF, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
IMF Player can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>imfplay.exe</tt>. Then drag and drop <tt>imfplay.exe</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with IMFCrush, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. For Keen 4, these range from <tt>sound156.IMF</tt> to <tt>sound161.IMF</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the new <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specfically the files: <tt>Audio.ck4</tt>, <tt>Egagraph.ck4</tt>, <tt>Gamemaps.ck4</tt>, and <tt>Keen4e.exe</tt>.<br />
* '''Note:''' Make sure this version of the <tt>keen4e.exe</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>WDC.exe</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it "keen4project" and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <code>no map code file</code> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>AUDIO</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
Go to your <tt>EGA</tt> folder and look for the file <tt>ck4_ansi_endgame.bin</tt>. Copy this to your <tt>keenscr</tt> folder and then rename it to <tt>4msc0000.bin</tt>.<br />
<br />
Load <tt>KEENSCR.EXE</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename keenscr.bin. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>4msc0000.bin</tt> back into your <tt>EGA</tt> folder. Rename <tt>4msc0000.bin</tt> back to <tt>ck4_ansi_endgame.bin</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>CK4LOAD.BIN</tt> into your <tt>Keen4mod</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin <br />
%patchfile $20cd7 ck5load.bin <br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46118Keen Galaxy Modding Tutorial (patch based)2022-08-28T14:10:51Z<p>Ceilick: /* Patching */ formatting, wording</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)|Keen:Galaxy Source Mod]] modding, which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up uGrab and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open uGrab and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving uGrab into your <tt>"Keen4Mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4Mod"</tt> folder and name it something like <tt>"EGA-Import"</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>"EGA-Import.bat"</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
A patch file is used as a library of instructions for the game to use modified content. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are many limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new text file called <tt>'''patchfile'''</tt>. Open the file and insert the following code lines:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Finally save it as <tt>'''patchfile.pat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section. <br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
A batch file is what you'll use from now on to run your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
<br />
ck4patch patchfile.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt>, making sure to select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''patchfile.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
%end<br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>'''%egahead EGAHEAD.CK4'''</tt> and <tt>'''%egadict EGADICT.CK4'''</tt> tell the game to use your new graphics.<br />
<br />
* <tt>'''%end'''</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes it so the [[Bounder]] can't be stunned:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
<br />
#Make Bounders un-stunnable<br />
%patch $11166 $12 $2F <br />
<br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders can't be stunned!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), run <tt>The Neural Stunner</tt>. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>"Patches"</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests there too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
Abiather is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
Fleexy, the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open Abiathar with the defaults. Go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will walk you through the creation of your dependency file (project). <br />
<br />
1. Select <code>Start from template</code> and your episode from the drop-down list. <br />
<br />
2. In the next window, select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>GAMEMAPS.CK4</tt> and <tt>MAPHEAD.CK4</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset (<tt>ck4_tile16.bmp</tt>). For the masked, select the foreground tileset (<tt>ck4_tile16m.bmp</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code><br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created Abiathar project file. From this point forward, whenever you open Abiathar, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In Abiathar one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map in <tt>Abiathar</tt> with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by [[Abiathar]] when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
Abiathar comes with a built in ''Tile Properties tool'' used to modify tile properties. To access it from Abiathar, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-downs determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
On major useful feature is the copy and paste feature. Use the C key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the X key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for import and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
Compose your music using your choice of software. As long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Then your MIDI will need to be converted to the IMF format using either MIDI2IMF or IMFCreator. Both tools are suggested since they can produce different sounding end results. Lastly, your IMF song will need optimizing with IMFCrush.<br />
<br />
=== Composition Tips ===<br />
<br />
Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]]. <br />
<br />
If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
If your instrument track is too quiet ''and'' it is set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
Keep percussion parts as simple as possible. It impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure:<br />
<br />
[SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (ie- parts drop out randomly ''and'' inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr.M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
On the subject of percussion: To circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases. (Credit for this tip goes to Bobby Prince)<br />
<br />
Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In IMF Creator it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a midi track to the IMF format, which is used by Keen Galaxy games. To do this simply drag and drop your MIDI file onto <tt>mid2imf.exe</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that MIDI2IMF is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
IMFCreator is an older alternative to MIDI2IMF for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into IMF Creator and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
IMFCrush, similar to MIDI2IMF, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
IMF Player can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>imfplay.exe</tt>. Then drag and drop <tt>imfplay.exe</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with IMFCrush, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. For Keen 4, these range from <tt>sound156.IMF</tt> to <tt>sound161.IMF</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the new <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specfically the files: <tt>Audio.ck4</tt>, <tt>Egagraph.ck4</tt>, <tt>Gamemaps.ck4</tt>, and <tt>Keen4e.exe</tt>.<br />
* '''Note:''' Make sure this version of the <tt>keen4e.exe</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>WDC.exe</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it "keen4project" and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <code>no map code file</code> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>AUDIO</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
Go to your <tt>EGA</tt> folder and look for the file <tt>ck4_ansi_endgame.bin</tt>. Copy this to your <tt>keenscr</tt> folder and then rename it to <tt>4msc0000.bin</tt>.<br />
<br />
Load <tt>KEENSCR.EXE</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename keenscr.bin. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>4msc0000.bin</tt> back into your <tt>EGA</tt> folder. Rename <tt>4msc0000.bin</tt> back to <tt>ck4_ansi_endgame.bin</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>CK4LOAD.BIN</tt> into your <tt>Keen4mod</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin <br />
%patchfile $20cd7 ck5load.bin <br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46117Keen Galaxy Modding Tutorial (patch based)2022-08-28T14:00:50Z<p>Ceilick: /* Importing Graphics and Texts */ formatting</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)|Keen:Galaxy Source Mod]] modding, which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up uGrab and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open uGrab and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>'''keen4_ega_apogee_14.def'''</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>'''EGAGRAPH.CK4'''</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving uGrab into your <tt>"Keen4Mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4Mod"</tt> folder and name it something like <tt>"EGA-Import"</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>"EGA-Import.bat"</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
Your patch file is used to access all the edited content in your mod in-game. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new <tt>.txt</tt> file called <tt>'''mymod'''</tt>. Open the file and insert the following code lines:<br />
<br />
<tt>%ext ck4<br />
%version 1.4<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
%end</tt><br />
<br />
Finally save it as <tt>'''mymod.pat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section. You should now have a <tt>'''mymod.pat'''</tt> file.<br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
Your batch file is what you'll use from now on to play your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
ck4patch mymod.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''mymod.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
<tt>%ext ck4<br />
%version 1.4<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
%end</tt><br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>%egahead EGAHEAD.CK4</tt> and <tt>%egadict EGADICT.CK4</tt> is what tells the game to use your new graphics.<br />
<br />
* <tt>%end</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes [[Bounder|Bounders]] unkillable:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
#Make bounders unkillable<br />
%patch $11166 $12 $2F <br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders should now be unkillable!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), run [[The Neural Stunner]]. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>Patches</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests here too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
Abiather is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
Fleexy, the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open Abiathar with the defaults. Go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will walk you through the creation of your dependency file (project). <br />
<br />
1. Select <code>Start from template</code> and your episode from the drop-down list. <br />
<br />
2. In the next window, select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>GAMEMAPS.CK4</tt> and <tt>MAPHEAD.CK4</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset (<tt>ck4_tile16.bmp</tt>). For the masked, select the foreground tileset (<tt>ck4_tile16m.bmp</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code><br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created Abiathar project file. From this point forward, whenever you open Abiathar, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In Abiathar one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map in <tt>Abiathar</tt> with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by [[Abiathar]] when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
Abiathar comes with a built in ''Tile Properties tool'' used to modify tile properties. To access it from Abiathar, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-downs determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
On major useful feature is the copy and paste feature. Use the C key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the X key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for import and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
Compose your music using your choice of software. As long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Then your MIDI will need to be converted to the IMF format using either MIDI2IMF or IMFCreator. Both tools are suggested since they can produce different sounding end results. Lastly, your IMF song will need optimizing with IMFCrush.<br />
<br />
=== Composition Tips ===<br />
<br />
Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]]. <br />
<br />
If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
If your instrument track is too quiet ''and'' it is set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
Keep percussion parts as simple as possible. It impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure:<br />
<br />
[SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (ie- parts drop out randomly ''and'' inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr.M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
On the subject of percussion: To circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases. (Credit for this tip goes to Bobby Prince)<br />
<br />
Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In IMF Creator it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a midi track to the IMF format, which is used by Keen Galaxy games. To do this simply drag and drop your MIDI file onto <tt>mid2imf.exe</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that MIDI2IMF is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
IMFCreator is an older alternative to MIDI2IMF for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into IMF Creator and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
IMFCrush, similar to MIDI2IMF, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
IMF Player can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>imfplay.exe</tt>. Then drag and drop <tt>imfplay.exe</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with IMFCrush, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. For Keen 4, these range from <tt>sound156.IMF</tt> to <tt>sound161.IMF</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the new <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specfically the files: <tt>Audio.ck4</tt>, <tt>Egagraph.ck4</tt>, <tt>Gamemaps.ck4</tt>, and <tt>Keen4e.exe</tt>.<br />
* '''Note:''' Make sure this version of the <tt>keen4e.exe</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>WDC.exe</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it "keen4project" and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <code>no map code file</code> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>AUDIO</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
Go to your <tt>EGA</tt> folder and look for the file <tt>ck4_ansi_endgame.bin</tt>. Copy this to your <tt>keenscr</tt> folder and then rename it to <tt>4msc0000.bin</tt>.<br />
<br />
Load <tt>KEENSCR.EXE</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename keenscr.bin. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>4msc0000.bin</tt> back into your <tt>EGA</tt> folder. Rename <tt>4msc0000.bin</tt> back to <tt>ck4_ansi_endgame.bin</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>CK4LOAD.BIN</tt> into your <tt>Keen4mod</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin <br />
%patchfile $20cd7 ck5load.bin <br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46116Keen Galaxy Modding Tutorial (patch based)2022-08-28T13:59:00Z<p>Ceilick: /* Editing Graphics and Text */ formatting</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)|Keen:Galaxy Source Mod]] modding, which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up uGrab and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>"EGA"</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>'''4bmp0102.bmp'''</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>'''ck4_sprites.txt'''</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>'''ck4_sprites.txt'''</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>'''4spr0006.bmp'''</tt>. So in <tt>'''4sprites.txt'''</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>"EGA"</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open uGrab and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>"keen4_ega_apogee_14.def"</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>"EGAGRAPH.CK4"</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving uGrab into your <tt>"Keen4Mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4Mod"</tt> folder and name it something like <tt>"EGA-Import"</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>"EGA-Import.bat"</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
Your patch file is used to access all the edited content in your mod in-game. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new <tt>.txt</tt> file called <tt>'''mymod'''</tt>. Open the file and insert the following code lines:<br />
<br />
<tt>%ext ck4<br />
%version 1.4<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
%end</tt><br />
<br />
Finally save it as <tt>'''mymod.pat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section. You should now have a <tt>'''mymod.pat'''</tt> file.<br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
Your batch file is what you'll use from now on to play your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
ck4patch mymod.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''mymod.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
<tt>%ext ck4<br />
%version 1.4<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
%end</tt><br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>%egahead EGAHEAD.CK4</tt> and <tt>%egadict EGADICT.CK4</tt> is what tells the game to use your new graphics.<br />
<br />
* <tt>%end</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes [[Bounder|Bounders]] unkillable:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
#Make bounders unkillable<br />
%patch $11166 $12 $2F <br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders should now be unkillable!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), run [[The Neural Stunner]]. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>Patches</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests here too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
Abiather is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
Fleexy, the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open Abiathar with the defaults. Go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will walk you through the creation of your dependency file (project). <br />
<br />
1. Select <code>Start from template</code> and your episode from the drop-down list. <br />
<br />
2. In the next window, select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>GAMEMAPS.CK4</tt> and <tt>MAPHEAD.CK4</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset (<tt>ck4_tile16.bmp</tt>). For the masked, select the foreground tileset (<tt>ck4_tile16m.bmp</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code><br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created Abiathar project file. From this point forward, whenever you open Abiathar, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In Abiathar one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map in <tt>Abiathar</tt> with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by [[Abiathar]] when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
Abiathar comes with a built in ''Tile Properties tool'' used to modify tile properties. To access it from Abiathar, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-downs determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
On major useful feature is the copy and paste feature. Use the C key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the X key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for import and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
Compose your music using your choice of software. As long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Then your MIDI will need to be converted to the IMF format using either MIDI2IMF or IMFCreator. Both tools are suggested since they can produce different sounding end results. Lastly, your IMF song will need optimizing with IMFCrush.<br />
<br />
=== Composition Tips ===<br />
<br />
Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]]. <br />
<br />
If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
If your instrument track is too quiet ''and'' it is set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
Keep percussion parts as simple as possible. It impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure:<br />
<br />
[SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (ie- parts drop out randomly ''and'' inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr.M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
On the subject of percussion: To circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases. (Credit for this tip goes to Bobby Prince)<br />
<br />
Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In IMF Creator it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a midi track to the IMF format, which is used by Keen Galaxy games. To do this simply drag and drop your MIDI file onto <tt>mid2imf.exe</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that MIDI2IMF is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
IMFCreator is an older alternative to MIDI2IMF for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into IMF Creator and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
IMFCrush, similar to MIDI2IMF, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
IMF Player can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>imfplay.exe</tt>. Then drag and drop <tt>imfplay.exe</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with IMFCrush, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. For Keen 4, these range from <tt>sound156.IMF</tt> to <tt>sound161.IMF</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the new <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specfically the files: <tt>Audio.ck4</tt>, <tt>Egagraph.ck4</tt>, <tt>Gamemaps.ck4</tt>, and <tt>Keen4e.exe</tt>.<br />
* '''Note:''' Make sure this version of the <tt>keen4e.exe</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>WDC.exe</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it "keen4project" and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <code>no map code file</code> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>AUDIO</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
Go to your <tt>EGA</tt> folder and look for the file <tt>ck4_ansi_endgame.bin</tt>. Copy this to your <tt>keenscr</tt> folder and then rename it to <tt>4msc0000.bin</tt>.<br />
<br />
Load <tt>KEENSCR.EXE</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename keenscr.bin. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>4msc0000.bin</tt> back into your <tt>EGA</tt> folder. Rename <tt>4msc0000.bin</tt> back to <tt>ck4_ansi_endgame.bin</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>CK4LOAD.BIN</tt> into your <tt>Keen4mod</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin <br />
%patchfile $20cd7 ck5load.bin <br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilickhttps://keenwiki.shikadi.net/w/index.php?title=Keen_Galaxy_Modding_Tutorial_(patch_based)&diff=46115Keen Galaxy Modding Tutorial (patch based)2022-08-28T13:57:05Z<p>Ceilick: /* EGA Folder Setup */ formatting</p>
<hr />
<div>This tutorial aims to teach patch based [[Goodbye, Galaxy!|Keen Galaxy]] modding (Keen episodes [[Keen 4|4]], [[Keen 5|5]], and [[Keen 6|6]]) to people who don't know the first thing about modding, however even the experienced modder should find this information to be a good reference tool. Keen 4 will be used for specific examples, but it should be easy to follow along with episode 5 or 6 as well.<br />
<br />
This tutorial is written as a primer for [[Keen Galaxy Modding Tutorial (source code based)|Keen:Galaxy Source Mod]] modding, which is a more advanced form of modding that uses source code instead of patching. Many of the processes, tools, and concepts from this tutorial will carry over. <br />
<br />
* '''Note''': This tutorial was written with <tt>Windows</tt> users in mind. <tt>Linux</tt> and <tt>MacOS</tt> users might need to install [[wikipedia:Wine_(software)|WINE]] in order to run a couple of <tt>Microsoft Windows</tt> based tools and script/batch files.<br />
<br />
= Setting Up Files and Folders =<br />
<br />
Download the [https://files.shikadi.net/keenwiki/tutorials/t.keen_galaxy_modding_package.patch_based_v.3.1.nisaba.2022-08-28.zip Keen Galaxy Modding Package] and unzip the tools in the <tt>"Tools"</tt> folder.<br />
<br />
* '''Note''': This package is set up to provide a folder structure ideal for learning modding and also includes a folder of modding tools, a folder for patches, and a folder providing a wealth of modding knowledge collected from members of the Keen community.<br />
<br />
Alternative to using the modding package, you can create your own:<br />
<br />
Create a base folder called <tt>"KeenModding"</tt> on your desktop. In this folder create two subfolders: <tt>"Keen4mod"</tt> and <tt>"Tools"</tt>. In your <tt>"Keen4mod"</tt> folder, create a folder called <tt>"EGA"</tt> and a folder called <tt>"AUDIO"</tt>.<br />
<br />
Copy all Keen 4 game files into the folder <tt>"Keen4mod"</tt>. <br />
<br />
* '''Note''': It is important that you use the right version of the episode you wish to mod: [[Keen_4_Versions#Version_1.4|Keen 4 v1.4]], [[Keen_5_Versions#Version_1.4|Keen 5 v1.4]], and [[Keen_6_Versions#Version_1.4|Keen 6 v1.4]].<br />
<br />
== Tools == <br />
<br />
The following table lists the tools needed to follow this tutorial. All tools, except graphical editing software, are included in the modding package mentioned above. If you are creating your own package you can download them individually and place them in the <tt>"Tools"</tt> folder.<br />
<br />
{| class="wikitable"<br />
! style="text-align:left;"| Tool Name<br />
! style="text-align:left;"| Usage Description<br />
! style="text-align:left;"| Additional Note<br />
|-<br />
|[[Abiathar]] <br />
|Level & Tile Property Editor, Sound & Music Import/Export <br />
|<br />
|-<br />
|[[CKPatch]] <br />
|Patching the game executable<br />
|<br />
|-<br />
|[http://www.dosbox.com DOSBox]<br />
|Emulator for MS-DOS Environments <br />
|<br />
|-<br />
|[[KeenScr]]<br />
|Intro/Outro DOS screen Graphic Text Editor <br />
|<br />
|-<br />
|[[IMF Creator]]<br />
|Converting MIDI music files to IMF <br />
|''This is an older tool than MIDI2IMF, but contains some features that may be desired. Be aware several antivirus programs have flagged this program as malicious.<br />
|-<br />
|[[IMFCrush]]<br />
|Optimizing IMF music files <br />
|<br />
|-<br />
|[[IMF Player]]<br />
|Playing IMF music files <br />
|''While not directly useful for modding, it can be used to see how an IMF song sounds<br />
|-<br />
|[[MIDI2IMF]]<br />
|Converting MIDI music files to IMF<br />
|<br />
|-<br />
|[http://sagorpirbd.deviantart.com/art/Win-7-MS-Paint-dll-XP-English-122788536 MS Paint] or [[wikipedia:GIMP|GIMP]] or [[wikipedia:PhotoShop|PhotoShop]] or [[wikipedia:Krita|Krita]]<br />
|Drawing Tools<br />
|''One of the simplest tools for modifying Keen graphics is <tt>MS Paint</tt>. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly. Tutorials for setting up older versions of MS Paint on later versions of Windows can be found online.''<br />
|-<br />
|[[The Neural Stunner]]<br />
|Used for easy patching <br />
|<br />
|-<br />
|[[uGrab]]<br />
|Graphics Import/Export <br />
|<br />
|-<br />
|[[UNLZEXE]]<br />
|Unpacks the game executable <br />
|''Get the 32/64 bit version.<br />
|-<br />
|[[Wolf Data Compiler (WDC)|WDC]]<br />
|Sound Effect Editor <br />
|''This tool was designed as a modding suite, however only the sound editor will be used.<br />
|<br />
|}<br />
<br />
* '''Note''': There are several older modding tools that are no longer supported by this tutorial and are not included in the modding package. They can be found on the [[Galaxy_Tools|Galaxy Tools page]].<br />
<br />
= CKPatch & Unlzexe Setup =<br />
<br />
Copy the following files into your <tt>"Keen4mod"</tt> folder from your <tt>"Tools"</tt> folder:<br />
* <tt>'''unlzexe.exe'''</tt><br />
* <tt>'''ck4patch.exe'''</tt> (Keen 5 requires '<tt>'''ck5patch.exe'''</tt>', Keen 6 '<tt>'''ck6patch.exe'''</tt>')<br />
<br />
Once these files are in place, unlzexe your <tt>'''Keen4.exe'''</tt> by dragging and dropping the file onto <tt>'''unlzexe.exe'''</tt>. A window may flash on the screen when you do so.<br />
<br />
* '''Note''': If you are using the 32/64 bit version of unlzexe, this will create a <tt>'''Keen4.exenew'''</tt>. You will then need to delete or rename the old <tt>'''Keen4.exe'''</tt>, and then rename <tt>'''Keen4.exenew'''</tt> to <tt>'''Keen4.exe'''</tt>.<br />
* '''Note''': If you are using the 16 bit version of UNLZEXE, open a command line in that folder and enter <code>UNLZEXE KEEN4E.EXE</code> to unpack it.<br />
<br />
This is a one time process; once your executable has been unlzexed, you can delete <tt>'''unlzexe.exe'''</tt>.<br />
<br />
= EGA Folder Setup =<br />
<br />
[[Image:UGrab.png |320px|thumb|<tt>uGrab</tt> in action]]<br />
From your <tt>"uGrab"</tt> folder in <tt>"Tools"</tt>, look in the <tt>"def"</tt> folder and copy/paste <tt>'''keen4_ega_apogee_14.def'''</tt> into your <tt>"Keen4mod"</tt> folder. Then open up uGrab and select <code>Import</code>, and then <code>Import from EGAGRAPH</code>. Select <tt>'''keen4_ega_apogee_14.def'''</tt> from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export to bitmap folder</code>. Set the extension as <code>CK4</code> and then select your <tt>"EGA"</tt> folder in the <tt>"Keen4mod"</tt> folder. When prompted with the question "Do you want to save a ModId definition file for the exported data?" select <code>cancel</code>.<br />
<br />
You can now find all graphic and text files in the <tt>"EGA"</tt> folder of your mod directory.<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
Copy modkeen.exe from your tools folder into your "Keen4mod" folder.<br />
<br />
Next, open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click <tt>'run'</tt>, or in the search field type <code>run</code> and click the first result. In the run box, type <code>cmd</code>. Now you have a command prompt open.<br />
<br />
[[Image:Modkeen-export.png|320px|thumb|Modkeen exporting graphics and texts]]<br />
You'll see something like<br />
<br /><code>C:\Users\UserName></code><br />
<br />
Type:<br />
<br /><code>cd desktop\KeenModding\Keen4mod</code><br />
<br />
Press enter, then:<br />
<br /><code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
If all goes well, you should see a list of everything modkeen has exported followed by the word <code>Done!</code><br />
<br />
* '''Note''': If you are working under Windows 64-bit, modkeen may not run through the command prompt. You can run it instead by dropping <tt>modkeen.exe</tt> onto <tt>DOSBox.exe</tt> and then typing:<br /> <code>modkeen -episode=4 -export -bmpdir="EGA"</code><br />
<br />
* '''Note''': If you don't want to type all commands all over again you can create a script file to speed up the process. Simply open up a simple text editor, paste in the commands: <code>modkeen -episode=4 -export -bmpdir="EGA"</code> and save it as "<tt>modexp</tt>" with the <tt>.bat</tt> extension. Afterwards just double click the new created batch file or type <code>modexp.bat</code> in your DOSBox promt in order to run that script.<br />
--><br />
<br />
= Editing Graphics and Text =<br />
To begin editing the graphics and most text found in the game, go to your <tt>'''EGA'''</tt> folder. You'll see a lot of images there as well as some text files and some other files.<br />
<br />
== Graphics ==<br />
[[Image:Ega-Color-Palette.png |320px|thumb|EGA Color Palette]]<br />
[[Image:UGrab-example-CKS_tile16m.png |320px|thumb|extracted 4til0001 bitmap]]<br />
<br />
You can edit any of these images however you want, but keep some things in mind:<br />
<br />
* You need to use the [[moddingwiki:EGA_Palette|original Keen color palette]]. This is easy to do if you just edit the images with <tt>MSpaint</tt>. <br />
** '''Note''': Windows 7/10 users will need to download the old version of <tt>mspaint</tt>.<br />
<br />
* You'll notice a light green color that is not part of the 16-color palette in some images. This color is used for transparency; it fills in the space that is not displayed in-game.<br />
<br />
* The image that displays in the scrolling story (for Keen 4 this is <tt>4bmp0102.bmp</tt>) is limited in palette colors. The colors available can be changed with patching.<br />
<br />
* On sprites, you'll notice a red box on a grey background on the right side of the image. This is used for hitbox measurement, although it doesn't directly affect hitbox size (the <tt>ck4_sprites.txt</tt> determines this, see the [[Keen Galaxy Modding Tutorial (by Ceilick)#Hitboxes|hitboxes section]] below).<br />
<br />
* The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).<br />
<br />
* Changing the size of an enemy will affect how it spawns (it could get stuck in the ground) and the 'hitbox' area it uses to interact with the environment and with Keen.<br />
<br />
* Tiles are made up of a 16 by 16 area of pixels.<br />
<br />
* You cannot change the size of the tilesets.<br />
<br />
* '''Note''': Although uGrab supports adding additional graphics, this feature is only usable when modding the source code, which is not done here.<br />
<br />
=== Hitboxes ===<br />
In Keen Galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment and with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.<br />
<br />
[[Image:Keengraph 5SPR0108.png|320px|thumb|uGrab extracted Keen sprite example]]<br />
To edit the hitboxes, open <tt>ck4_sprites.txt</tt>. <br />
[[Image:4SPRITES.png |320px|thumb|CK4_SPRITES.TXT file with Keen sprite highlighted]]<br />
<br />
We'll use Keen's left facing standing frame as an example. The image name for this is <tt>4spr0006.bmp</tt>. So in <tt>4sprites.txt</tt>, look for item 6. It will look like this: <br />
<br />
<code>6: [4, 0, 19, 31], [0, 0], 4.</code> <br />
<br />
The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the hitbox. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.<br />
<br />
The second set of brackets are coordinates that have to do with where a sprite image appears in-game relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed (negative values spawn that many pixels left, positive values that many pixels right). The second value is a Y coordinate which determines how far up or down the sprite is placed (negative values spawn further up, positive values spawn further down). <br />
* '''Note''': If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.<br />
<br />
The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value can be either 1, 2, or 4. This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.<br />
* '''Note''': Use the 4 value sparingly to avoid memory issues and game crashes.<br />
<br />
== Texts ==<br />
[[Image:4TXT0002-txt.png|270px|thumb|Keen 4 help section Text, INPUT]]<br />
[[Image:Helptext.png|320px|thumb|Keen 4 help section Text, OUTPUT]]<br />
The <tt>EGA</tt> folder contains a number of text files. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story. <br />
<br />
These files employ a formatting code:<br />
<br />
* <code>^P</code> Marks the beginning of a page.<br />
<br />
* <code>^Gy,x,n</code> Displays a bitmap image where <tt>n</tt> is the image number and <tt>x,y</tt> form the pixel coordinates of where the image will be placed. The image number is offset by 6 in relation to the image names in your <tt>"EGA"</tt> folder; to get the correct number, take the image number from the image's filename and subtract 6. So, for example, if you want to display image 22 at coordinates 10,10, it would look like <code>^G10,10,16</code>. <br />
<br />
* <code>^Ly,x</code> Text following this code will be aligned from pixel location <tt>x,y</tt>.<br />
<br />
* <code>^Cc</code> Changes the text to color <tt>c</tt>, which is a single hex digit, <tt>0-9</tt> or <tt>A-F</tt>. The specific codes for changing the color of text are:<br />
** <code>^CA</code> <code style="background:#AA0000; color:#55FF55"><b>lime text color </b></code><br />
** <code>^C2</code> <code style="background:#AA0000; color:#00AA00"><b>green text color </b></code><br />
** <code>^CB</code> <code style="background:#AA0000; color:#55FFFF"><b>cyan text color </b></code><br />
** <code>^C3</code> <code style="background:#AA0000; color:#00AAAA"><b>dark turquoise text color</b></code><br />
** <code>^CC</code> <code style="background:#AA0000; color:#FF5555"><b>red text color </b></code><br />
** <code>^C4</code> <code style="background:#AA0000; color:#AA0000"><b>red text color </b></code><br />
** <code>^CD</code> <code style="background:#AA0000; color:#FF55FF"><b>magenta text color </b></code><br />
** <code>^C5</code> <code style="background:#AA0000; color:#AA00AA"><b>violet red text color </b></code><br />
** <code>^CE</code> <code style="background:#AA0000; color:#FFFF55"><b>yellow text color </b></code><br />
** <code>^C6</code> <code style="background:#AA0000; color:#AA5500"><b>brown text color </b></code><br />
** <code>^C9</code> <code style="background:#AA0000; color:#5555ff"><b>light blue text color </b></code><br />
** <code>^C1</code> <code style="background:#AA0000; color:#0000aa"><b>blue text color </b></code><br />
** <code>^CF</code> <code style="background:#AA0000; color:#FFFFFF"><b>white text color </b></code><br />
** <code>^C7</code> <code style="background:#AA0000; color:#AAAAAA"><b>light grey text color </b></code><br />
** <code>^C8</code> <code style="background:#AA0000; color:#555555"><b>grey text color </b></code><br />
** <code>^C0</code> <code style="background:#AA0000; color:#000000"><b>black text color </b></code><br /><br /><br />
<br />
* <code>^Ty,x,n,t</code> After a delay of <tt>t</tt> time units (<tt>t/100</tt> seconds?), this timestamp displays a bitmap <tt>(n - 6)</tt> at pixel location <tt>x,y</tt> on the screen.<br />
<br />
* <code>^By,x,w,h,c</code> Fills a width-by-height pixel rectangle at pixel location <tt>x,y</tt> with color <tt>4</tt> (dark red). The <tt>c</tt> parameter is ignored in version 1.4.<br />
<br />
* <code>^E</code> Marks the end of the text file.<br />
<br />
= Importing Graphics and Texts =<br />
<br />
To import graphics into the game, open uGrab and select <code>Import</code>, and then <code>Import from bitmap folder</code>. Then select Select <tt>"keen4_ega_apogee_14.def"</tt> and then the <tt>"EGA"</tt> folder from your <tt>"Keen4mod"</tt> folder. This will load all of the game's graphics and text files into uGrab.<br />
<br />
Then select <code>Export</code> and then <code>Export as EGAGRAPH</code>. Choose to save over your <tt>"EGAGRAPH.CK4"</tt> in your <tt>"Keen4mod"</tt> folder. When prompted to choose a Huffman Compression type, choose <code>Best (Slowest)</code>. You do not need to save a definition file when asked.<br />
<br />
Your graphics and text files have now been imported into the game files, however, in order for them to appear in-game, patching must be done according to the steps in the next section.<br />
<br />
You can also simplify the import process considerably by moving uGrab into your <tt>"Keen4Mod"</tt> folder and creating a batch file. To create a batch file, first create a new text document in your <tt>"Keen4Mod"</tt> folder and name it something like <tt>"EGA-Import"</tt>. In the text file, type: <br />
<br />
uGrab.exe -import -gamedef=keen4_ega_apogee_14.def -bmpdir="EGA" -gamedir="."<br />
<br />
Now, go to <code>File</code> and save as <tt>"EGA-Import.bat"</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Now whenever you want to import from your <tt>"EGA"</tt> folder, simply run (not in DOSBbox) <tt>'''EGA-Import.bat'''</tt>.<br />
<br />
<br />
<!--<br />
== Using Modkeen ==<br />
<br />
[[Image:Modkeen-import.png|320px|thumb|Modkeen importing graphics and texts]]<br />
To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:<br />
<br />
<code>modkeen -episode=4 -import -bmpdir="EGA"</code><br />
<br />
* '''Note''': You may need to drag and drop <tt>modkeen</tt> onto <tt>DOSBox</tt> and then type this command.<br />
<br />
If you get the <tt>Done!</tt> message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.<br />
--><br />
<br />
= Patching = <br />
<br />
Your patch file is used to access all the edited content in your mod in-game. It's what allows you to utilize new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are limitations).<br />
<br />
== Patching Setup ==<br />
<br />
To create a patch file, create a new <tt>.txt</tt> file called <tt>'''mymod'''</tt>. Open the file and insert the following code lines:<br />
<br />
<tt>%ext ck4<br />
%version 1.4<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
%end</tt><br />
<br />
Finally save it as <tt>'''mymod.pat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section. You should now have a <tt>'''mymod.pat'''</tt> file.<br />
<br />
[[Image:Play-bat.png|280px|thumb|Play.bat batch file]]<br />
Your batch file is what you'll use from now on to play your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use <tt>'''Play'''</tt>. In the text file, type: <br />
ck4patch mymod.pat<br />
<br />
Now, go to <code>file</code> and save as <tt>'''Play.bat'''</tt> and make sure you select <code>all files</code> in the <code>Save as type</code> section.<br />
<br />
Run <tt>'''Play.bat'''</tt> in DOSBox to make sure your mod is working. If you see your modified graphics and/or texts, it works!<br />
<br />
== Patching Basics ==<br />
[[Image:Mymod-pat.png|280px|thumb|mymod.pat patch file]]<br />
After you've made sure <tt>'''Play.bat'''</tt> runs fine, open up <tt>'''mymod.pat'''</tt> with a text editor.<br />
<br />
You should see:<br />
<br />
<tt>%ext ck4<br />
%version 1.4<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
%end</tt><br />
<br />
Here's what each line means: <br />
<br />
* The first two lines mark the beginning of your patch file.<br />
<br />
* The '''#''' symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.<br />
<br />
* <tt>%egahead EGAHEAD.CK4</tt> and <tt>%egadict EGADICT.CK4</tt> is what tells the game to use your new graphics.<br />
<br />
* <tt>%end</tt> will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.<br />
<br />
Here's an example patch that makes [[Bounder|Bounders]] unkillable:<br />
<br />
<code>%patch $11166 $12 $2F</code><br />
<br />
Now add it to the patch file and also add a comment explaining what it does.<br />
<br />
%ext ck4<br />
%version 1.4<br />
# Load the modified graphics<br />
%egahead EGAHEAD.CK4<br />
%egadict EGADICT.CK4<br />
#Make bounders unkillable<br />
%patch $11166 $12 $2F <br />
%end<br />
<br />
Now save your patch file and run <tt>'''Play.bat'''</tt> . Bounders should now be unkillable!<br />
<br />
For a deeper understanding of how patches work please check out [[Patching Tutorial (by Levellass)|Levellass' Keen Patching Tutorial]], which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.<br />
<br />
== Patching Essentials ==<br />
<br />
[[File:The Neural Stunner.png|320px|thumb|generating patches with The Neural Stunner]]<br />
To generate some of the most common patches for your mod (for things such as level names, the scrolling story, and more), run [[The Neural Stunner]]. It will generate patches based on your input which you can copy to your patch file. <br />
<br />
[[User:K1n9_Duk3|K1n9_Duk3]] has written a [https://pckf.com/viewtopic.php?p=99250&hilit=patch+king#p99250| patch script] that fixes some graphical glitches in Keen Galaxy that are caused by playing in DOSBox. It is highly recommended to include this patch in your patch file. You can also find this script in the <tt>Patches</tt> folder of the Keen Galaxy Modding Package.<br />
<br />
You can find all kinds of patches on the [[:Category:Patches|Patches Wiki page]] or on the [https://www.keenmodding.org/ Keen Modding Forum] (you can make specific requests here too!). Lastly, don't be afraid to dig through the patch files of existing mods, many have unique patches you might be unable to find elsewhere.<br />
<br />
<!--<br />
= Scrolling Text =<br />
[[Image:Keen4Story.png|thumb|320px|Keen 4 Star Wars like scrolling text story.]]<br />
Run <tt>Startext</tt>. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.<br />
<br />
Copy <tt>story.ck4</tt> into your <tt>"Keen4mod"</tt> folder.<br />
<br />
Edit your patch file to include one of the following:<br />
<br />
%patchfile $1EE40 "STORY.CK4"<br />
%patchfile $1FDE0 "STORY.CK5"<br />
%patchfile $1ED50 "STORY.CK6"<br />
--><br />
<br />
= Level Editing =<br />
<br />
Abiather is the most up to date and feature rich level editor for Keen Galaxy. It comes with a [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file] which is strongly recommended. It contains advanced information this tutorial cannot match. <br />
Fleexy, the author, has uploaded a [https://www.youtube.com/playlist?list=PL-BuW7CehquocWygorgyo5YjJwiK5-kyn video tutorial] where most of the basic features are examined.<br />
<br />
== Setting up Abiathar ==<br />
[[Image:Abiathar-Wizard.png|thumb|250px|'''Abiathar''' Project Wizard.]]<br />
To get started open Abiathar with the defaults. Go to <code>File</code>, <code>New</code>, and a Project Wizard will appear. This wizard will walk you through the creation of your dependency file (project). <br />
<br />
1. Select <code>Start from template</code> and your episode from the drop-down list. <br />
<br />
2. In the next window, select your <tt>Keen4mod</tt> folder as the containing folder. <br />
<br />
3. In the next window, I recommend selecting <code>Load level files from the original game</code> (viewing and editing existing levels is one of the easiest ways to learn how levels are designed). <br />
<br />
4. In the next window for level files, leave these as the defaults (<tt>GAMEMAPS.CK4</tt> and <tt>MAPHEAD.CK4</tt>).<br />
<br />
5. Next, for the graphics source, select <code>Tile sheet bitmaps</code>. This will bring up a graphics files window: for unmasked, browse and select your background tileset (<tt>ck4_tile16.bmp</tt>). For the masked, select the foreground tileset (<tt>ck4_tile16m.bmp</tt>).<br />
<br />
6. Next, for the tileinfo source, select <code>Create or load a separate tileinfo file</code>. The next window will give you some options for the tileinfo file: leave these on the default settings (<code>Include the original game's tileinfo</code>).<br />
<br />
7. Select <code>Finish</code><br />
<br />
Before proceeding, make sure to go to <code>File</code> and <code>Save</code> to save your newly created Abiathar project file. From this point forward, whenever you open Abiathar, you'll also want to open this project file.<br />
<br />
== Update Patchfile == <br />
<br />
In order to load your modified levels in the game you'll need to add the following patch to your patchfile: <br />
<br />
# Map files<br />
%maphead MAPHEAD.CK4<br />
<br />
== Using Abiathar ==<br />
In Abiathar one can move throughout the level with the help of the keyboard and the scroll wheel. <br />
{|<br />
|-<br />
|Keyboard<br />
|<code>Arrow keys</code> move the viewer 1 tile <br />Holding <code>Control</code> changes the offset to 5 <br /> Holding <code>Shift</code> multiplies the offset by 3 <br /> Pressing <code>Backspace</code> moves back to the upper left <br />
|-<br />
|Scroll wheel<br />
|Each notch of the wheel moves 2 tiles vertically <br /> Holding <code>Control</code> makes it move horizontally <br />
|-<br />
|Zoom <br />
|The zoom controls can be found under the <code>View menu</code> <br /> or by using the <code>+</code> and <code>–</code> numpad keys.<br />
|}<br />
<br />
[[Image:Abiathar4.png|thumb|400px|'''Abiathar''' with all planes activated.]]<br />
<br />
=== Tile Palette ===<br />
The tile palette can be called either with the <code>Tileset</code> menu or by pressing <code>Space</code> to change to the tile palette view. To change between the palette views, press appropriate number key: <br /><code>1</code> calls the background set, <br /><code>2</code> calls the foreground set, <br /><code>3</code> calls the set of infoplane pseudo-tiles. <br />
<br />Simply click a tile to select it for placement (the active selected tile is shown in the bottom left). When finished, press <code>Space</code> to return to your level. If you do not want to press Space to access the palettes, you may at any time press:<br />
<br /><code>7</code> to open the background palette, <br /><code>8</code> for the foreground, or <br /><code>9</code> for the infoplane. <br />
<br />
Alternatively and highly recommended is the <code>Simultaneous</code> option found in the <code>Tileset menu</code>. This allows you to have both the level and tileset in view at the same time.<br />
<br />
=== Plane States ===<br />
[[Image:Abiathar3.png|thumb|400px|'''Abiathar''': Background plane ''activated'', Foreground plane ''hidden'', Infoplane ''locked'' .]]<br />
<br />
Keen 4, 5, and 6 levels consist of three planes, also called layers: the '''background''', '''foreground''', and '''info layers'''. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. <br />
<br />
Editing with all panes active at once is not recommended. To help you see and change only what you want to, Abiathar has several systems to control the status of the layers. Each of the three panes in the lower left can have one of three states: <br />
{|<br />
|-<br />
|<code>Active</code><br />
|visible and editable (default) <br />
|-<br />
|<code>Locked</code><br />
|only visible<br />
|-<br />
|<code>Hidden</code> <br />
|not visible or editable <br />
|}<br />
<br />
These can be controlled in several ways. The <code>Plane</code> menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes/layers at once. While viewing a level, the <code>1</code>-<code>3</code> keys control editability for the respective plane, while the <code>4</code>-<code>6</code> keys control visibility. For example, the <code>2</code> key toggles the foreground plane between <code>Active</code> and <code>Locked</code>, while the <code>4</code> key toggles it between <code>Active</code> and <code>Hidden</code>. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active). <br />
<br />
One simple way of managing plane control is to select <code>Lone Editing</code> in <code>Plane</code>. This ensures you are always editing a single plane. <br />
<br />
=== Undo & Redo ===<br />
Undo and Redo can be found under the <code>Edit</code> menu or by pressing <code>Z</code>. The undo/redo action stack is preserved until the file is saved or closed. <br />
<br />
=== Level Operations ===<br />
[[Image:Abiathar7.png|thumb|400px|'''Abiathar''': Link and tile properties overlays are activated]]<br />
Level operations can be accessed from the <code>Level menu</code>, above the levels list. Adding a level is done with <code>Level</code> → <code>Add</code>. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The <code>Automatic edge</code> check box will cause Abiathar to automatically fill in the boundary.<br /><br />
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the <code>Level</code> → <code>Properties</code> dialog. It is also possible to duplicate levels into a new slot with <code>Level</code> → <code>Copy</code>.<br />
<br />
=== Overlays ===<br />
All overlays can be found under the <code>View menu</code> section. <br />
<br />
{| <br />
|<code>Grid</code> <br />
|separating the tiles (it is automatically adjusted for changes in zoom level)<br />
|-<br />
|<code>Links</code><br />
|overlay processes unknown infoplane values and renders graphical links instead of infoplane <br />
|-<br />
|<code>Tile Properties</code><br />
|displays foreground tile properties even in the selected tile bay and tile palette<br />
|}<br />
<br /><br />
<br />
== Level Features ==<br />
<br />
=== Borders ===<br />
Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. <br />
Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
=== Invisible Foreground Tiles ===<br />
Even if a foreground tile doesn't contain any graphics (a blank tile) it can still be placed in a level and can still contain tile properties.<br />
<br />
An example of this is how the default world map is built primarily from background tiles which do no have solid properties and 'invisible' foreground tiles are placed to block Keen's path. <br />
<br />
Another example is how a bridge in the open position requires invisible bridge tiles to be placed where the bridge will appear when a switch is triggered.<br />
<br />
These can be difficult to figure out. A good way to familiarize yourself with these is to view the world map in <tt>Abiathar</tt> with the tile properties view turned on to see how these are utilized. You can right click a tile in the map to see where it is located in the tileset, and then, if desired, you can edit the invisible tiles in your graphics editor to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map in your mod (although this will use more memory).<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a <code>B</code> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as ''Goplats'') need a path made of the yellow arrow icons to follow.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Sprites and Enemies===<br />
You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on ''easy'', ''moderate'', and ''hard''. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Switches for Bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target.<br />
If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use the <code>Tile Property Modifier tool</code> in the <code>Tool</code> menu.<br />
<br />
===Switches for Goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, press <code>L</code> and <code>K</code> on your keyboard. This activates the linker tool. Make also sure that only the [[Keen_Galaxy_Modding_Tutorial_(by_Ceilick)#Plane States|Infoplane]] is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.<br />
<br />
== General Level Editing Issues ==<br />
<br />
Each level must not exceed 64KiB in size: width x height (in tiles) must not exceed 0x8000 (=32,768). Rule of thumb: As long as both stay below 180, there‘s nothing to worry about. The max level height is 250 tiles, and the max width should not exceed 256 tiles. <br />
<br />
If there are too many sprites in a level you will get the error <code>No space left in objarray</code>; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up, and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).<br />
<br />
If you have too many different types of tiles (background and foreground) then you will get the error <code>No space left in tilearray</code>; this means that the game does not have enough memory to store all the different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.<br />
<br />
You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (<code>Not enough memory to animate all these tiles.</code>) <br />
<br />
If a level is 'too large' for its music file, the error <code>Not enough memory to play background music!</code> will occur. This is an indication of either large levels or large music files. To fix this error, remove content from your level, and/or reduce the overall level size, and/or change the music to a smaller sized file.<br />
<br />
If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.<br />
<br />
* '''Note''': All of these problems and more can be detected by [[Abiathar]] when using it's Level Inspector tool or the inspection mode (press 'I') of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.<br />
<br />
<!--<br />
<br />
Included below are general instructions for <tt>'''[[TED5]]'''</tt> (sections written by [[User:Levellass|Levellass]] and [[User:Adurdin|Adurdin]], edited by [[User:Ceilick|Ceilick]]), <tt>'''[[Keen: Next (level editor)|Keen: Next]]'''</tt> (written by [[User:Ceilick|Ceilick]]), and <tt>'''[[The Omegamatic]]'''</tt> (written by [[User:Mink|Mink]] and edited by [[User:Ceilick|Ceilick]]).<br />
<tt>'''[[Abiathar]]'''</tt> however is not included in the following section. Therefore see the [[Abiathar|Abiathar-Wiki]] page (written by [[User:Fleexy|Fleexy]] and edited by [[User:Nisaba|Nisaba]]). Alternative take a look at [[User:Fleexy|Fleexy]]'s [https://abiathar.keenmodding.org//AbiatharHelp.pdf official manual], or [https://www.youtube.com/playlist?list=PL-BuW7CehquoCH_yGXeQqTIXQMY7sUm-u video tutorial playlist].<br />
*Note: While TED5 is from the early 1990's Abiathar is the most up to date and continuously updated editor (initially created in 2014).<br />
<br />
== TED5 ==<br />
=== Setting up TED5 ===<br />
[[Image:Ted5image1.png|thumb|320px|A level map loaded in '''TED5'''.]]<br />
Download and unzip <tt>TED5</tt> into your <tt>"keen4mod"</tt> folder. <br />
<br />
1. Look for the file <tt>Egahead.ck4</tt>. Rename this file <tt>Egahead.ren</tt>.<br />
<br />
2. Run <tt>Tedsetup</tt>.<br />
<br />
3. <tt>Tedsetup</tt> will generate a new <tt>Egahead.ck4</tt>. Delete this file. Now Rename <tt>Egahead.ren</tt> to <tt>Egahead.ck4</tt>.<br />
<br />
This is the only time you will need to run <tt>tedsetup</tt> and follow the above steps.<br />
<br />
You will probably need [https://www.dosbox.com/ DOSBox] to run <tt>TED5</tt>. Just drag and drop the <tt>TED5.exe</tt> onto your DOSBox icon.<br />
<br />
=== The Interface ===<br />
After dismissing the welcome screen, the first thing you will want to do is press <code>F9</code>, or click the <code>?</code> tab and select <code>Video Mode Switch</code>. That will cause <tt>TED</tt> to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once. <br />
<br />
At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays: <br />
<br />
* <code>Selected Background tile.</code> <br />
* <code>Selected Foreground tile.</code><br />
* <code>Selected Sprite Icon.</code><br />
<br />
These items display the icon as a graphic, followed by the tile number in hexadecimal (like <tt>$00AE</tt>) and decimal (<tt>174</tt>). Clicking on any of them will bring up the tiles palette so you can select a new one. <br />
<br />
Next appears the name of the level. This name is used only in <tt>TED5</tt>, it does not affect the level name in-game.<br />
<br />
Next appears: Active layers (B, F, I) <br />
* B: Background Tiles<br />
* F: Foreground Tiles<br />
* I: Sprite Icon, door/switch coordinates<br />
<br />
The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time. <br />
<br />
Next appears: Visible layers (b, f, i) <br />
This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.<br />
<br />
When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly. <br />
<br />
Lastly, on the bottom far right: Cursor location (X, Y) <br />
This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more. <br />
<br />
=== Editing ===<br />
<br />
By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village. <br />
<br />
You can use the arrow keys to scroll the level around.<br />
<br />
You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.<br />
<br />
Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile. <br />
<br />
Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location. <br />
<br />
Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer. <br />
<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.<br />
<br />
When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.<br />
<br />
In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).<br />
<br />
Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.<br />
<br />
Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are <br />
used before placing them in your own levels.<br />
<br />
=== Saving ===<br />
You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While <tt>TED5</tt> has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in <tt>TED5</tt>, just run InstantCarma.<br />
<br />
<tt>TEDSETUP</tt> creates an extra batch file (<tt>Go4.bat</tt>) and patch file (<tt>Patch4.pat</tt>) which you do not need if you open your existing patch file and add the line:<br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
You only need to add this to your patch file once. Then just run your batch file to try your level!<br />
<br />
=== Other TED5 Features ===<br />
<br />
Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.<br />
<br />
Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.<br />
<br />
Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.<br />
<br />
Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.<br />
<br />
Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for <br />
filling in the background of a level.<br />
<br />
You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.<br />
<br />
<br />
== Keen:Next ==<br />
[[Image:Keen_Next.png|thumb|320px|'''Keen: Next'''.]]<br />
<br />
=== Setting Up ===<br />
Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.<br />
<br />
Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.<br />
<br />
Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.<br />
<br />
When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'. <br />
<br />
* '''Note''': you will have to do this each time you open the editor.<br />
<br />
Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created. <br />
<br />
* '''Note''': this will not work if you have run tedsetup. <br />
<br />
* '''Note''': You only have to do this once.<br />
<br />
=== The Interface and Tools ===<br />
The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.<br />
<br />
In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles. <br />
<br />
There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset. <br />
<br />
* '''Note''': the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.<br />
<br />
I do not recommend using the paint can tool, since it is very buggy.<br />
<br />
The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.<br />
<br />
You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing. <br />
<br />
The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.<br />
<br />
The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.<br />
<br />
* '''Note''': This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them. <br />
<br />
=== Editing ===<br />
To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.<br />
<br />
The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.<br />
<br />
On the world map, this is how the coordinates work:<br />
The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.<br />
<br />
An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile. <br />
<br />
An x value of 240 is for the flag holders.<br />
<br />
Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.<br />
<br />
To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.<br />
<br />
* '''Note''': some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. <br />
<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.<br />
<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.<br />
<br />
To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.<br />
<br />
To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.<br />
<br />
Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".<br />
<br />
* '''Note''': Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!<br />
<br />
=== Saving ===<br />
When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok. <br />
<br />
* '''Note''': if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.<br />
<br />
* '''Note''': Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.<br />
<br />
After saving you can test your levels by adding this to your patch file:<br />
<br />
%maphead maphead.ck4<br />
%gamemaps editmaps.ck4<br />
<br />
Then run your batch file and you're all set.<br />
<br />
<br />
== The Omegamatic ==<br />
===Setting Up===<br />
[[Image:The Omegamatic.png|thumb|320px|A level map loaded in '''TOM'''.]]<br />
Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.<br />
<br />
===The Interface and Tools===<br />
Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.<br />
<br />
In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.<br />
<br />
To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.<br />
<br />
If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.<br />
<br />
If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking. <br />
<br />
You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.<br />
<br />
To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".<br />
<br />
You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.<br />
<br />
When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.<br />
<br />
===Sprites and Enemies===<br />
To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.<br />
<br />
===Secret Passages===<br />
Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.<br />
<br />
===Moving Platforms===<br />
A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.<br />
<br />
===Switches for goplats===<br />
Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.<br />
<br />
===Switches for bridges===<br />
To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.<br />
<br />
===Key Gem Doors===<br />
To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.<br />
<br />
===Doors===<br />
To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.<br />
<br />
===Scroll Blocks===<br />
Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.<br />
<br />
===Saving===<br />
To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.<br />
<br />
===Testing===<br />
After saving you can test your levels by adding this to your patch file: <br />
<br />
<code>%maphead maphead.ck4</code><br />
<br />
Then run your batch file.<br />
<br />
--><br />
<br />
= Tile Properties =<br />
<br />
Abiathar comes with a built in ''Tile Properties tool'' used to modify tile properties. To access it from Abiathar, simply go to <code>Tools</code> and then <code>Tile Property Modifier</code>. This will bring up a tiny window used in the modification process. <br />
<br />
== Changing Tile Properties ==<br />
<br />
The tile property modifier window will display the properties of the currently selected tile. The controls can be used to modify the tile property. Each time you select a new tile, the previously selected tile's properties will be saved. When you're finished simply close the tile property modifier.<br />
<br />
*The <code>Revert</code> button is used to return a tile's properties to what they were when that tile was first selected.<br />
<br />
*The <code>Front</code> check box on the left indicates whether the tile will appear in front of characters such as Keen. <br />
<br />
*The <code>solid</code> check boxes on the left and right determine whether the tile is solid on the respective side. <br />
<br />
*From top to bottom, the drop-downs determine: top property (e.g. flat, slope), special effect (e.g. deadly, point item), and bottom (similar to top but affects the bottom face).<br />
<br />
*The Animation section determines the offset to the next tile in the animation sequence and how many game-ticks will elapse before changing to it. A delay of zero is used for switches and things that are only controlled by sprites. Tiles that do not animate have an offset of zero.<br />
<br />
On major useful feature is the copy and paste feature. Use the C key to copy the active tile’s properties and enter copy mode. While in copy mode, any tile you left click will be given the properties of the copied tile. Press the X key to exit copy mode.<br />
<br />
The tile property modifier has other features which you can read about in Abiathar's [https://abiathar.keenmodding.org//AbiatharHelp.pdf Documentation/Help file].<br />
<br />
== Update Patch File ==<br />
<br />
After editing tile properties, don't forget to add an entry to your patch file to actually use these new properties:<br />
<br />
# Tileinfo file<br />
%patchfile $249C2 KEEN4.TLI<br />
<br />
<!--<br />
[[Image:Galactile.png|thumb|320px|Galactile working with Keen 4]]<br />
* '''Note''': The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called [[Galactile]]. Note that the level editor [[Abiathar]] comes with a built in ''Tile Properties tool'' as well, which works quite similar to Galactile.<br />
<br />
Go to your <tt>"Tools"</tt> folder and go into your <tt>Galactile</tt> folder. Copy the <tt>Keen4.tli</tt> file into your <tt>"keen4mod"</tt> folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:<br />
<br />
%patchfile $249C2 keen4.tli<br />
%patchfile $25B22 keen5.tli <br />
%patchfile $25212 keen6.tli<br />
<br />
Now run <tt>Galactile</tt>. The first item the program asks you for is the file which you just copied to your <tt>"keen4mod"</tt> folder. Locate and select it. Next, go into the <tt>"BMP"</tt> folder and select the background tileset, and after that select the foreground tileset.<br />
<br />
You're now in the editing menu.<br />
<br />
On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other. <br />
<br />
To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).<br />
<br />
If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence. <br />
<br />
* '''Note''': Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash<br />
<br />
* '''Note''': After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.<br />
<br />
On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the "FRONT" button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them. <br />
<br />
* '''Note''': the top, bottom, and side properties are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 3). <br />
<br />
* '''Note''': There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes Key-gem doors and and flag holders.<br />
<br />
When you're finished editing, click save.<br />
--><br />
<br />
= Music and Sounds = <br />
<br />
Abiathar is used for import and exporting music and sound effects, as well as adding additional music tracks.<br />
<br />
== Setup == <br />
<br />
In Abiathar and with your project loaded, go to <code>Edit</code>, then <code>Audio</code>, then <code>Resources</code>. Select <tt>Start from the original game's audio files</tt>. Abiathar should then populate the boxes with the game's associated audio files. Select <code>OK</code>.<br />
<br />
Then go to <code>Edit</code>, then <code>Audio</code>, then <code>Export</code>. Select <code>Yes</code> and then browse to your mod's <tt>AUDIO</tt> folder. Give your Abiathar sound configuration file a name such as <tt>audio.asnds</tt> and save. Abiathar should inform you of an successful export and all of the games music and sounds can now be found in your <tt>AUDIO</tt> folder.<br />
<br />
To change music and sounds, just replace the files in <tt>AUDIO</tt> with new files (they must be the same format). Music files are in the <tt>IMF</tt> format and we'll get into how to make these below. Sound effects can be created and modified using <tt>WDC</tt>, which we'll get into below as well.<br />
<br />
After changing the sounds or songs, go back to Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Update Patch File ==<br />
<br />
In order to play your new sounds you'll need the following patches included in your patch file:<br />
<br />
# Audio files<br />
%patchfile $20DF0 AUDIOHED.CK4<br />
%patchfile $354F6 AUDIODCT.CK4<br />
<br />
<!--<br />
[[Image:Keenwave3.png|320px|thumb|Keenwave editing sound names]]<br />
<br />
Copy <tt>Keenwave.exe</tt> into your <tt>"keen4mod"</tt> folder. Run <tt>Keenwave</tt> and it will generate an <tt>IDWAVE</tt> text file. Create a folder called <tt>"sounds"</tt>. Open <tt>IDwave.txt</tt> and add this line:<br />
<br />
<code>-episode=4 -export=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt> by dragging and dropping it onto <tt>DOSBox</tt>.<br />
<br />
Now look in your sounds folder. Here you will see a number of sound files and a few music files (<tt>IMF</tt> files) at the bottom. To change these, just replace the sounds with new files (they must be the same format, for music this is <tt>IMF</tt>). Sound effects can be created and modified using <tt>WDC</tt>. You can create <tt>IMF</tt> files by converting midi files with <tt>IMF Creator</tt>.<br />
<br />
After changing the sounds or songs, go back to <tt>IDWAVE.txt</tt> and change the command to:<br />
<br />
<code>-episode=4 -import=raw -snddir="sounds"</code><br />
<br />
Run <tt>Keenwave</tt>.<br />
<br />
Now open your patch file and include the lines that apply to the episode you're modding:<br />
<br />
#Keenwave patch file; Patch sounds Keen 4:<br />
%patchfile $20DF0 AUDIOHED.CK4 #Audio header<br />
%patchfile $354F6 AUDIODCT.CK4 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 5:<br />
%patchfile $21C80 AUDIOHED.CK5 #Audio header<br />
%patchfile $35EC4 AUDIODCT.CK5 #Audio dictionary<br />
<br />
#Keenwave patch file; Patch sounds Keen 6:<br />
%patchfile $20C50 AUDIOHED.CK6 #Audio header<br />
%patchfile $36EEE AUDIODCT.CK6 #Audio dictionary <br />
--><br />
<br />
== Music ==<br />
<br />
Compose your music using your choice of software. As long as it outputs standard General <tt>MIDI</tt> files, you should be good to go. Then your MIDI will need to be converted to the IMF format using either MIDI2IMF or IMFCreator. Both tools are suggested since they can produce different sounding end results. Lastly, your IMF song will need optimizing with IMFCrush.<br />
<br />
=== Composition Tips ===<br />
<br />
Some tools used by musicians in the community include <tt>Finale</tt>, <tt>FLStudio</tt>, and <tt>MIDI Editor</tt>.<br />
<br />
It's a good idea to read and get an understanding of the [[moddingwiki:IMF_Format| IMF specs]]. <br />
<br />
If you are using a sheet-music editor such as <tt>Finale</tt>: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.<br />
<br />
If your instrument track is too quiet ''and'' it is set to maximum volume, try manually adjusting the note velocities to be higher. The program <tt>FLStudio</tt> is capable of doing this, as well as <tt>MIDI Editor</tt>. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.<br />
<br />
Keep percussion parts as simple as possible. It impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure:<br />
<br />
[SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]<br />
<br />
Don't be shy about using chords and complex structures, especially if your percussion line is nonexistent or very simple.<br />
<br />
Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (ie- parts drop out randomly ''and'' inconsistently), and songs that exceed the filesize limits. [[User:Mr.M|Mr.M]] uses 4-8 tracks, counting percussion, to archive the sound in his work.<br />
<br />
On the subject of percussion: To circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in <tt>IMFCreator</tt>, tweak the patches you used by adjusting all the possible parameters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases. (Credit for this tip goes to Bobby Prince)<br />
<br />
Be careful with pitchbends in your music. <tt>IMFCreator</tt> tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale! <br />
<br />
==== Instrument Patches ====<br />
<br />
Don't be afraid to tweak patches! In IMF Creator it's under the <code>EDIT</code>, <code>Instrument</code> (or press <code>CTRL</code>+<code>I</code>) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.<br />
<br />
When Mr. M does this, he makes a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the <tt>.OP2</tt> file that is generated as something other than <tt>GENMIDI.OP2</tt>. Keep the original <tt>GENMIDI.OP2</tt> file as a base set. <br />
<br />
After you've tweaked the patches to your liking and saved your new <tt>.OP2</tt> file, stop any playback of the song you're previewing. Under <code>OPTIONS</code> and <code>OP2 File</code> you can choose the <code>OP2</code> file that has the modded patches you created. Press <code>play</code> and listen to your new instruments!<br />
<br />
* '''Note''': After editing an .OP2 file/patch set, you MUST stop and re-start playback in IMF Creator of your song for the changes to take effect.<br />
<br />
===Converting to IMF===<br />
<br />
====MIDI2IMF====<br />
Use <tt>MIDI2IMF</tt> to convert a midi track to the IMF format, which is used by Keen Galaxy games. To do this simply drag and drop your MIDI file onto <tt>mid2imf.exe</tt> and it will output a converted IMF version of the file. <br />
<br />
You can also create a batch file to include the various conversion options that MIDI2IMF is capable of using. These options are beyond the scope of this tutorial and can be found within the program's readme.<br />
<br />
====IMFCreator====<br />
<br />
IMFCreator is an older alternative to MIDI2IMF for converting MIDI songs to IMF. It also allows you to preview how the song will sound in the IMF format.<br />
<br />
To convert a MIDI, simply load it into IMF Creator and click <code>Convert to IMF</code>.<br />
<br />
==== IMF Optimization ====<br />
<br />
Use <tt>IMFCrush</tt> to optimize your IMF track's size for memory usage purposes in-game. To run, you will need to create and run (not in DOSBox) a batch file with the following:<br />
<br />
imfcrush.exe <the original imf file name> <the optimized imf file name><br />
<br />
An example of this might look like:<br />
<br />
imfcrush.exe song.imf optimized_song.imf<br />
<br />
IMFCrush, similar to MIDI2IMF, allows for options in the optimization process, however these are beyond the scope of this tutorial. The options can be found in the program's readme.<br />
<br />
==== IMF Playback ====<br />
<br />
IMF Player can be used to listen to your IMF song tracks. To use this program, you'll want to copy your IMF formatted songs in the same folder as <tt>imfplay.exe</tt>. Then drag and drop <tt>imfplay.exe</tt> onto DOSBox to get it started. In the DOSBox command line, type:<br />
<br />
imfplay.exe <your song>.imf 560<br />
<br />
* '''Note''': 560 is the rate used by Keen Galaxy songs. <br />
<br />
=== Importing Music ===<br />
<br />
After you've created a song, converted to IMF, and optimized it with IMFCrush, you'll want to swap it into your mod. To do so you'll first need to locate an original music file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. For Keen 4, these range from <tt>sound156.IMF</tt> to <tt>sound161.IMF</tt>. Then, simply rename your song to the same file and copy over the original.<br />
<br />
Once your new song is in place, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
== Sound Effects ==<br />
<br />
<tt>WDC</tt> is used for PC speaker and Adlib sound composition.<br />
<br />
=== WDC Setup === <br />
<br />
Begin by installing <tt>WDC</tt> to your tools folder. Once this is complete, go to the new <tt>WDC</tt> folder and create three new folders inside: <tt>"Keen4input"</tt>, <tt>"Keen4output"</tt>, and <tt>"KeenSounds"</tt>. You should then copy a clean version of Keen 4 into the <tt>"Keen4input"</tt> folder, specfically the files: <tt>Audio.ck4</tt>, <tt>Egagraph.ck4</tt>, <tt>Gamemaps.ck4</tt>, and <tt>Keen4e.exe</tt>.<br />
* '''Note:''' Make sure this version of the <tt>keen4e.exe</tt> has NOT been unlzexed.<br />
<br />
Now run <tt>WDC.exe</tt>. After it loads, go to <code>File</code> then <code>New Project</code>. <tt>WDC</tt> will then ask you to name the project and save the project file; name it "keen4project" and save it to you <tt>WDC</tt> folder.<br />
<br />
<tt>WDC</tt> will then bring up a window with several options. Under <code>Base Data Folder</code> select your folder <tt>"keen4input"</tt>. You will then get a <code>no map code file</code> alert. When this occurs, select <code>User Other</code> and then select <code>blank.wmc</code>. Under <code>Output Folder</code> select your folder <tt>"keen4output"</tt>. On the left side you will see a small menu, select <code>Other Options</code> and then check the box for <code>Use Tile16s for maps, if they exist</code>. Press <code>OK</code> to save your project settings.<br />
<br />
=== Using WDC ===<br />
<br />
You should now see the Keen 4 world map. Go to <code>View</code> and select either <code>PC Sounds</code> or <code>Adlib Sounds</code>. Adlib sounds are recommended as a starting point, since they are what most players will use and hear.<br />
<br />
<tt>WDC</tt> will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. <tt>WDC</tt> will then ask you where you want to save the file. Navigate to your <tt>"keensounds"</tt> folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.<br />
<br />
<tt>WDC</tt> will then load it's sound editor, which is different for different sound formats (PC speaker vs Adlib). <br />
<br />
==== Adlib Sounds ====<br />
<br />
For Adlib sounds, there are various tabs for effecting how the sound is played, and the main area allows you to use your mouse to 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting. Modifying the octave and waveform of a sound in particular can have some interesting effects.<br />
<br />
* '''Note''': The priority of a sound tells the game which sound has priority to play since only one sound can be played at a time. Values can be from 00 to 99 with the higher numbers being higher priority.<br />
<br />
==== PC Speaker Sounds ====<br />
<br />
For PC speaker sounds, the editor has one main area to 'draw' the sound. From <code>Edit</code> you can move the drawn sound 'up' or 'down' which changes the pitch of the sound.<br />
<br />
* '''Note''': A quick trick for creating PC speaker sounds that match your created Adlib sounds is to go to <code>File</code> and then <code>Import Adlib to PC Sound</code>. This will convert an existing Adlib sound to PC speaker sound (although you may still want to tweak the sound after conversion).<br />
<br />
=== Importing Sounds ===<br />
<br />
After you've saved some sounds with WDC, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the <tt>AUDIO</tt> folder of your <tt>Keen4mod</tt> folder. You can do this by finding the number of the sound you want to replace in <tt>WDC</tt> and then locating the corresponding number in the <tt>AUDIO</tt> folder. <br />
<br />
When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then, open Abiathar and, with your project open, go to <code>Edit</code>, then <code>Audio</code>, then <code>Import</code>. Select your <tt>audio.asnds</tt> file. Abiathar should inform your that an import was successful.<br />
<br />
= Loading Window =<br />
[[Image:Keenscr.png|thumb|320px|TheDraw editing the loading screens.]]<br />
[[Image:Thedrawk4.png|thumb|320px|TheDraw editing the final Keen 4 screen.]]<br />
Go to your <tt>EGA</tt> folder and look for the file <tt>ck4_ansi_endgame.bin</tt>. Copy this to your <tt>keenscr</tt> folder and then rename it to <tt>4msc0000.bin</tt>.<br />
<br />
Load <tt>KEENSCR.EXE</tt> into DOSBox and then type either: <br />
<br />
<code>keenscr 4</code><br />
<br />
or<br />
<br />
<code>keenscr load</code><br />
<br />
TheDraw will then start with either the DOS exit screen or the loading graphic loaded. <br />
<br />
== Using TheDraw ==<br />
<br />
Use <code>Alt</code>+<code>H</code> to display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing <code>Alt</code>+<code>U</code>, and it will use that color as you type. <br />
<br />
You can use <code>Alt</code>+<code>M</code> to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. <code>Alt</code>+<code>F1</code> to <code>Alt</code>+<code>F4</code> will give you different line styles for Draw mode. <br />
<br />
== Saving ==<br />
<br />
Once you are done editing the screen, you can save it by pressing <code>Alt</code>+<code>S</code>. TheDraw will ask which format to save it in; press <code>B</code> to select Binary, and enter the filename keenscr.bin. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated. <br />
<br />
== Importing ==<br />
<br />
After saving, you must then copy <tt>4msc0000.bin</tt> back into your <tt>EGA</tt> folder. Rename <tt>4msc0000.bin</tt> back to <tt>ck4_ansi_endgame.bin</tt>, then import using <tt>uGrab</tt>. <br />
<br />
You must also copy <tt>CK4LOAD.BIN</tt> into your <tt>Keen4mod</tt> folder.<br />
<br />
Edit your patch file to include the patch for the respective episode:<br />
<br />
%patchfile $1fe47 ck4load.bin <br />
%patchfile $20cd7 ck5load.bin <br />
%patchfile $1fca7 ck6load.bin<br />
<br />
= Credits For This Tutorial =<br />
* Written and Assembled by [[User:Ceilick|Ceilick]]<br />
* Revised by [[User:Nisaba|Nisaba]]<br />
<!--<br />
* Selections of [[User:Levellass|Levellass']] [[TED5|TED5 Tutorial]]<br />
* Selections of [[User:Adurdin|Andrew Durdin's]] [https://www.dosclassics.com/ckn/newsletter/issues/2002-03-01.txt|TED5 Tutorial]<br />
* Selections of [[User:CK Guy|CK Guy's]] ck456tli readme<br />
* Selections of [[User:Mink|Mink's]] The Omegamatic readme<br />
--><br />
* Selections of [[User:Leandrotlz|Leandrotlz's]] [[TheDraw|The Draw/Keenscr tutorial]]<br />
* [[User:Mr.M|_mr_m_'s]] IMF guide<br />
<br />
[[Category:Tutorials]]</div>Ceilick