Question about simple level editor

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
glitchapp
Party member
Posts: 235
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Question about simple level editor

Post by glitchapp »

Hello, I've been searching everywhere including this forum to try to find a simple level editor and I had no success. I found one that suits very much my needs but it is made in javascript: https://github.com/Evoltic/create-level ... ame-levels

I was wondering if no one has attempted something like this in lua? Creating it from scratch seems like a complex task, maybe it could be ported?

I'll be happy to know how would you approach this and if anyone has attempted it before, sorry if there is a thread about this already, I did not find anything related to a simple level editor.

Thanks!
User avatar
GVovkiv
Party member
Posts: 668
Joined: Fri Jan 15, 2021 7:29 am

Re: Question about simple level editor

Post by GVovkiv »

glitchapp wrote: Sun May 22, 2022 12:59 pm Hello, I've been searching everywhere including this forum to try to find a simple level editor and I had no success. I found one that suits very much my needs but it is made in javascript: https://github.com/Evoltic/create-level ... ame-levels

I was wondering if no one has attempted something like this in lua? Creating it from scratch seems like a complex task, maybe it could be ported?

I'll be happy to know how would you approach this and if anyone has attempted it before, sorry if there is a thread about this already, I did not find anything related to a simple level editor.

Thanks!
There exist some level editors:
tiled https://www.mapeditor.org/ and STI plug-in for love https://github.com/karai17/Simple-Tiled-Implementation
http://tilestudio.sourceforge.net/
https://ldtk.io/ can export data as json
https://ogmoeditor.itch.io/editor should also be able to export data as json (and, also, there somewhere in forums someone started to create plugin for this editor)

Sadly, only STI is full ready-to-use option here.
If you feel brave enough and you think ldtk, ogmoeditor, tilestudio is worth using it, then you can try write library to work with this editors.
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

Re: Question about simple level editor

Post by pgimeno »

Do you mean an in-game editor, or an external editor that you can use to create the levels?

If the latter, can't you just replace "[" with "{" and "]" with "}" and call it a day?
glitchapp
Party member
Posts: 235
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Question about simple level editor

Post by glitchapp »

pgimeno wrote: Sun May 22, 2022 2:25 pm Do you mean an in-game editor, or an external editor that you can use to create the levels?

If the latter, can't you just replace "[" with "{" and "]" with "}" and call it a day?
as an external level editor that javascript editor is almost perfect, as you said just [[]] needs to be changed. What I wish is something like that internal.
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

Re: Question about simple level editor

Post by pgimeno »

Here are a few games with a built-in level editor:

viewtopic.php?f=14&t=82127
viewtopic.php?f=14&t=83341
viewtopic.php?f=14&t=78421
viewtopic.php?f=5&t=82913

I haven't checked the licenses to see if they would allow you to reuse code, though.

And then there's this library: viewtopic.php?f=14&t=87644
glitchapp
Party member
Posts: 235
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Question about simple level editor

Post by glitchapp »

pgimeno wrote: Mon May 23, 2022 10:48 am Here are a few games with a built-in level editor:

viewtopic.php?f=14&t=82127
viewtopic.php?f=14&t=83341
viewtopic.php?f=14&t=78421
viewtopic.php?f=5&t=82913

I haven't checked the licenses to see if they would allow you to reuse code, though.

And then there's this library: viewtopic.php?f=14&t=87644
Oh this infromation is really useful! I love them! I tested (or try to test) all of them here there are my opinions:
- The slime game is not updated since long ago and crashes on new versions of löve. I can not test it.
- The liko editor I know already, but it does not suit most of the projects because it is targeted at ultra light and artificially restricted projects. The resolution is too low.
- The pix2level is a very cool idea, but I don't see how to export the levels to an useful format.
- The Otaku-Ball looks fantastic! It has save options, preview and everything I ever wishes for a level editor!

