Performance using a lot of draw functions

Hi! I wanted to know if a real Playdate can handle something like 150 draw functions at a time, while nothing else very important is happening in the game. The idea is to use a player tile with transparency to make a fade-to-black animation like this:

fade-animation

After that I'm using just a fill function

First, your game looks amazing!

Second, it might be a little hard to predict this without testing it. Do you happen to have code we could run on a Playdate?

Hi neven thanks!

I did this example with two transitions (one using the amount of tiles I'll need in my game and another one with the fade out in all of the screen).

FadeTransitionEx.json.zip (3.2 KB)
FadeTransitionEx_20220313231300.zip (30.5 KB)

Also doing this example I've seen there is a delay between "deleting" the fade out and going to another room

CleanShot 2022-03-13 at 23.34.58 2

This is the code in the teleport item

on collect do
	ignore
	fadeOutAnimation = 1
	wait 2 then
		fadeOutAnimation = 2
		wait 0.5 then
			goto 5,7 in "room2"
			fadeOutAnimation = 0
			fadeOut_animReset = 0
			tell event.player to
				swap "player"
			end
			listen
		end
	end
end

This is the code in the player's draw

if fadeOutAnimation==1 then
	if fadeOut_animReset==0 then
		play "tile_fadeOut"
		fadeOut_animReset = 1
	end
	drawCount = 0
	drawX = 4
	drawY = 0
	while drawCount<=152 do
		draw "tile_fadeOut" at drawX,drawY
		drawCount++
		drawX++
		if drawX==21 then
			drawX = 4
			drawY++
		end
	end
elseif fadeOutAnimation==2 then
	fill "black" at 32,0,136,72
end

But anyway this problem can be solved by changing those "reseting" variables in the enter of the next room and works fine, like this:

on enter do
	fadeOutAnimation = 0
	fadeOut_animReset = 0
	tell event.player to
		swap "player"
	end
end

Also it seems to have the same delay if I put exactly that in the exit event instead.

First of all, knowing about the performance of multiple draw calls is important. Some games might require a lot of objects on screen, like bullets.

For your problem in particular, it looks like you are fading with a repeating pattern. Would something like a single large area drawTiled() call work? You might need to usa a solid color image and setMaskImage() to your fade pattern.

Note that this is a question about Pulp specifically :slightly_smiling_face: