jakubg1 / OpenSMCE

Game engine which allows creating a broad range of marble popper games.
MIT License
14 stars 11 forks source link

Enhanced sound effects #95

Closed jakubg1 closed 1 month ago

jakubg1 commented 1 year ago

Split sound effects into actual sound effect files and sound definitions (number of samples, stream/load etc.).

The sound effects should be able to have a few different sounds defined and play an appropriate one depending on variables (for example, changing the pitch or actual sample using Expressions).

Example (collapse.json):

{
  "sounds": [
    {
      "sound": "collapse_1",
      "pitch": "$expr{1 + 0.05 * ([combo] - 1)}",
      "conditions": [
        "$expr{[length] == 3}"
      ]
    },
    {
      "sound": "collapse_2",
      "pitch": "$expr{1 + 0.05 * ([combo] - 1)}",
      "conditions": [
        "$expr{[length] == 4}"
      ]
    },
    {
      "sound": "collapse_3",
      "pitch": "$expr{1 + 0.05 * ([combo] - 1)}",
      "conditions": [
        "$expr{[length] == 5}"
      ]
    },
    {
      "sound": "collapse_4",
      "pitch": "$expr{1 + 0.05 * ([combo] - 1)}",
      "conditions": [
        "$expr{[length] == 6}"
      ]
    },
    {
      "sound": "collapse_5",
      "pitch": "$expr{1 + 0.05 * ([combo] - 1)}",
      "conditions": [
        "$expr{[length] >= 7}"
      ]
    }
  ]
}
jakubg1 commented 12 months ago

Possible sound event fields:

jakubg1 commented 1 month ago

Implemented in https://github.com/jakubg1/OpenSMCE/commit/162031c9a32955973a8c4beb8f08ffbe654cf91f