October 21, 2020, 03:03:21 AM

Author Topic: About LÖVE (Love2D)  (Read 207 times)

Offline Kryzon

  • Full Member
  • ***
  • Posts: 234
About LÖVE (Love2D)
« on: September 19, 2020, 10:09:25 AM »
Quote from: https://love2d.org/
LÖVE is an *awesome* framework you can use to make 2D games in Lua. It's free, open-source, and works on Windows, Mac OS X, Linux, Android and iOS.
I've been having a lot of fun with it, definitely recommend it for 2D games, even for production. 
It's very lightweight, low CPU use (it's bundled with LuaJIT so on desktop platform your scripts get JIT'ed to native instructions). 

If you have experience with games programming then most of the learning curve is just learning the Lua syntax, because the engine API is simple using callbacks, and you can still rewrite the entire mainloop to have complete control over it. The documentation is great too. And it's zlib licensed.

Here's some tiny projects that I've done with it: 


 
https://github.com/RNavega/2DMeshAnimation-Love2D 



 
https://github.com/RNavega/PixelArt-Antialias-Love2D 



 
https://github.com/RNavega/ScreenWipeShader-Love2D 



Offline MikeHart

  • Hero Member
  • *****
  • Posts: 725
  • Cerberus-X Developer
    • Whitesky Games
Re: About LÖVE (Love2D)
« Reply #1 on: September 19, 2020, 10:40:18 AM »
NICE! I love the animated2dmesh example. Can you explain it a bit? Is this a buildin feature of Löve or something you came up with?

Offline MrmediamanX

  • Full Member
  • ***
  • Posts: 236
    • 3MX Digital
Re: About LÖVE (Love2D)
« Reply #2 on: September 19, 2020, 10:47:58 AM »
I can remember using Love2d awhile ago ... just couldn't get use to it, not that it's bad.
look's like it's gone through a few updates since.

Offline Kryzon

  • Full Member
  • ***
  • Posts: 234
Re: About LÖVE (Love2D)
« Reply #3 on: September 19, 2020, 12:35:52 PM »
NICE! I love the animated2dmesh example. Can you explain it a bit? Is this a buildin feature of Löve or something you came up with?
Thanks man! It works like this: besides images/sprites and geometrical primitives like lines/rectangles/ovals, it also lets you create generic low-level "Mesh" drawables, where you can specify vertex format, vertex attributes etc., set a texture and draw it to the screen.

