Search found 947 matches
- Sun Jan 09, 2022 1:11 pm
- Forum: General
- Topic: How to go about daily random numbers
- Replies: 27
- Views: 12754
Re: How to go about daily random numbers
It makes no sense to use the convoluted hash method to generate a number just because the RNG algorithm might change in the future, if you use that number to seed love's RNG anyway. It is only good for one high-quality number and would require work to generate more (look up sponge functions if you'r...
- Sun Jan 09, 2022 11:07 am
- Forum: General
- Topic: How to go about daily random numbers
- Replies: 27
- Views: 12754
Re: How to go about daily random numbers
Future levels, too. Is that really a problem? Or could you just not care? I can assure you: you will regret to have opened that can of worms.Gunroar:Cannon() wrote: ↑Sun Jan 09, 2022 9:53 am Though the problem of people being able change their system clock to get old levels
- Sat Jan 08, 2022 6:58 pm
- Forum: General
- Topic: How to go about daily random numbers
- Replies: 27
- Views: 12754
Re: How to go about daily random numbers
A secure hash function is a really good PRNG.
Here's the fixed version:
(entirely untested!)
Here's the fixed version:
Code: Select all
local d = os.date('!*t') -- get utc date
local hash = love.data.encode('string', 'hex', love.data.hash('sha1', (d.day * 123) .. d.month .. d.year))
local rand = tonumber(hash:sub(1, 16), 16)
- Sat Jan 08, 2022 6:50 pm
- Forum: General
- Topic: How to go about daily random numbers
- Replies: 27
- Views: 12754
Re: How to go about daily random numbers
And the sha1 method has the flaw that it generates the same number for Jan. 11 and Nov. 1. Leading zeroes would fix this.
- Sat Jan 08, 2022 5:57 pm
- Forum: General
- Topic: How to go about daily random numbers
- Replies: 27
- Views: 12754
Re: How to go about daily random numbers
The year is was missing in the second one.
- Sat Jan 08, 2022 5:15 pm
- Forum: General
- Topic: How to go about daily random numbers
- Replies: 27
- Views: 12754
Re: How to go about daily random numbers
One quick idea to generate a "random" number based on the current date: local d = os.date('!*t') -- get utc date local hash = love.data.encode('string', 'hex', love.data.hash('sha1', d.day .. d.month .. d.year)) local rand = tonumber(hash:sub(1, 16), 16) It's not really random, because you...
- Sat Jan 08, 2022 1:53 am
- Forum: Support and Development
- Topic: Problems when using world callbacks[Solved]
- Replies: 12
- Views: 3407
Re: Problems when using world callbacks
Oops, fixed.
- Sat Jan 08, 2022 12:28 am
- Forum: Support and Development
- Topic: Problems when using world callbacks[Solved]
- Replies: 12
- Views: 3407
Re: Problems when using world callbacks
Code: Select all
-- not correct
world:setCallbacks(player.beginContact)
-- correct
world:setCallbacks(function(a, b, c) player:beginContact(a, b, c) end)
- Fri Jan 07, 2022 1:17 am
- Forum: Support and Development
- Topic: Strange bug trying to automate executable packaging [solved]
- Replies: 17
- Views: 4935
Re: Strange bug trying to automate executable packaging [solved]
Fusing your game to a Windows executable is not a security measure. There is no practical difference between a love file and a fused .exe file. It is a super thin layer of obscurity that will only fool people who know less than you do. Don't rely on it for security.
- Fri Jan 07, 2022 12:39 am
- Forum: Support and Development
- Topic: Strange bug trying to automate executable packaging [solved]
- Replies: 17
- Views: 4935
Re: Strange bug trying to automate executable packaging
Besides that: what a view on the concept of open source, posted in a forum providing free support for a software released under a very permissible open source license. All those people who are infinitely smarter than me but are still eager to steal my code and can't extract a zip file. I want to mee...