Monday, September 23, 2019

Defold: Using Tint to Reduce sprite count

Problem:

I'm new to Defold but it's coming along. I am working on a hex tile game and I wanted to have different tiles represent sand, grass, and water. After updating my atlas file to include each tile graphic, I created a tile game object with logic to show or hide each sprite based on the passed in type.

Generating smaller maps I soon realized this was not going to work. Each tile game object had multiple sprites on it, and even though some were not visible, they still counted. In addition, any sprite decorations inside the tiles, but only showing up ever on one tile also counted.

Solution: 

After playing around with the tint feature, I realized I could probably tint something white to be any color I wanted and anything dark or grey would still be visible (which is good because my tiles need outlines and I'm not going to build a shader for that...).



It worked really well. For each tile script I store the colors of each state, and tint the tile when I need it to change.

local water_color = vmath.vector4(.33, .66, 1, 1)
local sand_color = vmath.vector4(.99, .96, .62, 1)
local grass_color = vmath.vector4(.55, .79, 0, 1)

sprite.set_constant("#skin", "tint", grass_color)


Also, move any tile decorators outside the tile, make the tiles as simple as possible and that will help optimize your game.

No valid kits found. : Qt Creator on Windows

Problem:

While starting again on another python project and wanting to use Qt Creator to create a quick GUI, I was confused when things didn't go quite as planned. When creating a new Qt Widgets application, I got to a second step of Kit Selection but found a message reading:

No valid kits found. 


Solution: 

Once I installed the Windows SDK (debug utilities specifically) and rebooted my computer, Qt Creator was able to find the default kit profile.

Friday, September 20, 2019

C# Azure WebJobs - Functions Ending with Async Don't Run

Problem:
While trying to debug some new WebJobs that were running, I decided to implement the process of elimination to see what made certain job definitions not run. Here is the method, that would not run.

public static void PurgeOldRecordsAsync([TimerTrigger("0 * * * * *")] TimerInfo timerInfo, ILogger log)
{
     await helper.RunTaskAsync(); 
}

In the process of elimination, I simplified the function content to just print to the log when it ran. Also, I tried replacing the async Task portion the function with a void return. Neither changed anything. Then I tried changing the name of the function to TestJob and it ran. So I determined it had something to do with the name...

Solution
It turns out that any function name ending in Async wouldn't run. Once I removed this from the function name, the job triggered as expected.

I searched the web, but couldn't find a reason for this. If you know, please share in the comments.