Completely Lua/Love2D based map editor and player

Showcase your libraries, tools and other projects that help your fellow love users.
pauljessup
Party member
Posts: 355
Joined: Wed Jul 03, 2013 4:06 am

Re: Completely Lua/Love2D based map editor and player

Post by pauljessup »

What the example shows:
Loading a file saved earlier with the greentea system
This loads:
Two map layers- a ground layer and an above ground layer
The above ground layer uses the parallax plugin. This is an example of how plugins work, and how they can be used when loading/saving. This plugin is constantly scrolling this layer.
The above layer also has a 50% opacity.
Three cameras. A map camera, and then a camera for each layer.
A tileset made of tiles from games/maps/test.png
An object. This is just a simple object, without being changed through a plugin. This object is loaded from the file, and uses the image found at games/objects/test.png
pauljessup
Party member
Posts: 355
Joined: Wed Jul 03, 2013 4:06 am

Re: Completely Lua/Love2D based map editor and player

Post by pauljessup »

Github has been updated to support Love 0.9. Also here's a .love file that will work with that as well:
https://dl.dropboxusercontent.com/u/635 ... entea.love
pauljessup
Party member
Posts: 355
Joined: Wed Jul 03, 2013 4:06 am

Re: Completely Lua/Love2D based map editor and player

Post by pauljessup »

I'm getting to the point where I can show screen shots and have a pretty full example coming.

After that, I'll mostly do documentation, so that it should be easy for people to use/extend/customize.
User avatar
Jeeper
Party member
Posts: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: Completely Lua/Love2D based map editor and player

Post by Jeeper »

Awesome, looking forward to that :). Keep up the good work!
pauljessup
Party member
Posts: 355
Joined: Wed Jul 03, 2013 4:06 am

Re: Completely Lua/Love2D based map editor and player

Post by pauljessup »

Thanks :)

I want to have the way you extend it (ie: adding new file formats, adding objects to a map, etc) really well documented. That way, it will be simple to add something new. I'm using HUMP's classes so that extending anything should be crazy simple. All you need to do is over-ride the constructor, and then over-ride the method you want to change (usually update or draw). And then I'll have a huge list of all the methods & stuff you'll have access to.
pauljessup
Party member
Posts: 355
Joined: Wed Jul 03, 2013 4:06 am

Re: Completely Lua/Love2D based map editor and player

Post by pauljessup »

And now for some screenshots...
Attachments
Selecting a group of tiles from the tileset. You select by holding down the mouse button as you pick them out.
Selecting a group of tiles from the tileset. You select by holding down the mouse button as you pick them out.
maped3.png (181.08 KiB) Viewed 7304 times
Selecting a single tile from the tileset.
Selecting a single tile from the tileset.
maped2.png (185.47 KiB) Viewed 7304 times
Placing a group of tiles selected earlier in the first image.
Placing a group of tiles selected earlier in the first image.
maped1.png (143.83 KiB) Viewed 7304 times
Last edited by pauljessup on Tue Dec 24, 2013 4:54 pm, edited 1 time in total.
pauljessup
Party member
Posts: 355
Joined: Wed Jul 03, 2013 4:06 am

Re: Completely Lua/Love2D based map editor and player

Post by pauljessup »

So, the tile placing is almost done. Need to add a fill bucket, and that's it. Next will be the object drop tool- this will be extra handy, since you can create new objects and tell them how to behave/etc by creating an object plugin. This way, you can do some pretty nifty stuff, like NPC's talking, enemies hitting the player, etc. I'll have a few pre-made object plugins available later on. After the object dropper, I'll need to do the layer editor (changing opacity, deleting/adding layers, moving between them). The functionality is there, I just need to add the toolbars for these and to have it drop/make changes based on the mouse.

Also, attached herin is a small example, toying around with some tilesets I made for a game (requires love 0.9).
https://dl.dropboxusercontent.com/u/635 ... entea.love

Anyway...the editor also leaves no trace of itself in your game. So, no matter what font you use, no matter how/if you use the mouse, it reverts back to the original font and mouse after exiting the editor. You could start a game, play, decide you want to edit a map, press the map button, editor comes up, edit away, return to game, and everything is as it should. I'm also trying not to use any of the love. hooks (or as little as possible) so you only need to place greentea: whatever in just the load, update and draw functions for love. Rather then the mouse_pressed, key pressed, etc.
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Completely Lua/Love2D based map editor and player

Post by Lafolie »

I took a brief look at the code, I noticed that the layer object appears to simply iterate through the table containing tile references. You may want to use spritebatches as they make it easier for both you and the computer to handle. The only drawback is that they're expensive to constantly update - you may also want to use a canvas in the editor to circumvent this issue. In-game, the spritebatches can be drawn at a significantly reduced cost over nested iterators drawing each individual tile.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
pauljessup
Party member
Posts: 355
Joined: Wed Jul 03, 2013 4:06 am

Re: Completely Lua/Love2D based map editor and player

Post by pauljessup »

As much as I love canvases, they have their drawbacks, because of how Love does them. I used to use offscreen buffers all the time in Allegro, so when I switched to Love2d/Lua from C++/Allegro, it took a bit of getting used to...

Anyway....

I'm not going to use spritebatches, The current method can be very speedy for things that can slow sprite batches down (large amount of layers to a map, large maps, etc...all important for games of any decent size...this from experience in using some of the other already existing engines with large maps I've made in Tiled).

Anyway, I realized I need to optimize a few things, and blammo- the current iteration code now goes 200-fps or so, rather than the 24 from before. It had to do with a calculation error when drawing the visible tiles to the screen, but now that's fixed.

Anyway, I'll have more demos later.
pauljessup
Party member
Posts: 355
Joined: Wed Jul 03, 2013 4:06 am

Re: Completely Lua/Love2D based map editor and player

Post by pauljessup »

Okay, updated the demo with the recent changes. Also using a different tileset. Mostly because the tileset before was mine mine mine mine gimmie gimmie mine you can't use it, and instead I'm going to packaging the demos with one from open game art.

https://dl.dropboxusercontent.com/u/635 ... entea.love

Anyway, the FPS capping right now is crazy bad. But it's just hack in the demo until I get everything else into a good release state.
Post Reply

Who is online

Users browsing this forum: No registered users and 52 guests