tag:blogger.com,1999:blog-17487316.post8277144305852089905..comments2024-01-13T09:14:12.131+00:00Comments on The life of a Games Programmer: XeO3: Sprite Cache....Mikehttp://www.blogger.com/profile/15958965170878448339noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-17487316.post-1313218422992390202007-06-27T12:03:00.000+00:002007-06-27T12:03:00.000+00:00lol - he's been waiting on a script document for a...lol - he's been waiting on a script document for about a year now :)<BR/><BR/>I'll write something up, its pretty basic - but only once you know....Mikehttps://www.blogger.com/profile/15958965170878448339noreply@blogger.comtag:blogger.com,1999:blog-17487316.post-75941290010680967892007-06-27T08:18:00.000+00:002007-06-27T08:18:00.000+00:00Yes, that's something you avoid if you can, but he...Yes, that's something you avoid if you can, but helps if you run out of time in the end. Having unused speed-up methods in your arsenal never hurts :)<BR/><BR/><BR/>I wouldn't mind reading a blog entry on your script system. I tried to write one "back then" and didn't find satisfactory compromise between flexibility, efficiency and compactness.<BR/><BR/>(Don't let that keep you away from weapons system tho - Luca will kill me if I delay that any longer ;)<BR/><BR/><BR/>--<BR/>TNTAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-17487316.post-50279046723883968062007-06-26T18:51:00.000+00:002007-06-26T18:51:00.000+00:00wow...that sounds like way too much work! :)Too mu...wow...that sounds like way too much work! :)<BR/>Too much data as well I think. I only have 3k for scripts, and I expect it to be pretty full. That aside, I'm not a bit fan of having a tool like that really. it might help a bit, but its a lot of work for very little gain. <BR/><BR/>See, when a wave comes on they will tend to come on one at a time, and because of this, its a low CPU load at that point anyway, so the inital sprites are cached when its not that busy. By the time it <I>IS</I> busy, you've cached most of the graphics you need (as in general sprites followng follow the same path as the 1st one).<BR/><BR/>I suspect thats a lesson for the reader, I think thats too much effort for me - I just dont think I'll get back the size of reward I'd expect. :)Mikehttps://www.blogger.com/profile/15958965170878448339noreply@blogger.comtag:blogger.com,1999:blog-17487316.post-35404241185005594402007-06-26T16:53:00.000+00:002007-06-26T16:53:00.000+00:00If your enemies follow predefined pattern and appe...If your enemies follow predefined pattern and appear at specific points then you *do* know which rotations are used. In that case I would do a special version with front end or something else removed, then let the game scroll through a level and build a table telling where enemy sprite are created and which sprite rotations they are.<BR/><BR/>In a real game you have plenty of other sprites to keep in cache, but you are guaranteed to have to build at least those sprites noted in the above table. It might be useful to use smaller cache size for the scroll-through to compensate for lacking explosions etc. which will push out baddies during game.<BR/><BR/><BR/>If your enemies follow player in x-direction then you can't use hints, but for seeking missiles for example you might only need y movement.<BR/><BR/><BR/>--<BR/>TNTAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-17487316.post-55184380553754489862007-06-26T16:38:00.000+00:002007-06-26T16:38:00.000+00:00Yep, I know what you mean about hints.... My main ...Yep, I know what you mean about hints.... My main problem with it isn't the HINT system, but without knowing WHAT to cache, you'll end up caching way to much.<BR/><BR/>For example. If I hint that baddie 5 is about to come on, then without knowing its path, I cant know that I need frame 1 in rotation 2,1 and 3, frame 2 in rotation 4 and frame 3 in rotation 1. I'd have to rotate them all. And the problem with that is not that the CPU idle anyway so why not, but that it pushes out useful baddies cached there already.<BR/><BR/>If I could figure a way out of that without pushing useful data out, I'd probably use it.Mikehttps://www.blogger.com/profile/15958965170878448339noreply@blogger.comtag:blogger.com,1999:blog-17487316.post-90310998206214862842007-06-26T09:49:00.000+00:002007-06-26T09:49:00.000+00:00I put "without testing" there just to get away fro...I put "without testing" there just to get away from the idea if you say it won't work ;)<BR/><BR/>With preloading I meant levels having a hint system where you can create *actually needed* sprites in advance. With predictable enemy movement you can check for tight spots and create some of the sprites half a second earlier. That leads to more predictable CPU usage.<BR/><BR/>Hints can only be added at the last minute of level design tho - you don't want to change hints every time you adjust enemy attack patterns.<BR/><BR/>--<BR/>TNTAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-17487316.post-43597553381697205492007-06-26T05:16:00.000+00:002007-06-26T05:16:00.000+00:00Possibly.... With the cache working, I shouldn't h...Possibly.... With the cache working, I shouldn't have to save any for the player as it pretty natural for him to stay in the cache. <BR/><BR/>And the whole idea is that I only rotate "bits" of sprites. For example, if a sprite is moving over the screen from right to left, and animating through (say) 10 frames, then I'll simply never get certain frames in certain rotations because the don't come up. This saves loads of cache space. Otherwise 10frames*4 rotations = 40 slots.Mikehttps://www.blogger.com/profile/15958965170878448339noreply@blogger.comtag:blogger.com,1999:blog-17487316.post-79785112113467756762007-06-25T20:24:00.000+00:002007-06-25T20:24:00.000+00:00You could have first N cache entries reserved for ...You could have first N cache entries reserved for player sprite, but without testing it's hard to know how that affects the rest of cache.<BR/><BR/>Another idea is to add preload codes to levels - that way you could rotate some of the new bad guys into the cache between attack waves when there's a bit more time.<BR/><BR/>--<BR/>TNTAnonymousnoreply@blogger.com