What's everyone working on? (tigsource inspired)
Re: What's everyone working on? (tigsource inspired)
About losing Z index, that depends on how you're coding. Usually, you just draw everything in a specific order and voilá
https://github.com/Sulunia
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: What's everyone working on? (tigsource inspired)
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 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.
Re: What's everyone working on? (tigsource inspired)
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.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.
Code usually gets messier though, so it has that drawback.
https://github.com/Sulunia
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: What's everyone working on? (tigsource inspired)
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.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.
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 }
...
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.
Re: What's everyone working on? (tigsource inspired)
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" )
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.
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: What's everyone working on? (tigsource inspired)
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.
Re: What's everyone working on? (tigsource inspired)
Don't think I'm more knowledgeable than you but I'd def look into it.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.
Re: What's everyone working on? (tigsource inspired)
Agreed, i'm particularly interested aswells-ol wrote:Don't think I'm more knowledgeable than you but I'd def look into it.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.
https://github.com/Sulunia
-
- Citizen
- Posts: 52
- Joined: Wed Dec 23, 2015 4:03 pm
Re: What's everyone working on? (tigsource inspired)
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.Jasoco wrote:I created my own DrawPool library for it too.
Re: What's everyone working on? (tigsource inspired)
I'm working on a Pong clone:
Btw guys, I was the one Jasoco shared his DrawPool library with.
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
personal page and a raycaster
Who is online
Users browsing this forum: No registered users and 4 guests