Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Aug 10, 2015
1 parent 57874c8 commit 2dd7964
Show file tree
Hide file tree
Showing 3 changed files with 293 additions and 11 deletions.
137 changes: 137 additions & 0 deletions docs/unity/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,143 @@ <h1>Changelog for Unity Plugin</h1>
<div class="row">
<div class="col-sm-8 lesson-main">
<ul>
<li><p>1.2</p>
<ul>
<li><p>Added Export/Install/Publish menu items</p>
</li>
<li><p>added HFTGamepad.BUTTON_TOUCH for whether or not the user is touching the screen
on the orientation and touch controllers.</p>
</li>
<li><p>added ability to play sound through controller</p>
<p>There are currently 2 ways to make sounds for the controllers.</p>
<ol>
<li><p>JSFX</p>
<p>This is the recommended way as it&#39;s light weight.</p>
<ol>
<li><p>Go to the <a href="http://egonelbre.com/project/jsfx/">JSFX sound maker</a>.</p>
</li>
<li><p>Adjust the values until you get a sound you like.</p>
</li>
<li><p>Copy the sound values (near top of the page just below the buttons) to a text file with the extension &quot;.jsfx.txt&quot;
putting a name in front of each set of values. Save that file in Assets/WebPlayerTemplates/HappyFunTimes</p>
</li>
</ol>
<p>For example here is the sample <code>sounds.jsfx.txt</code> file</p>
<pre><code>coin [&quot;square&quot;,0.0000,0.4000,0.0000,0.0240,0.4080,0.3480,20.0000,909.0000,2400.0000,0.0000,0.0000,0.0000,0.0100,0.0003,0.0000,0.2540,0.1090,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
jump [&quot;square&quot;,0.0000,0.4000,0.0000,0.0960,0.0000,0.1720,20.0000,245.0000,2400.0000,0.3500,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.5000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
coinland [&quot;square&quot;,0.0000,0.4000,0.0000,0.0520,0.3870,0.1160,20.0000,1050.0000,2400.0000,0.0000,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
bonkhead [&quot;sine&quot;,0.0000,0.4000,0.0000,0.0000,0.5070,0.1400,20.0000,1029.0000,2400.0000,-0.7340,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.3780,0.0960,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
land [&quot;sine&quot;,0.0000,0.4000,0.0000,0.1960,0.0000,0.1740,20.0000,1012.0000,2400.0000,-0.7340,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.3780,0.0960,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
kicked [&quot;noise&quot;,0.0000,1.0000,0.0000,0.0400,0.0000,0.2320,20.0000,822.0000,2400.0000,-0.6960,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0270,0.0000]
dropkick [&quot;sine&quot;,0.0000,1.0000,0.0000,0.0880,0.0000,0.3680,20.0000,653.0000,2400.0000,0.2360,0.0000,0.1390,47.1842,0.9623,-0.4280,0.0000,0.0000,0.4725,0.0000,0.0000,-0.0060,-0.0260,1.0000,0.0000,0.0000,0.0000,0.0000]
bounce [&quot;noise&quot;,0.0000,1.0000,0.0000,0.0220,0.0000,0.1480,20.0000,309.0000,2400.0000,-0.3300,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
</code></pre></li>
<li><p>Use sounds files</p>
<p>Put sound files (<code>.mp3</code> or <code>.wav</code>) in <code>Assets/WebPlayerTemplates/HappyFunTimes/sounds</code>
They have to be in there because they must be served to the phone. Note that it&#39;s a
good idea to keep them as small as possible because each time a player connects to
the game his phone will have to download all the sounds. JSFX sounds comming soon.</p>
</li>
</ol>
<h2 id="playing-sounds">Playing Sounds</h2>
<p>To use the sounds, on some global gameobject (like LevelManager in all the samples)
add an <code>HFTGlobalSoundHelper</code> script component.</p>
<p>Then, on the prefab that gets spawned for your players, the same prefab you put
an <code>HFTInput</code> or <code>HFTGamepad</code> script component add the <code>HFTSoundPlayer</code> script
component.</p>
<p>In your <code>Awake</code> or <code>Start</code> look it up</p>
<pre><code>private HFTSoundPlayer m_soundPlayer;

void Awake()
{
m_soundPlayer = GetComponent&lt;HFTSoundPlayer&gt;();
}
</code></pre><p>To play a sound call <code>m_soundPlayer.PlaySound</code> with the name of the sound (no extension).
In other words if you have <code>sounds/explosion.mp3</code> then you can trigger that sound on
the user&#39;s phone with</p>
<pre><code>m_soundPlayer.PlaySound(&quot;explosion&quot;);
</code></pre><p>Or if you named a JSFX sound like</p>
<pre><code>bounce [&quot;noise&quot;,0.0000,1.0000,0.0000,0.0220,0.0000,0.1480,20.0000,309.0000,2400.0000,-0.3300,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
</code></pre><p>Then</p>
<pre><code>m_soundPlayer.PlaySound(&quot;bounce&quot;);
</code></pre></li>
</ul>
</li>
</ul>
<pre><code>* added mulit-touch support to HFTInput via the standard `GetTouch` function
as well as `axes` and `buttons`

public const int AXIS_TOUCH0_X = 13;
public const int AXIS_TOUCH0_Y = 14;
public const int AXIS_TOUCH1_X = 15;
public const int AXIS_TOUCH1_Y = 16;
public const int AXIS_TOUCH2_X = 17;
public const int AXIS_TOUCH2_Y = 18;
public const int AXIS_TOUCH3_X = 19;
public const int AXIS_TOUCH3_Y = 20;
public const int AXIS_TOUCH4_X = 21;
public const int AXIS_TOUCH4_Y = 22;
public const int AXIS_TOUCH5_X = 23;
public const int AXIS_TOUCH5_Y = 24;
public const int AXIS_TOUCH6_X = 25;
public const int AXIS_TOUCH6_Y = 26;
public const int AXIS_TOUCH7_X = 27;
public const int AXIS_TOUCH7_Y = 28;
public const int AXIS_TOUCH8_X = 29;
public const int AXIS_TOUCH8_Y = 30;
public const int AXIS_TOUCH9_X = 31;
public const int AXIS_TOUCH9_Y = 32;

public const int BUTTON_TOUCH0 = 18;
public const int BUTTON_TOUCH1 = 19;
public const int BUTTON_TOUCH2 = 20;
public const int BUTTON_TOUCH3 = 21;
public const int BUTTON_TOUCH4 = 22;
public const int BUTTON_TOUCH5 = 23;
public const int BUTTON_TOUCH6 = 24;
public const int BUTTON_TOUCH7 = 25;
public const int BUTTON_TOUCH8 = 26;
public const int BUTTON_TOUCH9 = 27;

Note: The Touch.rawPosition is currently in screen pixels of Unity
not the controller. It&#39;s not clear what the best way to handle this
is.

The Unity `Input` API says those value are in pixels but they are
assuming the game is running on the phone. In the case of HappyFunTimes
though each phone is different so having it be in phone screen pixels
would make no sense unless you also knew the resolution of each phone.
I could provide that but that would make it more complicated for you.

Personally I&#39;d prefer normalized values (0.0 to 1.0). If you want those
then take `Touch.rawPosition` and divide `x` by `Screen.width` and `y` by `Screen.height`
as in

HFTInput.Touch touch = m_hftInput.GetTouch(0);
float normalizedX = touch.x / Screen.width;
float normalziedY = touch.y / Screen.height;

Also note the AXIS versions of these are already normalized to
a -1.0 to +1.0 range.

* Changed sample HFTGamepad code to not issue an error if it&#39;s not actually
connected to a controller.

Users often leave a prefab in their scene. That prefab would generate
errors because it&#39;s not actually connected to a controller and was
trying to access the controllers `NetPlayer`.
</code></pre><ul>
<li><p>1.1</p>
<ul>
<li>Moved samples into samples folder</li>
</ul>
</li>
<li><p>1.0</p>
<ul>
<li>made the plugin based on <a href="http://github.com/greggman/hft-unity-gamepad">hft-unity-gamepad</a>
that implements 12 controllers.</li>
</ul>
</li>
<li><p>0.0.7</p>
<ul>
<li>Added <code>maxPlayers</code> to PlayerSpawner</li>
Expand Down
145 changes: 145 additions & 0 deletions docs/unity/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,151 @@
Title: Changelog for Unity Plugin
Description: Changes for Unity Plugin

* 1.2

* Added Export/Install/Publish menu items

* added HFTGamepad.BUTTON_TOUCH for whether or not the user is touching the screen
on the orientation and touch controllers.

* added ability to play sound through controller

There are currently 2 ways to make sounds for the controllers.

1. JSFX

This is the recommended way as it's light weight.

1. Go to the [JSFX sound maker](http://egonelbre.com/project/jsfx/).

2. Adjust the values until you get a sound you like.

3. Copy the sound values (near top of the page just below the buttons) to a text file with the extension ".jsfx.txt"
putting a name in front of each set of values. Save that file in Assets/WebPlayerTemplates/HappyFunTimes

For example here is the sample `sounds.jsfx.txt` file

coin ["square",0.0000,0.4000,0.0000,0.0240,0.4080,0.3480,20.0000,909.0000,2400.0000,0.0000,0.0000,0.0000,0.0100,0.0003,0.0000,0.2540,0.1090,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
jump ["square",0.0000,0.4000,0.0000,0.0960,0.0000,0.1720,20.0000,245.0000,2400.0000,0.3500,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.5000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
coinland ["square",0.0000,0.4000,0.0000,0.0520,0.3870,0.1160,20.0000,1050.0000,2400.0000,0.0000,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
bonkhead ["sine",0.0000,0.4000,0.0000,0.0000,0.5070,0.1400,20.0000,1029.0000,2400.0000,-0.7340,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.3780,0.0960,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
land ["sine",0.0000,0.4000,0.0000,0.1960,0.0000,0.1740,20.0000,1012.0000,2400.0000,-0.7340,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.3780,0.0960,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
kicked ["noise",0.0000,1.0000,0.0000,0.0400,0.0000,0.2320,20.0000,822.0000,2400.0000,-0.6960,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0270,0.0000]
dropkick ["sine",0.0000,1.0000,0.0000,0.0880,0.0000,0.3680,20.0000,653.0000,2400.0000,0.2360,0.0000,0.1390,47.1842,0.9623,-0.4280,0.0000,0.0000,0.4725,0.0000,0.0000,-0.0060,-0.0260,1.0000,0.0000,0.0000,0.0000,0.0000]
bounce ["noise",0.0000,1.0000,0.0000,0.0220,0.0000,0.1480,20.0000,309.0000,2400.0000,-0.3300,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]

2. Use sounds files

Put sound files (`.mp3` or `.wav`) in `Assets/WebPlayerTemplates/HappyFunTimes/sounds`
They have to be in there because they must be served to the phone. Note that it's a
good idea to keep them as small as possible because each time a player connects to
the game his phone will have to download all the sounds. JSFX sounds comming soon.

## Playing Sounds

To use the sounds, on some global gameobject (like LevelManager in all the samples)
add an `HFTGlobalSoundHelper` script component.

Then, on the prefab that gets spawned for your players, the same prefab you put
an `HFTInput` or `HFTGamepad` script component add the `HFTSoundPlayer` script
component.

In your `Awake` or `Start` look it up

private HFTSoundPlayer m_soundPlayer;

void Awake()
{
m_soundPlayer = GetComponent<HFTSoundPlayer>();
}

To play a sound call `m_soundPlayer.PlaySound` with the name of the sound (no extension).
In other words if you have `sounds/explosion.mp3` then you can trigger that sound on
the user's phone with

m_soundPlayer.PlaySound("explosion");

Or if you named a JSFX sound like

bounce ["noise",0.0000,1.0000,0.0000,0.0220,0.0000,0.1480,20.0000,309.0000,2400.0000,-0.3300,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]

Then

m_soundPlayer.PlaySound("bounce");


* added mulit-touch support to HFTInput via the standard `GetTouch` function
as well as `axes` and `buttons`

public const int AXIS_TOUCH0_X = 13;
public const int AXIS_TOUCH0_Y = 14;
public const int AXIS_TOUCH1_X = 15;
public const int AXIS_TOUCH1_Y = 16;
public const int AXIS_TOUCH2_X = 17;
public const int AXIS_TOUCH2_Y = 18;
public const int AXIS_TOUCH3_X = 19;
public const int AXIS_TOUCH3_Y = 20;
public const int AXIS_TOUCH4_X = 21;
public const int AXIS_TOUCH4_Y = 22;
public const int AXIS_TOUCH5_X = 23;
public const int AXIS_TOUCH5_Y = 24;
public const int AXIS_TOUCH6_X = 25;
public const int AXIS_TOUCH6_Y = 26;
public const int AXIS_TOUCH7_X = 27;
public const int AXIS_TOUCH7_Y = 28;
public const int AXIS_TOUCH8_X = 29;
public const int AXIS_TOUCH8_Y = 30;
public const int AXIS_TOUCH9_X = 31;
public const int AXIS_TOUCH9_Y = 32;

public const int BUTTON_TOUCH0 = 18;
public const int BUTTON_TOUCH1 = 19;
public const int BUTTON_TOUCH2 = 20;
public const int BUTTON_TOUCH3 = 21;
public const int BUTTON_TOUCH4 = 22;
public const int BUTTON_TOUCH5 = 23;
public const int BUTTON_TOUCH6 = 24;
public const int BUTTON_TOUCH7 = 25;
public const int BUTTON_TOUCH8 = 26;
public const int BUTTON_TOUCH9 = 27;

Note: The Touch.rawPosition is currently in screen pixels of Unity
not the controller. It's not clear what the best way to handle this
is.

The Unity `Input` API says those value are in pixels but they are
assuming the game is running on the phone. In the case of HappyFunTimes
though each phone is different so having it be in phone screen pixels
would make no sense unless you also knew the resolution of each phone.
I could provide that but that would make it more complicated for you.

Personally I'd prefer normalized values (0.0 to 1.0). If you want those
then take `Touch.rawPosition` and divide `x` by `Screen.width` and `y` by `Screen.height`
as in

HFTInput.Touch touch = m_hftInput.GetTouch(0);
float normalizedX = touch.x / Screen.width;
float normalziedY = touch.y / Screen.height;

Also note the AXIS versions of these are already normalized to
a -1.0 to +1.0 range.

* Changed sample HFTGamepad code to not issue an error if it's not actually
connected to a controller.

Users often leave a prefab in their scene. That prefab would generate
errors because it's not actually connected to a controller and was
trying to access the controllers `NetPlayer`.

* 1.1

* Moved samples into samples folder

* 1.0

* made the plugin based on [hft-unity-gamepad](http://github.com/greggman/hft-unity-gamepad)
that implements 12 controllers.

* 0.0.7

* Added `maxPlayers` to PlayerSpawner
Expand Down
22 changes: 11 additions & 11 deletions todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,6 @@ To Do
* download
* export
* run
* Export in Unity
* why textarea is not big for description?
* If install make it say "install"
* If install select platform and hide platform choices
* Make install and platform expanded by default
* (remove install check. Its' confusing)
* make semver editor?
* Check when installing game appears in /games.html
* progress?
* check package.json gets saved
* make prefab in scene not generate errors
* remove upgrade warning with install --upgrade. change to "upgrading ...."
* add "touch to start" on android (and iOS?) both sound and fullscreen can be added
* make unity provide files for controller
Expand Down Expand Up @@ -922,6 +911,17 @@ Runs Repo noid
Done
====

* Export in Unity
* why textarea is not big for description?
* If install make it say "install"
* If install select platform and hide platform choices
* Make install and platform expanded by default
* (remove install check. Its' confusing)
* make semver editor?
* Check when installing game appears in /games.html
* progress?
* check package.json gets saved
* make prefab in scene not generate errors
* fix HFT not noticing new game installed/removed
* keep backups of installed-games
* make unity input tester
Expand Down

0 comments on commit 2dd7964

Please sign in to comment.