Calculator Community > Axe

Advice for keeping up with data?

(1/2) > >>

johnbchron:
Hey, so does anybody have any advice/strategies for keeping up with large amounts of data in larger games? I am having trouble keeping up with all my sprites and such. Also, when I don't fill a space in the memory for a sprite, I thought those empty bytes were just zeroes, but through recent experimentation they seem to not exist if not assigned. Is that true?

Streetwalrus:
If you don't assign anything to the Pic* pointers, then no memory will be used. If you need a large amount of sprites, you can put them all under the same pointer and index them, since they are all 8 bytes. For example:

--- Code: ---[the hex for your first sprite here]→Pic0
[the hex for your second sprite here]
[the hex for your third sprite here]
[and so on]

--- End code ---
Now Pic0 is the first sprite, Pic0+8 is the second sprite, Pic0+16 is the third, etc.
This trick is very useful if you need to manage a large number of sprites in an enemy system, as you can just draw any of them with Pt-On(x,y,I*8+Pic0), where I is the enemy's number or whatever else you decide. Also great for tilemapping.

johnbchron:
In the final program, does this trick save memory? (is it an optimization?)

Eeems:
It does not save you memory as the actual data is the same size.

Streetwalrus:
It is an optimization in the way you write code though, as it makes it much easier to manage those sprites with less code.

Navigation

[0] Message Index

[#] Next page

Go to full version