<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:iweb="http://www.apple.com/iweb" version="2.0">
  <channel>
    <title></title>
    <link>http://www.scatterbrain.cc/i/DevBlog/DevBlog.html</link>
    <description> </description>
    <generator>iWeb 3.0.1</generator>
    <item>
      <title>SBPreferences&#13;</title>
      <link>http://www.scatterbrain.cc/i/DevBlog/Entries/2010/2/3_SBPreferences.html</link>
      <guid isPermaLink="false">d5333f45-84e3-48d1-8b6e-47646dcf8c47</guid>
      <pubDate>Wed, 3 Feb 2010 11:22:25 -0500</pubDate>
      <description>&lt;a href=&quot;http://www.scatterbrain.cc/i/DevBlog/Entries/2010/2/3_SBPreferences_files/ScatterBrainCC_Code.png&quot;&gt;&lt;img src=&quot;http://www.scatterbrain.cc/i/DevBlog/Media/object003_1.png&quot; style=&quot;float:left; padding-right:10px; padding-bottom:10px; width:117px; height:94px;&quot;/&gt;&lt;/a&gt;I’ve just started working on a project and one of the wishes was that every variable in the game was mutable.  Not only that, but also that everyone in the group could share their values with each other without having to send manually enter in each others values.  Initially, I started with GameObjects that could spit out a carat delimited string of themselves that I would store in a database. That solution lasted about 2 hours before coming up with something a little bit cooler. Cool enough that I wanted to share.&lt;br/&gt;&lt;br/&gt;SBPreferences behaves identically to PlayerPrefs, but with four additional functions: ReadyPreferences (), ReadyPreferencesCoroutine (), WritePreferences (), WritePreferencesCoroutine ().  All functions take a string; the name of the dictionary. SBPreferences also has two accessors: Status and Message to find out what’s happening with your read/write request.&lt;br/&gt;&lt;br/&gt;It should be pointed out that with any call to one of the standard PlayerPref functions (i.e. SBPreferences.SetString(“key”,”value”);), SBPreferences behaves like a standard dictionary. SBPreferences is not (yet) realtime unfortunately, so you are only read/writing the database when you make a call to Ready/WritePreferences().&lt;br/&gt;&lt;br/&gt;Here’s is the sample code (sorry in advance for my shameless logo placement): &lt;a href=&quot;http://scatterbrain.cc/UnityBuilds/SBPreferences.zip&quot;&gt;SBPreferences.zip&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;There is a PHP that I use on the server-side (feel free to use) and three C# scripts:&lt;br/&gt;	-	SBPreferences.cs is where it all happens. Dig in and modify. I’m thinking about adding passwords to each dictionary.&lt;br/&gt;	-	SBPreferencesGUI.cs is a quick GUI to demonstrate the dictionary. As a quick test. Run it, change a key value and click write database. Then stop and restart the game. Your value should remain. The example can be demonstrated with PlayerPrefs, but if you have an extra computer laying around, you’ll see your changes propagate there too.&lt;br/&gt;	-	SBGC.cs is a GameObject I put in every project of mine. It is important here because its MonoBehaviour is used to run the coroutines of the static SBPreferences.cs class; search “StartCoroutine” in SBPreferences.cs to see what I mean It is also important that you set the tag on GameObject with SBGC on it to “GameController”&lt;br/&gt;Click Play, try it out as it is connected to a sample database (be warned I might clear values), and start looking at the scripts to figure it out.  Any questions/suggestions: &lt;a href=&quot;mailto:greg@scatterbrain.cc?subject=SBPreferences/&quot;&gt;greg@scatterbrain.cc&lt;/a&gt;&lt;br/&gt;</description>
      <enclosure url="http://www.scatterbrain.cc/i/DevBlog/Entries/2010/2/3_SBPreferences_files/ScatterBrainCC_Code.png" length="213537" type="image/png"/>
    </item>
    <item>
      <title>Unity Networking Revisited</title>
      <link>http://www.scatterbrain.cc/i/DevBlog/Entries/2010/1/7_Unity_Networking_Revisited.html</link>
      <guid isPermaLink="false">722ac4b3-97b6-4b1b-b234-4bbb4251fe43</guid>
      <pubDate>Thu, 7 Jan 2010 17:55:52 -0500</pubDate>
      <description>&lt;a href=&quot;http://www.scatterbrain.cc/i/DevBlog/Entries/2010/1/7_Unity_Networking_Revisited_files/BlockTanks.jpg&quot;&gt;&lt;img src=&quot;http://www.scatterbrain.cc/i/DevBlog/Media/object000_1.jpg&quot; style=&quot;float:left; padding-right:10px; padding-bottom:10px; width:120px; height:90px;&quot;/&gt;&lt;/a&gt;Busy Busy.  I’m between projects and I’ve come back to revisit my networking endeavor with Unity.  First, I’m glad to discover that I’m not crazy: &lt;a href=&quot;http://forum.unity3d.com/viewtopic.php?t=35724&quot;&gt;Unity's networking is not functional&lt;/a&gt;.&lt;br/&gt;I’ve wrapped and debugged and wrapped the code some more, so everything works with only minor hiccups.  The code is all very base-case.  I only have two computers, so that’s all I can test with.  I also spent some time making the library reusable, so perhaps I might find the courage to post my code.&lt;br/&gt;&lt;br/&gt;So on that topic, new &lt;a href=&quot;../Game_Tanks.html&quot;&gt;PaperTanks&lt;/a&gt; is up.  As I haven’t touched the code in a while, some pieces had to be dropped so I could focus on the networking aspect.  It needs one more weekend of beating on.  Hopefully, my other projects stay quiet enough.&lt;br/&gt;&lt;br/&gt;BugLander3D got dropped since last I wrote.  It just wasn’t working out and I couldn’t make it look as good as I wanted.</description>
      <enclosure url="http://www.scatterbrain.cc/i/DevBlog/Entries/2010/1/7_Unity_Networking_Revisited_files/BlockTanks.jpg" length="19432" type="image/jpeg"/>
    </item>
  </channel>
</rss>

