HumanView vs Actors vs Audio

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • HumanView vs Actors vs Audio

      Hey guys,

      after a long pause I am back at playing around with my own small game (it is only a hobby so a couple of month of no progress is ok I guess).

      I am looking again at the "big picture" of the GCC4 architecture and struggle with the role of the AudioComponent in the Actor system and how it relates to the HumanView and how audio in general should be treated in an engine like GCC4.

      Where I'am getting confused is why GCC4 / TeapotWars uses the actor system to play background music but all other sounds are controlled within the HumanView. For me this makes no sense because the background music is only relevant for the human player.

      How would I implement for example the sound from an opening door? In the HumanView? Or using the actor system with an trigger-able sound component? And whats with running and jumping sounds of the player? I would need more then one AudioComponent...

      I hope you understand my confusion and hope someone can help me with that. Any input is welcome.

      Thanks
      Basti
    • I think it really depends, background audio is not a big deal when it comes to networked gameplay, if player A is playing background audio 1, and player B is playing background audio 2, they won't actually care, this is similar to how 2 games can be completely out of sync animation wise across 2 games, or things like rag dolls will be out of sync, because they are not things that a player will notice.

      Now lets look at something like gun shot sounds, explosions, characters giving orders, etc. These are things very important to gameplay especially in something meant to be tactical like the Battlefield games, if you don't here a bullet whip by your head, it gives the sniper on the other end the advantage of remaining unheard and unnoticed, events allow these sounds to be passed over the network from Server-Client and have each player who is within the audible location to here the sound.

      This doesn't mean that background audio can't be dispatched by events though, if you want to dispatch an event at client start to synchronize background audio there is nothing wrong with this. Generally in most engines I have seen (as well as my own), there are different component types.

      - Audio Listener component, this is generally attached along with a camera that the player views the game from, or maybe even forced along with a camera. This typically represents something that is able to receive audio events.
      - Audio Source component, this is something that produces sound, and can represent either a globally playing soundtrack, a trigger-able sound, etc. Usually you can also fire off sounds without these audio source components, as they act as a simple way to attach an audio clip to a logical entity in game.

      The way that you separate the audio between logic-view is up to you, but here are some points to think about.

      - Audio listeners don't necessarily need to play audio, but could simply be a pass through to say that 'this game object cares about audio, so lets make sure any attached view knows about the sound'
      - Audio listeners can be processed on the logic side, or the view side. If your AI are completely logic based this may be the only way to go. Otherwise you may need to dispatch Audio to the view.
      PC - Custom Built
      CPU: 3rd Gen. Intel i7 3770 3.4Ghz
      GPU: ATI Radeon HD 7959 3GB
      RAM: 16GB

      Laptop - Alienware M17x
      CPU: 3rd Gen. Intel i7 - Ivy Bridge
      GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
      RAM: 8GB Dual Channel DDR3 @ 1600mhz
    • Thanks for your reply! I was really confused when I learned that GCC essentially does not treat audio as part of an actor. Your explanation helped a lot!

      Separating an AudioListener from a source seems very smart, I will definitely use that. I found that Unity for example allows more than one AudioSource component which makes totally sense and again clears up some of my problems expressed in my post.

      Thanks again!