Login
Back to forumSee the full topicGo to last reply

Posted By

indi
on 2006-10-11
03:30:49
 Re: XeO3 Teaser.....

Now...Cache....

The cache is really simple - in concept at least. Whenever anyone needs to draw a sprite they pick up the original, rotate it, stick it in memory somewhere, then use that to mask a sprite to the screen.

All the cache does is has lots of "slots" for the "stick it in memory somewhere" phase. This means after the first few frames of a sprite, I never have to do that again - an it's an expensive process.

Although with things like animation I do sometimes need to rotate and drawm it means other sprites can share the answers and don't have to do that work. It's all a balancing act. If the game slows down, I have a few choices on how to speed it up just by changing the script. Circle commands are very slow really, but if all the baddies are the same shape, then chances are I can get away with it becase they don't all have to rotate every frame.

I can also simply drop a baddie from a path; saving drawing a single sprite will save oddles of time.

Anyway.... if I can use work from previous frames, then its always a time saving - as long as the cache is big enough... otherwise it'll thrash and you will end up rotating all the time - but thats still a job that would need doing. I currently have 147 slots in the cache, meaning I can store 147 pre-rotated sprites. This is usually the sum total on a +4 game, and with animations etc. you never really get great visuals. Think about it.... each frame has to be stored in 4 locations (Y is done with a spare 8 bytes at the start, so I don't need to store them), so that means you only have 36 shapes. Currently the pickups+player take around 47 (I think). We have space for 167 sprites, well past +4 games and actually larger than many C64 ones.


Caches are good..... happy



Back to top


Copyright © Plus/4 World Team, 2001-2024