Page 1 of 1
World Map and External Library
Posted: Sat Sep 05, 2009 5:31 am
by Boder
I'm working on an exploration platformer, so the map is very important. Each time you explore an area, I write an image file corresponding to the screen, in miniature to show that area.
I have to use a separate library called "GD" for this. Is this the way to go or is there another way people would recommend?
Since each screen is static, it seems kind of wasteful to store a text file for each screen and use a bunch of logic each time the game loads (which would be lengthy for a large map at the end of the game). This also needs dynamically generated textures, which I guess is possible in love 0.6.0?
Re: World Map and External Library
Posted: Sat Sep 05, 2009 7:52 am
by bmelts
I'm not entirely sure what you're asking here, but it's nearly 3 AM and I'm tired so I'm going to chalk it up to that.
In LÖVE 0.6.0 there's a few facilities that might enable you to do what I think you want to do. Most importantly, the addition of the ImageData class, which gives you a representation of, uh, image data that you can modify at your leisure. So, if you wanted to dynamically generate an image, you could do that (with some amount of effort). Once that's done, all you have to do is make an Image from the ImageData and draw it to the screen, which requires a total of two function calls to do.
I googled GD and it looks like one of its big features is the creation of image files from code you provide. I don't know if you need the ability to write the images out to files, but if you do, there's a similar, if more basic, version of that in LÖVE 0.6.0, using EncodedImageData (another new class) - you can encode image data in a given file format, making writing it to a file with love.filesystem trivial. Right now, the only file format supported is Targa, because it was fairly easy for me to implement; I don't know if support for other formats will be added prior to release. (Anything like PNG or JPEG would almost certainly require the use of their respective libraries, since there is no way in hell I'm reading through either format's spec and writing my own encoder.)
Re: World Map and External Library
Posted: Sat Sep 05, 2009 11:52 am
by bartbes
BMP is certainly easy to do, even though you don't like it
Re: World Map and External Library
Posted: Sun Sep 06, 2009 12:04 am
by napco
I don't know what you're trying to do, but if you only want a preview of the area you're entering you should use print screen to capture the image, add it to your resources and draw it before going into that place. By the way... How can i use a Lua library in LÖVE?
Re: World Map and External Library
Posted: Sun Sep 06, 2009 2:00 am
by osgeld
Maybe draw the image(s) in full, then transpose, and draw scaled on top of the desired area ...
I dont fully understand the question either, maybe an illustration, or some logic sudo code would help
Re: World Map and External Library
Posted: Sun Sep 06, 2009 4:10 am
by Boder
To make use of the library, I copied the DLLs to the folder with "love.exe" in Program Files. Then it allowed me to import and make use of it.
I was basically just needing the capability of drawing a small representation of the current screen and saving it at like 20% so I could piece together the larger map (for the whole game).
Actually I just realized since the tiles are mostly static, I could get away with pre-rendering each screen, and then drawing per-instance specifics like unexplored points and only saving those for the user's save game. But then I have to make sure to update (possibly automatically) when I change the tile map.