QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

Which is better (tiling question)

This is a discussion on Which is better (tiling question) within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; I am making a game, and was wondering which would be more effecient, 16x16 tiles, or larger tiles (say 32x32 ...

Reply
 
LinkBack Thread Tools
Old 10-05-2006, 01:34 PM   #1
I love the PS3!!!
 
Join Date: Nov 2005
Location: Look behind you
Posts: 1,876
Trader Feedback: 0
Default Which is better (tiling question)

I am making a game, and was wondering which would be more effecient, 16x16 tiles, or larger tiles (say 32x32 or 64x64), the map is around 900x900 (the max before it started crashing, lua for some reason wont support anything bigger). Also, would it free up memory to only draw tiles that are on screen? Because I was going to not draw tiles that were off the screen, but I thought that it would have the same performance because all the information still remains in the psp's memory.
__________________
[size=-3][color=#fefefe]11[/color][color=white]0[/color][color=#fbfbfb]1[/color][color=#f1f4f6]0[/color][color=#f2f5f8]0[/color][color=#f7f8fa]1[/color][color=#fcfcfc]0[/color][color=#fdfefd]0[/color][color=#fffffe]1[/color][color=#fefefe]1[/color][color=white]1[/color][color=#fefefe]000[/color][color=white]1[/color][color=#fefefe]0[/color][color=white]0[/color][color=#fefefe]1111011[/color][color=white]1[/color][color=#fefefe]1[/color][color=white]101[/color]
[color=white]1[/color][color=#fffefe]0[/color][color=#cad3e0]0[/color][color=#6f7f9c]1[/color][color=#788eaf]0[/color][color=#98b7d6]0[/color][color=#99c0e1]0[/color][color=#9ac2e2]1[/color][color=#a5c6e2]1[/color][color=#a6c3e2]0[/color][color=#b2bed1]1[/color][color=#dbe2ed]0[/color][color=#f7f9fa]1[/color][color=#fefefd]10110[/color][color=#fefefe]01[/color][color=#fefefd]0[/color][color=#fefefe]1[/color][color=#fefefd]10[/color][color=#fefefe]1[/color][color=white]00100[/color]
[color=#fefefe]0[/color][color=#f2f6f8]0[/color][color=#566da3]0[/color][color=#8a919d]1[/color][color=#e2e5e4]0[/color][color=#eff2f3]0[/color][color=#eef2f6]1[/color][color=#e8eef3]1[/color][color=#dfe6ee]1[/color][color=#d1dee8]0[/color][color=#c1cddd]1[/color][color=#7997ce]1[/color][color=#8ea4d1]1[/color][color=#ebeeee]0[/color][color=#fdfef9]0[/color][color=#fefffa]1[/color][color=#fefefc]01101011[/color][color=#fefefd]1[/color][color=#fefefe]00[/color][color=white]10[/color][color=#fefefe]1[/color]
[color=#fefefe]1[/color][color=#dde3ef]0[/color][color=#4866a7]1[/color][color=#b3bbc6]0[/color][color=#fafbf7]1[/color][color=#fefefc]0[/color][color=#f6f7f9]0[/color][color=#a8b6cf]1[/color][color=#6a7c9b]0[/color][color=#6886b2]0[/color][color=#7697c8]0[/color][color=#85a3cd]1[/color][color=#6287c3]1[/color][color=#496eb6]1[/color][color=#98abce]0[/color][color=#dde5e5]1[/color][color=#fcfef4]0[/color][color=#fdfef7]1[/color][color=#fefffa]100[/color][color=#fefefb]00[/color][color=#fefefc]00[/color][color=#fefefd]1[/color][color=#fefefe]1[/color][color=white]0[/color][color=#fefefe]0[/color][color=white]1[/color]
[color=#fefefd]0[/color][color=#f8fafa]0[/color][color=#a7bce4]1[/color][color=#6887cf]0[/color][color=#9eb0d3]1[/color][color=#e3e9ec]1[/color][color=#bbc4d6]0[/color][color=#405b99]1[/color][color=#848b97]0[/color][color=#c2cace]0[/color][color=#c2cdd7]1[/color][color=#bdcce0]0[/color][color=#94acd4]1[/color][color=#547dc3]1[/color][color=#385ea9]1[/color][color=#496eb1]1[/color][color=#90a7c7]1[/color][color=#dde4e4]1[/color][color=#f6f9ee]1[/color][color=#fcfef3]1[/color][color=#fdfff5]1[/color][color=#fdfef7]1[/color][color=#fdfef8]0[/color][color=#fdfef9]1[/color][color=#fefefa]1[/color][color=#fefffb]1[/color][color=#fefefb]0[/color][color=#fefefc]1[/color][color=#fefefe]11[/color]
[color=#fefefc]01[/color][color=#fcfdfc]0[/color][color=#e6ecf7]0[/color][color=#9fb5e7]0[/color][color=#6889cf]0[/color][color=#6b86c0]1[/color][color=#415ba1]0[/color][color=#6c82b0]0[/color][color=#d4d9da]0[/color][color=#f4f6ec]0[/color][color=#f8faf1]1[/color][color=#f5f8f3]0[/color][color=#e0e7ec]1[/color][color=#a0b7d8]1[/color][color=#5e82c2]0[/color][color=#2e5fb4]0[/color][color=#4065b0]1[/color][color=#809cc5]1[/color][color=#cdd7d9]1[/color][color=#f7f9e9]0[/color][color=#fafcef]1[/color][color=#fcfef2]1[/color][color=#fdfef5]1[/color][color=#fdfef6]1[/color][color=#fdfef9]0[/color][color=#fefff9]1[/color][color=#fefffa]1[/color][color=#fefefc]10[/color]
[color=#fefefc]1100[/color][color=#fbfcfc]1[/color][color=#e8eff7]1[/color][color=#a5b8e6]1[/color][color=#5a7cc9]1[/color][color=#3a589d]0[/color][color=#3c5ba2]1[/color][color=#8d9fc1]1[/color][color=#d8deda]0[/color][color=#f4f7e8]0[/color][color=#f5f8ec]1[/color][color=#f1f5ea]0[/color][color=#dee5e4]1[/color][color=#b1c2d5]0[/color][color=#6b8dc7]1[/color][color=#416dba]1[/color][color=#3965b2]0[/color][color=#6c88b8]1[/color][color=#b5c3cd]0[/color][color=#e4e8df]1[/color][color=#f7f8e8]0[/color][color=#fbfdef]1[/color][color=#fcfef4]0[/color][color=#fdfff7]1[/color][color=#fefffa]0[/color][color=#fefefb]0[/color][color=#fefefc]1[/color]
[color=#fefffb]1[/color][color=#fefefb]1[/color][color=#fefefc]0[/color][color=#fefffb]10[/color][color=#fdfefa]1[/color][color=#f9fbf9]0[/color][color=#dce4f1]1[/color][color=#94aada]1[/color][color=#4567b4]0[/color][color=#2c509f]0[/color][color=#4c6bac]0[/color][color=#a0adc3]1[/color][color=#e3e6db]0[/color][color=#f0f2e2]1[/color][color=#f0f3e4]0[/color][color=#ecf0e3]0[/color][color=#dde1dd]0[/color][color=#b1bfd1]0[/color][color=#7893bf]0[/color][color=#416fb7]0[/color][color=#3c66ad]0[/color][color=#6181b8]1[/color][color=#a3b2c8]1[/color][color=#dfe4de]1[/color][color=#f1f3e6]0[/color][color=#fafbf0]0[/color][color=#fcfdf6]1[/color][color=#fdfff8]1[/color][color=#fefffa]0[/color]
[color=#fefffa]10[/color][color=#fefefa]1[/color][color=#fefffa]1[/color][color=#fefff9]11[/color][color=#fdfef8]1[/color][color=#fcfdf4]0[/color][color=#f5f7f3]0[/color][color=#d6dee9]1[/color][color=#809ad5]0[/color][color=#3a5cad]1[/color][color=#264a9f]1[/color][color=#4e6aad]1[/color][color=#a8b3c5]1[/color][color=#e2e4d5]1[/color][color=#ebecda]1[/color][color=#edeee0]0[/color][color=#e9ebde]0[/color][color=#dee1db]1[/color][color=#bfc7cd]1[/color][color=#869ec2]1[/color][color=#5479ba]1[/color][color=#3665b4]1[/color][color=#466aaf]0[/color][color=#7f95b9]1[/color][color=#c5ccd0]1[/color][color=#f2f3e6]0[/color][color=#f9faef]1[/color][color=#fcfef4]0[/color]
[color=#fdfef7]10110[/color][color=#fdfef5]1[/color][color=#fdfdf2]1[/color][color=#fbfdf1]0[/color][color=#fbfcf0]0[/color][color=#f6f8ec]0[/color][color=#eaece8]0[/color][color=#c0cbdc]1[/color][color=#6e88c5]1[/color][color=#3657ab]0[/color][color=#2d4ea1]1[/color][color=#5b73ac]1[/color][color=#b1b9c1]1[/color][color=#dbdccf]0[/color][color=#e5e6d4]0[/color][color=#e6e7d7]0[/color][color=#e4e5da]0[/color][color=#d9ddd5]1[/color][color=#c1caca]0[/color][color=#99a9be]1[/color][color=#6584b9]1[/color][color=#4369b1]0[/color][color=#3f5fa1]0[/color][color=#7586a6]0[/color][color=#dcddd0]1[/color][color=#f4f4e7]1[/color]
[color=#fcfdf1]01[/color][color=#fcfcf0]1[/color][color=#fcfcef]1[/color][color=#fcfcf0]1[/color][color=#fcfcef]0[/color][color=#fbfced]0[/color][color=#f9fbeb]1[/color][color=#f9faea]1[/color][color=#f7f8e7]0[/color][color=#f3f4e6]1[/color][color=#eeeee2]1[/color][color=#dbdfdb]0[/color][color=#a4b1ca]1[/color][color=#5670b4]1[/color][color=#284ca4]1[/color][color=#2e4e9a]0[/color][color=#6d80aa]1[/color][color=#bcc0bb]0[/color][color=#d9dbc9]1[/color][color=#dfe0ce]0[/color][color=#e2e3d2]0[/color][color=#dfe1d2]1[/color][color=#d7dbd0]1[/color][color=#c4cbc9]1[/color][color=#96a2b6]0[/color][color=#3c558e]0[/color][color=#56637f]0[/color][color=#d0d2c2]0[/color][color=#eae9db]0[/color]
[color=#fafbec]1[/color][color=#f9faea]1000[/color][color=#f8f8e8]0[/color][color=#f7f7e6]1[/color][color=#f5f7e5]0[/color][color=#f5f5e3]0[/color][color=#f3f3e1]1[/color][color=#f1f1dd]0[/color][color=#eeeedc]0[/color][color=#ececda]0[/color][color=#e3e4d4]0[/color][color=#ced0c9]0[/color][color=#8e9db9]1[/color][color=#4766ac]0[/color][color=#234799]0[/color][color=#2e4c96]0[/color][color=#727d93]1[/color][color=#c1c2b1]0[/color][color=#d0d2c0]0[/color][color=#c1c6c1]1[/color][color=#9ba3b1]0[/color][color=#677591]0[/color][color=#415179]1[/color][color=#515d75]1[/color][color=#9fa29b]0[/color][color=#dbdacc]0[/color][color=#eceadb]0[/color]
[color=#f6f5e5]10[/color][color=#f5f4e4]1[/color][color=#f5f5e3]01[/color][color=#f3f3e1]0[/color][color=#f3f2de]1[/color][color=#f2f1e0]0[/color][color=#f0efdc]0[/color][color=#efeed9]0[/color][color=#edecd8]0[/color][color=#ebebd6]1[/color][color=#e8e8d2]1[/color][color=#e3e2cd]0[/color][color=#e0dfcb]1[/color][color=#d6d6c6]1[/color][color=#b7bcbf]0[/color][color=#7a8cb0]1[/color][color=#4564a7]0[/color][color=#354d81]1[/color][color=#616b7f]0[/color][color=#57657f]1[/color][color=#445371]1[/color][color=#4f586b]1[/color][color=#6f7478]0[/color][color=#999b93]0[/color][color=#bdbeb0]1[/color][color=#d7d6c6]0[/color][color=#e5e3d3]1[/color][color=#eae9d8]0[/color]
[color=#f1f0dd]0[/color][color=#f1efdc]0[/color][color=#f1f0e0]1[/color][color=#f0efdc]0[/color][color=#f0f0db]1[/color][color=#f0efd9]1[/color][color=#eeedd8]1[/color][color=#ededd7]1[/color][color=#ebebd4]0[/color][color=#eae9d3]0[/color][color=#e8e7d2]1[/color][color=#e6e6cf]0[/color][color=#e4e4cc]1[/color][color=#e2e2ca]1[/color][color=#e0dfca]0[/color][color=#dddcc6]0[/color][color=#d7d8c3]0[/color][color=#cdcfbd]1[/color][color=#adb1ac]1[/color][color=#868f95]1[/color][color=#777e7f]1[/color][color=#82867f]1[/color][color=#9d9e8f]1[/color][color=#b7b6a2]0[/color][color=#c6c6b0]1[/color][color=#d0d0ba]1[/color][color=#d7d6c3]0[/color][color=#dddcc9]0[/color][color=#e2e1ce]1[/color][color=#e5e4d1]0
[/color][/size]
[SIZE=1]a paper clip made by thekon[/SIZE]
dracule is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-05-2006, 01:51 PM   #2

Developer
 
yaustar's Avatar
 
Join Date: Jun 2006
Location: UK
Posts: 2,317
Trader Feedback: 0
Default

If the tilemap, map structure and the blitting process is done correctly, you should have a higher framerate and less memory usage.
yaustar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-05-2006, 01:58 PM   #3

I'm Baaaack!
 
Access_Denied's Avatar
 
Join Date: May 2006
Location: Waukegan,Illinois
Posts: 2,185
Trader Feedback: 0
Default

Quote:
Originally Posted by dracule
I am making a game, and was wondering which would be more effecient, 16x16 tiles, or larger tiles (say 32x32 or 64x64), the map is around 900x900 (the max before it started crashing, lua for some reason wont support anything bigger). Also, would it free up memory to only draw tiles that are on screen? Because I was going to not draw tiles that were off the screen, but I thought that it would have the same performance because all the information still remains in the psp's memory.
No, smaller tiles will slow it down, since it will have to blit more images per loop. And yes, only blit images that are on the screen. It will save RAM.
__________________
Access_Denied is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-05-2006, 02:06 PM   #4

Developer
 
yaustar's Avatar
 
Join Date: Jun 2006
Location: UK
Posts: 2,317
Trader Feedback: 0
Default

Why would it be slower? You are blitting more SMALLER images rather then one LARGE one. 32x32 tile x 135 tiles = 138240 pixels to blit. 900x900 = 810000 pixels to blit. To me, thats a LOT faster.
yaustar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-05-2006, 02:10 PM   #5

I'm Baaaack!
 
Access_Denied's Avatar
 
Join Date: May 2006
Location: Waukegan,Illinois
Posts: 2,185
Trader Feedback: 0
Default

Quote:
Originally Posted by head_54us
Why would it be slower? You are blitting more SMALLER images rather then one LARGE one. 32x32 tile x 135 tiles = 138240 pixels to blit. 900x900 = 810000 pixels to blit. To me, thats a LOT faster.
I have witnessed this first hand with Pencil Puzzles. That blitted 1600 5 x 5 tiles per loop. It ran slow as HELL. Trust me. It has to process more data with more tiles. It doesn't matter about the size.
__________________
Access_Denied is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-05-2006, 02:13 PM   #6

Developer
 
yaustar's Avatar
 
Join Date: Jun 2006
Location: UK
Posts: 2,317
Trader Feedback: 0
Default

Hmm.. I wonder if this is due to Lua being a scripting language and taking a performence hit on the for loops. Compiled languages should optimise quite a bit at this point. It *shouldn't* be slower.
yaustar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-05-2006, 02:15 PM   #7

I'm Baaaack!
 
Access_Denied's Avatar
 
Join Date: May 2006
Location: Waukegan,Illinois
Posts: 2,185
Trader Feedback: 0
Default

Put it in perspective. You have two puzzles. On has 50 small pieces and one has 15 larger pieces. Which one is going to take you longer to put together?
__________________
Access_Denied is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-05-2006, 02:16 PM   #8

Your Fate is Grim...
 
Grimfate126's Avatar
 
Join Date: Oct 2005
Posts: 2,269
Trader Feedback: 0
Default

Quote:
Originally Posted by ARza
I have witnessed this first hand with Pencil Puzzles. That blitted 1600 5 x 5 tiles per loop. It ran slow as HELL. Trust me. It has to process more data with more tiles. It doesn't matter about the size.

thats because you were using 5x5. you have to balance both out. not too many tiles, and not too large. which is faster:blitting 65280 2x2 tiles or just one big 480x272 map?? the map. and, which is better: blitting 2 450x272 maps, or blitting 400 50x50 tiles? actually, theyre both about the same, but tiles use less ram.

does lua have vram storage capabilities?? that would speed it up a lot.
__________________
--------------------------------------------------------------------------------------
Grimfate126 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-05-2006, 02:17 PM   #9

Developer
 
yaustar's Avatar
 
Join Date: Jun 2006
Location: UK
Posts: 2,317
Trader Feedback: 0
Default

You have a frame to put those pieces in, which set of pieces is less likely to waste space?
Edit: Time for proof
Code:
-- Tile version. Blitted the screen 10 times in one frame Average time taken is 0-16 ms
WHITE = Color.new(255, 255, 255);
GREEN = Color.new(0, 255, 0);
Tile = Image.createEmpty(16, 16);
Tile:clear(GREEN);

ProcessTimer = Timer.new();

while true do
	screen:clear(GREEN);
	ProcessTimer:reset();
	ProcessTimer:start();
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	local TimeElapsed = ProcessTimer:time();
	screen:print(1, 1, "Time Taken: "..TimeElapsed);
	screen:waitVblankStart();
	screen:flip();
end
Code:
-- Large 512x512 image version. Blitted the screen 10 times in one frame Average time taken is 16-32 ms
WHITE = Color.new(255, 255, 255);
GREEN = Color.new(0, 255, 0);
Tile = Image.createEmpty(512, 512);
Tile:clear(GREEN);

ProcessTimer = Timer.new();

while true do
	screen:clear(GREEN);
	ProcessTimer:reset();
	ProcessTimer:start();
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	local TimeElapsed = ProcessTimer:time();
	screen:print(1, 1, "Time Taken: "..TimeElapsed);
	screen:waitVblankStart();
	screen:flip();
end

Last edited by yaustar; 10-05-2006 at 02:39 PM..
yaustar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-05-2006, 02:43 PM   #10

I'm Baaaack!
 
Access_Denied's Avatar
 
Join Date: May 2006
Location: Waukegan,Illinois
Posts: 2,185
Trader Feedback: 0
Default

Why don't we just test it out. Take PSP Millionaires scrolling tile engine to test it. Make each map 900 x 900, but one with 16 x 16 tile and one with 32 x 32 tiles. See what you come up with.
__________________
Access_Denied is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-05-2006, 02:50 PM   #11

Developer
 
yaustar's Avatar
 
Join Date: Jun 2006
Location: UK
Posts: 2,317
Trader Feedback: 0
Default

Quote:
Originally Posted by ARza
Why don't we just test it out. Take PSP Millionaires scrolling tile engine to test it. Make each map 900 x 900, but one with 16 x 16 tile and one with 32 x 32 tiles. See what you come up with.
In terms of pure blitting, I just did. Tiling is faster.

Edit: Opps, I made a big mistake in my tiling version. Here is the correct version
Code:
WHITE = Color.new(255, 255, 255);
GREEN = Color.new(0, 255, 0);
Tile = Image.createEmpty(32, 32);
Tile:clear(GREEN);

ProcessTimer = Timer.new();

while true do
	screen:clear(WHITE);
	ProcessTimer:reset();
	ProcessTimer:start();
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,15 do
		for y=0,9 do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	local TimeElapsed = ProcessTimer:time();
	screen:print(1, 1, "Time Taken: "..TimeElapsed);
	screen:waitVblankStart();
	screen:flip();
end
And for the single large image
Code:
WHITE = Color.new(255, 255, 255);
GREEN = Color.new(0, 255, 0);
Tile = Image.createEmpty(512, 512);
Tile:clear(GREEN);

ProcessTimer = Timer.new();

while true do
	screen:clear(WHITE);
	ProcessTimer:reset();
	ProcessTimer:start();
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	screen:blit(0, 0, Tile);
	local TimeElapsed = ProcessTimer:time();
	screen:print(1, 1, "Time Taken: "..TimeElapsed);
	screen:waitVblankStart();
	screen:flip();
end

Last edited by yaustar; 10-05-2006 at 03:01 PM..
yaustar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-05-2006, 08:20 PM   #12

Developer
 
Join Date: Jul 2006
Posts: 205
Trader Feedback: 0
Default

Can't believe you made us test it ourselves.

At first I thought you cheated, because the one large image is 512x512 and the tiles only add up to 480x288, but changing both for loops to 0,16 didn't make a difference. Neither did shrinking the one large to 480x272...tiling still went faster on my Windows Luaplayer.
LMelior is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-05-2006, 08:28 PM   #13

 
Zettablade's Avatar
 
Join Date: May 2006
Location: Programming or Farming Mudkips
Posts: 657
Trader Feedback: 0
Default

EDIT: Oops, didn't notice the lua.
__________________
Current Project: Citrus

Last edited by Zettablade; 03-19-2007 at 12:30 AM..
Zettablade is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-06-2006, 06:02 AM   #14

Developer
 
yaustar's Avatar
 
Join Date: Jun 2006
Location: UK
Posts: 2,317
Trader Feedback: 0
Default

Quote:
Originally Posted by LMelior
Can't believe you made us test it ourselves.

At first I thought you cheated, because the one large image is 512x512 and the tiles only add up to 480x288, but changing both for loops to 0,16 didn't make a difference. Neither did shrinking the one large to 480x272...tiling still went faster on my Windows Luaplayer.
No that was intential. With a tiling engine, you only need to blit the tiles that can be shown by the player hence the total 'size' of the image is 480x288. If you only have a single large image, you have to blit the entire image (or actually thinking about it, you can probably crop it to fit the screen, I have to try that later).
yaustar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-06-2006, 03:23 PM   #15

Developer
 
Join Date: Jul 2006
Posts: 205
Trader Feedback: 0
Default

Quote:
Originally Posted by head_54us
No that was intential. With a tiling engine, you only need to blit the tiles that can be shown by the player hence the total 'size' of the image is 480x288. If you only have a single large image, you have to blit the entire image (or actually thinking about it, you can probably crop it to fit the screen, I have to try that later).
Ah, that makes sense. Well, like I said, I changed the empty image to 480x272 and it hardly changed the time at all; just like the 512x512, it averaged about 130 milliseconds on Windows Luaplayer. Tiling 480x288 averaged about 60-70 milliseconds, and, surprisingly, tiling 512x512 averaged around 70-80 milliseconds. To get to approximately the same speed, I was blitting over 3000 32x32 tiles (totaling about 1800x1800 pixels), ten times each, in about 130 ms.

Of course, this could all be meaningless because I'm using Windows Luaplayer, but it is interesting nonetheless. Can anybody duplicate these results? Maybe not the number (that probably depends on the computer), but the comparison between head54_us' single image blitting 10 times and this code (modified for easier testing):
Code:
WHITE = Color.new(255, 255, 255);
GREEN = Color.new(0, 255, 0);
Tile = Image.createEmpty(32, 32);
Tile:clear(GREEN);

ProcessTimer = Timer.new();
tlength=56
theight=56

while true do
	screen:clear(WHITE);
	ProcessTimer:reset();
	ProcessTimer:start();
	for x=0,tlength do
		for y=0,theight do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,tlength do
		for y=0,theight do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,tlength do
		for y=0,theight do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,tlength do
		for y=0,theight do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,tlength do
		for y=0,theight do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,tlength do
		for y=0,theight do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,tlength do
		for y=0,theight do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,tlength do
		for y=0,theight do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,tlength do
		for y=0,theight do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	for x=0,tlength do
		for y=0,theight do
			screen:blit(x * 32, y * 32, Tile);
		end
	end
	local TimeElapsed = ProcessTimer:time();
	screen:print(1, 1, "Time Taken: "..TimeElapsed);
	screen:waitVblankStart();
	screen:flip();
end
LMelior is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-19-2007, 12:28 AM   #16

 
Zettablade's Avatar
 
Join Date: May 2006
Location: Programming or Farming Mudkips
Posts: 657
Trader Feedback: 0
Default

Sorry to bump up an old topic like this, found it while searching for some junk on google.
Anyways, just in case any one is interested, 64x64 tiles would be the best, since it takes full advantage of the cache. sending over anything with a smaller width would result in wasted data (64 - image width = wasted data). Anything bigger the 64 would result in it having to do multiple passes to display the entire texture.
So in short, always make your images 64 pixels wide, and for anything bigger blit the image in strips. The speed gain is quite impressive
__________________
Current Project: Citrus
Zettablade is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-19-2007, 04:32 AM   #17
 

 
Join Date: Feb 2007
Posts: 246
Trader Feedback: 0
Default

I know that some of you more experience programmers probably already do something like this, but for those who might not I'll post this anyway.

In the tile map tutorials I've seen, the author always has the for loops run though the entire map data. Even if you use checks inside the loops to only draw what would currently be on screen, going through the entire map data will still slow the game down.

To speed things up, use the tilesize to calculate how much of the map area around the current map position would be visible, then use the for loops to scan only that area of the map data. With this method and a tile size of 64x64, drawing a 500x500 (250,000 tiles) map will be just as fast as drawing a map thats only 4x8 (32 tiles)
Merick is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-19-2007, 05:28 AM   #18
 
Join Date: Aug 2006
Posts: 1,633
Trader Feedback: 0
Default

Why the hell would you blit 500 bazillion images rather than use a buffer? It really shouldn't matter how many tiles you use if you use buffer images for them.
TacticalPenguin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-19-2007, 01:57 PM   #19

Developer
 
cools's Avatar
 
Join Date: Aug 2005
Posts: 472
Trader Feedback: 0
Default

Buffers are a good way to go! Take for example block dude... It uses 24x24 size tiles. Since some levels are longer (ex: Level 8) they require two buffers for the entire level. This is because the max size of a picture buffer in pixels has a width of 512. So if [tile size] * max width of level > 512, it uses two buffers. It draws up the entire level before the loop and then blits it to the screen. Then it updates the square of where block dude is and a couple of squares around him. That way it only ends up blitting 3-7 images to the screen at a time, compared to XXXXX images.
__________________

PSP Monopoly | PSP Tic Tac Toe | PSP eMail and SMS | Drag Mini | Block Dude
http://www.cools.biaklan.com
Currently Working on ?????

Quote of the Week
cools is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
question , tiling

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 12:05 PM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us