<?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>Vjeux &#187; Project</title>
	<atom:link href="http://blog.vjeux.com/category/project/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.vjeux.com</link>
	<description>French Web Developer</description>
	<lastBuildDate>Mon, 30 Jan 2012 13:31:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Javascript Ray Tracer</title>
		<link>http://blog.vjeux.com/2012/javascript/javascript-ray-tracer.html</link>
		<comments>http://blog.vjeux.com/2012/javascript/javascript-ray-tracer.html#comments</comments>
		<pubDate>Wed, 11 Jan 2012 14:00:59 +0000</pubDate>
		<dc:creator>vjeux</dc:creator>
				<category><![CDATA[EPITA]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Project]]></category>

		<guid isPermaLink="false">http://blog.vjeux.com/?p=2806</guid>
		<description><![CDATA[Here is a report of the Ray Tracer written by myself Christopher Chedeau and Gauthier Lemoine. We've taken the file format and most of the examples from the Ray Tracer of our friends Maxime Mouial and Clément Bœsch. The source is available on Github. It is powered by Open Source technologies: glMatrix, CodeMirror, CoffeeScript, Twitter [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>Here is a report of the Ray Tracer written by myself Christopher Chedeau and Gauthier Lemoine. We've taken the file format and most of the examples from the Ray Tracer of our friends <a target="_blank" href="http://www.linkedin.com/pub/maxime-mouial/1a/967/269">Maxime Mouial</a> and <a target="_blank" href="http://ubitux.fr/">Clément Bœsch</a>. The <a target="_blank" href="https://github.com/vjeux/jsRayTracer">source is available on Github</a>.</p>
<p>It is powered by Open Source technologies: <a target="_blank" href="https://github.com/toji/gl-matrix">glMatrix</a>, <a target="_blank" href="http://codemirror.net/">CodeMirror</a>, <a target="_blank" href="http://coffeescript.org/">CoffeeScript</a>, <a target="_blank" href="http://twitter.github.com/bootstrap/">Twitter Bootstrap</a>, <a target="_blank" href="http://jquery.com/">jQuery</a> and <a target="_blank" href="https://developer.mozilla.org/en/Using_web_workers">Web Workers</a>.</p>
<p>Check out the <strong><a target="_blank" href="http://fooo.fr/~vjeux/epita/raytracer/raytracer.html">demo</a></strong>, or click on any of the images.</p>
<h3>Objects</h3>
<p>Our Ray Tracer supports 4 object types: Plane, Sphere, Cylinder and Cone.</p>
<p><a target="_blank" href="http://fooo.fr/~vjeux/epita/raytracer/raytracer.html#origin"><img src="http://blog.vjeux.com/wp-content/uploads/2008/01/origin.png" /></a></p>
<p>The core idea of the Ray Tracer is to send rays that will be reflected on items. Given a ray (origin and direction), we need to know if it intersect an object on the scene, and if it does, how to get a ray' that will be reflected on the object.</p>
<p>Knowing that, we open up our high school math book and come up with all the following formulas.</p>
<p><strong>Legend:</strong> Ray Origin \(O\), Ray Direction \(D\), Intersection Position \(O'\), Intersection Normal \(N\) and Item Radius \(r\).</p>
<style>.eq { width: 100%; } .eq th { text-align: center; }</style>
<table class="eq">
<tr>
<th></th>
<th>Intersection</th>
<th>Normal</th>
</tr>
<tr>
<th>Plane</th>
<td>\[t = \frac{O_z}{D_z}\]</td>
<td>\[<br />
N = \left\{<br />
  \begin{array}{l}<br />
    x = 0 \\<br />
    y = 0 \\<br />
    z = -sign(D_z)<br />
  \end{array} \right.<br />
\]</td>
</tr>
<tr>
<th>Sphere</th>
<td>\[<br />
\begin{array}{l l l}<br />
  &#038; t^2 &#038; (O \cdot O) \\<br />
+ &#038; 2t   &#038; (O \cdot D) \\<br />
+ &#038;     &#038; (O \cdot O) - r^2<br />
\end{array}<br />
= 0\]</td>
<td>\[<br />
N = \left\{<br />
  \begin{array}{l}<br />
    x = O'_x \\<br />
    y = O'_y \\<br />
    z = O'_z<br />
  \end{array} \right.<br />
\]</td>
</tr>
<tr>
<th>Cylinder</th>
<td>\[<br />
\begin{array}{l l l}<br />
  &#038; t^2 &#038; (D_x D_x + D_y D_y) \\<br />
+ &#038; 2t   &#038; (O_x D_x + O_y D_y) \\<br />
+ &#038;     &#038; (O_x O_x + O_y O_y - r^2)<br />
\end{array}<br />
= 0\]</td>
<td>\[<br />
N = \left\{<br />
  \begin{array}{l}<br />
    x = O'_x \\<br />
    y = O'_y \\<br />
    z = 0<br />
  \end{array} \right.<br />
\]</td>
</tr>
<tr>
<th>Cone</th>
<td>\[<br />
\begin{array}{l l l}<br />
  &#038; t^2 &#038; (D_x D_x + D_y D_y - r^2 D_z D_z) \\<br />
+ &#038; 2t   &#038; (O_x D_x + O_y D_y - r^2 O_z D_z) \\<br />
+ &#038;     &#038; (O_x O_x + O_y O_y - r^2 O_z O_z)<br />
\end{array}<br />
= 0\]</td>
<td>\[<br />
N = \left\{<br />
  \begin{array}{l}<br />
    x = O'_x \\<br />
    y = O'_y \\<br />
    z = - O'_z * tan(r^2)<br />
  \end{array} \right.<br />
\]</td>
</tr>
</table>
<p>In order to solve the equation \(at^2 + bt + c = 0\), we use<br />
\[\Delta = b^2 - 4ac \]\[<br />
\begin{array}{c c c}<br />
\Delta \geq 0 &#038; t_1 = \frac{-b - \sqrt{\Delta}}{2a} &#038; t_2 = \frac{-b + \sqrt{\Delta}}{2a}<br />
\end{array}<br />
\]</p>
<p>And here is the formula for the reflected ray:</p>
<p>\[<br />
\left\{<br />
  \begin{array}{l}<br />
    O' = O + tD + \varepsilon D' \\<br />
    D' = D - 2 (D \cdot N) * N<br />
  \end{array}<br />
\right.<br />
\]</p>
<p>In order to fight numerical precision errors, we are going to move the origin of the reflected point a little bit in the direction of the reflected ray (\(\varepsilon D'\)). It will avoid to falsely detect a collision with the current object.</p>
<h3>Coordinates, Groups and Rotations</h3>
<p>We want to move and rotate objects. In order to do that, we compute a transformation matrix (and it's inverse) for each object in the scene using the following code:</p>
<p>\[<br />
T = \begin{array}{l}<br />
 (Identity * Translate_g * RotateX_g * RotateY_g * RotateZ_g) * \\<br />
 (Identity * Translate_i * RotateX_i * RotateY_i * RotateZ_i)<br />
\end{array}<br />
\]\[ I = T^{-1} \]</p>
<table style="width: 100%;">
<tr>
<td>
\[Translate(x, y, z) = \left(\begin{array}{c c c c}<br />
1 &#038; 0 &#038; 0 &#038; x \\<br />
0 &#038; 1 &#038; 0 &#038; y \\<br />
0 &#038; 0 &#038; 1 &#038; z \\<br />
0 &#038; 0 &#038; 0 &#038; 1<br />
\end{array}\right)\]
</td>
<td>
\[RotateX(\alpha) = \left(\begin{array}{c c c c}<br />
1 &#038; 0 &#038; 0 &#038; 0 \\<br />
0 &#038; cos(\alpha) &#038; -sin(\alpha) &#038; 0 \\<br />
0 &#038; sin(\alpha) &#038; cos(\alpha) &#038; 0 \\<br />
0 &#038; 0 &#038; 0 &#038; 1<br />
\end{array}\right)\]
</td>
</tr>
<tr>
<td>
\[RotateY(\alpha) = \left(\begin{array}{c c c c}<br />
cos(\alpha) &#038; 0 &#038; sin(\alpha) &#038; 0 \\<br />
0 &#038; 1 &#038; 0 &#038; 0 \\<br />
-sin(\alpha) &#038; 0 &#038; cos(\alpha) &#038; 0 \\<br />
0 &#038; 0 &#038; 0 &#038; 1<br />
\end{array}\right)\]
</td>
<td>
\[RotateZ(\alpha) = \left(\begin{array}{c c c c}<br />
cos(\alpha) &#038; -sin(\alpha) &#038; 0 &#038; 0 \\<br />
sin(\alpha) &#038; cos(\alpha) &#038; 0 &#038; 0 \\<br />
0 &#038; 0 &#038; 1 &#038; 0 \\<br />
0 &#038; 0 &#038; 0 &#038; 1<br />
\end{array}\right)\]
</td>
</tr>
</table>
<p>We have written the intersection and normal calculations in the object's coordinate system instead of the world's coordinate system. It makes them easier to write. We use the transformation matrix to do object -> world and the inverse matrix to do world -> object.</p>
<table style="width: 100%;">
<tr>
<td>
\[<br />
\left\{\begin{array}{l}<br />
O_{world} = T * O_{object} \\<br />
D_{world} = (T * D_{object}) - (T * 0_4)<br />
\end{array}\right.<br />
\]
</td>
<td>
\[<br />
\left\{\begin{array}{l}<br />
O_{object} = I * O_{world} \\<br />
D_{object} = (I * D_{world}) - (I * 0_4)<br />
\end{array}\right.<br />
\]
</td>
<td>
\[0_4 = \left(\begin{array}{c} 0 \\<br />
0 \\<br />
0 \\<br />
1<br />
\end{array}\right)<br />
\]
</td>
</tr>
</table>
<p><a target="_blank" href="http://fooo.fr/~vjeux/epita/raytracer/raytracer.html#cylinders_3-spheres_reflect"><img src="http://blog.vjeux.com/wp-content/uploads/2008/01/cylinders_3-spheres_reflect.png" /></a><br />
<a target="_blank" href="http://fooo.fr/~vjeux/epita/raytracer/raytracer.html#pokeball"><img src="http://blog.vjeux.com/wp-content/uploads/2012/01/pokeball.png" /></a></p>
<h3>Bounding Box</h3>
<p>The previous equations give us objects with infinite dimensions (except for the sphere) whereas objects in real life have finite dimensions. To simulate this, it is possible to provide two points that will form a bounding box around the object. On the intersection test, we are going to use the nearest point that is inside the bounding box.</p>
<p>This gives us the ability to do various objects such as mirrors, table surface and legs, light bubbles and even a Pokeball!</p>
<p><a target="_blank" href="http://fooo.fr/~vjeux/epita/raytracer/raytracer.html#reflect"><img src="http://blog.vjeux.com/wp-content/uploads/2012/01/reflect.png" /></a><br />
<img src="http://blog.vjeux.com/wp-content/uploads/2012/01/pokeball_exploded.png" /></p>
<h3>Light</h3>
<p>An object is composed of an Intensity \(I_o\), a Color \(C_o\) and a Brightness \(B_o\). Each light has a Color \(C_l\) and there is an ambient color \(C_a\). Using all those properties, we can calculate the color of a point using the following formula:</p>
<p>\[<br />
I_o * (C_o + B_o) * \left(C_a + \sum_{l}{(N \cdot D) * C_l}\right)<br />
\]</p>
<p>Only the lights visible from the intersection point are used in the sum. In order to check this, we send a shadow ray from the intersection point to the light and see if it intersects any object.</p>
<div style="text-align: center;"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Ray_trace_diagram.svg/500px-Ray_trace_diagram.svg.png" /></div>
<p>The following images are examples to demonstrate the lights.</p>
<p><a target="_blank" href="http://fooo.fr/~vjeux/epita/raytracer/raytracer.html#light_3"><img src="http://blog.vjeux.com/wp-content/uploads/2012/01/light_3.png" /></a><br />
<a target="_blank" href="http://fooo.fr/~vjeux/epita/raytracer/raytracer.html#single_light"><img src="http://blog.vjeux.com/wp-content/uploads/2012/01/single_light.png" /></a></p>
<h3>Textures</h3>
<p>In order to put a texture on an object, we need to map a point \((x, y, z)\) in the object's coordinate system into a point \((x, y)\) in the texture's coordinate system. For planes, it is straightforward, we just the \(z\) coordinate (which is equal to zero anyway). For spheres, cylinders and cones it is a bit more involved. Here is the formula where \(w\) and \(h\) are the width and height of the texture.</p>
<p>\[<br />
\begin{array}{c c}<br />
\phi = acos(\frac{O'_y}{r}) &#038; \theta = \frac{acos\left(\frac{O'_x}{r * sin(\phi)}\right)}{2\pi}<br />
\end{array}<br />
\]\[<br />
\begin{array}{c c}<br />
x = w * \left\{\begin{array}{l l} \theta &#038; \text{if } O'_x < 0 \\<br />
1 - \theta &#038; \text{else}\end{array}\right. &#038; y = h * \frac{\phi}{\pi}<br />
\end{array}<br />
\]</p>
<p>Once we have the texture coordinates, we can easily create a checkerboard or put a texture. We added options such as scaling and repeat in order to control how the texture is placed.</p>
<p><a target="_blank" href="http://fooo.fr/~vjeux/epita/raytracer/raytracer.html#checkerboard"><img src="http://blog.vjeux.com/wp-content/uploads/2008/01/checkerboard.png" /><br />
<a target="_blank" href="http://fooo.fr/~vjeux/epita/raytracer/raytracer.html#texturing"><img src="http://blog.vjeux.com/wp-content/uploads/2008/01/texturing.png" /></a></p>
<p>We also support the alpha mask in order to make a color from a texture transparent.</p>
<p><a target="_blank" href="http://fooo.fr/~vjeux/epita/raytracer/raytracer.html#texturing_cut"><img src="http://blog.vjeux.com/wp-content/uploads/2008/01/texturing_cut.png" /></a></p>
<h3>Progressive Rendering</h3>
<p>Ray tracing is a slow technique. At first, I generated pixels line by line, but I found out that the first few lines do not hold much information.</p>
<p>Instead, what we want to do is to have a fast overview of the scene and then improve on the details. In order to do that, during the first iteration we are only generating 1 pixel for a 32x32 square. Then we generate 1 pixel for a 16x16 square and so on ... We generate the top-left pixel and fill all the unknown pixels with it.</p>
<p><a target="_blank" href="http://fooo.fr/~vjeux/epita/raytracer/raytracer.html#cylinders_3-spheres_reflect"><img src="http://blog.vjeux.com/wp-content/uploads/2008/01/progressive.png" /></a></p>
<p>In order not to regenerate pixels we already seen, I came up with a condition to know if a pixel has already been generated. \(size\) is the current square size (32, 16, ...).</p>
<p>\[\left\{\begin{array}{l}<br />
x \equiv 0 \pmod{size * 2}\\<br />
y \equiv 0 \pmod{size * 2}<br />
\end{array}\right.<br />
\]</p>
<h3>Supersampling</h3>
<p>Aliasing is a problem with Ray Tracing and we solve this issue using supersampling. Basically, we send more than one ray for each pixel. We have to chose representative points from a square. There are multiple strategies: in the middle, in a grid or random. Check the result of various combinations in the following image:</p>
<p><a target="_blank" href="http://fooo.fr/~vjeux/epita/raytracer/raytracer.html#pokeball">
<div id="supersampling" style="overflow: hidden; width: 660px; height: 300px; background: url(http://blog.vjeux.com/wp-content/uploads/2008/01/aliasing.png) 0 0;"></div>
<p></a></p>
<ul id="supersampling-links">
<li><strong>1x</strong>: <span data-id="0" class="btn primary">Basic</span></li>
<li><strong>4x</strong>: <span data-id="1" class="btn primary">4 random</span>  <span data-id="2" class="btn primary">1 fixed, 3 random</span>  <span data-id="3" class="btn primary">2x upscale</span></li>
<li><strong>16x</strong>: <span data-id="4" class="btn primary">4x upscale</span> <span data-id="5" class="btn primary">2x upscale, 1 fixed, 3 random</span></li>
</ul>
<style>#supersampling-links strong { display: inline-block; width: 23px; text-align: right; }</style>
<p><script>
$('#supersampling-links span').click(function () {
  $('#supersampling').css('background-position', '0px ' + (- 300 * +$(this).attr('data-id')) + 'px');
});
</script></p>
<h3>Perlin Noise</h3>
<p>We can generate random textures using Perlin Noise. We can control several parameters such as \(octaves\), the number of basic noise, the initial scale \(f\) and the factor of contribution \(p\) of the high frequency noises.</p>
<p>\[ noise(x, y, z) = \sum_{i = 0}^{octaves}{p^i * PerlinNoise(\frac{2^i}{f}x, \frac{2^i}{f}y, \frac{2^i}{f}z)} \]</p>
<p><a target="_blank" href="http://fooo.fr/~vjeux/epita/raytracer/raytracer.html#perlin_sphere"><img src="http://blog.vjeux.com/wp-content/uploads/2008/01/perlin.png" /></a><br />
<table style="width: 100%">
<tr>
<td width="33%">\[noise\]</td>
<td width="33%">\[noise * 20 - \lfloor noise * 20 \rfloor\]</td>
<td width="33%">\[\frac{cos(noise) + 1}{2}\]</td>
</tr>
</table>
<p>As seen in the example, we can apply additional functions after the noise has been generated to make interesting effects.</p>
<h3>Portal</h3>
<p>Last but not least, Portals from the self-titled game. They are easy to reproduce in a Ray Tracer and yet, I haven't seen any done.</p>
<p>If a ray enters portal A, it will go out from portal B. It is trivial to implement it, it is just a coordinates system transformation. Like we did for world and object transformation, we do it between A and B using their transformation matrix.</p>
<table style="width: 100%;">
<tr>
<td>
\[<br />
\left\{\begin{array}{l}<br />
O_{a}' = T * O_{b} \\<br />
D_{a}' = (T * D_{b}) - (T * 0_4)<br />
\end{array}\right.<br />
\]
</td>
<td>
\[<br />
\left\{\begin{array}{l}<br />
O_{b}' = T * O_{a} \\<br />
D_{b}' = (T * D_{a}) - (T * 0_4)<br />
\end{array}\right.<br />
\]
</td>
</tr>
</table>
<p><a target="_blank" href="http://fooo.fr/~vjeux/epita/raytracer/raytracer.html#portal"><img src="http://blog.vjeux.com/wp-content/uploads/2008/01/portal.png" /></a></p>
<h3>Scene Editor</h3>
<p>In order to create scenes more easily, we have defined a scene description language. We developed a basic <a target="_blank" href="http://codemirror.net/">CodeMirror</a> syntax highlighting script. Just enter write your scene down and press Ray Trace <img src='http://blog.vjeux.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a target="_blank" href="http://fooo.fr/~vjeux/epita/raytracer/raytracer.html"><img src="http://blog.vjeux.com/wp-content/uploads/2008/01/editor.png" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vjeux.com/2012/javascript/javascript-ray-tracer.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Diablofans Theme Improvement</title>
		<link>http://blog.vjeux.com/2011/project/diablofans-theme-improvement.html</link>
		<comments>http://blog.vjeux.com/2011/project/diablofans-theme-improvement.html#comments</comments>
		<pubDate>Thu, 10 Nov 2011 09:17:32 +0000</pubDate>
		<dc:creator>vjeux</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Project]]></category>

		<guid isPermaLink="false">http://blog.vjeux.com/?p=2689</guid>
		<description><![CDATA[Diablofans.com needed a bit of love. It is really gratifying to be able to visually improve a website by an order of magnitude just by changing some colors and fixing broken layout Here are some of the changes I made: Post Poll Blizzquote]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.diablofans.com/">Diablofans.com</a> needed a bit of love. It is really gratifying to be able to visually improve a website by an order of magnitude just by changing some colors and fixing broken layout <img src='http://blog.vjeux.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Here are some of the changes I made:</p>
<table>
<tr>
<td>
<h3>Post</h3>
</td>
</tr>
<tr>
<td style="text-align: center;"><a href="http://blog.vjeux.com/wp-content/uploads/2011/11/diablofans_new.jpg"><img src="http://blog.vjeux.com/wp-content/uploads/2011/11/post_new.png" alt="" /></a></td>
<td style="text-align: center;"><a href="http://blog.vjeux.com/wp-content/uploads/2011/11/diablofans_old.jpg"><img src="http://blog.vjeux.com/wp-content/uploads/2011/11/post_old.png" alt="" /></a></td>
</tr>
<tr>
<td>
<h3>Poll</h3>
</td>
</tr>
<tr>
<td style="text-align: center;"><img src="http://blog.vjeux.com/wp-content/uploads/2011/11/poll_new.png" alt="" /></td>
<td style="text-align: center;"><img src="http://blog.vjeux.com/wp-content/uploads/2011/11/poll_old.png" alt="" /></td>
</tr>
<tr>
<td>
<h3>Blizzquote</h3>
</td>
</tr>
<tr>
<td>
<div style="width: 330px; overflow: hidden;">
  <a href="http://blog.vjeux.com/wp-content/uploads/2011/11/blizzquote_new.png"><img src="http://blog.vjeux.com/wp-content/uploads/2011/11/blizzquote_new.png" alt="" /></a></div>
</td>
<td>
<div style="width: 330px; overflow: hidden;">
  <a href="http://blog.vjeux.com/wp-content/uploads/2011/11/blizzquote_old.png"><img src="http://blog.vjeux.com/wp-content/uploads/2011/11/blizzquote_old.png" alt="" /></a></div>
</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://blog.vjeux.com/2011/project/diablofans-theme-improvement.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simulated Annealing Project</title>
		<link>http://blog.vjeux.com/2011/javascript/simulated-annealing-project.html</link>
		<comments>http://blog.vjeux.com/2011/javascript/simulated-annealing-project.html#comments</comments>
		<pubDate>Sat, 05 Nov 2011 16:32:09 +0000</pubDate>
		<dc:creator>vjeux</dc:creator>
				<category><![CDATA[EPITA]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Project]]></category>

		<guid isPermaLink="false">http://blog.vjeux.com/?p=2669</guid>
		<description><![CDATA[For a school project, I have to implement Simulated Annealing meta heuristic. Thanks to many open source web tools, I've been able to quickly do the project and have a pretty display. CoffeeScript, Raphael, Highcharts, Three.js, Twitter Bootstrap, jQuery and Web Workers. 2D Demo You have a shuffled grid and you have to find the [...]]]></description>
			<content:encoded><![CDATA[<p>For a school project, I have to implement <a href="http://en.wikipedia.org/wiki/Simulated_annealing">Simulated Annealing</a> meta heuristic.</p>
<p>Thanks to many open source web tools, I've been able to quickly do the project and have a pretty display. <a href="http://coffeescript.org/">CoffeeScript</a>, <a href="http://raphaeljs.com/">Raphael</a>, <a href="http://www.highcharts.com/">Highcharts</a>, <a href="https://github.com/mrdoob/three.js/">Three.js</a>, <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap</a>, <a href="http://jquery.com/">jQuery</a> and <a href="https://developer.mozilla.org/en/Using_web_workers">Web Workers</a>.</p>
<style>.hover-border img { border: 1px solid transparent; } .hover-border a:hover img { border: 1px solid #DB5104; }</style>
<h3>2D Demo</h3>
<p>You have a shuffled grid and you have to find the original grid. The only operation available is to swap 2 random elements. The cost function is the distance of the point with their original neighbors.</p>
<div style="text-align: center;" class="hover-border"><a href="http://fooo.fr/~vjeux/epita/recuit/recuit.html"><img src="http://blog.vjeux.com/wp-content/uploads/2011/11/recuit.png" /><br />Click to view the 2D demo</a></div>
<h3>3D Demo</h3>
<p>On this one, we are given many functions and we have to find the global minimum. The challenge was to be able to display the evolution of the algorithm, as it traverses 200k points per second.</p>
<div style="text-align: center;" class="hover-border"><a href="http://fooo.fr/~vjeux/epita/recuit/3d.html"><img src="http://blog.vjeux.com/wp-content/uploads/2011/11/recuit-3d.png" /><br />Click to view the 3D demo</a></div>
<h3>CoffeeScript Sexyness</h3>
<p>I've written the project in CoffeeScript and I don't regret it. I find myself writing code a lot faster because I have a lot less to type. Most of the Javascript syntax is either shortened (<code>function</code> to <code>-></code>) or optional (parenthesis, curly brackets ...) in CoffeeScript. There are also handy features such as splats, generators ...</p>
<h4>Destructuring Assignment</h4>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">worker.<span style="color: black;">onmessage</span> = <span style="color: black;">&#40;</span>data: <span style="color: black;">&#91;</span><span style="color: #008000;">id</span>, rest...<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> -<span style="color: #66cc66;">&gt;</span>
	switch <span style="color: #008000;">id</span>
		when <span style="color: #483d8b;">'update'</span>
			<span style="color: black;">&#91;</span>cost, temperature, accepted, tried, data, force<span style="color: black;">&#93;</span> = rest</pre></div></div>

<h4>Trimmed JSON</h4>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">chart = <span style="color: #dc143c;">new</span> Highcharts.<span style="color: black;">Chart</span>
	chart:
		renderTo: <span style="color: #483d8b;">'container'</span>
	yAxis: <span style="color: black;">&#91;</span>
		title:
			text: <span style="color: #483d8b;">'Cost'</span>
	<span style="color: black;">&#93;</span>
	tooltip:
		<span style="color: #dc143c;">formatter</span>: -<span style="color: #66cc66;">&gt;</span>
			this.<span style="color: black;">series</span>.<span style="color: black;">name</span> + <span style="color: #483d8b;">': '</span> + this.<span style="color: black;">y</span></pre></div></div>

<h3>Report</h3>
<p>Felix Abecassis wrote a report that explains everything <img src='http://blog.vjeux.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It's in French, sorry!</p>
<p><a href="http://blog.vjeux.com/wp-content/uploads/2011/12/recuit.pdf" style="float: right;">Download PDF</a><br />
<embed width="100%" height="600" name="plugin" src="http://blog.vjeux.com/wp-content/uploads/2011/12/recuit.pdf" type="application/pdf"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vjeux.com/2011/javascript/simulated-annealing-project.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>World of Warcraft HTML Tooltip Diff</title>
		<link>http://blog.vjeux.com/2011/project/world-of-warcraft-html-tooltip-diff.html</link>
		<comments>http://blog.vjeux.com/2011/project/world-of-warcraft-html-tooltip-diff.html#comments</comments>
		<pubDate>Sun, 11 Sep 2011 17:00:08 +0000</pubDate>
		<dc:creator>vjeux</dc:creator>
				<category><![CDATA[Project]]></category>

		<guid isPermaLink="false">http://blog.vjeux.com/?p=2068</guid>
		<description><![CDATA[MMO-Champion is a World of Warcraft news website. When a new patch is released, we want to show what has changed in the game (Post Example). An english summary of each spell change is hand written, but we want to show the exact tooltip changes. jsHTMLDiff is available on Github. Generate Tooltips First, we use [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mmo-champion.com/">MMO-Champion</a> is a World of Warcraft news website. When a new patch is released, we want to show what has changed in the game (<a href="http://www.mmo-champion.com/content/2323-Patch-4.2-PTR-Build-14199-Patch-4.2-roar-emote-sounds#spell-change">Post Example</a>). An english summary of each spell change is hand written, but we want to show the exact tooltip changes.</p>
<div style="background: #FAF9E2; border: solid #DDDAAA; border-width: initial; color: #5D5636; margin-bottom: 0em; padding: 0.75em 15px; text-align: center;">
<a href="https://github.com/vjeux/jsHTMLDiff/"><strong>jsHTMLDiff</strong> is available on Github</a>.
</div>
<link type="text/css" rel="stylesheet" href="http://blog.vjeux.com/wp-content/uploads/2011/09/tooltip.css"></link>
<style>
.sigrie-tooltip {
    max-width: 325px !important;
    float: none;
    display: inline-block;
}
.inline ins { background-color: #afa; }
.inline del { background-color: #faa; }
ins, del {
    text-decoration: none;
}
.new ins {
    background-color: #afa;
}
.old ins {
    background-color: #faa;
}
.sigrie-tooltip ins {
    color: black;
    background-color: #80FF80;
    font-weight: bold;
}
</style>
<h3>Generate Tooltips</h3>
<p>First, we use the database application to generate the tooltips in HTML form.</p>
<table>
<tr class="change tooltip" id="78487-tooltip">
<td class="value old" valign="top">
<div class="tt-spell sigrie-tooltip tt-spell-tradespell">
<div class="tt-name tti-name q4"><a href="http://db.mmo-champion.com/i/56561/chestguard-of-natures-fury/" class="q4">Chestguard of Nature's Fury</a></div>
<div class="tti-quality">Epic</div>
<div class="tti-bind">Binds when equipped</div>
<div class="tti-subclass"><a href="http://db.mmo-champion.com/items/4/2/">Armor</a></div>
<div class="tti-slot">Chest</div>
<div class="tti-armor">1669 Armor</div>
<div>
<div class="tti-stat">+341 Intellect</div>
<div class="tti-stat">+512 Stamina</div>
</div>
<div class="tti-required_level">Requires Level 85</div>
<div class="tti-level">Item Level 359</div>
<div class="tti-stat-special">
<div class="tti-stat">Equip: Improves critical strike rating by 205.</div>
<div class="tti-stat">Equip: Increases your mastery rating by 241.</div>
</div>
</div>
</td>
<td class="value new">
<div class="tt-spell sigrie-tooltip tt-spell-tradespell">
<div class="tt-name tti-name q4"><a href="http://db.mmo-champion.com/i/56561/chestguard-of-natures-fury/" class="q4">Chestguard of Nature's Fury</a></div>
<div class="tti-quality">Epic</div>
<div class="tti-bind">Binds when equipped</div>
<div class="tti-subclass"><a href="http://db.mmo-champion.com/items/4/2/">Armor</a></div>
<div class="tti-slot">Chest</div>
<div class="tti-armor">1669 Armor</div>
<div>
<div class="tti-stat">+321 Intellect</div>
<div class="tti-stat">+512 Stamina</div>
</div>
<div class="tti-sockets">
<div class="socket-red wow-socket tti-socket"><a href="http://db.mmo-champion.com/items/?gem_color__band=2">Red Socket</a></div>
<div class="tti-socket_bonus">Socket Bonus: <a href="http://db.mmo-champion.com/e/4211/10-haste-rating/">+10 Haste Rating</a></div>
</div>
<div class="tti-required_level">Requires Level 85</div>
<div class="tti-level">Item Level 359</div>
<div class="tti-stat-special">
<div class="tti-stat">Equip: Improves critical strike rating by 205.</div>
<div class="tti-stat">Equip: Increases your mastery rating by 221.</div>
</div>
</div>
</td>
</tr>
</table>
<h3>Tokenize</h3>
<p>We are not going to do a full HTML diff which is really difficult. Instead, the trick is to parse the HTML and extract only text nodes. We split them by space to generate a token stream.</p>
<style>
.html-diff-bulle span { display: inline-block; border: 1px solid #333; border-radius: 3px; margin: 3px; padding: 2px; }
.html-diff-bulle .old { background-color: #faa; }
.html-diff-bulle .new { background-color: #afa; }
</style>
<table class="html-diff-bulle">
<tr>
<td width="50%" valign="top">
<span>Chestguard</span><span>of</span><span>Nature's</span><span>Fury</span><span>Binds</span><span>when</span><span>equipped</span><span>Chest</span><span>1669</span><span>Armor</span><span>+341</span><span>Intellect</span><span>+512</span><span>Stamina</span><span>Requires</span><span>Level</span><span>85</span><span>Equip:</span><span>Improves</span><span>critical</span><span>strike</span><span>rating</span><span>by</span><span>205.</span><span>Equip:</span><span>Increases</span><span>your</span><span>mastery</span><span>rating</span><span>by</span><span>241.</span>
</td>
<td width="50%" valign="top">
<span>Chestguard</span><span>of</span><span>Nature's</span><span>Fury</span><span>Binds</span><span>when</span><span>equipped</span><span>Chest</span><span>1669</span><span>Armor</span><span>+321</span><span>Intellect</span><span>+512</span><span>Stamina</span><span>Red</span><span>Socket</span><span>Socket</span><span>Bonus:</span><span>+10</span><span>Haste</span><span>Rating</span><span>Requires</span><span>Level</span><span>85</span><span>Equip:</span><span>Improves</span><span>critical</span><span>strike</span><span>rating</span><span>by</span><span>205.</span><span>Equip:</span><span>Increases</span><span>your</span><span>mastery</span><span>rating</span><span>by</span><span>221.</span>
</td>
</tr>
</table>
<h3>Diff</h3>
<p><a href="http://paulbutler.org/archives/simplediff-in-python/">Paul Butler SimpleDiff</a> algorithm is used on the two token streams to label each token with <code>old</code>, <code>new</code> or <code>both</code>.</p>
<table class="html-diff-bulle">
<tr>
<td width="50%" valign="top">
<span>Chestguard</span><span>of</span><span>Nature's</span><span>Fury</span><span>Binds</span><span>when</span><span>equipped</span><span>Chest</span><span>1669</span><span>Armor</span><span class="old">+341</span><span>Intellect</span><span>+512</span><span>Stamina</span><span>Requires</span><span>Level</span><span>85</span><span>Equip:</span><span>Improves</span><span>critical</span><span>strike</span><span>rating</span><span>by</span><span>205.</span><span>Equip:</span><span>Increases</span><span>your</span><span>mastery</span><span>rating</span><span>by</span><span class="old">241.</span>
</td>
<td width="50%" valign="top">
<span>Chestguard</span><span>of</span><span>Nature's</span><span>Fury</span><span>Binds</span><span>when</span><span>equipped</span><span>Chest</span><span>1669</span><span>Armor</span><span class="new">+321</span><span>Intellect</span><span>+512</span><span>Stamina</span><span class="new">Red</span><span class="new">Socket</span><span class="new">Socket</span><span class="new">Bonus:</span><span class="new">+10</span><span class="new">Haste</span><span class="new">Rating</span><span>Requires</span><span>Level</span><span>85</span><span>Equip:</span><span>Improves</span><span>critical</span><span>strike</span><span>rating</span><span>by</span><span>205.</span><span>Equip:</span><span>Increases</span><span>your</span><span>mastery</span><span>rating</span><span>by</span><span class="new">221.</span>
</td>
</tr>
</table>
<h3>Combine</h3>
<p>We parse the HTML again. This time we pretty-print the HTML while traversing it. As we parse text nodes, we add <code>&lt;ins&gt;</code> tags where we need to. We just make sure to group contiguous insertions.</p>
<table>
<tr class="change tooltip" id="78487-tooltip">
<td class="value old" valign="top">
<div class="tt-spell sigrie-tooltip tt-spell-tradespell">
<div class="tt-name tti-name q4"><a href="http://db.mmo-champion.com/i/56561/chestguard-of-natures-fury/" class="q4">Chestguard of Nature's Fury</a></div>
<div class="tti-quality">Epic</div>
<div class="tti-bind">Binds when equipped</div>
<div class="tti-subclass"><a href="http://db.mmo-champion.com/items/4/2/">Armor</a></div>
<div class="tti-slot">Chest</div>
<div class="tti-armor">1669 Armor</div>
<div>
<div class="tti-stat"><ins>+341</ins> Intellect</div>
<div class="tti-stat">+512 Stamina</div>
</div>
<div class="tti-required_level">Requires Level 85</div>
<div class="tti-level">Item Level 359</div>
<div class="tti-stat-special">
<div class="tti-stat">Equip: Improves critical strike rating by 205.</div>
<div class="tti-stat">Equip: Increases your mastery rating by <ins>241.</ins></div>
</div>
</div>
</td>
<td class="value new">
<div class="tt-spell sigrie-tooltip tt-spell-tradespell">
<div class="tt-name tti-name q4"><a href="http://db.mmo-champion.com/i/56561/chestguard-of-natures-fury/" class="q4">Chestguard of Nature's Fury</a></div>
<div class="tti-quality">Epic</div>
<div class="tti-bind">Binds when equipped</div>
<div class="tti-subclass"><a href="http://db.mmo-champion.com/items/4/2/">Armor</a></div>
<div class="tti-slot">Chest</div>
<div class="tti-armor">1669 Armor</div>
<div>
<div class="tti-stat"><ins>+321</ins> Intellect</div>
<div class="tti-stat">+512 Stamina</div>
</div>
<div class="tti-sockets">
<div class="socket-red wow-socket tti-socket"><a href="http://db.mmo-champion.com/items/?gem_color__band=2"><ins>Red Socket</ins></a></div>
<div class="tti-socket_bonus"><ins>Socket Bonus:</ins> <a href="http://db.mmo-champion.com/e/4211/10-haste-rating/"><ins>+10 Haste Rating</ins></a></div>
</div>
<div class="tti-required_level">Requires Level 85</div>
<div class="tti-level">Item Level 359</div>
<div class="tti-stat-special">
<div class="tti-stat">Equip: Improves critical strike rating by 205.</div>
<div class="tti-stat">Equip: Increases your mastery rating by <ins>221.</ins></div>
</div>
</div>
</td>
</tr>
</table>
<h3>Text Diff</h3>
<p>We would also like to get a text-based diff we can insert in a Patch Note. We combine both token streams into one. </p>
<blockquote class="inline"><p>
Chestguard of Nature's Fury<br />
Binds when equipped<br />
Chest<br />
1669 Armor<br />
<del>+341</del><ins>+321</ins> Intellect<br />
+512 Stamina<br />
<ins>Red Socket</ins><br />
<ins>Socket Bonus: +10 Haste Rating</ins><br />
Requires Level 85<br />
Equip: Improves critical strike rating by 205.<br />
Equip: Increases your mastery rating by <del>241.</del><ins>221.</ins>
</p></blockquote>
<blockquote class="inline"><p>
Chestguard of Nature's Fury Binds when equipped Chest 1669 Armor <del>+341</del><ins>+321</ins> Intellect +512 Stamina <ins>Red Socket</ins> <ins>Socket Bonus: +10 Haste Rating</ins> Requires Level 85 Equip: Improves critical strike rating by 205. Equip: Increases your mastery rating by <del>241.</del><ins>221.</ins>
</p></blockquote>
<p>However, the result isn't that readable. There is too much noise. We want to show only the information that has changed! In order to do that, we are going to keep only the lines that contain changes.</p>
<blockquote class="inline"><p>
<del>+341</del><ins>+321</ins> Intellect<br />
<ins>Red Socket</ins><br />
<ins>Socket Bonus: +10 Haste Rating</ins><br />
Equip: Increases your mastery rating by <del>241.</del><ins>221.</ins>
</p></blockquote>
<blockquote class="inline"><p>
<del>+341</del><ins>+321</ins> Intellect <ins>Red Socket</ins> <ins>Socket Bonus: +10 Haste Rating</ins> Equip: Increases your mastery rating by <del>241.</del><ins>221.</ins>
</p></blockquote>
<p>And it works a lot better <img src='http://blog.vjeux.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Conclusion</h3>
<p>This approach is working really well with the World of Warcraft tooltips. After many patches and hundreds of changes, I haven't seen any weird behavior. They were common before using this technique. The only downside: non textual changes such as icons or colors will be completly ignored.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vjeux.com/2011/project/world-of-warcraft-html-tooltip-diff.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript &#8211; Binary Decision Diagram</title>
		<link>http://blog.vjeux.com/2011/project/javascript-binary-decision-diagram.html</link>
		<comments>http://blog.vjeux.com/2011/project/javascript-binary-decision-diagram.html#comments</comments>
		<pubDate>Wed, 06 Jul 2011 14:57:27 +0000</pubDate>
		<dc:creator>vjeux</dc:creator>
				<category><![CDATA[Project]]></category>

		<guid isPermaLink="false">http://blog.vjeux.com/?p=1844</guid>
		<description><![CDATA[During the course "Introduction to Model Checking" by Alexandre Duret-Lutz we've been assigned to create a Binary Decision Diagram library. Contrary to most people, I've been writing mine in Javascript instead of C++. Overall it is running slower but by an acceptable factor (around x5). Display I've written a BDD display using the graph library [...]]]></description>
			<content:encoded><![CDATA[<p>During the course "Introduction to Model Checking" by <a href="http://www.lrde.epita.fr/~adl/">Alexandre Duret-Lutz</a> we've been assigned to create a <a href="http://fooo.fr/~vjeux/epita/bdd/bdd.pdf">Binary Decision Diagram</a> library. Contrary to most people, I've been writing mine in Javascript instead of C++. Overall it is running slower but by an acceptable factor (around x5).</p>
<h3>Display</h3>
<style>iframe { border: 1px solid #ccc; }</style>
<p>I've written a BDD display using the graph library called <a href="http://www.graphdracula.net/">Dracula</a> which is built on-top of <a href="http://raphaeljs.com/">RaphaëlJS</a>. The API of the lib is really neat but there are only 2 available node layout algorithms and none of them really fit my needs. I'd love to have the ones available in <a href="http://www.graphviz.org/Gallery.php">GraphViz</a>.</p>
<p>In order to enter a formula, I've written a small parser that accepts most common binary operations. The little <img src="http://fooo.fr/~vjeux/epita/bdd/random.png"/> dice gives you some random formula. Also, on the left, you have all the evaluations that satisfy your formula.</p>
<p><iframe src="http://fooo.fr/~vjeux/epita/bdd/interactive.html#%21c+%26+%28a+%7C+%21b%29" width="100%" height="500" border="0"></iframe></p>
<h3>Use Case</h3>
<p>Binary Decision Diagram are used in <a href="http://en.wikipedia.org/wiki/Boolean_satisfiability_problem">Boolean Satisfiability Problem</a> and <a href="http://en.wikipedia.org/wiki/Model_checking">Model Checking</a>. As a benchmark example, we use the BDD to solve the <a href="http://en.wikipedia.org/wiki/Eight_queens_puzzle">8-Queens</a> problem.</p>
<p>A version using web-workers is available. However, using more than one worker will be slower as the cost of communication (through JSON serialization) is really high (hundreds of thousands nodes). You can also try to use a random ordering for the variables, but beware, the execution time varies a lot (up to x100 for the fastest/slowest)!</p>
<p><iframe src="http://fooo.fr/~vjeux/epita/bdd/queens.html" width="100%" height="400" border="0"></iframe></p>
<h3>Conclusion</h3>
<p>It was a really fun project to do. You can <a href="http://fooo.fr/~vjeux/epita/bdd/">view the sources</a> and probably use them as a base if you ever need to use a BDD in your life <img src='http://blog.vjeux.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vjeux.com/2011/project/javascript-binary-decision-diagram.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WoWTal.com Cataclysm</title>
		<link>http://blog.vjeux.com/2010/javascript/wowtal-com-cataclysm.html</link>
		<comments>http://blog.vjeux.com/2010/javascript/wowtal-com-cataclysm.html#comments</comments>
		<pubDate>Fri, 15 Oct 2010 13:11:15 +0000</pubDate>
		<dc:creator>vjeux</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Project]]></category>

		<guid isPermaLink="false">http://blog.vjeux.com/?p=1146</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<link rel="stylesheet" href="http://fooo.fr/~vjeux/html5video/video-js.css" type="text/css" media="screen" title="Video JS" charset="utf-8">
  </link>
<link rel="stylesheet" href="http://fooo.fr/~vjeux/html5video/skins/vim.css" type="text/css" media="screen" title="Video JS" charset="utf-8">
  <script src="http://fooo.fr/~vjeux/html5video/video.js" type="text/javascript" charset="utf-8"></script><br />
 <script type="text/javascript" charset="utf-8">
    // Add VideoJS to all video tags on the page when the DOM is ready
    VideoJS.setupAllWhenReady();
  </script></p>
<div class="video-js-box vim-css" style="margin-left: 85px;">
    <video class="video-js" width="464" height="440" controls preload><br />
      <source src="http://fooo.fr/~vjeux/boub/wowtal/wowtal.mov" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'><br />
      <object class="vjs-flash-fallback" width="464" height="440" type="application/x-shockwave-flash" data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf"><param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" /><param name="allowfullscreen" value="true" /><param name="flashvars" value='config={"playlist":[{"url": "http://fooo.fr/~vjeux/boub/wowtal/wowtal.mov","autoPlay":false,"autoBuffering":true}]}' /></object><br />
    </source></video>
  </div>
</link>
]]></content:encoded>
			<wfw:commentRss>http://blog.vjeux.com/2010/javascript/wowtal-com-cataclysm.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://fooo.fr/~vjeux/boub/wowtal/wowtal.mov" length="8113449" type="video/quicktime" />
		</item>
		<item>
		<title>Project &#8211; SC2Mapster</title>
		<link>http://blog.vjeux.com/2010/project/project-sc2mapster.html</link>
		<comments>http://blog.vjeux.com/2010/project/project-sc2mapster.html#comments</comments>
		<pubDate>Mon, 22 Mar 2010 09:09:08 +0000</pubDate>
		<dc:creator>vjeux</dc:creator>
				<category><![CDATA[Project]]></category>

		<guid isPermaLink="false">http://blog.vjeux.com/?p=1061</guid>
		<description><![CDATA[Starcraft II has been a beta for a month and I've been actively working on the map making features. The Galaxy Map Editor has not been released yet however it is already possible to do edit the map files. My goal is not to develop a map but to build a community around that editor. [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1060" class="wp-caption alignright" style="width: 210px"><a href="http://www.sc2mapster.com/" title="Starcraft 2 Maps"><img src="http://blog.vjeux.com/wp-content/uploads/2010/03/sc2mapster-logo.png" alt="SC2Mapster" title="SC2Mapster" width="200" height="169" class="size-full wp-image-1060" /></a><p class="wp-caption-text"><a href='http://www.sc2mapster.com/' title='Starcraft 2 Maps'>SC2Mapster</a></p></div>
<p>Starcraft II has been a beta for a month and I've been actively working on the map making features. The Galaxy Map Editor has not been released yet however it is already possible to do edit the map files.</p>
<p>My goal is not to develop a map but to build a community around that editor. With Curse co-workers we have launched the website <a href="http://www.sc2mapster.com/">SC2Mapster.com</a>.</p>
<p>In order to prepare the future We set up a documentation wiki. It is being filled by the community and currently contains the <a href="http://www.sc2mapster.com/api-docs/functions/">function listing</a>, the <a href="http://www.sc2mapster.com/api-docs/game-files/xml/">xml files descriptions</a>, a <a href="">Galaxy language overview</a> and <a href="http://www.sc2mapster.com/api-docs/">much more</a> ...</p>
<p>Here is a small part of the function listing:</p>
<blockquote style="text-align: left;">
<h5>Trigger</h5>
<p>Triggers are function that are executed when an event occur. These functions allow the user to create new triggers from custom functions and bind them to different events.</p>
<ul>
<li><a href="http://wiki.sc2mapster.com/sc2-api/functions/trigger-create/">TriggerCreate</a>(<a href="http://wiki.sc2mapster.com/sc2-api/types/string/">string</a> func) - Create a new trigger from a function</li>
<li><a href="http://wiki.sc2mapster.com/sc2-api/functions/trigger-output/">TriggerDebugOutput</a>(<a href="http://wiki.sc2mapster.com/sc2-api/types/int/">int</a> triggerDebug, <a href="http://wiki.sc2mapster.com/sc2-api/types/text/">text</a> message, <a href="http://wiki.sc2mapster.com/sc2-api/types/bool/">bool</a> UI) - Display a message in the trigger debug panel</li>
<li><a href="http://wiki.sc2mapster.com/sc2-api/functions/trigger-add-event-map-init/">TriggerAddEventMapInit</a>(<a href="http://wiki.sc2mapster.com/sc2-api/types/int/">int</a> player, <a href="http://wiki.sc2mapster.com/sc2-api/types/trigger/">trigger</a> t) - Register a trigger that will be executed on map initialization</li>
<li><a href="http://wiki.sc2mapster.com/sc2-api/functions/wait/">Wait</a>(<a href="http://wiki.sc2mapster.com/sc2-api/types/fixed/">fixed</a> seconds, <a href="http://wiki.sc2mapster.com/sc2-api/types/int/">int</a> timezone) - Pause the current trigger without blocking</li>
<li><a href="http://wiki.sc2mapster.com/sc2-api/functions/trigger-add-event-chat-message/">TriggerAddEventChatMessage</a>(<a href="http://wiki.sc2mapster.com/sc2-api/types/trigger/">trigger</a> t, <a href="http://wiki.sc2mapster.com/sc2-api/types/int/">int</a> player, <a href="http://wiki.sc2mapster.com/sc2-api/types/string/">string</a> message, <a href="http://wiki.sc2mapster.com/sc2-api/types/bool/">bool</a> strict) - Register a trigger that will be executed on Chat Messages</li>
<li><a href="http://wiki.sc2mapster.com/sc2-api/functions/event-chat-message/">EventChatMessage</a>(<a href="http://wiki.sc2mapster.com/sc2-api/types/bool/">bool</a> strict) - Message content available on TriggerAddEventChatMessage callback</li>
</ul>
<p>This is a preview of the <a href="http://www.sc2mapster.com/api-docs/functions/">Starcraft II Galaxy Functions API</a>.
</p></blockquote>
<p>The website also hosts many map making related projects such as <a href="http://www.sc2mapster.com/maps/">maps</a>, <a href="http://www.sc2mapster.com/assets/">galaxy scripts</a> or <a href="http://www.sc2mapster.com/assets/">tilesets</a>. In order to prove that we are able to start working, I've been working on a Tower Defense: <a href="http://www.sc2mapster.com/maps/mapster-td/">Mapster TD</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vjeux.com/2010/project/project-sc2mapster.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project &#8211; WoW Genuine</title>
		<link>http://blog.vjeux.com/2010/project/project-wow-genuine.html</link>
		<comments>http://blog.vjeux.com/2010/project/project-wow-genuine.html#comments</comments>
		<pubDate>Fri, 22 Jan 2010 10:16:03 +0000</pubDate>
		<dc:creator>vjeux</dc:creator>
				<category><![CDATA[Project]]></category>
		<category><![CDATA[recruitment]]></category>

		<guid isPermaLink="false">http://blog.vjeux.com/?p=982</guid>
		<description><![CDATA[Working on the World of Raids Guild Recruitment I needed to make sure the user was really member of the guild he claimed to represent. Since there is no official API and we don't want to ask for the user login and password, we had to find an other way. The idea is to take [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_988" class="wp-caption alignright" style="width: 185px"><a href="http://www.wowgenuine.com/"><img src="http://blog.vjeux.com/wp-content/uploads/2010/01/wowgenuine1-175x300.png" alt="WoW Genuine" title="WoW Genuine" width="175" height="300" class="size-medium wp-image-988" /></a><p class="wp-caption-text"><a href='http://www.wowgenuine.com/'>WoW Genuine</a></p></div>
<p>Working on the <a href="/2009/project/project-wor-guild-recruitment.html">World of Raids Guild Recruitment</a> I needed to make sure the user was really member of the guild he claimed to represent. Since there is no official API and we don't want to ask for the user login and password, we had to find an other way.</p>
<p>The idea is to take advantage of the official Armory. When the user logs off the game, his character profile is updated on the website. To make sure the user is who he pretends to be, we are going to ask him to make a change on his character, wait for the armory to update and verify.</p>
<p>Since it's a tool that can be useful to anyone, we decided to make it a standalone service with an open API. If you have a World of Warcraft website and feel the need to verify that your users are genuine, this is your chance!</p>
<p>It has been in activity since the launch of the recruitment tool. So far 100 conflicts have been automatically resolved thanks to this tool.</p>
<p>Check out <a href="http://www.wowgenuine.com/">WoW Genuine.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vjeux.com/2010/project/project-wow-genuine.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project &#8211; WoR Guild Recruitment</title>
		<link>http://blog.vjeux.com/2009/project/project-wor-guild-recruitment.html</link>
		<comments>http://blog.vjeux.com/2009/project/project-wor-guild-recruitment.html#comments</comments>
		<pubDate>Wed, 23 Dec 2009 17:26:27 +0000</pubDate>
		<dc:creator>vjeux</dc:creator>
				<category><![CDATA[Project]]></category>
		<category><![CDATA[recruitment]]></category>

		<guid isPermaLink="false">http://blog.vjeux.com/?p=646</guid>
		<description><![CDATA[World of Raids Guild Recruitment Guild recruitment is a recurrent problem in World of Warcraft, many attempt have been made but none succedeed so far. After a brainstorming we decided that the following points were crucial. The guild recruiter has to spend less time as possible to set-up a guild and maintain it. The guild [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_647" class="wp-caption alignright" style="width: 310px"><a href="http://blog.vjeux.com/wp-content/uploads/2009/12/wor-recruit-search.png"><img src="http://blog.vjeux.com/wp-content/uploads/2009/12/wor-recruit-search-300x276.png" alt="World of Raids Guild Recruitment Search" title="wor-recruit-search" width="300" height="276" class="size-medium wp-image-647" /></a><p class="wp-caption-text"><a href='http://www.worldofraids.com/recruitment/'>World of Raids Guild Recruitment Search</a></p></div>
<h3>World of Raids Guild Recruitment</h3>
<p>Guild recruitment is a recurrent problem in World of Warcraft, many attempt have been made but none succedeed so far. After a brainstorming we decided that the following points were crucial.</p>
<ul>
<li>The guild recruiter has to spend less time as possible to set-up a guild and maintain it.</li>
<li>The guild search must be easy and focus on what people expect from their guild.</li>
</ul>
<p>With these points in mind, we had to find technical responses in order to make the <a href="http://www.worldofraids.com/recruitment/">World of Raids Guild Recruitment Tool</a>.</p>
<ul>
<li><strong>What You See Is What You Get</strong>: The guild management interface is the final display, there is no intermediate step.</li>
<li><strong>Tailored Widgets</strong>: About every widget has been heavily customized to fit the user need.</li>
<li><strong>Automatic Save</strong>: Every time you make a change, it is automatically published and available to anyone!</li>
<li><strong>Javascript Search</strong>: Having all the guilds fetched during the loading allows to have a complex filtering system instantly updated.</li>
</ul>
<h3>Guild Search</h3>
<p>Looking for a guild should no more be a pain! You just have to tweak the filters and result appear sorted as you edit them! No more long page reload or even ajax requests. It is instant!</p>
<p>We focused hard on making filters one click away. We also took great care of the raid time filter, it is an important aspect of the guild choice that is too often avoided because of its complexity.</p>
<p><object width="100%" height="400"><param name="movie" value="http://www.youtube.com/v/leoCXK8lDf8&#038;hl=fr_FR&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/leoCXK8lDf8&#038;hl=fr_FR&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="100%" height="400"></embed></object></p>
<p>For more details on the optimizations made, see the post <a href="/2009/javascript/guild-recruitement-search-optimizations.html">Guild Recruitement – Search Optimizations</a>.</p>
<h3>Guild Management</h3>
<p>Our original goal was to be able to create a guild in less than a minute (yes, 60 seconds!) and we pretty much did it. The proof in the following video.</p>
<p>In order to achieve this, we opted for a Wysiwyg approach to remove the need of making two interfaces for both display and edition. Every widget has been tailored to fit the user needs. For example, as soon as you enter your name and realm, it automatically gathers your progression from the official website.</p>
<p><object width="100%" height="400"><param name="movie" value="http://www.youtube.com/v/qyQuPpPLTmo&#038;hl=fr_FR&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/qyQuPpPLTmo&#038;hl=fr_FR&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="100%" height="400"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vjeux.com/2009/project/project-wor-guild-recruitment.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Project &#8211; Fooo</title>
		<link>http://blog.vjeux.com/2009/project/project-fooo.html</link>
		<comments>http://blog.vjeux.com/2009/project/project-fooo.html#comments</comments>
		<pubDate>Tue, 04 Aug 2009 18:46:41 +0000</pubDate>
		<dc:creator>vjeux</dc:creator>
				<category><![CDATA[Project]]></category>

		<guid isPermaLink="false">http://blog.vjeux.com/?p=376</guid>
		<description><![CDATA[Presentation Fooo is my first year school project written in Delphi. During 8 months, Vladimir Nachbaur, Alban Perillat-Merceroz, Felix Abecassis and I developed a game that mimics Warcraft III and achieved to be major of the promotion. We tried to make no use of copyrighted Warcraft files, however, a large majority of custom models are [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_377" class="wp-caption alignright" style="width: 106px"><a href="http://hgf.fooo.fr/en/index.html"><img src="http://blog.vjeux.com/wp-content/uploads/2009/09/fooo_avatar1.png" alt="Fooo" title="Fooo" width="96" height="96" class="size-full wp-image-377" /></a><p class="wp-caption-text"><a href='http://hgf.fooo.fr/en/index.html'>hgf.fooo.fr</a></p></div>
<h2>Presentation</h2>
<p><a href="http://hgf.fooo.fr/en/index.html">Fooo</a> is my first year school project written in Delphi. During 8 months, Vladimir Nachbaur, Alban Perillat-Merceroz, Felix Abecassis and I developed a game that mimics Warcraft III and achieved to be major of the promotion. </p>
<p>We tried to make no use of copyrighted Warcraft files, however, a large majority of custom models are based on Warcraft files at some point and use some of their textures. All the interface graphic, icons, models has been made by fans and we are using them with their approbation.</p>
<p>What's the game able to do :</p>
<ul>
<li>Animated 3D Models</li>
<li>Interface in XML/Lua</li>
<li>Building &#038; Unit creation</li>
<li>Group and Subgroup management</li>
<li>Group movement with formations</li>
<li>Ranged &#038; Melee Attacks</li>
<li>Multiplayer over LAN or Internet</li>
<li>Ingame Chat</li>
<li>2 Races: Treants and Rats</li>
<li>And much more ...</li>
</ul>
<h3>Demonstration Video</h3>
<p><object width="100%" height="400px"><param name="movie" value="http://www.youtube.com/v/rZh6L40TJMY&#038;hl=fr&#038;fs=1&#038;ap=%2526fmt%3D22"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/rZh6L40TJMY&#038;hl=fr&#038;fs=1&#038;ap=%2526fmt%3D22" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="100%" height="400px"></embed></object></p>
<p />
<h2>My work in the project</h2>
<h3>Interface</h3>
<p>A RTS game is requiring a lot of user interaction, so it needs a complex interface. I decided to make an interface engine like the one used by World of Warcraft. The content is displayed through XML files and scripted with Lua. If you are not familiar with this, you can think the XML as HTML and Lua as Javascript.</p>
<p>The interface engine is able to do the following:</p>
<ul>
<li>Supports Frame, Texture and FontString elements</li>
<li>Ability to draw Backgrounds and Borders from images</li>
<li>Mouse and Keyboard Interaction</li>
<li>Inheritance and Virtual Frames</li>
<li>Position through 2 Anchor points (element and its relative)</li>
</ul>
<h3>3D Engine</h3>
<p>The 3D Engine is written on top of OpenGL. I've been confronted to two major problems. The first one is the Warcraft III models: there is really few documentation on them so i had to spent quite some time to reverse engineer them and figure out how animation were working.<br />
The engine had to be optimized in many ways. At first, displaying one building was freezing the PC, now we are able to show more than 100 units and the game still runs smoothly.</p>
<p>The 3d engine is able to do the following:</p>
<ul>
<li>Animated Warcraft III Models</li>
<li>Camera: Zoom and Rotation</li>
<li>3D Picking</li>
<li>Frustum Culling</li>
<li>Vertex Array</li>
</ul>
<h3>Learn more</h3>
<p>If you want to learn more, for each presentation we made a 30 page document (french) explaining in detail the progression. You can read them at <a href="http://hgf.fooo.fr/en/downloads.html#docs">hgf.fooo.fr</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vjeux.com/2009/project/project-fooo.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

