DPRam multiplexing in 1.21

Started by jaymzjulian, December 31, 2019, 12:24:46 PM

Previous topic - Next topic

jaymzjulian

EDIT: From 1.22 onwards, this is redundant, and you absolutely shouldn't use it - it's left here entirely for historical value :)


I threw this together to test some things - it is a generic dpram multiplexor.  It's the simplest possible implementation, and with that comes a couple of caveats, the biggest one being that it _demands_ the pattern of:

ReturnToOrigin()
Object()
ReturnToOrigin()
AnotherObject()

because it simply slices at an arbitrary place where the drawing is completed.  For my actual games, I have a bit more intelligence than this, in that I actually track which object is a ReturnToOrigin sprite, and always clip there - but my method for doing that currently involves setting up magic arrays for that.  Bob did add tagging in the most recent release, and maybe I'll do a generic example at some point to demo that.

This is not without it's drawbacks, though, and this demo adequately demostrates them - which is that, of course, the more vectors you fill your screen with, the more it will flicker.  I picked a really bad case scenario on purpose here, to try and flesh out some issues, but if you change the scale from 48 to 16 in the basic file, you can see that at that size it's really stable - it's all about the long lines :).  Which is sort of the point - I ended up with a game that acutally did run between 20 and 30fps, which is enough, but really needed two dpram pages to do so!

As an aside: I did benchmark using an array of objects instead of calling DrawingListSprite, and it _is_ slightly faster, though we're talking around the 5% mark, so it's probably not worth it unless you have a reason (like better slicing!), but again, this is a starting point, not an ending point, hence being in code swap and not game swap :).


EDIT: I attached the wrng file :)

Vectrex32

I'm not sure what to make of this. I loaded the program and called rose(). I get a large, flickering pattern on the screen (it might be a zoomed-in portion of a rose).

Can you describe what DPRAM multiplexing is supposed to do?

QuoteI did benchmark using an array of objects instead of calling DrawingListSprite, and it _is_ slightly faster

If you maintained your own array of sprites and looked them up with spritelist[index] instead of DrawingListSprite(index), I'm not surprised that it's a little bit faster. It means accessing an array is faster than making a function call.

- Bob

jaymzjulian

I attached the wrong file, is what happened :)

What it's supposed to do, is throw way more lines than can fit into dpram, and split them across multiple frames. 

Vectrex32