Skip to content

Conversation

@Leischii
Copy link

@Leischii Leischii commented Apr 6, 2025

Depends on #136 , supersedes #135

What does this PR do?

This PR does multiple things: It changes the way music files for battles are loaded, adds a new system that can change music and play sound effects based on battle events, introduces two new settings and some other more general improvements. Lets go over each one in detail.

New Music Load System

The main change all other changes are building on is a rework of how the game loads audio files for battles. Before pretty much all music files were in the same folder and the game just checked this folder for a file, using fallbacks if necessary.
Now there is a new folder for music in "Audio/BGM" called "Types" which then includes more folders, one for each battle type and event supported.

Battle Types

  • Wild
  • Trainer
  • Rival
  • Leader
  • Elite 4
  • Champion

Battle Events

  • Low Health
  • Successful Capture
  • Battle Victory (one for each battle types)
  • Last Gym Leader Pokemon

If you use these changes and don't change the settings, you won't notice any difference as the game will only check these folders for valid files if told to do so. To tell the game to load from these folders let's talk about the first new setting, Battle Music Style.

New Game Setting: Battle Music Style

The first new setting is called "Battle Music Styles" and allows the user to swap between different music styles, changing the music used in battles based on types and events. The different styles are defined in an array in the "Settings" script and consist of:

  • SettingsId: The selected value for the setting. This one needs to be unique and should never change.
  • Indicator: This is a string and is what is being used to tell the game which music file in a type or event folder belongs to which style, When a battle music type or event is choosen, it will check the respective folder for files containing this indicator in their file name. If multiple files with this indicator are found, one file will be selected at random. If none are found it will use the originally used music as fallback.
  • CaptureMeDuration (Optional): Float telling the game the duration of the successful capture music in seconds
  • Description: An object with langauge shortcuts for property names. The value of these are the description to use for a given style in the settings menu. For now "EN" is hardcoded as this is just for the future.

Default Battle Music Styles

For now the following battle music styles are included in the game:

  • Classic: The current battle music implementation of Pokemon Infinite Fusions. If you don't want any thing battle audio related to change, use this setting (Also default)
  • Random: At the start of each battle, pick one battle style at random.
  • Black/White: Adds the music from the Black and White games for every type and event the games have
  • Custom: Checks for files with the Indicator "Custom" in their name. This option is for people who want to add their own music to the game. Simply add the music file to the folder you want the music to be used for and add "Custom" somewhere to it's file name. If no file for a given type or event with the indicator is found, it will fall back to the "Classic" option version.

More styles can easily be added in the future. If you want to know how to loop your music files correctly, you can checkout the following tutorial:
https://forums.rpgmakerweb.com/index.php?threads/make-looping-bgm-part-1-ogg-vorbis.10987/
(Little outdated, some stuff in audacity moved around but the rest is the same)

New Game Setting: Play Low Health

One of the newly supported events is low health. If a style includes a music track for low health, it will be played when one of your active Pokemon is in red health. It there is no music variant for low health, it will fall back to the generic beeping sound. The setting "Play Low Health" is for everyone who get annoyed or doesn't like the beeping in styles without a music variant.
When turned on, low health beeping will play. If turned off, it won't. The music variants of low health can not be turned off.

Other changes

  • Improved audio file loading. Before two regex were used to check if a file included volume and pitch in the string. Since these strings are seperated with ":" there is nothing that prevents us from replacing the two regex with a "string.split(':')" and check the length of the array instead. This should be a lot faster and first tests show that this improves the loading times for loading a Pokemon battle.
  • Refactored the code of files touched by these changes in general. I found a few cases where bigger functions could be improved by restructuring them or introducing early returns.
  • Changes from Options UI: Fix descriptions not updating correctly #136 are included and needed for "Battle Music Style" descriptions to work

Open Todos

  • Testing: Already did quite a lot but there were a few thing I couldn't test due to missing save games with access to some of the battle types (Rival, Elite and Champion)
  • More battle styles: There is always the option to introduce more battle styles. These could be used to add more styles from different pokemon games or to add music from the community.
  • Future: Add support for battle music style setting to change ability sfx. Mainly looking at the different status effects and stat up/down, heal and other things like that. Every sfx would be nice but would be too much, at least for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant