<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Topic: CCTileMapAtlas &#124; gaps &#124; artifacts &#124; black lines &#124; flicker &#124; v0.99.0rc</title>
		<link>http://www.cocos2d-iphone.org/forum/topic/4219</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 02:20:56 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/topic/4219" rel="self" type="application/rss+xml" />

		<item>
			<title>Neo-Dragon on "CCTileMapAtlas | gaps | artifacts | black lines | flicker | v0.99.0rc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4219#post-55426</link>
			<pubDate>Thu, 16 Sep 2010 18:44:19 +0000</pubDate>
			<dc:creator>Neo-Dragon</dc:creator>
			<guid isPermaLink="false">55426@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm getting an error using this class with cocos2D version 99.5 beta.</p>
<blockquote><p>"target" not declared</p>
</blockquote>
<p>in the CCMoveTo+RoundedUpdate.m.</p>
<p>Edit:<br />
Just change it to<br />
<code>target_</code><br />
Seemed to fix it.
</p></description>
		</item>
		<item>
			<title>cell-gfx on "CCTileMapAtlas | gaps | artifacts | black lines | flicker | v0.99.0rc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4219#post-50492</link>
			<pubDate>Sun, 15 Aug 2010 08:58:44 +0000</pubDate>
			<dc:creator>cell-gfx</dc:creator>
			<guid isPermaLink="false">50492@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Awesome - this just fixed an issue that I had! I'd taken the example TileMap application from <a href="http://www.raywenderlich.com" rel="nofollow">http://www.raywenderlich.com</a> and applied a CCMoveTo to both my player and the viewport to smooth things out. That worked fine, but then I got the tearing problem, which this promptly removed! Thanks again!
</p></description>
		</item>
		<item>
			<title>Adam Allen on "CCTileMapAtlas | gaps | artifacts | black lines | flicker | v0.99.0rc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4219#post-37147</link>
			<pubDate>Wed, 12 May 2010 03:56:51 +0000</pubDate>
			<dc:creator>Adam Allen</dc:creator>
			<guid isPermaLink="false">37147@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I was having the same problem with flickering black lines appearing between my tiles on my TMX map when I moved the map layer around.</p>
<p>I found two different ways to solve it:</p>
<ul>
<li>Changing my spritesheet png to use a margin and spacing of 2 and then running the spritesheet-artifact-fixer.py on it.</li>
<li>Using my original spritesheet and your code above. I like using the original spritesheet because I can fit more tiles on it with no spacing or margins.</li>
</ul>
<p>Can someone comment on the preferred method? spritesheet-artifact-fixer.py  or rounding? Are we losing anything important by rounding?
</p></description>
		</item>
		<item>
			<title>Neo-Dragon on "CCTileMapAtlas | gaps | artifacts | black lines | flicker | v0.99.0rc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4219#post-34400</link>
			<pubDate>Sat, 17 Apr 2010 13:22:52 +0000</pubDate>
			<dc:creator>Neo-Dragon</dc:creator>
			<guid isPermaLink="false">34400@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Just wanted to give a big thanks to you.<br />
Ever since I've been testing on the device, I couldn't fix the lines no matter what trick I tired.<br />
But when I tried your trick it worked like a charm.<br />
Cheers.<br />
Although if you try change the vertex value, the lines will be back.
</p></description>
		</item>
		<item>
			<title>MikeTron on "CCTileMapAtlas | gaps | artifacts | black lines | flicker | v0.99.0rc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4219#post-32683</link>
			<pubDate>Sat, 03 Apr 2010 06:53:44 +0000</pubDate>
			<dc:creator>MikeTron</dc:creator>
			<guid isPermaLink="false">32683@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>thanks It works!!!</p>
<p>@<a href='http://www.cocos2d-iphone.org/forum/profile/5531'>psi</a> thanks I was having the same problem but with CCMoveBy.
</p></description>
		</item>
		<item>
			<title>psi on "CCTileMapAtlas | gaps | artifacts | black lines | flicker | v0.99.0rc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4219#post-26081</link>
			<pubDate>Tue, 09 Feb 2010 12:10:41 +0000</pubDate>
			<dc:creator>psi</dc:creator>
			<guid isPermaLink="false">26081@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I decided to use a category to work-around this issue. Create a class called "CCMoveTo+RoundedUpdate" and add this code:</p>
<p><em>CCMoveTo+RoundedUpdate.h</em><br />
<pre><code>//
//  CCMoveTo+RoundedUpdate.h
//
//	Category to rounded move any object and avoid gaps in tilemap.
//  --&#62; Overrides &#34;update&#34; code from CCIntervalAction.m
//
//  Created by Markus Barta on 09.02.10.
//
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#60;Foundation/Foundation.h&#62;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;cocos2d.h&#34;
@interface CCMoveTo (RoundedUpdate)
@end</code></pre>
<p><em>CCMoveTo+RoundedUpdate.m</em><br />
<pre><code>//
//  CCMoveTo+RoundedUpdate.m
//
//  Created by Markus Barta on 09.02.10.
//
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;CCMoveTo+RoundedUpdate.h&#34;

@implementation CCMoveTo (RoundedUpdate)
-(void) update: (ccTime) t
{
	//NSLog(@&#34;Using category CCMoveTo+RoundedUpdate for movement -&#62; rounded setPosition!&#34;);
	[target setPosition: ccp( round(startPosition.x + delta.x * t ), round(startPosition.y + delta.y * t ) )]; //Setting to a rounded pos avoids gaps in tilemap!
}
@end</code></pre>
<p>Just add those two files to your project and compile. The gaps should be gone :)</p>
<p>Hope this helps!</p>
<p>Best,<br />
Markus
</p></description>
		</item>
		<item>
			<title>Neo-Dragon on "CCTileMapAtlas | gaps | artifacts | black lines | flicker | v0.99.0rc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4219#post-25986</link>
			<pubDate>Mon, 08 Feb 2010 18:24:20 +0000</pubDate>
			<dc:creator>Neo-Dragon</dc:creator>
			<guid isPermaLink="false">25986@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I also have this problem with my map.<br />
Only when scrolling along the x axis the lines appear.<br />
I tried all the tips and nothing works.<br />
When moving up and down, it's fine.</p>
<p>I tried adding in the tip/hack above in CCIntervalAction, but I got an error saying "shortens value from 64 bit to 32 bit"</p>
<p>Any suggestions?
</p></description>
		</item>
		<item>
			<title>riq on "CCTileMapAtlas | gaps | artifacts | black lines | flicker | v0.99.0rc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4219#post-25481</link>
			<pubDate>Thu, 04 Feb 2010 14:58:49 +0000</pubDate>
			<dc:creator>riq</dc:creator>
			<guid isPermaLink="false">25481@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>You  can create your own action, like <code>MoveRounded</code>, so you don't need to modify the cocos2d sources.
</p></description>
		</item>
		<item>
			<title>psi on "CCTileMapAtlas | gaps | artifacts | black lines | flicker | v0.99.0rc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4219#post-25472</link>
			<pubDate>Thu, 04 Feb 2010 11:58:15 +0000</pubDate>
			<dc:creator>psi</dc:creator>
			<guid isPermaLink="false">25472@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>After trying a lot of different things in the last 10+ hours I have not been able to reproduce the problem in another project yet. It seems to have to do with my setup of the scene, as a simple Tilemap added to a scene, using the same tilemap GFX does not produce flicker at all - no matter what I set the projection, alias, subpixel settings to, I mentioned above.</p>
<p>The setup of the nodes in my real project is not quite trivial (lots of parent/child nodes...), so I will have to continue to build up the same structures in my test-app (called "mindTheGap" ;) until the gaps show up again.</p>
<p>In the meantime I came up with a little hack that "solves" my problem: In CCIntervalAction.m in line 535 I round the x and y position - and *boom* gaps/artifacts/lines are gone:<br />
<pre><code>-(void) update: (ccTime) t
{
	[target setPosition: ccp( round(startPosition.x + delta.x * t ), round(startPosition.y + delta.y * t ) )]; //HACK: set to rounded pos to avoid gaps in tilemaps when scrolling around
}</code></pre>
<p>The only thing is, I'm not quite comfortable with messing around in the cocos2d code. It gets frequently updated, so I will always have to change this when updating. I'm also not sure if this change might have other negative side-effects in the future - well, we'll see.</p>
<p>What do you think?</p>
<p>Best,<br />
Markus
</p></description>
		</item>
		<item>
			<title>psi on "CCTileMapAtlas | gaps | artifacts | black lines | flicker | v0.99.0rc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4219#post-25371</link>
			<pubDate>Wed, 03 Feb 2010 07:55:11 +0000</pubDate>
			<dc:creator>psi</dc:creator>
			<guid isPermaLink="false">25371@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Will do so today. Hope to create a test project that shows the issue properly.
</p></description>
		</item>
		<item>
			<title>riq on "CCTileMapAtlas | gaps | artifacts | black lines | flicker | v0.99.0rc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4219#post-25323</link>
			<pubDate>Tue, 02 Feb 2010 21:14:51 +0000</pubDate>
			<dc:creator>riq</dc:creator>
			<guid isPermaLink="false">25323@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Could you open a bug attaching the code to reproduce the problem ?<br />
The <code>tests/TileMapTest.m</code> seems to work OK without artifacts.
</p></description>
		</item>
		<item>
			<title>psi on "CCTileMapAtlas | gaps | artifacts | black lines | flicker | v0.99.0rc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4219#post-25289</link>
			<pubDate>Tue, 02 Feb 2010 17:02:11 +0000</pubDate>
			<dc:creator>psi</dc:creator>
			<guid isPermaLink="false">25289@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>The gap is back...</p>
<p>After hours(!!) of fighting these pesky little black lines in my CCTilemapAtlas in the last release of cocos2d (0.9 beta2) I upgraded to the latest release (0.99 rc) yesterday and my beloved friends are back. *bitesHisTongue*</p>
<p>I followed all the tips and tricks I could find:</p>
<pre><code>// 2D Projection:
[[CCDirector sharedDirector] setProjection:CCDirectorProjection2D];

// Alias textures
[myTilemap.texture setAliasTexParameters];

// Disable subpixel rendering in ccConfig.h
#<a href='http://www.cocos2d-iphone.org/forum/tags/define'>define</a> CC_COCOSNODE_RENDER_SUBPIXEL 0
#<a href='http://www.cocos2d-iphone.org/forum/tags/define'>define</a> CC_SPRITESHEET_RENDER_SUBPIXEL 0</code></pre>
<p>With these tricks the gaps were gone in 0.9b2 but now they are back. I noticed it's again the subpixel rendering problem, as the black lines appear only if I use a CCMoveTo action, where I can not control the placement while the tilemap moves - or is this possible?! To clarify, I can place the tilemap at integer value coordinates - everything is fine (no gaps), but when moving around with an action those gaps show up again.</p>
<p>The tip regarding the "spritesheet-artifact-fixer.py" did also not solve my problems. I got the same flicker but a ruined texture. IMHO it does not work. It just doubles border pixels which looks simply BAD if you have to use tiles that perfectly align by pixel.</p>
<p>I really do not want to go back to 0.9b2 because the performance increased by 5-10 FPS for my game with the new release, so if anyone has another tip / trick to solve this problem I would be really grateful!</p>
<p>Thanks in advance for any help,<br />
Markus
</p></description>
		</item>

	</channel>
</rss>

