There are two things I've been working on since my last blog:
- HAARP Sound Manager (For UI Sound only atm) &
- HAARP Switchboard
The HAARP Sound Manager is not very much different to what you would expect from most games sound manager layers except for the fact that once again it is completely data driven. All data on sounds are stored in the database. Each UI element holds an ID of a sound to play at certain times for example:
1. Hover Sound
2. Click Sound
The challenge is how can this be set up dynamically. Well this part is actually quite simple. Each sound has an ID in the database, each Button has two sound id's stored in two different columns, one for hover sound and one for click sound. All that is needed once the data has been extracted from the database is to cross reference the sound id's that the button has with the actual sounds referenced by those id's and you can easily give a relationship dynamically based on the database values.
However, things get a little trickier when you want to allow the creation of these element to sound relationships in the HAARP editor using the wires like I can already attach states. To solve this I came up with HAARP Switchboard. HAARP switchboard is basically a set of classes that allow easy visual relationships to be made between UI elements, sounds, functions and variables.
Basically a swithboard can be created and that switchboard can have any number of plugs. The switchboard can be moved around the screen in edit mode and the user can plug elements into those switchboards however they want. Depending on the switchbaord being used it can hold many different types of data:
For example, a post processing effect switchboard may have a plug for SSAO, Godrays, FXAA etc. and plugging check boxes into those plugs on the PPFX switchboard would link the two together and give a dynamic relationship so that when the check box is checked, that effect will be active and when it is unchecked the effect will not be active. I am even considering making the option to have dynamic switchboards which can be created by the user in game.
So as I was doing the sound system I thought I would start with the simplest of simple switchboards and this is the UI Sound Switchboard which only has a single plug. The sound switchboard holds a sound in it and different sound channels from UI elements can be plugged into it and based on those relationships will play a sound. Have a look at the screenshot below:
Perhaps the very first thing that you would notice is the wires going everywhere. These wires are important to show relationships between elements, sounds, screen transitions, variables and functionality.
The green line is a screen state relationship. As you can see it is plugged into the options screen. If the user exits from edit mode and clicks on the options screen they will automatically be transitioned to the options screen state. (It is important to note that even these states listed are not hard coded but dynamically drawn from the databases. Later I will add functionality to create new screens in the editor).
The blue lines show sound relationships to the UI elements. As you can see there are two plugs and two wires for sound. This is because a button has 2 sounds, one for initial hovering and one for when the button is clicked. Therefore, the first plug is the hover sound and the second is the Click sound. If this were a check box it would only have one sound plug for when it is clicked as no hover sound is necessary. The editor will dynamically detect the number of sound channels a UI element has and dynamically create these plugs based on that number.
It should be noted that these sound channels can be unplugged by just dragging the plug onto nothing and then there will be no relationship and sound will not be played through that channel.
It is arguable that the whole visual idea with wires running everywhere can make things a bit cluttered. Therefore, I have implemented features which help remove this clutter. First of all there is a wire toggle. The user will be able to toggle different types of wires so that only certain types show or none show at all. This lets the user focus only on the wires they want or no wires at all. I have also made it that when even when all the toggles are off the wires will show on the selected element. This way you will see only a few wires. I am considering have a toggle all wires on the selected element HUD to improve it even further.
So the long story short is that HAARP Switchboard is the methodology or technique that I came up with to dynamically and visually make relationships between two seemingly isolated pieces of data without any hard coding of the data whatsoever. Although the sound switchboard is different to say an options menu switchboard it will still work on the same principals
Other Things I've Done Since Last Time:
- Added a text box to top right with an OK button which is used to set the background texture.
- Added a number of tabs to the HAARP Editor Side panels for future use for more space and functionality
- Improved the databases dramatically so that even more settings can be set within the elements from the database, meaning less code in the main areas of the editor code