Log In  


Cart #34769 | 2017-01-02 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6

1.0.1: Quick fix for the title screen

main inspiration

The main slowdown factor of the whole thing is this:

for x=0,127 do
		for y=0,127 do
			if brd[x][y] != 0 then
				pset(x,y,brd[x][y])
			end
		end
	end

I have to copy everything from the board to the screen, every frame. Maybe someone could help with a more efficient way to do that?

Sometimes, very rarely, snakes just crash into themselves when nothing happens. Should maybe fix that.

The stupid AI is surprisingly good at beating me. I should probably practice some curve fever.

Feedback is greatly appreciated!

6


Hey there!

SojaBird here from the original CF dev team.
Great job on recreating CF in pico!
Today I was just about to do the same as my first practise game in pico.
Keep it up!

As for the slowdown, maybe there is a way you can write data into the (shared) sprite-sheet and draw that instead of setting pixels every time.
Or, mark which pixels were changed so you only have to change a few pixels instead of the whole playfield.

Best regards,
SojaBird, CF3 dev.


@SojaBird Thanks! I think the shared spritesheet is too small though :(


@eis Hmm I see. You could maybe not clear the whole screen but only parts that are changed (rectfill and then reapply the pixels.
I'm also facing the same issue now but will continue to look for other solutions.
I'm not sure about the impact of multi-dimentional arrays in Lua, but you could rewrite the brd to be a single-dimention array (at least that's what I have out of habbit).



[Please log in to post a comment]