That example shows how you can animate that mesh by either modifying its vertices on the CPU, or sending all the data needed to a vertex shader and doing it on the GPU (which on my integrated, low-end GPU is still 10x faster than CPU). So it uses the built-in Mesh drawables, but the animation part is done by the script in the fastest way that I profiled. 
A secondary goal was to find a way to get a mesh made and animated on Blender (there's an exporter script in that repo to export the scene as Lua script with data tables). 

There's a Spine library for importing animations made with Spine, but judging from the source, the method they use to animate the mesh is not the fastest.

In order to run these examples you need to download the love executable (more info here), extract it anywhere or use the installer if you prefer it that way, then from a command-line run love.exe with the path to either a ".love" package (a renamed ZIP archive with all the scripts & assets) or the path to a folder with a "main.lua" script inside.

So to run the 2D mesh example, download its .love package from here and then do a:
Quote
D:\path\to\love.exe "D:\path\to\2DMeshAnimation_v1.1.0.love"
Or if you downloaded the source files, running from a folder: 
Quote
D:\path\to\love.exe "D:\path\to\2DMeshAnimation-Love2D-master\"
The pixel art shader example is the only one that doesn't have a .love, only the main.lua script, so you need to put it in some folder and use that folder-style execution.

When distributing your game on Steam and such, there are more elegant ways of packaging your game: 
https://love2d.org/wiki/Game_Distribution

I can remember using Love2d awhile ago ... just couldn't get use to it, not that it's bad.
look's like it's gone through a few updates since.
It's on v11.3, and it looks like v12 is coming soon. I don't know much of its history but you're probably right that it's changed a lot.

Offline MikeHart

  • Hero Member
  • *****
  • Posts: 725
  • Cerberus-X Developer
    • Whitesky Games
Re: About LÖVE (Love2D)
« Reply #4 on: September 19, 2020, 02:28:57 PM »
NICE! I love the animated2dmesh example. Can you explain it a bit? Is this a buildin feature of Löve or something you came up with?
Thanks man! It works like this: besides images/sprites and geometrical primitives like lines/rectangles/ovals, it also lets you create generic low-level "Mesh" drawables, where you can specify vertex format, vertex attributes etc., set a texture and draw it to the screen.

That example shows how you can animate that mesh by either modifying its vertices on the CPU, or sending all the data needed to a vertex shader and doing it on the GPU (which on my integrated, low-end GPU is still 10x faster than CPU). So it uses the built-in Mesh drawables, but the animation part is done by the script in the fastest way that I profiled. 
A secondary goal was to find a way to get a mesh made and animated on Blender (there's an exporter script in that repo to export the scene as Lua script with data tables). 

There's a Spine library for importing animations made with Spine, but judging from the source, the method they use to animate the mesh is not the fastest.

In order to run these examples you need to download the love executable (more info here), extract it anywhere or use the installer if you prefer it that way, then from a command-line run love.exe with the path to either a ".love" package (a renamed ZIP archive with all the scripts & assets) or the path to a folder with a "main.lua" script inside.

So to run the 2D mesh example, download its .love package from here and then do a:
Quote
D:\path\to\love.exe "D:\path\to\2DMeshAnimation_v1.1.0.love"
Or if you downloaded the source files, running from a folder: 
Quote
D:\path\to\love.exe "D:\path\to\2DMeshAnimation-Love2D-master\"
The pixel art shader example is the only one that doesn't have a .love, only the main.lua script, so you need to put it in some folder and use that folder-style execution.

When distributing your game on Steam and such, there are more elegant ways of packaging your game: 
https://love2d.org/wiki/Game_Distribution

I can remember using Love2d awhile ago ... just couldn't get use to it, not that it's bad.
look's like it's gone through a few updates since.
It's on v11.3, and it looks like v12 is coming soon. I don't know much of its history but you're probably right that it's changed a lot.
Thanks man, back then and before I got into Monkey, I was using Ansca/Corona SDK and then Gideros Studio A LOT, so Lua is no unknown for me.

Offline STEVIE G

  • Sr. Member
  • ****
  • Posts: 490
Re: About LÖVE (Love2D)
« Reply #5 on: September 19, 2020, 02:58:01 PM »
This looks good, probably my best chance to learn something new. Will definitely give this a go. Thanks for sharing!

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 2529
  • I mostly code at night... Mostly.
    • SyntaxBomb - Indie Coders
Re: About LÖVE (Love2D)
« Reply #6 on: September 19, 2020, 03:09:49 PM »
Love the animated jelly fish, it looks well swishy ;D
Mac mini ( 2018 / 2020 ), 3 GHz 6-Core Intel Core i5, 16 GB 2667 MHz DDR4, 1TB NVMe, eGPU Radeon Pro 580 8 GB, LG Ultragear 27GL83A-B 27 Inch
Commodore VIC-20, 1.1Mhz MOS 6502 CPU, 5KB RAM, VIC ( 6560 ) GPU

Until the next time...

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 2816
  • elgol 2021
Re: About LÖVE (Love2D)
« Reply #7 on: September 19, 2020, 03:30:47 PM »
The animated jellyfish looks cool and I like the old skool retro demo antialiasing effect, it just needs some scrolling text now.   :)
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Catalina, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi 3 and 4

Offline Kryzon

  • Full Member
  • ***
  • Posts: 234
Re: About LÖVE (Love2D)
« Reply #8 on: September 19, 2020, 03:38:51 PM »
This looks good, probably my best chance to learn something new. Will definitely give this a go. Thanks for sharing!
Good luck. If you're new to Lua like me, these resources can help: 
- The official manual: https://www.lua.org/manual/5.3/ 
- The user wiki: http://lua-users.org/wiki/TutorialDirectory (just be careful with the differences between Lua versions) 
- googling for Stackoverflow questions about basic things 

You can also get more motivated by trying some full games: https://itch.io/games/tag-love2d (I recommend Curse of the Arrow)
Most of the time you can open the .love file from the game and look around its source code, see how they did stuff. That is, unless they converted their scripts down to LuaJIT bytecode directly for each platform, as a mild protection (more info here). To do that you'd use a LuaJIT binary to produce the bytecode files out of your scripts.

Edit: forgot to say, you can get a lot of help (on Lua or LÖVE) at their Discord server: https://discord.gg/rhUets9

Love the animated jelly fish, it looks well swishy ;D
The animated jellyfish looks cool and I like the old skool retro demo antialiasing effect, it just needs some scrolling text now.   :)
Thanks guys :D

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal