barreytor Posted July 30, 2012 Author Share Posted July 30, 2012 The atacched, and needed, files: http://www.mediafire.com/download.php?os377d5nyfes596So, this is my very first post in this forum, and I would like to use it to share the very first thing I did just after downloading Eclipse Origins 2.3 Event system: Loading all the graphics from PNGs instead of BMPs.It was kind of a quick, dirty job, and it doesn't allow you to use the alpha channel, but an overall 90% reduction in the actual filesize makes me think it's worth mentioning here.(And basically it's the only thing I did until I found and downloaded EO 3.0 with DX8, but that's unrelated)So, if you want to use the light PNG graphics format with your DirectDraw7 powered Eclipse Origins project, here are the steps:**All client side**First of all, download the attached zip and add all of the classes and modules to your client source.Then, after adding everything, open the menu "Project->References", find "Ole automation" and activate it.Second, find this:```' load persistent surfaces```in your modDirectDraw7 and change the extension from all files from ".bmp" to ".png"Then, in modConstants, replace```Public Const GFX_EXT As String = ".bmp"```with```Public Const GFX_EXT As String = ".png"```And now, for the real meat. Go back to modDirectDraw7 and, under```Public NumFaces as Long```add```Private cImage As c32bppDIB```Next, go to the```InitDDSurf```sub, and replace```' set flagsSurfDesc.lFlags = DDSD_CAPSSurfDesc.ddsCaps.lCaps = DDSD_Temp.ddsCaps.lCaps' init objectSet Surf = DD.CreateSurfaceFromFile(fileName, SurfDesc)```with```' set flagsSurfDesc.lFlags = DDSD_CAPS Or DDSD_WIDTH Or DDSD_HEIGHTSurfDesc.ddsCaps.lCaps = DDSD_Temp.ddsCaps.lCaps' init object' Set Surf = DD.CreateSurfaceFromFile(FileName, SurfDesc)Set cImage = New c32bppDIBcImage.LoadPicture_File (fileName)SurfDesc.lWidth = cImage.WidthSurfDesc.lHeight = cImage.HeightSet Surf = DD.CreateSurface(SurfDesc)Dim DCDC = Surf.GetDCcImage.Render (DC)Surf.ReleaseDC (DC)cImage.DestroyDIB```And that's that! Now you can load your image files from PNGs instead of BMPs… Only alpha channels won't do anything. (except for fully transparent pixels, for which, if I recall correctly, it DID work. Either that or the mask color system, which is still used)For the task of mass changing the format, use something like PNGGauntlet or other. Link to comment Share on other sites More sharing options...
eddy34 Posted July 30, 2012 Share Posted July 30, 2012 Very good partner, it's always good to have a better quality that weighs less. xD Link to comment Share on other sites More sharing options...
Wortel Angels Posted July 30, 2012 Share Posted July 30, 2012 I got an error :([![](http://www10.pic-upload.de/thumb/30.07.12/2ghdxgfvlpq6.png)](http://www.pic-upload.de/view-15369971/Unbenannt.png.html) Link to comment Share on other sites More sharing options...
barreytor Posted July 30, 2012 Author Share Posted July 30, 2012 Damnit. Forgot about that. Editing this in a minute with that other absolutely neccesary step I somehow forgot.EDIT: Okay, edited the original post with this simple step that's the cause of your problem there: "Then, after adding everything, open the menu "Project->References", find "Ole automation" and activate it."You just have to open "Project->References" and activate OLE Automation. Link to comment Share on other sites More sharing options...
Wortel Angels Posted July 30, 2012 Share Posted July 30, 2012 Works :DBut you need to use .png with an background if you let it Transparent it will change to black but…Look self :DAt top an tileset without backgroundAt bottom with[![](http://www10.pic-upload.de/thumb/30.07.12/rap45v5om1y.png)](http://www.pic-upload.de/view-15370284/Unbenannt.png.html)I can look funny if anyone want an black edge around all but yeah ;-) Link to comment Share on other sites More sharing options...
barreytor Posted July 30, 2012 Author Share Posted July 30, 2012 Well, that's the catch: You can't get any good use of the alpha channel as DirectDraw7 doesn't support it.The method is more to get the bulk of the space used by the graphics cut down without losing any quality.Make sure the tiles that are supposed to be transparent don't have any transparency gradient. That is: treat them as you would plain BMPs, only smaller filesize. Link to comment Share on other sites More sharing options...
Wortel Angels Posted July 30, 2012 Share Posted July 30, 2012 Yeah xDI just tryed it out and i can say anyone who use this its really Great :DFrom 6168.05 KB to 341.02 KB Really awesome :-D Link to comment Share on other sites More sharing options...
Dawntide Posted July 31, 2012 Share Posted July 31, 2012 Does it increase the quality of the sprites, so i can make them larger without messing the quality up so hard?How you create transparent things, for example an icon, same way as with .bmp? Link to comment Share on other sites More sharing options...
barreytor Posted July 31, 2012 Author Share Posted July 31, 2012 @Dawntide:> Does it increase the quality of the sprites, so i can make them larger without messing the quality up so hard?> How you create transparent things, for example an icon, same way as with .bmp?I think you're asking if zoomed sprites will look better. They won't look any better than they do in BMP, and nothing you can do to a sprite will make it have a better quality when zoomed in.As for the transparent things question: Yes, do the same way as if it was a BMP.In fact, when using this tutorial don't think of PNGs as PNGs, but as BMPs that use roughly a tenth of the disk space. Link to comment Share on other sites More sharing options...
Wortel Angels Posted July 31, 2012 Share Posted July 31, 2012 With this tutorial its like…PNG = BMPPNG Size < Size BMPAnd all other stuff is the same Link to comment Share on other sites More sharing options...
barreytor Posted August 20, 2012 Author Share Posted August 20, 2012 Edited the first post reattaching the files needed as they were lost with the change of forum. Link to comment Share on other sites More sharing options...
Joyce Posted August 20, 2012 Share Posted August 20, 2012 Yes, do increase the strain on dynamically loading/unloading data.Note to everyone; This does not and will not ever add proper PNG support. All it does is buffer it in memory and convert it to a bitmap when loaded, which is bloody inefficient when you're loading/unloading stuff on the fly. It works, but I honestly don't see the advantage to using it as the disk space used isn't all THAT big anyway.(Unless you're being a dunce and ship your game with graphics you're not even using).While the effort is admirable, it's been done a few times and discussed more times. But it's really not worth bothering with.Question though, did you look into seeing if it properly unloads everything it converts as well?TL;DR, use it if you wish. But it's just a memory convertor. It uses more resources and time to load/unload stuff on the fly and will never add Alpha Masking. Link to comment Share on other sites More sharing options...
Justn Posted August 20, 2012 Share Posted August 20, 2012 Well that sucks I started using this cause i didn't notice a performance drop but only tested with a few players.. the only reason i was using is my client size went from 450mb to 60 :/ guess I will remove it thanks for the info Joyce Link to comment Share on other sites More sharing options...
Joyce Posted August 20, 2012 Share Posted August 20, 2012 It shouldn't drop MUCH really. But it does slightly, not noticable on modern hardware though(Maybe on older computers with slower memory and such). I did make it sound more dramatic than it really is. :] Not sure how well it's designed in terms of memory management though, I haven't looked into it yet, so keep an eye out for memory leaks. Link to comment Share on other sites More sharing options...
Justn Posted August 20, 2012 Share Posted August 20, 2012 Well you are adding 3 modules full of code.. not sure if its all used cause it looks to be ripped from something else but still may be wasteful.. I had been using ths on my lower end pc to map with no visible issues. I'll probably just remove it before i release the game.. if anyone else could maybe download the files and take a look any info would be helpful. Link to comment Share on other sites More sharing options...
barreytor Posted August 21, 2012 Author Share Posted August 21, 2012 > Note to everyone; This does not and will not ever add proper PNG support.And that's why I switched to EO 3.0, though I did that after going ALL the way to find a way to find a way to be able to load PNG with EO 2.3\. Though it's a whole lot cleaner than the first try I went through (I saved a converted bitmap, then loaded THAT), it will indeed be a performance hit.I just posted this here because I thought it be of some use for someone.> Well you are adding 3 modules full of code.. not sure if its all used cause it looks to be ripped from something else but still may be wasteful.. I had been using ths on my lower end pc to map with no visible issues. I'll probably just remove it before i release the game.. if anyone else could maybe download the files and take a look any info would be helpful.The modules are just the parsers that load and convert other image formats to PNG on memory. I didn't tamper with them, and they don't seem to have any malicious code, but as I said before, I just left this and went to EO 3.0 with it's DX8 and proper, native PNG support. Link to comment Share on other sites More sharing options...
WK67 Posted May 10, 2013 Share Posted May 10, 2013 Thanks dude! My GFX folder shrank from 141 to barely 14mb. HUGE difference! Haven't had any errors yet either. Good work! Link to comment Share on other sites More sharing options...
ravhi1044 Posted July 7, 2013 Share Posted July 7, 2013 error on this code```Set Surf = DD.CreateSurface(SurfDesc)```"Invalid call procedures or arguments" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now