<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DevLog &#187; Processing</title>
	<atom:link href="http://82.30.70.163/BlueThen/wordpress/tag/processing/feed/" rel="self" type="application/rss+xml" />
	<link>http://82.30.70.163/BlueThen/wordpress</link>
	<description></description>
	<lastBuildDate>Mon, 06 Sep 2010 15:24:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Orb</title>
		<link>http://82.30.70.163/BlueThen/wordpress/2010/02/orb/</link>
		<comments>http://82.30.70.163/BlueThen/wordpress/2010/02/orb/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 05:03:45 +0000</pubDate>
		<dc:creator>BlueThen</dc:creator>
				<category><![CDATA[Processing App]]></category>
		<category><![CDATA[circles]]></category>
		<category><![CDATA[depth]]></category>
		<category><![CDATA[depth of view]]></category>
		<category><![CDATA[field of view]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[orb]]></category>
		<category><![CDATA[perception]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[rotate]]></category>
		<category><![CDATA[sphere]]></category>

		<guid isPermaLink="false">http://82.30.70.163/BlueThen/BlueThen/wordpress/?p=253</guid>
		<description><![CDATA[Hey. It&#8217;s been awhile since I&#8217;ve done any math-intensive apps, and I was starting to get a little nervous about &#8220;losing my touch&#8221;. Not to mention, all I&#8217;ve worked on for the past several months is Chase, and the last thing I want is for me to get bored of it. So I something different, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="/BlueThen/wordpress/wp-content/uploads/2010/02/orbCropped.png"><img src="/BlueThen/wordpress/wp-content/uploads/2010/02/orbCropped-184x300.png" width="200" height="325" class="alignleft size-medium wp-image-252"/></a>
<p style="text-indent:20pt; line-height:20pt;">Hey. It&#8217;s been awhile since I&#8217;ve done any math-intensive apps, and I was starting to get a little nervous about &#8220;losing my touch&#8221;. Not to mention, all I&#8217;ve worked on for the past several months is Chase, and the last thing I want is for me to get bored of it. So I something different, and programmed a real quick application of some random effect. I like rotating things in isometric space (who doesn&#8217;t?), and always thought that it&#8217;d be neat to do some sort of depth-of-view thing, so I threw <a href="/processing-apps/orb/">this</a> together.</p>
<p style="text-indent:20pt; line-height:20pt;">I&#8217;ll probably release the source tomorrow (assuming I have time), after optimizing and making it a bit easier to read. Don&#8217;t forget that I have other apps you can watch and get briefly entertained by <a href="/processing-apps/">here</a>, if you&#8217;re ever bored.</p>
 <img src="http://82.30.70.163/BlueThen/wordpress/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=253" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://82.30.70.163/BlueThen/wordpress/2010/02/orb/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Day 9</title>
		<link>http://82.30.70.163/BlueThen/wordpress/2010/01/day-9/</link>
		<comments>http://82.30.70.163/BlueThen/wordpress/2010/01/day-9/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 21:57:47 +0000</pubDate>
		<dc:creator>BlueThen</dc:creator>
				<category><![CDATA[Chase Engine]]></category>
		<category><![CDATA[Dev Log]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Chase]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[dev-C++]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[snow day]]></category>

		<guid isPermaLink="false">http://82.30.70.163/BlueThen/BlueThen/wordpress/?p=169</guid>
		<description><![CDATA[Good day! Over the winter break, I began working on Chase&#8217;s conversion over to C++. Today, I&#8217;ve had the convenience of a snow day, so I took advantage of it and proceeded to work on Chase&#8217;s Engine. Note, however, I haven&#8217;t really made any *real* progress. I will count this as a day though, since [...]]]></description>
			<content:encoded><![CDATA[<p><a href="/BlueThen/wordpress/wp-content/uploads/2010/01/soureDist.jpg"><img src="/BlueThen/wordpress/wp-content/uploads/2010/01/soureDist-217x300.jpg" alt="" title="soureDist" width="217" height="300" class="alignleft size-medium wp-image-170" /></a>
<p style="text-indent:20pt; line-height:20pt;">Good day! Over the winter break, I began working on Chase&#8217;s conversion over to C++. Today, I&#8217;ve had the convenience of a snow day, so I took advantage of it and proceeded to work on Chase&#8217;s Engine. Note, however, I haven&#8217;t really made any *real* progress. I will count this as a day though, since a lot has been done in the conversion.</p>
<p style="text-indent:20pt; line-height:20pt;">The conversion isn&#8217;t done yet. I&#8217;ve got all the coordinate, polygon, and model classes converted (although certainly not finished in terms of features), as well as the transformation functions. If tomorrow also provides the convenience of a snow day, I&#8217;ll take advantage of that as well, and hopefully get Chase&#8217;s C++ engine up to an equivalent of Chase&#8217;s <a href="http://processing.org/">Processing</a> (the API for Java!) engine.</p>
<p style="text-indent:20pt; line-height:20pt;">I&#8217;ve uploaded a picture of my colorfully written rough draft for how my .h and .cpp files should work out. My compiler (<a href="http://www.bloodshed.net/devcpp.html">Dev-C++</a>) has an awfully convenient feature which allows me to place individual files in their own folders unlike the Processing <a href="http://en.wikipedia.org/wiki/Integrated_development_environment">IDE</a>, as far as I&#8217;m aware of. You can check out the picture by clicking the image to the left/top of this post&#8217;s text. Feel free to give me any feedback or comments.</p>
 <img src="http://82.30.70.163/BlueThen/wordpress/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=169" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://82.30.70.163/BlueThen/wordpress/2010/01/day-9/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Day 8</title>
		<link>http://82.30.70.163/BlueThen/wordpress/2009/12/day-8/</link>
		<comments>http://82.30.70.163/BlueThen/wordpress/2009/12/day-8/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 22:20:42 +0000</pubDate>
		<dc:creator>BlueThen</dc:creator>
				<category><![CDATA[Chase Engine]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[Chase]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[optimize]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[program]]></category>

		<guid isPermaLink="false">http://bluethen.wordpress.com/?p=82</guid>
		<description><![CDATA[No significant additions today. Mostly optimizing and polishing of the graphics engine. I also did a lot of commenting for easier referencing. I&#8217;ve been experimenting around, trying to find the most efficient and clean way of rendering and handling 3D graphical data. Christmas was fun. I got some sketchpads, so now I can keep all [...]]]></description>
			<content:encoded><![CDATA[<p>No significant additions today. Mostly optimizing and polishing of the graphics engine. I also did a lot of commenting for easier referencing. I&#8217;ve been experimenting around, trying to find the most efficient and clean way of rendering and handling 3D graphical data.</p>
<p>Christmas was fun. I got some sketchpads, so now I can keep all my notes and junk all in one place, instead of scattered all over my desk (I should probably clean this up). I&#8217;m using one sketchpad for the notes, and the other for all my formulas and algorithms. I also bought myself some pretty nice pens, of different colors, so labeling shouldn&#8217;t be a problem.</p>
 <img src="http://82.30.70.163/BlueThen/wordpress/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=84" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://82.30.70.163/BlueThen/wordpress/2009/12/day-8/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Day 7</title>
		<link>http://82.30.70.163/BlueThen/wordpress/2009/12/71/</link>
		<comments>http://82.30.70.163/BlueThen/wordpress/2009/12/71/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 03:01:14 +0000</pubDate>
		<dc:creator>BlueThen</dc:creator>
				<category><![CDATA[Chase Engine]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Chase]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[isometric]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://82.30.70.163/BlueThen/BlueThen/wordpress/?page_id=260</guid>
		<description><![CDATA[There&#8217;s officially been about a week&#8217;s worth of development for Chase. Today, however, was admittedly disappointing in terms of progress. I started working on a quick reference, since the code was getting more and more complex, and keeping track of parameters for each function was difficult. This would be especially useful, since I&#8217;m developing Chase [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s officially been about a week&#8217;s worth of development for Chase.</p>
<p>Today, however, was admittedly disappointing in terms of progress. I started working on a quick reference, since the code was getting more and more complex, and keeping track of parameters for each function was difficult. This would be especially useful, since I&#8217;m developing Chase over a long time (up to a week or two between development days). The quick reference, however, wasn&#8217;t so quick. It ended up taking me longer to document the different functions than it did for me to actually make some of the functions, so I decided that it was a waste of time, and to ditch it. If it&#8217;s getting difficult for me to keep track of things, then it&#8217;s probably time for me to re-organize and clean up the code a bit.<img title="More..." src="https://bluethen.wordpress.com/wp-includes/js/tinymce/plugins/BlueThen/wordpress/img/trans.gif" alt="" /></p>
<p><span id="more-71"></span></p>
<p><a href="http://bluethen.files.wordpress.com/2009/12/3drotate.gif"><img class="alignright" title="3Drotate" src="http://bluethen.files.wordpress.com/2009/12/3drotate.gif" alt="" width="356" height="322" /></a>I did get a working 3D rotation function in today. It&#8217;ll allow me to rotate models, polygons, and coordinates along the x, y, or z axis freely.</p>
<p>I&#8217;ll probably devote an entire day to organizing and cleaning up the code soon, and start following a little more strict and consistent standard of coding. I might even start naming functions <a href="http://en.wikibooks.org/wiki/OpenGL_Programming/Basics/NamingConventions#OpenGL_Functions">the same way openGL does with their functions</a>. Being somewhat new to programming,  it&#8217;s best for me to set some good habits for the long run.</p>
<p>Even though I haven&#8217;t programmed in the past week and a half until today, I&#8217;ve been hard at work at composing some of the formulas to be used in Chase. One that&#8217;ll be particularly essential is line to polygon intersection detection in 3D space. This would be used in my lighting algorithm and collision detection, unless I pick up a more efficient method of calculating these.</p>
<p>Another feature I&#8217;ll implement is culling. There&#8217;s a working zbuffer right now, but polygons intersection won&#8217;t actually draw that way. I&#8217;ll hopefully implement that eventually as well.</p>
<p>By the end of Winter Break, I hope to port the entire engine to C++. I originally chose Processing for ease of creation, and to make playing convenient and available to users from within their browser. Chase is looking a little too ambitious to be ran quickly within the browser. Making Chase in a lower level language (compared to Processing) will probably be a wise decision, since it&#8217;ll allow me more resources.</p>
 <img src="http://82.30.70.163/BlueThen/wordpress/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=71" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://82.30.70.163/BlueThen/wordpress/2009/12/71/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finals</title>
		<link>http://82.30.70.163/BlueThen/wordpress/2009/12/finals/</link>
		<comments>http://82.30.70.163/BlueThen/wordpress/2009/12/finals/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 02:17:27 +0000</pubDate>
		<dc:creator>BlueThen</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Chase]]></category>
		<category><![CDATA[finals]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[program]]></category>

		<guid isPermaLink="false">http://bluethen.wordpress.com/?p=61</guid>
		<description><![CDATA[I normally set aside my weekends for developing programs (in this case, Chase), but it&#8217;s looking like I won&#8217;t be this weekend. We have finals this Friday, next Monday, and the day after that, and I need to prepare for that. Also, we&#8217;ll be having company on Saturday, and my sister is coming over from [...]]]></description>
			<content:encoded><![CDATA[<p>I normally set aside my weekends for developing programs (in this case, Chase), but it&#8217;s looking like I won&#8217;t be this weekend. We have finals this Friday, next Monday, and the day after that, and I need to prepare for that. Also, we&#8217;ll be having company on Saturday, and my sister is coming over from College on Monday.</p>
<p>Development on Chase up to this point has been going super slow. I&#8217;ve only been able to use a few weekends to work on it. I&#8217;d work on it on the week days if I didn&#8217;t have school crowding my time, and family keeps making plans with me during some weekends. I&#8217;ve only had 6 days since the 21st of November to work on this. At this rate, Chase isn&#8217;t going to be completed any time soon, unless I get together a development team of some sort, which I doubt I&#8217;ll do.</p>
<p><span id="more-61"></span></p>
<p>Fortunately, Winter Break is coming up. It starts next Wednesday. I&#8217;d spend everyday developing, but no promises. I&#8217;ll take advantage of the time available as much as possible, and hopefully get some significant features done.</p>
<p>Even when I&#8217;m not developing Chase, I&#8217;m still perpetually thinking of the various algorithms and formulas to be implemented. Polygon to line intersection in 3D space, lighting and shading, 3D model collision detection, etc. The next time I develop, I plan to implement 3D model rotating along x, y, and z axis freely, have suspensions work with rotations on vehicles, and clean up.</p>
 <img src="http://82.30.70.163/BlueThen/wordpress/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=61" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://82.30.70.163/BlueThen/wordpress/2009/12/finals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chase</title>
		<link>http://82.30.70.163/BlueThen/wordpress/2009/12/chase/</link>
		<comments>http://82.30.70.163/BlueThen/wordpress/2009/12/chase/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 04:42:24 +0000</pubDate>
		<dc:creator>BlueThen</dc:creator>
				<category><![CDATA[Chase Engine]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[Chase]]></category>
		<category><![CDATA[formulas]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[isometric]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[mirc]]></category>
		<category><![CDATA[msl]]></category>
		<category><![CDATA[particles]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[program]]></category>

		<guid isPermaLink="false">http://bluethen.wordpress.com/?p=37</guid>
		<description><![CDATA[I&#8217;ve been working on a game for a little under a month (ever since November 21st). It started out as an idea several months earlier, in which I proceeded to work on in mSL.  I got a  wireframe isometric engine made and running fairly nice (roughly 40 fps, which was godly for such a slow language). I had [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a game for a little under a month (ever since November 21st). It started out as an idea several months earlier, in which I proceeded to work on in mSL.  I got a  wireframe isometric engine made and running fairly nice (roughly 40 fps, which was godly for such a slow language). I had some problems with mSL, however. Resources played too large of a factor, and involved having to use every little hack I could come up with to speed it up. I was literally optimizing it to the very byte. That would&#8217;ve been fine for a simple game, but I had bigger plans for my game.</p>
<p><span id="more-37"></span></p>
<p>I didn&#8217;t really want my game to be wireframe. It didn&#8217;t seem very ideal to me.  So I scripted up a simple hidden line removal algorithm, where lines being overlapped by polygons wouldn&#8217;t be displayed. mSL didn&#8217;t provide support for drawing custom polygons, and making a loop to draw each individual pixel of one would be way too slow. I went over every solution I could come up with, like storing different values that would be used in some of the frames. But I&#8217;d always run into one problem or another.</p>
<p>So I gave up on the idea all together. Later, I moved on to Processing. I made a couple of experimental apps, some being duplicates of previous scripts in mSL, and released them on<a title="BlueThen's profile on OpenProcessing" href="http://www.openprocessing.org/portal/?userID=3044"> OpenProcessing</a>. After getting a feel for the language, I started to revisit the idea of the game I wanted to make. The idea of it kept coming back to me. In my mind, it seemed completely revolutionary. Concepts that are used very little, if at all, in main stream games.</p>
<p>I love isometric rendering. Something about the diagonal lines grabs my attention, and stimulates interest into the media. Photographers and artists would tell you that diagonal lines shows action, depth, and stimulation. They convey feelings of movement, and tend to lead your eyes throughout the piece.</p>
<p>Another reason I was interested in isometric rendering was the ease of use. All that&#8217;s required is a simple formula to plug the xyz coordinates, and you&#8217;re done. No rotations, matrixes, or whatever is really required. Just a basic knowledge of 3 dimensional Cartesian coordinates.</p>
<p><a href="http://bluethen.files.wordpress.com/2009/12/isometric.gif"><img class="size-full wp-image-38 alignright" title="isometric" src="http://bluethen.files.wordpress.com/2009/12/isometric.gif" alt="" width="292" height="261" /></a></p>
<p>I began using an isometric formula I came across a number of months ago.<br />
onScreenX = (x &#8211; z) * cos(radians(30)) + width/2<br />
onScreenY = (x + z) * sin(radians(30)) &#8211; y + height/2<br />
Assentially, adding width/2 to the x, and height/2 to the y, moves the point of origin (0,0) to the center of the window. I later came across the translate() function in Processing, which allowed me to do just that: translate(width/2,height/2);<br />
onScreenX = (x &#8211; z) * cos(radians(30))<br />
onScreenY = (x + z) * sin(radians(30)) &#8211; y</p>
<p>When multiplying anything by cosine and sine, the radius of an ellipse is created. (x-z) determines the width of the ellipse, and (x+z) is the height. The x-coordinate is then calculated to be 30 degrees counter clockwise from the x axis, and the z-coordinate is calculated 30 degrees clockwise from the x axis.</p>
<p><a href="http://bluethen.files.wordpress.com/2009/12/pixels.gif"><img class="alignleft size-full wp-image-39" title="pixels" src="http://bluethen.files.wordpress.com/2009/12/pixels.gif" alt="" width="100" height="70" /></a>I was suggested to later on to use something like 33 degrees instead. Ideally to line it up so that the pixels aren&#8217;t abnormally lined up when drawn directly along the x or z axis. Instead of having 2 dots sideways, then one up, then 3 side, or whatever, it&#8217;d be a clean 2 dots to the side, then 2 dots vertical from that. I never adopted the idea, since none of my scripts ever heavily involved lines parallel to the x or z axis.</p>
<p>The isometric formula was an essential part of all my algorithms. It&#8217;d be used hundreds of thousands of times, for each coordinate involves this calculation. I later decided that it&#8217;d be a good idea to optimize it. Knowing that I&#8217;ll always be using 30 degrees for my isometric formulas, I precalculated that accordingly. 30 degrees in radians is 0.523598776,  cosine of that is roughly 0.866, and sin of our radians is conveniently 0.5.</p>
<p>Later, I rounded the 0.866 to 1. Rounding it that much seemed like it&#8217;d have a significant effect, and it sort of did. It was, however, only noticeable when placed side by side, or immediately compared, to an accurate rendering. The inaccurate rendering only appeared to be a slightly wider scaled version of the accurate rendering.  I ended up with an extremely simple formula:<br />
onScreenX = x &#8211; z<br />
onScreenY = (x + z)/2 &#8211; y</p>
<p>This, I planned to be the main component of the Chase Engine. Chase Engine is essentially going to be the name of the collective algorithms, functions, and classes in my game. I plan to make the graphical engine vector-based. Most isometric/dimetric/trimetric games are bitmap based, where images are used for every angle of every object.</p>
<p>I will render models polygon by polygon, just as if I were doing everything as if it were truely 3D. Textures would probably not be used, and if they are, they&#8217;d be procedural just as well as the rendering.</p>
<p>The isometric formula is the simple part of my game. Other, more complex and brain-tumor-inducing, things will be involved. They will involve my collective knowledge of everything I know about mathematics, programming, graphical algorithms, and plus some. I&#8217;ve thought about it for hours on end,  getting every basic concept ironed out. I knew my game inside and out before I even started, or so I assumed.</p>
<p>I started on November 21st, 2009. I&#8217;ve been dedicating entire days to the game. No less than 3 hours at a time, if you don&#8217;t count the brief breaks I take frequently to keep a fresh mind. The first thing I&#8217;ve accomplished was simple rendering. Functions that&#8217;d draw different shapes and lines in the isometric space. I then added a rough draft of the vehicle class, and of the environment class. The environment class was simply a place-holder, to test the vehicle class. In the vehicle class, featured a simple algorithm for calculating the y position of the vehicle&#8217;s corners, as they act as springs according to the wheels. This was to simulate suspension.</p>
<p>By day 2, November 22nd, I already had about 402 lines of code.  I created a model class and a function for reading files. I then wrote an algorithm to take on screen coordinates and convert them to isometric coordinates.</p>
<p>On day 3, or November 25th, the line count was cut down to 342, and the file reader was turned into a model importer. The model importer took in coordinates from a file, and loaded them into a 3D model class. I was lacking a z-buffer at that time.</p>
<p><a href="http://bluethen.files.wordpress.com/2009/12/suspensions.gif"><img class="alignright size-medium wp-image-48" title="suspensions" src="http://bluethen.files.wordpress.com/2009/12/suspensions.gif?w=288" alt="" width="288" height="300" /></a>I got a basic Scene buffer going by December 6th, 2009. There was no z-buffering yet. I also recreated the suspension algorithm for vehicles. This one was a little more dynamic, since it allowed me to change the mass, dampening, and other values with ease.</p>
<p>The algorithm I came up with for suspension was</p>
<p>newRest = rest + min ; The resting y position, is determined by a preset rest coordinate + min, or the tire&#8217;s y coordinate. This allows the resting coordinate to change as the wheel coordinate changes.</p>
<div id="_mcePaste">velocity += 0.2 * (newRest &#8211; yPos) &#8211; mass ; The velocity is adjusted. The y position of the car is subtracted from the new resting coordinate. This finds the distance between the vehicle and the resting position. It&#8217;s then multiplied by 0.2 so it the velocity isn&#8217;t significant, and mass is subtracted to simulate gravity.</div>
<div id="_mcePaste">velocity *= dampening ; velocity is multiplied by dampening (which is less than 1), to simulate friction.</div>
<div id="_mcePaste">yPos += velocity ; velocity is added to the y position.</div>
<div id="_mcePaste">constrain(yPos, newMin, maxHeight+newMin) ; the y position is constrained to withing the minimum and maximum heights.</div>
<div></div>
<div>On the 5th day, today, December 12th, 2009, I finally made a working zbuffer. I&#8217;ve probably spent over 10 hours trying to get a working zbuffer. My main problem was the syntax. The logic seemed simple. Simply sort the polygons according to their values.  sort(polygons), right? Wrong!</div>
<div></div>
<div>The sort() function doesn&#8217;t support objects, and arrays are often a pain. I eventually came across a pretty simple way of getting around this. Using comparables for sorting the objects. So I went ahead and created a polygon class for storing all the coordinates in, creating a large array of that for the buffer, then sorting it using comparable. It ended up technically being xyzBuffering, since x, y, and z are all playing a factor in the buffer. In an isometric rendering, the camera is simply at (1,1,1) pointed towards (0,0,0), so I added together the mean (average) x, y, and z of a coordinate to represent it&#8217;s depth.</p>
<div>without zbuffering (CLICK):</div>
</div>
<div><a href="http://bluethen.files.wordpress.com/2009/12/withoutzbuffer.gif"><img class="alignnone size-thumbnail wp-image-33" style="border:0 initial initial;" title="withoutZBuffer" src="http://bluethen.files.wordpress.com/2009/12/withoutzbuffer.gif?w=150" alt="" width="150" height="150" /></a></div>
<div><a href="http://bluethen.files.wordpress.com/2009/12/withoutzbuffer.gif"></a></div>
<div>With zbuffering (CLICK):</div>
<div><a href="http://bluethen.files.wordpress.com/2009/12/withzbuffer1.gif"><img class="alignnone size-thumbnail wp-image-35" title="withZBuffer" src="http://bluethen.files.wordpress.com/2009/12/withzbuffer1.gif?w=150" alt="" width="150" height="150" /></a></div>
<div></div>
<div></div>
<div></div>
<div>I have a lot more planned for the game. It&#8217;ll probably take me months, if not one or two years, to complete. I&#8217;m willing to take however long to make the game though. I will not give up, even if it takes me 10+ hours to complete a simple function, or 3+ days to get a formula to work.</div>
<div>

</div>
 <img src="http://82.30.70.163/BlueThen/wordpress/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=37" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://82.30.70.163/BlueThen/wordpress/2009/12/chase/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Galaxy</title>
		<link>http://82.30.70.163/BlueThen/wordpress/2009/12/galaxy/</link>
		<comments>http://82.30.70.163/BlueThen/wordpress/2009/12/galaxy/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 03:12:23 +0000</pubDate>
		<dc:creator>BlueThen</dc:creator>
				<category><![CDATA[Processing App]]></category>
		<category><![CDATA[galaxy]]></category>
		<category><![CDATA[openprocessing]]></category>
		<category><![CDATA[particles]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[rotate]]></category>

		<guid isPermaLink="false">http://bluethen.wordpress.com/?p=14</guid>
		<description><![CDATA[Galaxy is another one of my Processing Apps. It&#8217;s another particle engine, but with the particles all rotating around the center on their own axis. Each particle&#8217;s speed is determined by the distance from the center, and can be effected by the user dragging the cursor left or right. The particle count is about 5,000. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.openprocessing.org/visuals/?visualID=5582"><img class="alignleft size-full wp-image-15" title="galaxyScreeny" src="http://bluethen.files.wordpress.com/2009/12/galaxyscreeny.gif" alt="" width="450" height="466" /></a><a href="http://www.openprocessing.org/visuals/?visualID=5582">Galaxy</a> is another one of my Processing Apps. It&#8217;s another particle engine, but with the particles all rotating around the center on their own axis. Each particle&#8217;s speed is determined by the distance from the center, and can be effected by the user dragging the cursor left or right.</p>
<p><span id="more-14"></span></p>
<ul>
<li>The particle count is about 5,000. The code uses a custom class object for each particle, for easy updating and management. In the class for the particles, a number of variables are used to define the properties of each particle.</li>
<li>The angle, to keep track of the position of the particle around the center</li>
<li>The radius, or distance from the center the particle is</li>
<li>dec and turnVelocity, both to decide the speed. dec is constant speed, where the particles closer to the center are faster (simply by multiplying by its distance inverted, 200-radius. We use 200 since that&#8217;s the max radius), and turnVelocity the speed of the particles controlled by the cursor&#8217;s x position, for when it&#8217;s dragged. turnVelocity is reduced by 5% every frame to simulate friction.</li>
<li>tilt is pretty much the tilt of the particle&#8217;s orbit.</li>
</ul>
<p>When each particle is initialized, the angle is set to in between 0 and 6.28 (2Pi), since 2Pi is about a full circle, this should distribute particles somewhat evenly. Radius is randomly in between 70 and 200. The 70 allows a visible gap about 140 pixels in diameter at the center.  The tilt is between -60 and 60 (60 below and 60 above the origin), and dec is (200-radius) * 0.00014. Since dec is the rotational speed, and the rotation is measured in Radians, our values will be pretty small (again, in between 0 and 6.28). So we multiply by 0.00014 to get a desired speed. Multiplying by radius will have the speed determined by distance from center, and by subtracting radius from 200, it will invert the speeds, meaning that the particles closer will be faster than ones on the outside.</p>
<p>Every frame, the particle is updated. Here is where we apply the rotational algorithms, and update the coordinates of the particles. Before the update function is called, a turn rate is determined by the cursor. The program finds out whether or not the user is clicking, and if so, it finds the change in x coordinate, and plugs it in to the update function. This is done so the program can run a lot more smoothly. If we were to have these 2 lines of code in the update function, then it&#8217;d have to be recalculated for every particle.</p>
<p>The first thing the update function does is, update the coordinates. It uses the formula:<br />
<span style="font-family:Consolas, Monaco, 'Courier New', Courier, monospace;line-height:18px;font-size:12px;white-space:pre;">x = radius * cos(angle)<br />
y = tilt + 20 * cos(angle + 3.5)<br />
z = radius * sin(angle)</span></p>
<p>In the x part of the formula, cosine is used to find the x coordinate around the center the particle is, and radius is multiplied on to apply distance. In the y part, tilt is added on to move the origin to (0,tilt,0).  20 shows that the y varies by about 20 pixels. In the cosine of the y value, 3.5 is added to the angle. The reason here is simply to orientate the swirl to face the camera at a correct angle. The calculation for z is the same as x, but uses sin to achieve a circular orbit.</p>
<p>The next part checks to see if turn is 0. Turn variable is the value plugged in earlier. The value was determined by the mouse&#8217;s effect on Galaxy&#8217;s spin. If it isn&#8217;t 0, it is multiplied by (200-radius), then set to turnVelocity. This makes the values so it&#8217;s larger if the particle is closer to center, rather than farther away. If it were 0, which is prevented, then (200 &#8211; radius) * turn would return 0. We don&#8217;t want this because we want to apply our own stopping algorithm, which will make it seemingly slow to a halt, but that is applied after angle is recalculated.</p>
<p>We use the formula: angle -= dec + turnVelocity to determine the angle. dec is the constant rotation the Galaxy goes through, and turnVelocity determined by the user.</p>
<p>turnVelocity is decreased by about 5% to simulate friction, and to make it seemingly slow down to a halt.</p>
<p>The previous coordinate is set if the current coordinate isn&#8217;t already (for the first frame).</p>
<p>A line is then rendered isometrically using the previous and current coordinate. I explain my isometric algorithm in the <a href="http://bluethen.wordpress.com/2009/12/02/explode/">Explode</a> post. Afterwards, the previous coordinate is set to the current, for drawing the tail in the next frame.</p>
 <img src="http://82.30.70.163/BlueThen/wordpress/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=14" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://82.30.70.163/BlueThen/wordpress/2009/12/galaxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
