Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!helios!stat!aaron From: aaron@stat.tamu.edu (Aaron Hightower) Newsgroups: comp.sys.amiga.programmer Subject: Re: Sprite Animation Glitches Message-ID: <15716@helios.TAMU.EDU> Date: 2 May 91 21:07:56 GMT References: <1991May2.155342.1317@daffy.cs.wisc.edu> Sender: usenet@helios.TAMU.EDU Organization: Texas A&M University Lines: 45 In article <1991May2.155342.1317@daffy.cs.wisc.edu> pochron@cat30.cs.wisc.edu (David Pochron) writes: >In article ersys!kumbach@nro.cs.athabascau.ca (Kevin Umbach) writes: >>Basically all I do to change a sprites image is do a memcpy() >>from an array into the sprite's image data area and I believe > >No no no no! Why are you using memcpy() to change the sprite images? I can't answer why for the person who posted the original question, but I first used your technique for one game, but the problem is that if you use one image multiple times, you HAVE to copy it. IE since the position and control information is a field in the sprite data structure, you must have a different copy of the image for each hardware sprite that uses it - no sharing sprite image data between two hardware sprites. So if you have one image that you would like to display with 6 sprites, you will either have to have eight declarations of this image as you suggested with the CHIP storage class modifier, or you will have to copy it somehow. I concluded for one game that it is better to copy it (It's not doing heavy animation though). To sum up, if you have sharing of images your options are something like memcpy vs 7 copies in chip ram of each sprite image or some hybrid method employing the two ideas. (EG double or triple buffering). >You can just set up all the sprite image structures in the code, then all >you have to do is a ChangeSprite whenever you want to change images. > >ChangeSprite just changes the pointer to the sprite data. It Is MUCH faster >to do that than to recopy the sprites entirely into a fixed sprite space. > An important observation. This is the classic speed versus space efficiency debate - you decide - but no ONE way is correct. >Just make sure all the sprite image data is in CHIP mem. Most good C compilers >let you specify where structure/array data gets stored at load time. > > >>Kevin Umbach ersys!kumbach@nro.cs.athabascau.ca >>Edmonton Remote Systems: Serving Northern Alberta since 1982 > > David M. Pochron | Transparent DWV pipe: For the man who wants to > | see it all... >pochron@garfield.cs.wisc.edu | (If you don't know what DWV is, get a life! :-) Aaron Hightower - Texas A&M University - Computer Science