Deprecated: Assigning the return value of new by reference is deprecated in /var/www/dpadhero.com/public_html/blog/wp-settings.php on line 512

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl(&$output) in /var/www/dpadhero.com/public_html/blog/wp-includes/classes.php on line 1199

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl(&$output) in /var/www/dpadhero.com/public_html/blog/wp-includes/classes.php on line 1199

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el(&$output) in /var/www/dpadhero.com/public_html/blog/wp-includes/classes.php on line 1199

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el(&$output) in /var/www/dpadhero.com/public_html/blog/wp-includes/classes.php on line 1199

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el(&$output) in /var/www/dpadhero.com/public_html/blog/wp-includes/classes.php on line 1244

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl(&$output) in /var/www/dpadhero.com/public_html/blog/wp-includes/classes.php on line 1391

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl(&$output) in /var/www/dpadhero.com/public_html/blog/wp-includes/classes.php on line 1391

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el(&$output) in /var/www/dpadhero.com/public_html/blog/wp-includes/classes.php on line 1391

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el(&$output) in /var/www/dpadhero.com/public_html/blog/wp-includes/classes.php on line 1391

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el(&$output) in /var/www/dpadhero.com/public_html/blog/wp-includes/classes.php on line 1442

Strict Standards: Redefining already defined constructor for class wpdb in /var/www/dpadhero.com/public_html/blog/wp-includes/wp-db.php on line 306

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/dpadhero.com/public_html/blog/wp-includes/cache.php on line 103

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /var/www/dpadhero.com/public_html/blog/wp-includes/cache.php on line 431

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/dpadhero.com/public_html/blog/wp-includes/query.php on line 61

Strict Standards: Declaration of Walker_Comment::start_lvl() should be compatible with Walker::start_lvl(&$output) in /var/www/dpadhero.com/public_html/blog/wp-includes/comment-template.php on line 1266

Strict Standards: Declaration of Walker_Comment::end_lvl() should be compatible with Walker::end_lvl(&$output) in /var/www/dpadhero.com/public_html/blog/wp-includes/comment-template.php on line 1266

Strict Standards: Declaration of Walker_Comment::start_el() should be compatible with Walker::start_el(&$output) in /var/www/dpadhero.com/public_html/blog/wp-includes/comment-template.php on line 1266

Strict Standards: Declaration of Walker_Comment::end_el() should be compatible with Walker::end_el(&$output) in /var/www/dpadhero.com/public_html/blog/wp-includes/comment-template.php on line 1266

Strict Standards: Redefining already defined constructor for class WP_Dependencies in /var/www/dpadhero.com/public_html/blog/wp-includes/class.wp-dependencies.php on line 31

Strict Standards: Redefining already defined constructor for class WP_Http in /var/www/dpadhero.com/public_html/blog/wp-includes/http.php on line 61
Behind the Scenes of D-Pad Hero 2: Song Data
Deprecated: preg_replace() [function.preg-replace]: The /e modifier is deprecated, use preg_replace_callback instead in /var/www/dpadhero.com/public_html/blog/wp-includes/kses.php on line 1002
Windows binaries for development tools D-Pad Hero 1 & 2 NSFs
Oct 03

With the full D-Pad Hero 2 source code in hand, you might be interested in some more information on how it all works; what would it take to, say, add new playable songs? Let’s begin by examining the core of DH2: The song data.

The song data consists of two distinct parts: The music data, and the level data (AKA “object data” or “target data”). The music data is, unsurprisingly, the song (background music) itself. The level data defines the objects that come flying down the screen during play; their position (lane), timing and type.

Songs are composed as described in this video. At the composing stage, no consideration needs to be made with regards to how a song will be played in D-Pad Hero, i.e. the song can be composed freely.

Once the core song is ready, it must be “mapped” in order to make it playable in D-Pad Hero — that is, level data must be created. The mapping process is technically very similar to composing; instead of sequencing musical notes, you sequence the objects that the player can hit. In fact, we’re using the same tool (FastTracker 2) for creating both the music data and level data! The level data is placed in a separate channel (track), one per difficulty level (beginner - normal - expert). In such a channel, a note corresponds to one or more lanes in the game; for example, C corresponds to the left-most lane, E corresponds to the middle lane, and A corresponds to the two right-most lanes. Furthermore, the effect columns are used to encode the object type (0 = orb, 1 = skull, 2 = POW, and so on). It’s maybe not the most visually luxurious approach to mapping, and it’s not “realtime”; you typically map a small segment of the song, load up the game, try the song, make adjustments to the mapping; repeat. But it’s pretty effective once you get used to it (ask Andreas ;) ).

Excerpt from “Whip Man”. Channels 0 through 4 contain the music (square 0, square 1, triangle, noise, DPCM). Channels 5 through 7 contain the mapping (beginner, normal, expert).

The xm2btn tool (part of the DH2 source code repository) extracts the song’s mapping and creates level data in a packed format that is essentially a list of (lane specifier(s), object type(s), time units until next occurrence) tuples. The level data is completely decoupled from the music data; the music is only used to drive the level data processing (by issuing a callback every time the song advances by one unit (row)). This means that changes can be made to a song or its mapping without affecting the other, and entirely new mappings can easily be accommodated (in order to support more difficulty levels, for instance).

Markers can be inserted in a mapping to define segments (”clips”) of a song. These segments are used in DH2’s final (”boss battle”) stage to create the “mega-mix” containing parts from all songs. FT2 effect 700 indicates the beginning/end of a segment in the mapping. The order of segments in the DH2 “mega-mix” is hard-coded (see the clips label in game.asm).

In D-Pad Hero 2 there are eight possible “challenges” that can be completed for each song (e.g. “Streak over 100″, “Blow up all POWs”). Care must be taken when designing a mapping to ensure that the challenges are actually possible to complete (e.g. are all letters that spell “D-PAD HERO” present?), and that there’s some balance between the various difficulty levels. To help with this, the xm2btn tool prints some statistics about the objects that occur in each lane, per difficulty level:

***** Statistics for targetdata/ripetargets.xm *****
  EASY
                L       R       S       B       A       Total
    Orb         75      56      49      53      62      295
    Skull       22      17      6       16      16      77
    POW         4       3       6       3       2       18
    Star        1       0       1       0       1       3
    Clock       4       0       2       0       1       7
    Letter      1       2       3       0       2       8
    F-skull     0       0       2       1       0       3
  NORMAL
                L       R       S       B       A       Total
    Orb         90      79      44      86      102     401
    Skull       28      50      19      57      32      186
    POW         3       1       10      1       0       15
    Star        1       1       0       1       1       4
    Clock       2       1       0       1       0       4
    Letter      0       1       3       0       4       8
    F-skull     0       2       0       0       1       3
  HARD
                L       R       S       B       A       Total
    Orb         113     92      46      128     133     512
    Skull       70      69      30      78      56      303
    POW         1       0       0       0       0       1
    Star        0       0       0       1       1       2
    Clock       1       0       0       0       1       2
    Letter      4       2       2       0       0       8
    F-skull     0       1       1       1       0       3

In D-Pad Hero 2, the challenges are the same for all songs; the only variable is the score limit in the “Score over XXXXX” challenge, which should reflect the difficulty and maximum obtainable score. These limits are defined in rock_score_table in game.asm.

That should cover the basics of song data in D-Pad Hero 2. The game engine takes care of the rest; I’ll leave that for a future behind-the-scenes special.

Leave a Reply

preload preload preload