<?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>gaming &#8211; Sanity Free Coding</title>
	<atom:link href="http://sanity-free.org/tag/gaming/feed" rel="self" type="application/rss+xml" />
	<link>http://sanity-free.org</link>
	<description>Methods to the Madness</description>
	<lastBuildDate>Thu, 20 Nov 2025 04:38:33 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>http://sanity-free.org/wp-content/uploads/2025/10/sanity-free-512-150x150.jpg</url>
	<title>gaming &#8211; Sanity Free Coding</title>
	<link>http://sanity-free.org</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>A Battlefield 2 Rank Avatar Script in PHP</title>
		<link>http://sanity-free.org/battlefield_rank_avatar_script_in_php.html</link>
		
		<dc:creator><![CDATA[steve]]></dc:creator>
		<pubDate>Tue, 20 Sep 2005 18:00:18 +0000</pubDate>
				<category><![CDATA[PHP Articles]]></category>
		<category><![CDATA[battlefield2]]></category>
		<category><![CDATA[gaming]]></category>
		<category><![CDATA[php]]></category>
		<guid isPermaLink="false">http://dev.sanity-free.org/?p=107</guid>

					<description><![CDATA[This is a little departure from my typical topic. To cut a rather tedious and boring story short, I play Battlefield 2, which has a cool stats service that folks have been hacking with outside of the game (the game has a stats board built in, which stats board uses some pseudo web-services to obtain [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>This is a little departure from my typical topic.<br><br>To cut a rather tedious and boring story short, I play Battlefield 2, which has a cool stats service that folks have been hacking with outside of the game (the game has a stats board built in, which stats board uses some pseudo web-services to obtain game statistic info).<br><br>There are a multitude of server hosts out there that generate dynamic signature images with your game stats in them, so that you can look cool and show off how much time you actually waste online gaming, on every forum you frequent.<br><br>I decided to join the masses and write a script that pulls my users rank and score from the stats servers and returns an image that can be used as an avatar on most bulletin board systems out there. I had a size restriction on the server I wanted it for, so the images produced are 80&#215;80 and less than 6k in size.<br><br>Using the avatar script is pretty easy, you direct the image source URL to the server where you install the script (or you can just use the one here)<br></p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono-NL.ttf" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#000000;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#FFFFFF"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" style="color:#000000;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>html
&lt;img src="http://www.sanity-free.org/bf2rank/?pid=45647367">

bbCode
&#91;img&#93;http://www.sanity-free.org/bf2rank/?nick=&#91;OinK&#93;_MadHatter&#91;/img&#93;</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki light-plus" style="background-color: #FFFFFF" tabindex="0"><code><span class="line"><span style="color: #000000">html</span></span>
<span class="line"><span style="color: #000000">&lt;img src=&quot;http://www.sanity-free.org/bf2rank/?pid=45647367&quot;&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #000000">bbCode</span></span>
<span class="line"><span style="color: #000000">&#91;img&#93;http://www.sanity-free.org/bf2rank/?nick=&#91;OinK&#93;_MadHatter&#91;/img&#93;</span></span></code></pre></div>



<p>most bulletin board systems have places for you to link in a remote avatar, and one would add this same url w/ a name just as you would a normal image.<br><br>One annoying thing about most <code>bbcode</code> systems is that they require a valid image extension (.png, .jpg, .gif &#8230; ) on the URL inside the <code>[img][/img]</code> blocks (otherwise it just shows text inside the img blocks). To get your rank image to show up if you&#8217;re having troubles is to simply add an <code>&amp;avatar.jpg</code> to the end of the URL. The PHP code will ignore it, and the forum will think its a valid image and will show it correctly.<br><br>The resulting image looks like this:<br><img decoding="async" width="80" height="80" class="wp-image-94" style="width: 80px;" src="/wp-content/uploads/2025/10/bf2-rank-image-01.jpg" alt="rank image"></p>



<p>You can also specify a couple of options.</p>



<ul class="wp-block-list">
<li>adding <code>&amp;score</code> will display your global score at the top of the image.<br><img decoding="async" width="80" height="80" class="wp-image-98" style="width: 80px;" src="/wp-content/uploads/2025/10/bf2-rank-image-score.jpg" alt=""></li>



<li>adding <code>&amp;no_text</code> to the end of the URL will keep the text from being written on the image.<br><img decoding="async" width="80" height="80" class="wp-image-97" style="width: 80px;" src="/wp-content/uploads/2025/10/bf2-rank-image-no_text.jpg" alt=""></li>



<li>adding <code>&amp;delta</code> to the end will show the difference in your progress between your last rank and your next one.<br><img loading="lazy" decoding="async" width="80" height="80" class="wp-image-96" style="width: 80px;" src="/wp-content/uploads/2025/10/bf2-rank-image-delta.jpg" alt=""></li>



<li>you can also combine any combination of them as well (this one is using <code>&amp;delta</code>, <code>&amp;no_text</code>, and <code>&amp;score</code> options).<br><img loading="lazy" decoding="async" width="80" height="80" class="wp-image-95" style="width: 80px;" src="/wp-content/uploads/2025/10/bf2-rank-image-delta-no_text.jpg" alt=""></li>
</ul>



<p><strong>EDIT Feb. 15 2006</strong>: since the last patch, I haven&#8217;t updated this article source code. <a href="https://gist.github.com/nullfx/9f8fa02103c0699585e1f4a7d3ca29d5#file-bf2rank-code-txt" target="_blank" rel="noreferrer noopener">HERE&#8217;S</a> the most recent version of the script. you can download the package and copy that over the script provided.<br><br><strong>EDIT March 20 2006</strong>: I updated the code to include nick name resolution (using <code>searchforplayers.aspx</code>). the link to the code above has that change in it. so you can use your player nick again instead of trying to find out your player ID.<br><br><strong>EDIT June 30 2006</strong>: I removed the source code from the article and repacked the download with everything you need.<br><br><strong>EDIT July 18 2006</strong>: I&#8217;ve added easy URLs for the rank avatars. for more info on that&#8211;and if you&#8217;d like to add them to your server&#8211;take a look at the thread in the forums <s>here</s>. <em>(forums no longer part of the site)</em><br><br><a href="https://github.com/nullfx/bf2rank" data-type="link" data-id="https://github.com/nullfx/bf2rank" target="_blank" rel="noreferrer noopener">Here&#8217;s the code for the script</a>. Edit: this for entertainment purposes only since nothing about this game exists anymore <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f62d.png" alt="😭" class="wp-smiley" style="height: 1em; max-height: 1em;" />.<br></p>



<p><a class="sf-downloads" href="https://github.com/nullfx/bf2rank" data-type="link" data-id="https://github.com/nullfx/bf2rank" target="_blank" rel="noreferrer noopener">Download source and resources here.</a></p>



<p></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
