<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Player info</title>
		<link>http://www.allegro.cc/forums/view/590684</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 23 Mar 2007 19:21:04 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi everybody ! <br />(anybody?)</p><p>Someone said that putpixel and getpixel are really slow. Is this true?<br />And more importantly (for me) does this also go for the explicit _getpixel and _putpixel ?<br />I wanted to replace a (single) whole blit with this. Or should I then resort to something more complicated?</p><p>[EDIT] Uhhmm... first I thought about posting something else, but I forgot to to rename the post. Sorry!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (weapon_S)</author>
		<pubDate>Fri, 23 Mar 2007 17:25:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Someone said that putpixel and getpixel are really slow. Is this true?
</p></div></div><p>Yes</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
And more importantly (for me) does this also go for the explicit _getpixel and _putpixel ?
</p></div></div><p>Yes, but it is a bit less slow than regular putpixel</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I wanted to replace a (single) whole blit with this. Or should I then resort to something more complicated?
</p></div></div><p>Replacing a whole blit with putpixel calls is bad idea. You better describe what you want to achieve, I bet there are better alternative solutions to the problem.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HoHo)</author>
		<pubDate>Fri, 23 Mar 2007 17:32:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If it&#39;s just blitting you want, resort to blit().<br />If you need more sophisticated selective replacement, or blending, a lot can be done with allegro&#39;s blender functions, but for better performance, you should look into libraries that allow you to use hardware acceleration; AllegroGL and / or OpenLayer are good starting points.<br />In many situations, direct access to the bitmap data through line pointers can be the answer.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tobias Dammers)</author>
		<pubDate>Fri, 23 Mar 2007 17:36:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks for the answers. I will answer your question:<br />it is a fighting-game (ie two guys slapping eachother) and at first I thought it was a good idea to only use one (set of) bitmap(s) if the characters were the same. (side note: because initially I started out making another type of game actually.)<br />But if I want an alternative colour for the other guy, I will have to figure something out. Before looking into it I thought I could do something like &quot;draw_sprite(bmp, palette+1)&quot;. But ofcourse I can&#39;t. And before you say so: I also want it to be able to run 8bpp, so alternating palettes is not an option (I think).<br />I could make a copy of the bitmap to be different, but I don&#39;t consider it clean...<br />and it would require me to rethink the loading procedure.<br />It&#39;s only a 8bpp blit (to a temporary 8-bits bitmap), but it is every frame...<br />(How would I use the line pointers for this?)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (weapon_S)</author>
		<pubDate>Fri, 23 Mar 2007 17:44:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;d say go with a quick and easy solution. Before the game starts, predraw all the frames with the new colors (using (_)putpixel) and use the new frames in the game. As long as there aren&#39;t zillions of frames and you don&#39;t do in in real time there shouldn&#39;t be a problem.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Johan Peitz)</author>
		<pubDate>Fri, 23 Mar 2007 18:00:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I could make a copy of the bitmap to be different, but I don&#39;t consider it clean...
</p></div></div><p>I consider it to be much cleaner than the kind of hacking you propose, especially since copying images would be considerably faster <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>One way of achieving it relatively simple would be this:<br />First, create your base sprites with colourcoded areas that can be colored differently. For example this magnificent stickman has three different areas whose colour you can choose. They are red, blue and yellow. The black is unchangeable:<br /><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/0/4/0491c3b3de5d78c3740873ac8f315784.png" alt="591653" width="75" height="100" /></p><p>Using this image you can create several copy&#39;s, each one will have its colourcoded areas filled with different colour. As those copies are generated once at loading time I don&#39;t see any problems by creating them using plain old get/putpixel.</p><p>Of course there are other more interesting ways of doing it but that one is the simplest one I came up with <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HoHo)</author>
		<pubDate>Fri, 23 Mar 2007 18:06:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yeah, you&#39;re right... The method I came up with now is kind of hackish... and assumes a char to be 8 bits (or defines a 8 bit struct <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" /> ).<br />The reason why I wanted this, is because I don&#39;t consider each player to have an appearance (bitmap), but each kind of game-object. This works like a charm if you have <s>let&#39;s say</s> a shooter  <img src="http://www.allegro.cc/forums/smileys/embarassed.gif" alt=":-[" /> .<br />How do 3D games tackle this? I&#39;ve seen totally different alternate models, but I do not consider it clean to allocate memory for something that&#39;s almost exactly the same.<br />But for the rest, you guys are right.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (weapon_S)</author>
		<pubDate>Fri, 23 Mar 2007 19:13:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I&#39;ve seen totally different alternate models, but I do not consider it clean to allocate memory for something that&#39;s almost exactly the same.
</p></div></div><p>Usually they do just that: have alternative skins for the models. When they are really smart they divide the skin to smaller parkts so they can have five identical bodies all with different heads.</p><p>After all, a single skin doesn&#39;t take that much memory. A few megs is not all that much when you consider how much computations you save with it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HoHo)</author>
		<pubDate>Fri, 23 Mar 2007 19:21:04 +0000</pubDate>
	</item>
</rss>
