Touhou Wiki
Line 98: Line 98:
 
So, let's create a file called <code>Test.txt</code>. Touhou Danmakufu uses the <code>.txt</code> format, an ordinary text file. You can use any text editor (for example Notepad) to edit the following:
 
So, let's create a file called <code>Test.txt</code>. Touhou Danmakufu uses the <code>.txt</code> format, an ordinary text file. You can use any text editor (for example Notepad) to edit the following:
   
 
#TouhouDanmakufu
<blockquote><code>
 
 
#Title [The title of the danmaku]
#TouhouDanmakufu
 
#Title [The title of the danmaku]
+
#Text [The description of the danmaku]
 
#ScriptVersion [2]
#Text [The description of the danmaku]
 
 
script_enemy_main {
#ScriptVersion [2]
 
 
}
 
script_enemy_main {
 
}
 
</code></blockquote>
 
   
 
== Lesson 3: Hello, Enemy! ==
 
== Lesson 3: Hello, Enemy! ==

Revision as of 08:09, 16 July 2009


Note: This is an in-progress translation of the tutorial found here. It is meant to be worked through in order.

Touhou Danmakufu is based on the Touhou series of danmaku shooters. You can use it to create your own danmaku patterns, and even your own complete games. The coding language is based loosely off the C language, however it has been heavily simplified for the purpose of creating scripts easily. In this tutorial, we will explain how to create a simple Danmakufu script. This tutorial has been written specifically with the idea of teaching people with no prior programming experience.

Lesson 1: Our First Script

First, prior to making your own script, let's have a look at an existing Touhou Danmakufu script.

Installation

Installing is easy. First, go to the Touhou Danmakufu website. Then download the latest version of Touhou Danmakufu. (This should be the first link on the page.) Because it comes as a ZIP file, you can unzip and run it from wherever you want by opening the th_dnh.exe file in the main folder. If you have enabled "Hide extensions", it's possible that someone may have slipped a virus into the folder, so you should disable this feature if possible.

You can unpack the ZIP with various software. (The site mentions a program called "Vector", but the Windows ZIP utility should be fine.)

Settings

If you have a game pad, it's best if you set it up before starting to play with Touhou Danmakufu. Special settings such as this should be controlled with the pre-configure program "config.exe". Upon running config.exe, you should see this dialog.

The top half of the dialog displays the specifications for the environment you are running Danmakufu on. The bottom half displays the settings for the device (Windowed/Fullscreen, Window Size, Graphic Depth and Audio Source on the left) and the gamepad settings (the usual buttons for the Touhou games.)

Regular players of Touhou games will recognize this layout, however if the graphics become unstable, feel free to experiment with the right half of the dialog.

Setting the pad is easy, as this dialog shows. Simply highlight the button which you want to change, and press the button. They are, in order from top to bottom:

  • Shot
  • Bomb
  • Focus
  • Decide
  • Cancel
  • Pause
  • Event Skip

It is also possible to set the same button to different behaviour, for example you might want to select the Shot button to be the Decide button, or the Bomb button to be Cancel.

Playing the Game

th_dnh.exe is the main part of Touhou Danmaku. When you run the program, you will see a menu, the meanings of which will be explained below.

All Play all scripts within the main folder and subfolders.
Single Play one script within the main folder and subfolders.
Plural Play a continuous danmaku with more than one pattern. Only uses the plural scripts.
Stage Play a stage danmaku with enemies and bosses. Only uses the stage scripts.
Directory Play one script. Differs from "Single" by the choice of subdirectory.
Random Play one script randomly selected from the main folder and subfolders.
Exit Quits the program.

Apart from "Exit", the player chooses a character and then a script to play.

All, Single, Plural, Stage

Only scripts are listed. Select the desired script, then press the decision button (Z key) to choose. Press the decision button again to play. If you use no continues, it's possible to save the replay. Replays will be shown at the bottom of the screen when you select a script; you can choose to play them back.

Directory

Scripts are listed along with directories. Navigate through the directories until you find the script you want, then select it.

Random

Selects a script at random from all the scripts. You can save replays, but you can't replay them.

Updating

To update Touhou Danmakufu, first extract the new th_dnh.zip elsewhere. Then, simply move everything to the old folder. This will overwrite all the older files in the main directory.


Lesson 2: Let's Make One!

So, small talk aside, let's now make a simple danmaku pattern. In this second and later lessons, we'll provide a summary of what we've learned in that lesson.

Summary

  • Placing files in the script folder.
  • #TouhouDanmakufu recognized as the first line in a script.
  • script_enemy_main defines the behaviour of the enemy.

A script that does nothing

First, let's make a script that does nothing. Place the file in the "scripts" folder, or if you prefer, you can make a new folder. Anyway, if the script is in the "scripts" folder, there are no restrictions.

So, let's create a file called Test.txt. Touhou Danmakufu uses the .txt format, an ordinary text file. You can use any text editor (for example Notepad) to edit the following:

#TouhouDanmakufu
#Title [The title of the danmaku]
#Text [The description of the danmaku]
#ScriptVersion [2]
script_enemy_main {
}

Lesson 3: Hello, Enemy!

Lesson 4: Hello, Bullets!

Lesson 5: Using Variables

Lesson 6: Changing Variables

Lesson 7: That way? This way?

Lesson 8: Möbius Strip

Lesson 9: Automations

Lesson 10: Automated Computations

Lesson 11: Cutting the Gordian Knot

Lesson 12: One Hundred Metre Dash

Lesson 13: Tadpole to Frog

Lesson 14: Human Realm Sword "Delusion of Enlightenment -Easy-" (1)

Lesson 15: Human Realm Sword "Delusion of Enlightenment -Easy-" (2)

Lesson 16: Human Realm Sword "Delusion of Enlightenment -Easy-" (3)

Lesson 17: Human Realm Sword "Delusion of Enlightenment -Easy-" (4)

Lesson 18: Human Realm Sword "Delusion of Enlightenment -Easy-" (5)

Lesson 19: Wave Sign "Mind Shaker" Easy (1)

Lesson 20: Wave Sign "Mind Shaker" Easy (2)

Lesson 21: Wave Sign "Mind Shaker" Easy (3)

Lesson 22: Wave Sign "Mind Shaker" Easy (4)

Lesson 23: Ambition Sign "Buretsu Crisis" (1)

Lesson 24: Ambition Sign "Buretsu Crisis" (2)

Lesson 25: Ambition Sign "Buretsu Crisis" (3)

Lesson 26: Plural Linking