tetris-love

Show off your games, demos and other (playable) creations.
Post Reply
nununoisy
Prole
Posts: 3
Joined: Tue Apr 09, 2019 5:17 am

tetris-love

Post by nununoisy »

Yet another Tetris clone for Love2D...

... but this time, it's Guideline Tetris!

All your favorites, including:
  • Correctly colored Tetriminoes!
  • SRS!
  • The Hold!
  • Marathon, Sprint, and Ultra!
and much more!

Download here!

It's open source: https://github.com/nununoisy/tetris-love

This was a fun first project though. Any feedback appreciated!
Last edited by nununoisy on Thu Apr 11, 2019 3:00 am, edited 1 time in total.
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: tetris-love

Post by zorg »

Hi and welcome to the forums!

So, some constructive feedback, i hope:

- Local variables are a good thing to use, but if you clearly use the same locally defined functions in multiple files, think about putting them into their own lua file, and requiring that in the others to avoid code duplication. (like gDraw)

- Löve uses LuaJIT by default, which means it has its own bitops library you can require in with something like local bit = require 'bit'; LuaJIT's own website has a section on how that works.

- LuaJIT also optimizes 0th indices so you don't necessarily need to use 1-indexed tables... that said, there are downsides, as in, many functions that work on the "sequence" part of tables would disregard the 0th elements, like ipairs (a moot point since most of your for loops are simple numeric ones), or # would return one less than you'd expect. In any case there's no real performance gain/loss with either method, just wanted to mention it since you did write comments regarding lua's 1-based indexing in your source.

Bonus points for trying to make it compatible with multiple löve versions though. :3
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
nununoisy
Prole
Posts: 3
Joined: Tue Apr 09, 2019 5:17 am

Re: tetris-love

Post by nununoisy »

zorg wrote: Tue Apr 09, 2019 2:15 pm Hi and welcome to the forums!

So, some constructive feedback, i hope:

- Local variables are a good thing to use, but if you clearly use the same locally defined functions in multiple files, think about putting them into their own lua file, and requiring that in the others to avoid code duplication. (like gDraw)

- Löve uses LuaJIT by default, which means it has its own bitops library you can require in with something like local bit = require 'bit'; LuaJIT's own website has a section on how that works.

- LuaJIT also optimizes 0th indices so you don't necessarily need to use 1-indexed tables... that said, there are downsides, as in, many functions that work on the "sequence" part of tables would disregard the 0th elements, like ipairs (a moot point since most of your for loops are simple numeric ones), or # would return one less than you'd expect. In any case there's no real performance gain/loss with either method, just wanted to mention it since you did write comments regarding lua's 1-based indexing in your source.

Bonus points for trying to make it compatible with multiple löve versions though. :3
Thanks for that!

I’m not sure why I defined those functions multiple times. Quite silly of me. I also didn’t know LuaJIT had bitops, thanks for telling me!

As for 1-indexing, I have so many hardcoded tables it wouldn’t help to make everything 0-indexed. I’m also too lazy to refactor ;)

Also, would anyone happen to know why there are odd timing issues in 0.10? I don’t see them in 11.0, but it seems like 0.10 runs faster than it should.
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: tetris-love

Post by zorg »

I don't think there are timing issues in 0.10, at least i never noticed such a thing, but i did try to go through your main.lua and to be honest, i couldn't find anything glaring that could cause timing issues.

By the way, your legalese may be correct, but i don't think i ever read anything about a "trade dress" before, didn't you mean "trademark"?
Also, to me, the text kind of reads like you actually got a license for this clone (or at least to use the name tetris) from the tetris company.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
nununoisy
Prole
Posts: 3
Joined: Tue Apr 09, 2019 5:17 am

Re: tetris-love

Post by nununoisy »

Thanks zorg!

I figured out the timing issue, it was because of some version inconsistency that caused the animation timer to reset. It should be fixed now.

As for the legal stuff, it came straight from the Guideline, so I assume it's correct. Most licensed Tetris games use the same text. Mine isn't licensed (no response from them), but I figured mentioning the legal stuff would be important.
Akanshi579
Prole
Posts: 1
Joined: Thu Apr 11, 2019 8:42 am
Contact:

Re: tetris-love

Post by Akanshi579 »

Best game ever.
Post Reply

Who is online

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