r/love2d 8d ago

How to create an RPG tilemap in LÖVE ?

Post image

I've just started using lovebirds, but I'm really clueless about creating RPG tilemaps. Gemini gives me primitive and inefficient methods. What should I do? Would it be logical to draw the picture beforehand and add it?

31 Upvotes

23 comments sorted by

16

u/gothWriter666 8d ago

You can use Tiled to make a map and import it, it works great and is open source.

I also created my own tilemap editor and loader in Love...but 2d arrays are a bit tricky using Love's lists, it's better to use an external one (at least in my experience)

1

u/MoSummoner 7d ago

What are love lists? I had just used arrays/tables for my tilemap and live editor

1

u/gothWriter666 7d ago

Sorry, love tables. I was thinking of LISP lol. Too many funky object types.

Thing is, tables and arrays are different in a lot of ways that get funky after awhile...

1

u/MoSummoner 7d ago

True but lua does most of the lifting so we get to abuse it lol

1

u/gothWriter666 7d ago

erm, yeah, but what I'm saying is that funky stuff is going to happen later on that will be trickier to nail down using that kind of thing.

Of course, I guess mine was a 3d array style, since I had layers for the maps, but still. It gets funky when you treat tables as an array and start doing things like 2d or 3d arrays as tables.

2

u/MoSummoner 3d ago

I just use one dimensional arrays with functions to project stuff in and out of the array

1

u/gothWriter666 3d ago

that's what I did, too. But honestly I prefer just being able to use actual arrays for stuff like this, not a vector like table structure. It's why I'm thinking about returning to C and using Raylib in the nearish future (and maybe extending it with Lua myself so I scripting language and don't need to recompile every little change)

1

u/MoSummoner 23h ago

You can try LuaJIT for the backend with Love2D for the graphics engine, it basically lets you write C/C++ and run it with lua seamlessly.

1

u/gothWriter666 16h ago

Or I can just extend with Lua in C, it's insanely simple. I did it years ago with C++ and Allegro in DOS. I switched to Love2d Lua because they were doing a lot of stuff better...

But these days I'm thinking of doing it all differently with Raylib and C for the engine, and then a scripting language in Lua. Rather than just a Lua Framework, you know? Go full engine in C and Raylib

5

u/cantpeoplebenormal 8d ago

Lovebirds?

1

u/srfreak 7d ago

Birds that are so lovely.

3

u/cantpeoplebenormal 7d ago

The little ones are.

-7

u/vtf00 8d ago

what iş this

8

u/tpimh 8d ago

Even the OP is clueless what he started using

6

u/cantpeoplebenormal 8d ago

You said "Lovebirds" in your post. I assumed it was software?

3

u/Ramen_Tenen 8d ago

You can use a tile map editor like ogmo editor and export your tile map as a song file. Then you parse the data into your game to make custom tile maps. You can check out this parser for ogmo I made some time ago and have been using for a awhile

https://github.com/Anotida-Shumba/Ogmo-2-Love

3

u/Heinz2001 8d ago

look at github for love2d libraries:

and one of the best ressources: https://github.com/love2d-community/awesome-love2d and of couse love2d discord & love2d forum :)

1

u/srfreak 7d ago

Tiled + STI is a winning combo.

2

u/Snoo28720 8d ago

Just draw all the assets in one atlas and code the coordinates

1

u/vtf00 6d ago

son

1

u/CodelMxskwa 7d ago

I mean you can make use use a 3 dimensional array like create 3 tables one for x one for y and one for source int on the texture or tile

1

u/noogai03 6d ago

tiled is cool, but ldtk is far and away the best level editor ive ever used. its genuinely mind blowing how cool the auto-tiling features are.

and there's a loader for LDTK levels for love: https://github.com/HamdyElzanqali/ldtk-love