Log In  

Hello, I'm planning on making some sort of Elite-clone for pico8, and to start off I'm creating a 3D renderer. In the original game all 3d objects were rendered as wireframes, but for my version I'd like to draw things using filled triangles instead. I've been thinking up a couple of ways of doing this using pico8's selection of drawing methods but I'm unsure of how they compare in efficiency.

So for my question: what differences are there in drawing speed using rectfill as opposed to sspr with a predefined geometrical sprite? Are multiple spr calls faster than a single sspr? Are there other methods for filling areas of pixels that are quicker than the previously stated ones? Any clues would be appreciated, thanks :)

P#14043 2015-09-12 07:52 ( Edited 2015-09-12 12:55)

:: impbox

Generally the bottleneck will be the number of lua commands you have to call (because of the way the CPU limiting works), so aim to use functions that can call fewer times to get the desired effect.

eg. a pset is just as expensive as rectfill

please correct me if i'm wrong

P#14044 2015-09-12 08:36 ( Edited 2015-09-12 12:36)

I actually did a bit of benchmarking on the subject matter, here's what I found so far when trying to draw as many 32x32 rects as possible with the different methods:

[b]-multiple spr calls - draws ~60 rects at 30fps[/b]
[b]-sspr - draws ~80 rects at 30fps[/b]
[b]-rectfill - draws ~350 rects at 30fps[/b]

So far rectfill is the clear winner. I suspect it has to do with some low-level stuff happening when you call sprite methods. Deactivating sprite blitting doesn't seem to make any difference either.

P#14045 2015-09-12 08:55 ( Edited 2015-09-12 12:59)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2021-09-22 07:38:20 | 0.008s | Q:13