Lattelua — когда Lua уже мало

Если вы хоть раз встраивали Lua в свой проект — будь то игровой движок, высоконагруженный веб-сервер на OpenResty или конфигуратор сложного сетевого оборудования — вы знаете, за что мы его любим:) А любим мы его — за компактность, быстроту, встраиваемость и предсказуемость. Не любим — за аскетичный синтаксис, отсутствие привычных конструкций и постоянное «изобретение велосипеда». Эта статья — обзор диалекта Lattelua : зачем он нужен, чем отличается от других диалектов, и почему его особенно удобно использовать в уже существующих проектах, где Lua — встраиваемый язык. Погнали

https://habr.com/ru/articles/1011614/

#Lua #moonscript #AST #parsers

Lattelua — когда Lua уже мало

По мотивам CoffeeScript Если вы хоть раз встраивали Lua в свой проект — будь то игровой движок, высоконагруженный веб-сервер на OpenResty или конфигуратор сложного сетевого оборудования — вы знаете,...

Хабр
this would've been great if it just parsed
```moon
class B extends class A
@__inherited: => print " lmao"
new: => print "ayyyy"
```
#moonscript

why did I think this would work

... #moonscript

2damoring..

Non so se da ieri, o l’altro ieri, vabbè non importa… volevo provare a fare dei giocattolini interattivi (non oso chiamarli giochi perché non ho piani per renderli tali, se esce qualcosa bene e sennò pazienza), quindi ho ripreso il discorso delle librerie che feci tempo fa, e stavo quindi provando un po’ meglio LOVE2D. È basato!!! …Circa. 🦧️

Bello che ha comunque una libreria di robe abbastanza intuitiva e completa, cross-platform bla bla… e poi, è abbastanza conosciuto da avere una community. Finite le cose belle, tuttavia, resta il fatto che la versione Android ha qualche mancanza non poco grave… permette di caricare giochi solo da archivi .love, o l’eventuale presente nella cartella /sdcard/Android/data/org.love2d.android/files/games/lovegame/, che può contenerne solo uno alla volta. Come si fa per sviluppare, quindi? Bella domanda, stamattina. 🥱️

Poi, onestamente, #Lua ci sta, non mi dispiace, ma… dato che esiste letteralmente il linguaggio di scripting delle ragazze magiche, che di design traspila verso Lua, è meglio usare quello per me, ovviamente… ho sentito proprio l’attrazione. È MoonScript (https://memos.octt.eu.org/m/HCocbexUdDAZzLtMi4zijp), e si, è veramente delle magipuelle perché… guardate il logo insomma (non è opera mia, quindi non me lo sto inventando). Inusuale la sintassi eh, però mi è bastato usare i poteri per comprenderla subito. ✨️

Problema di MoonScript è che, anche se funziona in modalità immediata (cioè, che si carica all’interno di una runtime Lua normale, e da solo o programmaticamente può caricare per tradurre ed eseguire tutti gli script lunari), in realtà sembra spaccatissimo all’interno di alcuni ambienti… ad esempio, per LOVE2D pare funzionare solo su PC via cartella; niente file .love, e no su Android in generale. Quindi, vanno precompilati, cosa semplicissima ma che richiede di installare il toolchain… poco male, perché è tutto leggero e compatto. 🙏️

Considerato sia questo fatto, sia il problema di prima (Android mi farà impazzire), in realtà penso di aver fatto una cosa non troppo merdosa: uso uno script shell piccino per compilare da MoonScript a Lua (…dovrei usare un Makefile, per non ricompilare tutto ogni volta…), e poi un altro per avere un menu di selezione. Il tutto avviabile con un tap da Termux:Widget sulla home del telefono… ma solo quando Termux è già in RAM o qualcosa, altrimenti l’avvio viene esplicitamente negato dal sistema, nonostante io abbia dato tutti i permessi a tutto (MIUI mi farà impazzire). 😵‍💫️

Il menu per la selezione del “gioco” è tipo, wow. Volevo farlo con Termux:GUI, ma poi ho visto che quello ha tipo un server che deve rimanere attivo, e non parte da solo, quindi cacata perché dovrei aprire ancora una app di più a mano. Quindi ho usato invece dialog, con l’opzione --fselect che punta alla mia cartella #Dev; da lì, scegliendo una cartella, questa viene copiata alla posizione interna di prima, e viene avviata la activity principale della app di Love2D, quindi parte ciò che starei sviluppando. 😳️ (E mi chiedo perché questo widget su GNU dialog sia tipo rotto, mi richiede di premere freccia giù tipo 3 volte prima che i successivi click di spazio ed invio prendano effettivamente una cartella, altrimenti fa altre cose; gradisco alternative, purché sempre TUI.)

Questo quindi è il modo in cui riesco a devvare con questo stack anche su Android, senza fare tutto dentro un desktop Linux, che su telefono è scomodo. Non il meglio, ma accettabile… credo che su Android sia più veloce ricompilare e far partire un gioco di questi, rispetto a qualsiasi webapp con più di 0 build step. E, boh, il mio giocattolino #WIP di typin’ funziona, ma dovrei continuarlo ancora… 😭️

#Android #Dev #development #gamedev #LOVE2D #Lua #mobile #MoonScript #WIP

softwarepostaggio - fritto misto di octospacc

Ieri carestia di postaggio. A parte un altro esame e ancora altro gamin’, stavo vedendo delle robe riguardo la fabbricazione del gamin’, cioè varie tecnologie per fare giochini con un buon livello di cross-platformness e basse rogne (aka no C perché potenzialmente applicazioni complesse)… da un lato la scelta è ampia, ma dall’altro un po’ […]

fritto misto di octospacc

Posted a code example for a #tic80 effect: horizontal gradients

TIC-80 is usually limited to a 16-colour palette, so this involved two tricks: a callback which runs every scanline, and poking the memory location for the first palette colour, which is used as the background. Do so in the right way and we can exceed the colour limit!

I used this recently in a game to add a nice night sky background.

https://cxong.github.io/tic-80-examples/sky-gradient

#MoonScript #GameDev

Example: Sky Gradient

For #LD55 I worked on a cute platformer with @triplecubes in #tic80 !

https://ldjam.com/events/ludum-dare/55/crystalline

I had fun making the music and art, and although I didn't get to do as much #pixelart as I would have liked, I'm still pretty happy with the result!

And now I'd like to take a holiday...

#ScreenshotSaturday #GameDev #MoonScript

Made a code example for #tic80 : shooting bullets!

https://cxong.github.io/tic-80-examples/bullets

Shmups are great because they are one of the easiest genres to get started with, but this took a lot longer to make than expected, because it covers lots of techniques:

- spawning bullets
- collision between bullets and enemies
- despawning on collision, out of bounds
- sound effects
- cooldown using counters

if you haven't done #GameDev before, even if you're using an engine... it's not easy!

#PixelArt #MoonScript

Example: Bullets

Just wrote this code example of AABB collision using #tic80 and #MoonScript

https://cxong.github.io/tic-80-examples/collide

TIC-80 is a great fantasy computer, which also means it has a very barebones API, with no physics functions at all. If you just need some basic collision, this should help save you some time writing it from scratch!

#GameDev

Example: Collide

@patrickmcurry #tic80 is an #OpenSource multi-language #FantasyConsole

FCs in general are super easy to get started, and are great for learning, prototyping and jamming. I blogged about the latter here: https://cxong.github.io/2020/06/fantasy-consoles-for-jams

In terms of languages, it has great support for #lua, #javascript, decent support for #ruby, #python, and a bunch of niche yet fun languages - my fave is #moonscript

Here’s a video showing some games (mine is one of them)

https://youtu.be/ew-6Dp9cVvc

congusbongusgames

I made a scraper (in #python) for #tic80 carts hosted on tic80.com, as I wanted to find the #opensource ones but the website had no way to search this.

https://github.com/cxong/tic80-cart-scraper

It looks at all metadata on the pages as well as in the cart headers; some interesting results:

https://docs.google.com/spreadsheets/d/1GnnkFf-IP_YxdlRwmIpDKPGYCEyPqGPRurY3PdhtzqU/edit?usp=sharing

E.g. most carts are unlicensed but for those that are, 60%+ use MIT, followed by GPL3's 12%. Despite supporting many languages, 90% of carts are #lua, with #javascript 5% and #moonscript 1.6%.

GitHub - cxong/tic80-cart-scraper: Script to scrape, download and extract metadata from carts hosted on the TIC-80 website

Script to scrape, download and extract metadata from carts hosted on the TIC-80 website - GitHub - cxong/tic80-cart-scraper: Script to scrape, download and extract metadata from carts hosted on the...

GitHub