Definitely I will try to adapt that editor to fits my needs if the project is open source and developers agree. I created a level to test how the exported file looks like and it does not look very useful yet:

Code: Select all

local data = {}
data.bricks = {
	{8, 6, 1, {}},
	{8, 7, 1, {}},
	{9, 5, 1, {}},
	{9, 6, 1, {}},
	{9, 7, 1, {}},
	{9, 8, 1, {}},
	{10, 5, 1, {}},
	{10, 8, 1, {}},
	{10, 9, 1, {}},
	{11, 4, 1, {}},
	{11, 5, 1, {}},
	{11, 9, 1, {}},
	{12, 4, 1, {}},
	{12, 8, 1, {}},
	{12, 9, 1, {}},
	{13, 4, 1, {}},
	{13, 8, 1, {}},
	{14, 4, 1, {}},
	{14, 8, 1, {}},
	{15, 4, 1, {}},
	{15, 8, 1, {}},
	{16, 4, 1, {}},
	{16, 7, 1, {}},
	{16, 8, 1, {}},
	{17, 4, 1, {}},
	{17, 5, 1, {}},
	{17, 6, 1, {}},
	{17, 7, 1, {}}
}
data.menacer = {redgreen = false, cyan = false, bronze = false, silver = false, pewter = false, dizzy = false, cubic = false, gumballtrio = false, walkblock = false}
data.config = {}
data.config.slot_blue = {1, 2, 3}
data.config.slot_yellow = {1, 2, 3}
data.powerup = {
}
data.background = {r = 0, g = 0, b = 128}
return data
But I don't think adapting that would be a lot of work.

Thanks for sharing! I really appreciate those links!
glitchapp
Party member
Posts: 235
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Question about simple level editor

Post by glitchapp »

Hi! fortunately the developer of the level editor in which I'm interested has no problem of me using it for another project.
I started trying to implement it but my first problem is that I don't know if any additional file is needed, I don't want to copy the whole game as I' m only interested in the editor.

The editor I'm trying to use is here: https://github.com/chiud3UCI/OtakuBall/ ... rstate.lua

This is my first attempt at loading the editor:

Code: Select all

class = require("lib/otaku-level-editor/middleclass")			-- load library for level editor
editorstate = require ('lib/otaku-level-editor/editorstate')			-- Load otaku level editor

function love.load()
	EditorState:initialize()		--initialize editorState
end

function love.update(dt)
	EditorState:update(dt)		--update editorState
end

function love.draw(dt)
	EditorState:draw()		--draw editorState
end
I attached the program with this post.

update: after checking the amount of libraries linked... I think it would be a lot easier to create it from scratch, unless someone find an easy way to run it. Thank you!
Attachments
leditor.zip
(52.53 KiB) Downloaded 56 times
Ross
Citizen
Posts: 97
Joined: Tue Mar 13, 2018 12:12 pm
Contact:

Re: Question about simple level editor

Post by Ross »

If you want a level editor that's internal to your game, and that javascript one you linked in your first post is really all you need, then I would just write it yourself. That's pretty darn simple. You just have a 2D array and a "brush" data variable, and when you click you convert mouse coords to grid coords and place the brush data into the array. Done. Import and export are also very simple. The hardest part would be the GUI for changing the level size, colors, and tile data, but I'm assuming you have your own preferred GUI solution for your game already.
glitchapp
Party member
Posts: 235
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Question about simple level editor

Post by glitchapp »

Hi, thanks for the reply. I agree with you, the reason why I attempted this is because that level editor is far more sophisticated that what I',m probably going to create and it is worth trying. I underrated the complexity of extracting that tool from the rest of the game and I will probably do it from scratch.

Hopefully my level editor is useful for other people too, I think many projects use grids and could benefit from it, specially puzzle games. Maybe if the tool is useful and I publish it on git it could be improved over time and get to be as sophisticated and cool as the one above.

Thank you!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 53 guests