What's everyone working on? (tigsource inspired)

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: What's everyone working on? (tigsource inspired)

Post by Sulunia »

About losing Z index, that depends on how you're coding. Usually, you just draw everything in a specific order and voilá
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: What's everyone working on? (tigsource inspired)

Post by Jasoco »

The way I deal with Z indexing on images is to throw every single drawable into a table and sort that then draw the objects. Table sorting in Lua is pretty damn fast. I created my own DrawPool library for it too.

I use it in every project I make. It's much easier to deal with drawing when you don't have to worry about what order items have been drawn. Let the DrawPool sort it by their "layer", or "distance from camera" and you're set. Just draw whenever.
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: What's everyone working on? (tigsource inspired)

Post by Sulunia »

Jasoco wrote:The way I deal with Z indexing on images is to throw every single drawable into a table and sort that then draw the objects. Table sorting in Lua is pretty damn fast. I created my own DrawPool library for it too.

I use it in every project I make. It's much easier to deal with drawing when you don't have to worry about what order items have been drawn. Let the DrawPool sort it by their "layer", or "distance from camera" and you're set. Just draw whenever.
I for instance like drawing everything by hand in a specific order. Sure, some cases is good to have a DrawPool like you do, but in others i just prefer to have the values exposed so i can fine adjust where everything should go.
Code usually gets messier though, so it has that drawback. :monocle:
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: What's everyone working on? (tigsource inspired)

Post by Jasoco »

Sulunia wrote:I for instance like drawing everything by hand in a specific order. Sure, some cases is good to have a DrawPool like you do, but in others i just prefer to have the values exposed so i can fine adjust where everything should go.
Code usually gets messier though, so it has that drawback. :monocle:
But my method lets you fine tune placement better than just calling love.graphics.* functions straight. For instance, it lets you choose what layer to place the drawable. So even if I call a circle first and a square second, if the circle has a higher layer, it's going to draw last and on top. This is useful because you can't always be certain what order entities will be updated and drawn in since for is unpredictable with pairs() and you can't sort unnumbered indexed tables. Only ones with ordered pairs. My DrawPool makes sure I don't have to care. Plus it adds barely any extra time since table.sort is really fast. Plus it helps with any kind of game with any sort of 3D or pseudo 3D style to it like TMNT style brawlers and the like. I initially invented the method when I was toying around with a Star Fox style SuperFX engine.

Basically I can create drawables like so:

Code: Select all

drawPool:push { kind = "rect", x = 100, y = 100, w = 100, h = 100, color = {255,0,0}, layer = 100 }
drawPool:push { kind = "circle", x = 200, y = 120, rad = 80, color = {0,0,255}, layer = 95 }
drawPool:push { kind = "text", x = 50, y = 200, width = 300, align = "center", shadow = true, font = your_font, color = {255,255,255}, layer = 103 }
drawPool:push { kind = "image", x = 80, y = 60, image = fluffyBunny, quad = bunnyQuad[1], rot = 0, sx = 1, sy = 1, iox = 0, ioy = 0, layer = -304.43 }
...
And they'll draw in the right order. I could modify it to make the push() function work exactly like the equivalent drawable, but I use a table like this so I can add extra features if needed and it's easier to tell which argument does what and lets you skip arguments if you want.

But of course people can do what they want how they want. I made a library for myself so it could be reused and because someone was interested in my method so I drew up a Readme documentation (Which is larger in character size than the code itself) and let him have it. I'd put it on GitHub but I'd rather someone more knowledgeable look over the code and make sure it looks proper enough before I do that. Plus I'd want to make it more user-friendly. But this works really well.
User avatar
D0NM
Party member
Posts: 250
Joined: Mon Feb 08, 2016 10:35 am
Location: Zabuyaki
Contact:

Re: What's everyone working on? (tigsource inspired)

Post by D0NM »

well, thank u.
but i do sort my objects from the very beginning. ^__^
and... thanks to Jasoco, i've got a new idea to implement (not related to the last posts, but related to the "steps dust clouds particles" )
Our LÖVE Gamedev blog Zabuyaki (an open source retro beat 'em up game). Twitter: @Zabuyaki.
:joker: LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua :joker:
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: What's everyone working on? (tigsource inspired)

Post by Jasoco »



As usual, I don't even know where this is going. I just started with a prototype and it somehow turned into this. And it currently doesn't even do what the original prototypes did. But it does more.

I want to make it a twin stick shooter. I'm really inspired by Enter the Gungeon lately. But I don't want to rip it off. Plus it's been done now.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: What's everyone working on? (tigsource inspired)

Post by s-ol »

Jasoco wrote:I'd put it on GitHub but I'd rather someone more knowledgeable look over the code and make sure it looks proper enough before I do that. Plus I'd want to make it more user-friendly. But this works really well.
Don't think I'm more knowledgeable than you but I'd def look into it.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: What's everyone working on? (tigsource inspired)

Post by Sulunia »

s-ol wrote:
Jasoco wrote:I'd put it on GitHub but I'd rather someone more knowledgeable look over the code and make sure it looks proper enough before I do that. Plus I'd want to make it more user-friendly. But this works really well.
Don't think I'm more knowledgeable than you but I'd def look into it.
Agreed, i'm particularly interested aswell :D
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
marco.lizza
Citizen
Posts: 52
Joined: Wed Dec 23, 2015 4:03 pm

Re: What's everyone working on? (tigsource inspired)

Post by marco.lizza »

Jasoco wrote:I created my own DrawPool library for it too.
I opted for a similar approach, in some projects, but using a queue of closures with priority. That way I simply enqueue the drawing snippets without the need to define a specification format to be interpreted.
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: What's everyone working on? (tigsource inspired)

Post by Davidobot »

I'm working on a Pong clone: Image

Btw guys, I was the one Jasoco shared his DrawPool library with.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
Post Reply

Who is online

Users browsing this forum: No registered users and 91 guests