I thought I would make a thread here to collaborate with other Defold users for feedback/advice - Since, most people look at me funny when I mention anything about sprite constants, or vector4’s.
I am working on a very basic puzzle game for children and parents(no pun intended there).
The goal for this game is to be my first release on Google Play, and to monetize with IAP.
The Original Concept Design:
The Original Proof of Concept has the basic game framework where the player matches pieces to empty slots.
It gets puzzle categories via math.random() which I didn’t really like. It seems that using math.random() with a small set of numbers, frequently yields the same result. Even with more complex seeding such as
I also didn’t like the method of choosing the puzzles based on which ones were unlocked.
repeat category = math.random(num_categories) until iap_store.locked[category] == false
Which seemed pretty inefficient.
Even more so, using it for the pieces in a loop with for i=1,n do repeat math.random(n) until…
(device bursts into flames)
After replacing my phone, the method was converted to use my new favorite function.
local function shuffle(tbl) size = #tbl for i = size, 1, -1 do local rand = math.random(size) tbl[i], tbl[rand] = tbl[rand], tbl[i] end return tbl end
Which is LUA version of Fisher-Yates shuffle algorithm.
So now to get random categories and pieces, we simply make a table and shuffle(it) on init(), then step through as needed, with key = key + 1
Are you with me? Good! Because everyone else I talk with would be giving me those funny looks.
OK - Hopefully I have appealed to the great minds here, now you can let your brain relax by checking out this really simple game for kids.
Latest Development Screenshots:
There is still a long way to go… but it’s being made with Defold, so it’s going to be awesome.