Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Making Blank Sprites

Author
Message
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 6th Jun 2010 00:48
I was thinking about if it would take a lot of system resources to create a lot of blank sprites which I could then alter the texture but was wondering if creating a lot of blank sprites (500x500) would kill my FPS.

I am mother and father, but never nurse.I'm rarely still, but I never wander. What am I? See my sketch
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 6th Jun 2010 02:20
You should at least try it for yourself - its a better way to learn and you don`t need to wait for responses to make progress. 250000 sprites is a heck of a lot of sprites - do you think you really need that many or could you find a better way of managing this so that you don`t need so many? If each sprite was 16*16 pixels; each pixel is 4 bytes, then that makes 244.15mb of texture data([[[16*16]*4]*[500*500]]/1024/1024). Now if you expect all sprites visible then I suspect(hardware dependant) that you will recieve a hugely significant hit to fps. If you were to hide some of them then you should be able to claw back some fps(but probably not much); how much depends on how many are not needed for your scene - also this would require a gfx card with at least 256mb vidram. When you state "blank sprites" - what exactly do you mean? If they were all black then you might think that the filesize would be reduced as only zero`s are needed for the data but essentially I would think that at runtime 4 bytes per pixel are still allocated in texture memory regardless, as we are no longer talking about files, but memory data. ie the memory data still needs to have an allocation purely to define a zero value - which would still be 4 bytes per pixel. From what I gather file storage size can be reduced as data can be described with maths which can be used to load the full data correctly into memory. If you were to compare this to objects then you would see that an object can be excluded or hidden, whereas a sprite can only be hidden. When an object is excluded versus an object hidden there is a significant difference in frame rate between the two. Perhaps you should explore using a plain(two triangles that make a rectangle/square) for each sprite, ensuring each object(sprite) is positioned and orientated correctly to be visible as a sprite would appear on screen. This would give you a further option to utilise the "exclude object on" command to further decrease the loss of framerate. You would also gain the ability to use anti alias on your sprites(iirc dbp sprites aren`t affected by AA - not sure about plugins), aswell as full object control. Hope that helps, hope I haven`t said anything that isn`t true. In short I believe you would benefit from using 3d objects as sprites instead of sprites themselves, and also if you try things for yourself, you will learn more - plus you tend to make less mistakes in the long run; once you have spent a large portion of your spare time following the wrong route, you sure as hell will think twice before making that same type of error again.
DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 6th Jun 2010 02:54
No idea why you would need blank sprites but there you go.....

http://s6.bitefight.org/c.php?uid=103081
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 6th Jun 2010 04:55
Thanks you very much.

I am mother and father, but never nurse.I'm rarely still, but I never wander. What am I? See my sketch

Login to post a reply

Server time is: 2026-07-25 14:18:00
Your offset time is: 2026-07-25 14:18:00