What's everyone working on? (tigsource inspired)

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Germanunkol
Party member
Posts: 705
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

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

Post by Germanunkol » Sun Jan 22, 2017 9:04 am

@Jasoco, in Bandana, we used Regular Expressions to find which tile should be used at a certain position.
We wrote about it here, might be an interesting read.
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de

MrFariator
Citizen
Posts: 92
Joined: Wed Oct 05, 2016 11:53 am

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

Post by MrFariator » Sun Jan 22, 2017 10:52 am

In my autotiling case I just run the algorithm described on the linked site twice: once to get the cardinal sum factor, and then again to get the diagonal sum factor. This requires 31 dfferent variations of the tile for the corner checks.

However, this is not pefect (though is good enough for my purposes), and one easier method that doesn't require as much manual tile work is to separate a single tile into four parts, and each part checks the surrounding tiles independently.
-- Run once in a blue moon
if math.random() > 0.99 then
  local account = Twitter:getProfile ( https://twitter.com/GravityCircuit )
  account:post ( currentProgress:getGIF() )
end

Zireael
Party member
Posts: 139
Joined: Fri Sep 02, 2016 10:52 am

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

Post by Zireael » Sun Jan 22, 2017 2:16 pm

I'm thinking of picking up the LOVE port of my roguelike back up! However I can't figure out how to force LOVE to redraw my map once I change the level...

User avatar
Jasoco
Inner party member
Posts: 3637
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

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

Post by Jasoco » Mon Jan 23, 2017 4:20 am

MrFariator wrote:In my autotiling case I just run the algorithm described on the linked site twice: once to get the cardinal sum factor, and then again to get the diagonal sum factor. This requires 31 dfferent variations of the tile for the corner checks.

However, this is not pefect (though is good enough for my purposes), and one easier method that doesn't require as much manual tile work is to separate a single tile into four parts, and each part checks the surrounding tiles independently.
Due to the way I wanted to account for every single combination, I had to do a lot of edge case checks for certain tiles but I got something that works.

Image

Mine has 49 different variations for tiles to account for every single corner and edge combination. (Which you can see in the screenshot above) It's probably overkill, but I want it to be flexible.

MrFariator
Citizen
Posts: 92
Joined: Wed Oct 05, 2016 11:53 am

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

Post by MrFariator » Mon Jan 23, 2017 5:00 am

49 isn't ultimately too bad. My initial ideas for covering all possible cases went well beyond that, and it's not like I really need that kind of accuracy for my game. The auto tiling in my editor is there for making placing big solid chunks easier, while requiring fine-tuning corners and other things by hand. This is because the tile sheets I'm intending to make later down the line would be too detailed/specific (think Mega Man X on the SNES) that it would become tiresome to develop a more sophisticated auto tiling scheme when I just want 16x16 tiles.

But guess that proof of concept has to wait till I actually get around making the game prettier.
-- Run once in a blue moon
if math.random() > 0.99 then
  local account = Twitter:getProfile ( https://twitter.com/GravityCircuit )
  account:post ( currentProgress:getGIF() )
end

User avatar
Jasoco
Inner party member
Posts: 3637
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

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

Post by Jasoco » Tue Jan 24, 2017 5:03 am

Turns out it's actually 47. I did two tiles twice. (Bottom right corner of the tile portion of the grid.) Though my posted tile sheet is also missing 8 tile variations.

I keep finding more edge cases. Ugh. I think I might have to write a new algorithm of my own.

Image

User avatar
Jasoco
Inner party member
Posts: 3637
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

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

Post by Jasoco » Wed Jan 25, 2017 4:53 am

Well I did it. I made my own algorithm that deals with micro tiles of 8x8 instead of 16x16 and it ended up taking up way less code. It basically checks the four corners of the tile and compares which neighbors are water or not and uses one of the 4 possible variations for each corner. I cut myself down from a redundantly impossible to manage tile sheet like the one on the previous page:
Image

And replaced it with a much more manageable and smaller sprite sheet with only 12 variations:
Image

And it works perfectly and covers every base. The algorithm also returns whether the tile has no solid neighbors so I can add details like the rock pictured above or maybe a lily pad or something.

It'll be able to make changes much easier and add variations to randomly be selected. This will work for ground-based autotiling. I'll write a different one based on the original code for wall-based autotiling which will probably still use 16x16 tiles.

Edit: Now I added some "roughness" to the tiles to make them look more natural. Kind of. I like it...

Image

Edit 2: Experimenting.

Image

User avatar
raidho36
Party member
Posts: 1685
Joined: Mon Jun 17, 2013 12:00 pm

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

Post by raidho36 » Fri Jan 27, 2017 12:51 pm

Trying to make my own genetic algorithm Box2D car simulator. The physics engine will automatically weld nearby vertices so if you create a triangle it can degenerate into a straight line. Now it could act as a line segment but still being treated as a would-be polygon, it gets rejected. And then it also requires that resulting shape had some substantial volume and if the triangle gets really flat it throws errors as well. Picky bastard!

At least the genetic part is working and for as long as Box2D doesn't crash it functions properly.
Attachments
Screenshot from 2017-01-27 15-47-51.png
Screenshot from 2017-01-27 15-47-51.png (10.92 KiB) Viewed 2125 times

User avatar
Jasoco
Inner party member
Posts: 3637
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

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

Post by Jasoco » Wed Feb 01, 2017 8:38 pm

Been trying to figure out a good lighting method and I came up with something that almost resembles Metaballs.


It's not even that difficult either. I have an image of a gradient circle that fades from solid white in the middle to fully transparent. Draw that as the light to my canvas. Run the canvas through my shader which checks the Alpha of the pixel and "snaps" it to one of a few fixed values.

My shader is simple enough, but I want to do more:

Code: Select all

extern vec2 dim;

vec4 effect(vec4 col, Image texture, vec2 texturePos, vec2 screenPos)
{
    vec2 coords = texturePos;

	vec4 pixel = texture2D(texture, texturePos);

	number alpha = (1 - pixel.a);
	number alphaOut = alpha;
	if (alpha <= 0.25)
		alphaOut = 0.25;
	else if (alpha > 0.25 && alpha <= 0.5)
		alphaOut = 0.5;
	else if (alpha > 0.5 && alpha <= 0.6)
		alphaOut = 0.75;
	else
		alphaOut = 1;

    vec4 finalColor = vec4(0, 0, 0, alphaOut * dim[0]);
    return finalColor;
}
Like add a dither or something. I don't know yet. But it looks really cool when moving around. I'm not going for realistic of course so I don't need shadowing or blocking the light though that'd be neat. I'll figure something out in time.

Germanunkol
Party member
Posts: 705
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

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

Post by Germanunkol » Sat Feb 04, 2017 11:02 pm

Jasoco wrote:Been trying to figure out a good lighting method and I came up with something that almost resembles Metaballs.
It looks cool, but I think it breaks the style a little - you have rectangular tiles everywhere and then this very round shadow. Maybe you could make it adjust to the tiles, i.e. a single tile can either be fully in the shadow, in the semi-shadow or not in shadow at all.
That way the shadow outline would be blocky, just like the tiles...
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests