World Map and External Library

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Boder
Prole
Posts: 7
Joined: Thu Aug 27, 2009 5:47 pm

World Map and External Library

Post 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?
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: World Map and External Library

Post 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.)
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: World Map and External Library

Post by bartbes »

BMP is certainly easy to do, even though you don't like it :D
User avatar
napco
Party member
Posts: 129
Joined: Fri Jun 12, 2009 9:28 pm
Location: Ital... ehm...

Re: World Map and External Library

Post 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?
User avatar
osgeld
Party member
Posts: 303
Joined: Sun Nov 23, 2008 10:13 pm

Re: World Map and External Library

Post 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
User avatar
Boder
Prole
Posts: 7
Joined: Thu Aug 27, 2009 5:47 pm

Re: World Map and External Library

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 148 guests