Commit dad46256 authored by Andrew's avatar Andrew

Ambient Sound and Nginx documentation pages

parent 8a37f9dd
<p>Foundry Virtual Tabletop allows for local ambient sound effects which are activated when a player-controlled Token is moved into it's area of effect. This can be useful for environmental features like a waterfall or a crackling campfire which your players will be able to hear when their Tokens are nearby.</p>
<figure>
<video width="100%" controls>
<source src="https://foundryvtt.s3-us-west-2.amazonaws.com/website-media-dev/videos/ambient-sound-creation.webm" type="video/webm">
</video>
<figcaption>Create an Ambient Sound using a left-mouse drag workflow on the Sounds Layer.</figcaption>
</figure>
<p>Ambient Sounds are created by navigating to the Sounds layer of the active Scene by clicking on the musical notes icon in the Scene control palette. While on the Sounds layer, you can create a new Sound by using a left-click and drag workflow to expand the area of effect (you can change it later). Once you are done dragging the Sound Configuration form will appear. You must select a sound file to play in order to complete the creation. The Sound Configuration shown in the following figure and it's configuration options are explained below:</p>
<figure>
<img src="https://foundryvtt.s3.us-west-2.amazonaws.com/website-media-dev/user_1/screen/ambient-sound-configuration-2020-05-18.png" alt="Ambient Sound Configuration" />
<figcaption>Double click the Ambient Sound to open the Configuration Form.</figcaption>
</figure>
<dl>
<dt>Sound Type</dt>
<dd>
<p>Configure the type of sound emitted by this source. Ambient Sounds can either be <strong>local</strong> which are blocked by any Walls which inhibit perception or <strong>global</strong> which are always audible within their area regardless of the presence of Walls.</p>
</dd>
<dt>Audio Source</dt>
<dd>
<p>You must choose a path to a valid sound file which plays when Tokens are within the area of effect. Ambient Sounds always repeat on loop, so it is recommended to use a format like webm, wav, or ogg which allows for seamless looping, but other audio file formats are also supported.</p>
</dd>
<dt>X-Position</dt>
<dd>
<p>The x-coordinate for the center of the Ambient Sound area of effect.</p>
</dd>
<dt>Y-Position</dt>
<dd>
<p>The y-coordinate for the center of the Ambient Sound area of effect.</p>
</dd>
<dt>Sound Radius</dt>
<dd>
<p>The radius of the area of effect for the Ambient Sound, expressed in distance units. For example, if your Scene is configured where each square represents 5ft.</p>
</dd>
<dt>Volume Easing</dt>
<dd>
<p>This option specifies that the volume of the Ambient Sound should automatically reduce as Tokens are further from it's origin (but still within the area) and increase in volume when Tokens are closer to the origin of the sound. If this option is disabled, the volume level of the Ambient Sound will be the same everywhere within the affected area.</p>
</dd>
<dt>Maximum Volume</dt>
<dd>
<p>This slider configures the maximum volume level of the Ambient Sound at it's point of origin (if easing is applied) or throughout the area (if no easing).</p>
</dd>
</dl>
<hr/>
<h3>Modifying Placed Sounds</h3>
<p>After an Ambient Sound has been created, you can edit it later by double clicking on its control icon that is visible when on the Sounds Layer. To move the position of an existing Ambient Sound you can click and drag it's icon to move it. You may also use <code>CTRL+C</code> and <code>CTRL+V</code> commands to copy and paste sounds.</p>
<p>Players can control the volume level of playing Ambient Sounds using the global Ambient slider in the Playlists tab of the Sidebar.</p>
<p>Note that Ambient Sounds always loop if a Token is within their area of effect. If you are interested in one-time audio effects which play at a certain time that will be handled by the Event Trigger system, a post-release feature that is not yet added.</p>
<hr/>
<h3>API References</h3>
<p>To interact with Ambient Sound objects programmatically, you will primarily use the following API concepts:
<ul>
<li>The <a href="/api/AmbientSound.html" title="The AmbientSound Object" target="_blank">AmbientSound</a> Object</li>
<li>The <a href="/api/SoundsLayer.html" title="The SoundsLayer Object" target="_blank">SoundsLayer</a> Canvas Layer</li>
<li>The <a href="/api/AmbientSoundConfig.html" title="The AmbientSoundConfig Application" target="_blank">AmbientSoundConfig</a> Application</li>
</ul>
</p>
<hr/>
<h3>Attributions</h3>
<p class="note">"Fossil Caves" map by <a href="https://www.patreon.com/fablekit" title="FableKit on Patreon" target="_blank">FableKit on Patreon</a>.</p>
\ No newline at end of file
<p>Foundry Virtual Tabletop includes built-in technology to allow for audio/video (A/V) calls shared between all of the players in your game. This is achieved using a technology called <em>WebRTC</em> which is a standard specification for Real Time Communications. In order to enable A/V functionality in Foundry VTT, you will need to satisfy some specific requirements.</p>
<p class="notification warning"><strong>Important:</strong> In order to use built-in AV you must run Foundry VTT using SSL certificates. This requires some additional setup.</p>
<p class="note warning"><strong>Important:</strong> In order to use built-in AV you must run Foundry VTT using SSL certificates. This requires some additional setup.</p>
<hr />
<h2>What You Need</h2>
......
<p><a href="https://www.nginx.com/" title="Nginx Web Server" title="_blank">Nginx</a> is a popular web server which you may consider using as a proxy server in front of Foundry Virtual Tabletop. There are a number of advantages to using a proxy server like Nginx like using a subdomain, using an external port that is different than your Foundry VTT port, stronger access controls, and faster serving of static files. This article provides a basic overview of using Nginx with Foundry Virtual Tabletop. There are <em>many advanced options</em> which are not covered here.</p>
<p class="note info">Please note that using a proxy server like Nginx, while advantageous for dedicated web hosts, is absolutely not required in order to use Foundry Virtual Tabletop.</p>
<hr/>
<h3>Step 1 - Install Nginx</h3>
<p>Start by installing Nginx for your Linux distribution. Some common examples are provided below, but consult the <a href="https://www.nginx.com/resources/wiki/start/topics/tutorials/install/" title="Nginx documentation" target="_blank">Nginx documentation</a> for your Linux flavor.</p>
<p class="note warning">This guide assumes a basic level of familiarity with the Linux operating system and how to interface with it. If you are brand new to Linux we recommend starting with a beginner's tutorial to the Linux command line before proceeding.</p>
<h4>Ubuntu</h4>
<pre><code class="language-bash">sudo apt-get update
sudo apt-get install nginx
</code></pre>
<h4>Red Hat</h4>
<pre><code class="language-bash">sudo yum update -y
sudo yum install nginx
</code></pre>
<h4>Amazon Linux 2</h4>
<pre><code class="language-bash">sudo yum update -y
sudo amazon-linux-extras install nginx1 -y
</code></pre>
<hr/>
<h3>Step 2 - Configure Nginx</h3>
<p>Nginx requires a configuration file which defines how the server functions. A functional starting point to begin testing Nginx is the following configuration which does not use SSL certificates (we can enable those later). For the purposes of this example we assume that Foundry Virtual Tabletop is running from <code>/home/ec2-user/foundryvtt</code>, but your application installation path may be different, you should adjust the configuration file accordingly.</p>
<p class="note warning">Make sure to update the references to <code>your.hostname</code> in the configuration.</p>
<pre><code class="language-bash"># This goes in /etc/nginx/nginx.conf
# CONFIGURE NGINX PROCESS
user ec2-user ec2-user;
pid /var/run/nginx.pid;
# EVENTS
events {
worker_connections 1024;
accept_mutex off;
}
# HTTP SERVER
http {
include mime.types;
default_type application/octet-stream;
error_log /tmp/nginx.error.log warn;
access_log /tmp/nginx.access.log combined;
sendfile on;
server {
# Enter your fully qualified domain name or leave blank
server_name your.hostname.com;
# Listen on port 80 without SSL certificates
listen 80;
# Allow File Uploads
client_max_body_size 300M;
keepalive_timeout 5;
# Proxy Requests to Foundry VTT
location / {
# Set proxy headers
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# These are important to support WebSockets
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
# Make sure to set your Foundry VTT port number
proxy_pass http://localhost:30000;
}
}
}
</code></pre>
<hr/>
<h3>Step 3 - Start, Stop, and Restart Nginx</h3>
<p>You can use the <code>service</code> utility to easily manage your Nginx server.</p>
<pre><code class="language-bash"># Test your configuration file
sudo service nginx conftest
# Start Nginx
sudo service nginx start
# Stop Nginx
sudo service nginx stop
# Restart Nginx
sudo service nginx restart
</code></pre>
<hr/>
<h3>Step 4 - Add SSL Certificates (Optional)</h3>
<p>For more advanced usage you can add SSL Certificates for added security. Start by creating SSL Certificates (not covered by this guide). Once your certificates are created, your Nginx configuration file will be updated to use port 443 and the SSL certificates you have created.</p>
<p class="note warning">Make sure to update the references to <code>your.hostname</code> in the configuration.</p>
<pre><code class="language-bash"># This goes in /etc/nginx/nginx.conf
# CONFIGURE NGINX PROCESS
user ec2-user ec2-user;
pid /var/run/nginx.pid;
# EVENTS
events {
worker_connections 1024;
accept_mutex off;
}
# HTTP SERVER
http {
include mime.types;
default_type application/octet-stream;
error_log /tmp/nginx.error.log warn;
access_log /tmp/nginx.access.log combined;
sendfile on;
server {
# Enter your fully qualified domain name or leave blank
server_name your.hostname.com;
# Listen on port 443 using SSL certificates
listen 443;
ssl_certificate "/etc/letsencrypt/live/your.hostname/fullchain.pem";
ssl_certificate_key "/etc/letsencrypt/live/your.hostname/privkey.pem";
# Allow File Uploads
client_max_body_size 300M;
keepalive_timeout 5;
# Proxy Requests to Foundry VTT
location / {
# Set proxy headers
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# These are important to support WebSockets
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
# Make sure to set your Foundry VTT port number
proxy_pass http://localhost:30000;
}
}
}
</code></pre>
<p>Once you have edited the Nginx configuration to include your SSL certificates, be sure to do a configuration test before restarting your server.</p>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment