<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>Currently developing Legacy of a Warlord. A graphical tile rogue like game. This blog is about my foray into C++ programming.</description><title>Will Blog</title><generator>Tumblr (3.0; @willraman)</generator><link>http://willraman.tumblr.com/</link><item><title>It’s been awhile since I posted. I hope you all are doing...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_m5wfd5njso1qf38cko1_500.png"/&gt;&lt;br/&gt; Desert at night&lt;br/&gt;&lt;br/&gt; &lt;img src="http://24.media.tumblr.com/tumblr_m5wfd5njso1qf38cko2_500.png"/&gt;&lt;br/&gt; Forest at night&lt;br/&gt;&lt;br/&gt; &lt;p&gt;It’s been awhile since I posted. I hope you all are doing well.&lt;/p&gt;
&lt;p&gt;If anyone is curious if I fell off the world or vaporwared, not yet. I adapted and pushed sideways into C#.&lt;/p&gt;
&lt;p&gt;Oh and I found a programming job! With this new job I transitioned into a C# development position. Started out as a Software Analyst creating wireframes and visio documentation and saw an opening for programming and applied. &lt;/p&gt;
&lt;p&gt;I am working on the next iteration of my game design hobby. C#, XNA 4.0 refresh and only a fraction of the effort it took in C++ I made this. &lt;/p&gt;</description><link>http://willraman.tumblr.com/post/25486074966</link><guid>http://willraman.tumblr.com/post/25486074966</guid><pubDate>Tue, 19 Jun 2012 21:37:40 -0700</pubDate></item><item><title>I finished character selection today. Here are some shots.
The...</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_m0rlqcjHz21qf38cko1_500.png"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://25.media.tumblr.com/tumblr_m0rlqcjHz21qf38cko2_500.png"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://25.media.tumblr.com/tumblr_m0rlqcjHz21qf38cko3_500.png"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://25.media.tumblr.com/tumblr_m0rlqcjHz21qf38cko4_500.png"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://24.media.tumblr.com/tumblr_m0rlqcjHz21qf38cko5_500.png"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://24.media.tumblr.com/tumblr_m0rlqcjHz21qf38cko6_500.png"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://24.media.tumblr.com/tumblr_m0rlqcjHz21qf38cko9_r3_500.png"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;p&gt;I finished character selection today. Here are some shots.&lt;/p&gt;
&lt;p&gt;The server sends authorized playable characters to the client, the client then loads the resources from the shared Sqlite3 db file and tileset. TCODlib renders the result.&lt;/p&gt;
&lt;p&gt;Might be another week before I post the server application as freeware. Want to at least have it generate a world and let players run around on it and talk.&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/19173987010</link><guid>http://willraman.tumblr.com/post/19173987010</guid><pubDate>Mon, 12 Mar 2012 02:25:57 -0700</pubDate><category>pictures</category><category>roguelike</category><category>game development</category><category>tileset</category></item><item><title>Snapshots</title><description>&lt;p&gt;I found a highly effective way of taking automatic snapshots. I used Gadwin printscreen, and an AutoIT script I wrote. Gadwin was configured to dump screenshots in a snaps directory and not prompt.&lt;/p&gt;
&lt;p&gt;AutoIT script. alt-esc toggles pause, and shift-esc turns off the script.&lt;/p&gt;
&lt;pre&gt;
Global $UnPaused
HotKeySet("!{ESC}", "TogglePause")
HotKeySet("+{ESC}", "Terminate")

While 1
    Sleep(100)
WEnd

Func TogglePause()
    $UnPaused = NOT $UnPaused
    if($UnPaused) then
       ToolTip("Capture on.",0,0)
    else
       ToolTip("Capture paused.",0,0)
   EndIf
    While $UnPaused
        Send("{PRINTSCREEN}")
        Sleep(5000)
WEnd
EndFunc

Func Terminate()
    Exit 0
EndFunc

&lt;/pre&gt;</description><link>http://willraman.tumblr.com/post/19130868375</link><guid>http://willraman.tumblr.com/post/19130868375</guid><pubDate>Sun, 11 Mar 2012 11:45:00 -0700</pubDate><category>snapshot</category><category>autoit</category></item><item><title>Had an hour an a half to code today and put in Sqlite3 data read...</title><description>&lt;iframe width="400" height="300" src="http://www.youtube.com/embed/VuXzjpCgiZ4?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Had an hour an a half to code today and put in Sqlite3 data read for entities and an ini file reader. Enjoy the movie.&lt;/p&gt;
&lt;p&gt;I love to code.&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/19098257132</link><guid>http://willraman.tumblr.com/post/19098257132</guid><pubDate>Sat, 10 Mar 2012 19:39:19 -0800</pubDate></item><item><title>Legacy of a Warlord - Client</title><description>&lt;a href="https://bitbucket.org/willraman/legacy-of-a-warlord-client"&gt;Legacy of a Warlord - Client&lt;/a&gt;: &lt;p&gt;I’ve posted the client part of the legacy of a warlord multiplayer game on bitbucket. &lt;a href="https://bitbucket.org/willraman/legacy-of-a-warlord-client" target="_blank"&gt;https://bitbucket.org/willraman/legacy-of-a-warlord-client&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It is still pretty rough around the edges but it is shaping up nicely.&lt;/p&gt;
&lt;p&gt;Soon as the client can connect with the server in a more robust fashion (character creation finished). I’ll post the server application to &lt;a href="http://www.legacyofawarlord.com" target="_blank"&gt;http://www.legacyofawarlord.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Will&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/18984210984</link><guid>http://willraman.tumblr.com/post/18984210984</guid><pubDate>Thu, 08 Mar 2012 19:11:40 -0800</pubDate><category>bitbucket</category><category>c++</category><category>libtcod</category><category>legacy of a warlord</category></item><item><title>Quick and Easy budget 1.0</title><description>&lt;a href="https://bitbucket.org/willraman/quick-and-easy-budget"&gt;Quick and Easy budget 1.0&lt;/a&gt;: &lt;p&gt;I posted my new PHP budgeting app. Has a long way to go but it is a good start. Already immensely useful for me.&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/18622234674</link><guid>http://willraman.tumblr.com/post/18622234674</guid><pubDate>Fri, 02 Mar 2012 13:45:44 -0800</pubDate><category>PHP</category><category>programming</category><category>GitHub</category><category>Budget</category></item><item><title>A name and todo for version 1</title><description>&lt;p&gt;I figured I will call this Quick and Easy budget (PHP). The license I decided on will be AGPL .&lt;/p&gt;
&lt;p&gt;I added some date controls and am now trusting my budget to it. I&amp;#8217;m not going to give something away unless I dogfood it. :)&lt;/p&gt;
&lt;p&gt;Todo list for version 1.0, maybe one more week.&lt;br/&gt;&lt;br/&gt;major:&lt;br/&gt;1. Database manager tab&lt;/p&gt;
&lt;ul&gt;&lt;li&gt; Add/remove tags (default seems to cover everything, but maybe it is too much or not enough?)&lt;/li&gt;
&lt;li&gt; Database cleaning(vacuum), dropping tables (ajax via PHP auto creates any missing table), direct downloading database for backup.&lt;/li&gt;
&lt;li&gt; Specify database location.&lt;/li&gt;
&lt;li&gt; Import CSV file to payments table. File format(duedate,info,tag,budget,amount)&lt;/li&gt;
&lt;li&gt; Import XML file to payments table. File format(&amp;lt;xml&amp;gt;&amp;lt;row&amp;gt;&amp;lt;duedate&amp;gt;data&amp;lt;/duedate&amp;gt;&amp;lt;info&amp;gt;data&amp;lt;/info&amp;gt;&amp;#8230;&amp;lt;/row&amp;gt;&amp;lt;row&amp;gt;&amp;#8230;&amp;lt;/row&amp;gt;&amp;lt;/xml&amp;gt;)&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;2. Line chart graph - Showing 3 plots, actual amount, budget amount and income. Maybe even a volume graph. Expenses fills up a volume of the income display. Not sure yet.&lt;br/&gt;&lt;br/&gt;3. 3d pie chart for income vs. expense button added to current chart control.&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;4. Arrow moves view in month range (instead of just one month). If a difference in months is detected that is greater than 1. Every next arrow or previous arrow click increases months by that amount. This should give me the speed of navigation I want.&lt;br/&gt;&lt;br/&gt;5. A spreadsheet report dump for tags and amount for the time period specified. Also an optional dump to PDF. I found a nice open source PDF exporter.&lt;/p&gt;
&lt;p&gt;And a few minor fixes and code cleanup.&lt;/p&gt;
&lt;p&gt;Version 0.9.1:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lzithtmexk1qeqgzx.png"/&gt;&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/17752717784</link><guid>http://willraman.tumblr.com/post/17752717784</guid><pubDate>Thu, 16 Feb 2012 20:59:52 -0800</pubDate><category>budget</category><category>php</category><category>web</category><category>application</category><category>easy</category></item><item><title>About a week ago I looked at my billing/budgeting spreadsheet...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_lzembv9raT1qf38cko1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;About a week ago I looked at my billing/budgeting spreadsheet and it is completely overwhelming and unorganized.&lt;/p&gt;
&lt;p&gt;I decided I need to better my web programming and database skills so I created a simple budgeting web page tool. It runs on PHP, ajax, and CSS3. The database is SQLite3. This is actually a perfect database for such a small app.&lt;/p&gt;
&lt;p&gt;Here is a picture of version 0.9. When I finish this I will post 2 versions. A full application with apache/PHP engine zipped up. Also the PHP code by itself.&lt;/p&gt;
&lt;p&gt;Probably licensed on LGPL.&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/17623709345</link><guid>http://willraman.tumblr.com/post/17623709345</guid><pubDate>Tue, 14 Feb 2012 14:26:19 -0800</pubDate><category>PHP</category><category>CSS</category><category>budget</category><category>programming</category></item><item><title>A new language to learn</title><description>&lt;p&gt;Now this is interesting. If google continues to dominate the market, this might be the next language I decide to learn.&lt;/p&gt;
&lt;p&gt;Dart - &lt;a href="http://www.dartlang.org/" target="_blank"&gt;http://www.dartlang.org/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Language spec - &lt;a href="http://www.dartlang.org/docs/spec/dartLangSpec.pdf" target="_blank"&gt;http://www.dartlang.org/docs/spec/dartLangSpec.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I think i&amp;#8217;ll give it a shot. I&amp;#8217;ve been playing with PHP lately and writing a simple web game text hack for the legacyofawarlord.com site. I&amp;#8217;ll try this dart thing for the client side communications using dart.&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/12934468078</link><guid>http://willraman.tumblr.com/post/12934468078</guid><pubDate>Thu, 17 Nov 2011 12:17:47 -0800</pubDate></item><item><title>Popularity of Programming language</title><description>&lt;p&gt;Found this in my wanders on the internet.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://langpop.com/" target="_blank"&gt;http://langpop.com/&lt;/a&gt;&lt;br/&gt;&lt;a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html" target="_blank"&gt;http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Looks like C and C++ will be around a long time.&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/12864625566</link><guid>http://willraman.tumblr.com/post/12864625566</guid><pubDate>Tue, 15 Nov 2011 18:41:23 -0800</pubDate></item><item><title>A game update</title><description>&lt;p&gt;A couple nights ago I got the UDP server  working. I took the code from another project I worked on (encrypted UDP client/server), broke apart all the  modules that made up legacy of a warlord, finally took the code from the tile memory manager project and squished them all together into 2 parts server/client.&lt;/p&gt;
&lt;p&gt;The server currently handles:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Client session management&lt;/li&gt;
&lt;li&gt;Packet encryption between client/server&lt;/li&gt;
&lt;li&gt;Processing client event requests (after determining if it is valid) &lt;/li&gt;
&lt;li&gt;Multiple threads: client session manager and network thread (non-blocking UDP)&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;The client handles:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Display of tiles&lt;/li&gt;
&lt;li&gt;User input&lt;/li&gt;
&lt;li&gt;Sending event requests to the server (very simple commands like, &amp;lt;request move left&amp;gt;)&lt;/li&gt;
&lt;li&gt;Processing packets based on server encryption key.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Moving  forward now by adding in more modules from legacy of a warlord for the server. Next is  the XML files for entities (mobs.xml). I decided I will split this file  in half. Tiles/Ascii displayed will be controlled by the client. All the  AI/attributes will be stored in the server.&lt;/p&gt;
&lt;p&gt;I hope to have a release of the client up by Christmas and a server running somewhere on the internet. I think this time I will also try to have a linux release of the client. I really respect that community and like that OS.&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/12358399268</link><guid>http://willraman.tumblr.com/post/12358399268</guid><pubDate>Fri, 04 Nov 2011 22:02:06 -0700</pubDate><category>udp server</category><category>moddable</category></item><item><title>I use Mercurial </title><description>&lt;p&gt;I&amp;#8217;ve used subversion and tortoise SVN (as the client) to control my source code. I find it absolutely necessary when I break something to be able to diff my code and figure out what was the wrong path.&lt;/p&gt;
&lt;p&gt;When LIBTCOD maintainers changed to mercurial I decided to do the same. I am very well pleased with the change myself. It was easy enough to import my SVN into the mercurial server and Tortoise HG makes it a snap to compare, merge and diff versions.&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/12330311165</link><guid>http://willraman.tumblr.com/post/12330311165</guid><pubDate>Fri, 04 Nov 2011 10:07:44 -0700</pubDate><category>source control</category></item><item><title>Favorite STL container types c++</title><description>&lt;p&gt;In the past week of coding/testing/profiling. I touched a few of the different STL container types.&lt;/p&gt;
&lt;p&gt;Here is what I think about them:&lt;/p&gt;
&lt;p&gt;1. STD::Vector. My favorite. Much like a standard c array, yet with a lot of methods attached to it. It is very quick. The ability to reserve space makes it absolutely effective in reducing memory bloat also saves me from having to manage the malloc/calloc/free.&lt;/p&gt;
&lt;p&gt;2. STD::TR1::Unordered_Map. I use this on the HashNodesClass (branch object) storage, with only 40k - 100k keys it does a great job and is pretty fast. Seems to do a pretty good job managing it&amp;#8217;s memory bloat and is pretty quick on lookups. I originally tried to use this as containers for tiles but wasn&amp;#8217;t fast enough and the bloat was almost as bad as a std::map.&lt;/p&gt;
&lt;p&gt;3. STD::Queue. I was playing with the idea of adding a cache method inside of the HashNodesClass class. Yet after a day of programming and testing, I found just using the random access method HashNodesClass::get was still quicker then going through the caching logic (even compared to a best case scenario of 100% cache hit rate on sequential reads). The checking of Queue.empty(), Queue.pop() and destructor of a std::pair&amp;lt;bool, unsigned int&amp;gt; all added up to 2 seconds for 20 million calls. Queue is pretty nice for its FIFO. I think if I were to play with caching again, I would try a STD::DeQueue (double ended queue).&lt;/p&gt;
&lt;p&gt;4. Std::Map. For it&amp;#8217;s ease of use and automatic clean up,indexing, sorting, it is the dull swiss army knife of C++ type storage. It&amp;#8217;s great for anything that doesn&amp;#8217;t require a LOT of data in it and require fast lookups. I learned a useful tidbit to avoid. Nested maps are insanely slow on deconstruction.&lt;/p&gt;
&lt;p&gt;In closing, of the C++ STL types, the vector speed wins (if you can effectively access the index). Map is easier to manage. Unordered_map(hash_map) seems to fall squarely in the middle. Every tool has its purpose and I now have a slightly better understanding of them.&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/11242514521</link><guid>http://willraman.tumblr.com/post/11242514521</guid><pubDate>Sun, 09 Oct 2011 13:58:46 -0700</pubDate><category>c++</category><category>STL</category><category>programming</category></item><item><title>Previous posts picture. Full size. An OpenGL raw pixel display...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_lsql8k3ubM1qf38cko1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Previous posts picture. Full size. An OpenGL raw pixel display visual of my new c++ sparse data storage class.&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/11174010095</link><guid>http://willraman.tumblr.com/post/11174010095</guid><pubDate>Sat, 08 Oct 2011 00:38:44 -0700</pubDate><category>photo</category></item><item><title>Finally, testing complete</title><description>&lt;p&gt;I&amp;#8217;m pretty satisfied with the results. I&amp;#8217;m ready to move forward now that my sparse tile storage class is complete. I even took a few days to have some fun programming OpenGL on SDL. Attached is a picture of the pixel dump into a texture then displayed via a call to glTexSubImage2d.&lt;code&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt; &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;As you can see there is no visual loss of data from the original picture. This is a visual representation of the data stored in HashNodes class. A pixel represents either a root node, branch node or uncompressed tile.&lt;/p&gt;
&lt;p&gt;Both of the below test applications used an abstract function (GetMapTile) to call an underlying data structure. I made sure both were using stack assigned variables.&lt;/p&gt;
&lt;p&gt;Maybe I should make a lib out of it and post it on github or something.&lt;br/&gt;&lt;br/&gt;gprof results&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;std::map&lt;/strong&gt;&lt;br/&gt;name: GetMapTile(unsigned int, unsigned int)&lt;br/&gt;[rank]time%    self    children    called&lt;br/&gt;[2]    79.2     0.12    10.08        20,160,000        &lt;br/&gt;&lt;br/&gt;Core search lookup implementation&lt;br/&gt;name: std::map&amp;lt;unsigned int,tilemap::Tile&amp;gt;(&amp;#8230;)::find()&lt;br/&gt;[rank]time%    self    children    called&lt;br/&gt;[4]    77.2    0.03    9.92        20,160,000&lt;br/&gt;&lt;br/&gt;            VS.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Will&amp;#8217;s hash algorithm (WHA).&lt;/strong&gt;&lt;br/&gt;name: GetMapTile(unsigned int, unsigned int)&lt;br/&gt;[rank]time%    self    children    called  &lt;br/&gt;[4]     42.0      0.33      6.14    20,160,000         &lt;br/&gt;&lt;br/&gt;Core search lookup implementation&lt;br/&gt;name: BinarySearch(std::vector&amp;lt;unsigned int, std::allocator&amp;lt;unsigned int&amp;gt; &amp;gt; const&amp;amp;, int, int, unsigned int)&lt;br/&gt;[rank]time%    self    children    called(+ recursive)&lt;br/&gt;[9]    18.2      2.52    0.58      11390744 (+75491000)&lt;br/&gt;&lt;br/&gt;Total Speed:   &lt;br/&gt;std::map (10.20 seconds) / WHA ( 6.47 seconds ) = WHA 40% faster.&lt;br/&gt;&lt;br/&gt;Memory storage: &lt;br/&gt;&lt;br/&gt;***         Compression Test Results      ***&lt;br/&gt;&lt;br/&gt;Control struture: (std::map)&lt;br/&gt;  Size dimension: x=8400 y=2400&lt;br/&gt;  Total tile count:20160000&lt;br/&gt;  Size (MB):230&lt;br/&gt;  Map overhead (MB):400 (had to observe in process explorer)&lt;br/&gt;  Total memory (MB): 630&lt;/p&gt;
&lt;p&gt;Branches structure: (WHA)&lt;br/&gt;  Size dimension (both x&amp;amp;y):20&lt;br/&gt;  Branches count:40470&lt;br/&gt;  Total tile count:6676135&lt;br/&gt;  Branches overhead (KB):2529&amp;#160;&lt;br/&gt;  Size (MB):76&lt;br/&gt;  Total Size (MB):79&amp;#160;&lt;br/&gt;&lt;br/&gt;Total Compression/Memory efficiency = WHA has 87% smaller memory use&lt;img src="http://media.tumblr.com/tumblr_lsqkljWm9l1qeqgzx.png"/&gt;.&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/11173929424</link><guid>http://willraman.tumblr.com/post/11173929424</guid><pubDate>Sat, 08 Oct 2011 00:33:31 -0700</pubDate><category>memory tile engine</category><category>testing</category><category>opengl</category><category>picture</category></item><item><title>1st data structure profile</title><description>&lt;p&gt;Not as bad as I thought. Looking at the profiled data the biggest consumer of time is my UN-optimized use of SDL. The last entry on this list is the most promising that I am on the right track, 27,000,000 calls and tile retrievals from the data structure only took 0.12 of a second.&lt;/p&gt;
&lt;p&gt;  %   cumulative   self         self      total           &lt;br/&gt; time   seconds   seconds    calls  ms/call  ms/call  name &amp;lt;Comment&amp;gt;&lt;/p&gt;
&lt;p&gt;35.00      6.43      6.43       UNK                         inflateMark &amp;lt;SDL/DLL&amp;gt;&lt;/p&gt;
&lt;p&gt;17.15      9.58     3.15     UNK                            inflateUndermine &amp;lt;SDL/DLL&amp;gt;&lt;/p&gt;
&lt;p&gt;13.12     11.99     2.41    UNK                            pqdownheap &amp;lt;SDL/DLL&amp;gt;&lt;/p&gt;
&lt;p&gt;3.48     12.63     0.64     UNK                        UM::Branch::GetSize()&amp;lt;stats info&amp;gt;&lt;/p&gt;
&lt;p&gt;2.99     13.18     0.55&amp;#160;109967520  0.00    0.00  __mingw_pformat &amp;lt;sloppy&amp;gt;&lt;/p&gt;
&lt;p&gt;2.78     13.69     0.51    UNK     __static_initialization_and_destruction_0(int, int)&lt;/p&gt;
&lt;p&gt;2.78     14.20     0.51    UNK                              inflateCopy &amp;lt;SDL/DLL/Zlib?&amp;gt;&lt;/p&gt;
&lt;p&gt;2.50     14.66     0.46&amp;#160;69600015    0.00    0.00  __gdtoa &amp;lt;too many types&amp;gt;&lt;/p&gt;
&lt;p&gt;1.47     14.93     0.27&amp;#160;103947170  0.00    0.00  void std::vector&amp;lt;unsigned int*, std::allocator&amp;lt;unsigned int*&amp;gt; &amp;gt;::_M_insert_aux&amp;lt;unsigned int*&amp;gt;(__gnu_cxx::__normal_iterator&amp;lt;unsigned int**, std::vector&amp;lt;unsigned int*, std::allocator&amp;lt;unsigned int*&amp;gt; &amp;gt; &amp;gt;, unsigned int*&amp;amp;&amp;amp;) &amp;lt;creating the worldmap&lt;/p&gt;
&lt;p&gt;0.63     16.32     0.12&amp;#160;&lt;strong&gt;27569449&lt;/strong&gt;     0.00     0.00  UM::Branch::GetTile(unsigned char, unsigned char) &amp;lt;WOOT! Getting a tile is QUICK&amp;gt;&lt;/p&gt;
&lt;p&gt;There are a few 0.5 second entries I can reduce with optimizing (I was sloppy). &lt;/p&gt;</description><link>http://willraman.tumblr.com/post/10952680953</link><guid>http://willraman.tumblr.com/post/10952680953</guid><pubDate>Sun, 02 Oct 2011 14:54:44 -0700</pubDate></item><item><title>The hash storage class</title><description>&lt;p&gt;I figured I&amp;#8217;d share the storage class I&amp;#8217;m using now. Little bit more overhead (2mb more overall) for 6 million tiles. Yet look ups are quicker. Total tiles size in memory is 86 mb (including bloat).&lt;/p&gt;
&lt;p&gt;This class has a derived logic class as a higher layer in the program to act as an intermediary between data and SDL pixel drawing functions.&lt;/p&gt;
&lt;p&gt;// HashNodeClass.hpp&lt;/p&gt;
&lt;p&gt;class HashNodes&lt;br/&gt;{&lt;br/&gt;    private:&lt;br/&gt;        Sint32 p2b;&lt;br/&gt;        Uint32 count;&lt;br/&gt;        Sint32 idlookup;&lt;br/&gt;        void resize(void);&lt;br/&gt;        Sint32 const getIndex( Uint32 const &amp;amp; hashlookup  );&lt;br/&gt;&lt;br/&gt;        std::vector&amp;lt;Tile&amp;gt; TileEntry;&lt;br/&gt;        std::vector&amp;lt;Uint32&amp;gt; Hash; // find on hash, get o(1) lookup on tile.&lt;br/&gt;        std::vector&amp;lt;Sint8&amp;gt; HasData; // -1 delete, 0 empty, 1 yes&lt;br/&gt;&lt;br/&gt;    public:&lt;br/&gt;        HashNodes();&lt;br/&gt;        virtual ~HashNodes();&lt;/p&gt;
&lt;p&gt;        bool insert(Tile const &amp;amp; tl,Uint32 const &amp;amp; x , Uint32 const &amp;amp; y );&lt;br/&gt;        bool remove (Uint32 const &amp;amp; hashlookup);&lt;br/&gt;        Uint32 Count(void);&lt;br/&gt;        Tile const * get (Uint32 const &amp;amp; hashlookup)&amp;#160;;&lt;br/&gt;        void SortHash(void);&lt;br/&gt;};&lt;/p&gt;
&lt;p&gt;High level summary:&lt;/p&gt;
&lt;p&gt;1. On creation all 3 vectors are initialized to a power of 2 amount of entries in memory (128 to start with).&lt;br/&gt;2. Insert pushes data onto the stack into each of the 3 vectors simultaneously. These entries are on a parallel index (VERY IMPORTANT). So, Tile[0] will always line up with Hash[0] value.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Tile entry - stores the tile class. Right now it just contains a color value and a few extra bytes to mimic the size of what I saw in Terraria memory format on one of those free server mods.&lt;/li&gt;
&lt;li&gt;Hash - Value of the 1D location of the converted 2D (x,y). Necessary for binary search look ups.&lt;/li&gt;
&lt;li&gt;Has data - This is used by the sort function to erase/ignore or check if data exists for retrieval.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;3. Get() performs a binary search lookup on the sorted array against the hash value vector. When it finds a value that matches the 1d location of the tile requested, it returns the index of where the data was stored. Now the program performs an o(1) constant time look up to retrieve the tile and the hasdata.&lt;/p&gt;
&lt;p&gt;4. Remove() sets values for deletion on the next sort.&lt;/p&gt;
&lt;p&gt;5. SortHash() resorts all 3 vectors based on the hash values and erases any indexes that HasData equals -1.&lt;/p&gt;
&lt;p&gt;6. Resize() - When the index amount on an insert surpasses pow(2,p2b) , it resizes all 3 arrays in memory to the next power of 2. Starting at 128 then 256 then 512. Etc.. For faster lookup on the binary searches.&lt;/p&gt;
&lt;p&gt;Ran using this data structure last night. It takes about 30 seconds to load all 20,000,000 (2400x8400 map) into the same sized RGBA SDL surface for display.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m sure I have some more performance tweaks to make.&lt;/p&gt;
&lt;p&gt;Then onto testing if this is faster then using a std::map.&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/10950665376</link><guid>http://willraman.tumblr.com/post/10950665376</guid><pubDate>Sun, 02 Oct 2011 14:06:00 -0700</pubDate><category>c++</category><category>hashing storage class</category></item><item><title>I’m Close. I wrote up an SDL app to display the data...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_lsfgk2wvbX1qf38cko1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;I’m Close. I wrote up an SDL app to display the data retrieved from the compressed data stored in the tile map class.&lt;/p&gt;
&lt;p&gt;All the water tiles are now lava. Oops. I think this might be an issue with my lack of experience with SDL and I’m reversing the colors displayed but the data is coming out fine. I bet that would be a hard core Terraria world to play. All that lava.&lt;/p&gt;
&lt;p&gt;Soon as I am absolutely sure I am retrieving the data properly I’ll move onto hard core testing. Then post some code. There were a couple zone blocks to the left of the picture that didn’t come out of the bit bucket. I think they were compressed into NULL.&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/10926280010</link><guid>http://willraman.tumblr.com/post/10926280010</guid><pubDate>Sun, 02 Oct 2011 00:24:02 -0700</pubDate><category>programming bug</category><category>picture</category><category>Terraria map</category><category>de-compression</category></item><item><title>Screenshot of a Terraria tile based zone (2400x8400)
I have ...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_lsd3njWkqD1qf38cko1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Screenshot of a Terraria tile based zone (2400x8400)&lt;/p&gt;
&lt;p&gt;I have  spent the past few days designing a tile engine. I want BIG, I mean  maybe an earth sized world to run around on. … But how is that even  possible in a rogue like, you might wonder.&lt;/p&gt;
&lt;p&gt;Roguelike worlds have  space defined as tiles or cubes. I think of a tile being roughly 3 sq  ft (or however you want to interpret it). I just wouldn’t have enough  ram for a 41,849,280 by 41,717,280 tile grid (earth sized). Just the  thought of my windows paging all that space to my hard drive, I think it  would probably melt the hard drive and be done loading a zone in 1  month.&lt;/p&gt;
&lt;p&gt;To tackle this problem I decided develop an algorithm and class that does a few things.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Stores or retrieves tiles from a compact hashed 1-d array.&lt;/li&gt;
&lt;li&gt;Aggregates tile data based on the most common tile found in the branch.&lt;/li&gt;
&lt;li&gt;Erases and consolidates branches to the root node (which is the most common tile in the world structure)&lt;/li&gt;
&lt;li&gt;Re-Aggregates the branch if it has a new most common tile.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Here is a screenshot of a Terraria tile based world I made and imported into a std::map(2400,8400) structure with 20160000 tiles. The map is a test control. It uses about 230 mb + appx 400mb more ram. The +400 is all the map pointer/variable/poor memory allocation/etc… overhead from windows.&lt;/p&gt;
&lt;p&gt;Picture: &lt;a href="http://www.legacyofawarlord.com/images/world1.png" target="_blank"&gt;http://www.legacyofawarlord.com/images/world1.png&lt;/a&gt; (big picture)&lt;/p&gt;
&lt;p&gt;Then, I ran the Tile Aggregator/compressor/sparse memory storage class against it (here is a visualized result) &lt;br/&gt; Picture: &lt;a href="http://www.legacyofawarlord.com/images/cmpout.png" target="_blank"&gt;http://www.legacyofawarlord.com/images/cmpout.png&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Legend: &lt;/strong&gt;&lt;br/&gt; black = tiles not stored in the branch&lt;br/&gt; red = branch has no data, and was removed. dot @ 0,0 of branch.&lt;br/&gt; color tile = data that was not aggregated onto the branch root.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;stdout results:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Generating test control structure: &lt;br/&gt; Control structure generated.&lt;br/&gt; Determining map root tile (most used): &lt;br/&gt;   Compression root set to tile &lt;16777215&gt;&lt;br/&gt;   Generating branches and loading data from image:&lt;br/&gt; …………………………………………… - complete&lt;br/&gt; Saving compressed results picture to cmpout.png&lt;br/&gt;   Image save complete.&lt;br/&gt;&lt;br/&gt; ***         Compression Test Results      ***&lt;br/&gt;&lt;br/&gt; Control struture:&lt;br/&gt;   Size dimension: x=8400 y=2400&lt;br/&gt;   Total tile count:20160000&lt;br/&gt;   Size (MB):230&lt;/p&gt;
&lt;p&gt;Branches structure:&lt;br/&gt;  Size dimension (both x&amp;y):20&lt;br/&gt;  Branches count:40230&lt;br/&gt;  Total tile count:6703849&lt;br/&gt;  Branches overhead (KB):1885&lt;br/&gt;  Size (MB):77&lt;br/&gt;  Total Size (MB):79&lt;br/&gt;&lt;br/&gt;Total Compression = 65%&lt;/p&gt;
&lt;p&gt;The Total compression number is skewed. It doesn’t take into account windows bloated memory on the map structure by 400 mb.&lt;/p&gt;
&lt;p&gt;So,  with that in place, I see no reason I couldn’t generate a 41,849,280 by  41,717,280 tile grid. Just take me awhile to populate it. It’ll be a lot of tweaks and maybe sub branches before I get it that large.&lt;/p&gt;
&lt;p&gt;If you are a developer, you are probably thinking… wow that  must be slow on lookups. My first thought too, then again, 2 - o(1)  lookups and 2 variable comparisons should be much faster then, tile =  map[3000,8000]. Each lookup on that map takes about 7 steps ( o(log n) ).&lt;/p&gt;
&lt;p&gt;I’ll be profiling it after I make a large world and throw a couple million random inserts and retrieval test passes against it. Then test the same against a std::map lookup. I can’t wait to see those results!&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/10868244557</link><guid>http://willraman.tumblr.com/post/10868244557</guid><pubDate>Fri, 30 Sep 2011 17:49:57 -0700</pubDate></item><item><title>Ideas on the games future</title><description>&lt;p&gt;I have branched some of the code to test an idea&amp;#8230; It has something  to do with my recent exploits into UDP programming. Maybe implemented by  0.60.&lt;/p&gt;
&lt;p&gt;Still have some core item/display work to iron out (bug hunting).&lt;/p&gt;
&lt;p&gt;Also really, really want to move into sparse data structure  storage for legacy of a warlord instead of storing every single cell. I have an idea  for storing regions then only track the cells that are different.&lt;/p&gt;</description><link>http://willraman.tumblr.com/post/10170580721</link><guid>http://willraman.tumblr.com/post/10170580721</guid><pubDate>Tue, 13 Sep 2011 12:03:00 -0700</pubDate><category>Ideas</category></item></channel></rss>
