But after restarting Zerobrane Studio color scheme stays the same, nothing changed. How to chage it? (ultimately I want it to be the same as in Gideros, did anybody tune a Zerobrane theme to be Gideros-like? )
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Guys is it better (perfomance-wise) to always add event listeners or call functions directly from enterFrame? (I've seen somewhere that it's better to avoid event listeners whenever we can, is it true?) Or some other method is better? Variant #1 without dispatcher:
clicksCounter=0
isWindowShown=falsefunction onMouseDownFunc(event)
clicksCounter+=1--if clicksCounter ==10 then showAchievementWindow() --it could be here, but in more complex apps I'd need to watch the variable 'clicksCounter' every frame--and counter could be changed not only after MouseDown, but after other actionsend
stage:addEventListener(Event.MOUSE_DOWN, onMouseDownFunc)--achievement window function should be called only once:function showAchievementWindow()ifnot isWindowShown thenprint("now achievement window has to be shown!")
isWindowShown=trueendendfunction onEnterFrameFunc()if clicksCounter ==10then
showAchievementWindow()endend
stage:addEventListener(Event.ENTER_FRAME, onEnterFrameFunc)
Variant #2 using event dispatcher:
clicksCounter=0function onMouseDownFunc(event)
clicksCounter+=1end
stage:addEventListener(Event.MOUSE_DOWN, onMouseDownFunc)
myDispatcher = EventDispatcher.new()function showAchievementWindow2()print("now achievement window has to be shown!")
myDispatcher:removeEventListener("tenClicksDone", showAchievementWindow2)end
myDispatcher:addEventListener("tenClicksDone", showAchievementWindow2)
stage:addEventListener(Event.ENTER_FRAME, function()if clicksCounter ==10then
myDispatcher:dispatchEvent(Event.new("tenClicksDone"))endend)
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
The built-in event listeners are fine. This is the problem:
myDispatcher = EventDispatcher.new()
If used rarely it's fine, but if you use it every frame, or in loops, it can slow things down a lot. I made a callback system, CallbackBroadcaster, that works in the same way, but is much more efficient.
I use the event listeners like an interrupt system in the old days - so for mouse, controller input, timers and vblank (enter frame) I use an event listener. I also use them to add the game overlay system so that the game can work independently of menus, high score tables, etc... That's all really.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
@SinisterSoft when do we need to include "64bits libs" in our apk? I don't get what is their purpose? Should we include 64bits libs to every app?
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
@Apollo14, basically you should always do it for performance reasons, and also because it will soion become mandatory for play store. However it will double the size of gideros core (twice as much libraries), and there can still be a few thirs party libraries (ads providers, etc) not yet compatible, that's why it is still disabled by default.
I strongly encourage everyone to have a try at 64bit before google enforces it, to be sure your apps actually work ok in 64 bit.
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
main.lua:6: module 'ads'not found:
no field package.preload['ads']
no file './ads.lua'
no file './ads/init.lua'
no file './_LuaPlugins_/ads.lua'
no file './_LuaPlugins_/ads/init.lua'
no file '/usr/local/share/lua/5.1/ads.lua'
no file '/usr/local/share/lua/5.1/ads/init.lua'
no file '/usr/local/lib/lua/5.1/ads.lua'
no file '/usr/local/lib/lua/5.1/ads/init.lua'
no file './ads.so'
no file '/usr/local/lib/lua/5.1/ads.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
main.lua:6: in main chunk
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Without looking at the lua source code, I think lua converts the key name to a hash then searches for it, it could be that the hashes are sorted in some way and that the order of key pairs is revealed in order of the hashes ?
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Guys how does Core.yield(false) work? Can you provide a basic example? I just don't get it, in what situations it may be needed? Parameters 'true' and [number of seconds to wait] are pretty much self-explanatory
function testFunc1()for i=1,5do
Core.yield(1)print(i.." seconds passed")endend
Core.asyncCall(testFunc1)
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
The dafult behavior of 'fakethreads' is to autoyield, that is gideros will check periodically if there is some time left in the frame for the thread, and if not an automatic yield is performed.
Calling Core.yield(true) disable autoyield, and makes sure the thread is further executed without interruption until it calls Core.yield(true/number) again. To go back to autoyielding mode, you need to call Core.yield(false)
Guys I was going to create an Idle economic game. It seems there have to be LOTS of counters, multipliers, boosts, etc. And they have to be used extremely frequently, probably most of them every frame. Perfomance-wise what is better: to keep them all in one table, or in separate vars?
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
But if you have loads then it might be easier to code in a table - you could have a table of incrementers that increments a table of variables - you could then iterate through them - even make new ones up live.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
I'd say the first variant: a single table, doesn't matter its size and nested tables, should count as a single variable and it's easy to save. Then you can go local to operate/process entries, and save the result back to the table.
Guys why GTween onComplete doesn't work in my case? GTween animation runs normally, but it doesn't call onTweenComplete function update:uh, I had to add 'tween1.dispatchEvents=true'
function onTweencomplete()print("tween completed")-- it doesn't printendlocal tween1 = GTween.new(picsArr[1], 0.5, {x = -600}, {delay =0, ease = easing.linear, onComplete=onTweencomplete})
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Guys, what way is optimal to play random sound every 20-30 seconds?
Is it a good practice to create infinite recursive functions or they should be avoided? (app is intened to be active for long periods of time, memory leaks are extremely undesired)
function randRecursive()local timerDelayed = Timer.delayedCall(math.random(20000,30000), function()local randVoice = Sound.new("sounds/voice"..math.random(1,17)..".mp3")
randVoice:play()
randVoice=nil--should we make it nil for better garbage collection?
randRecursive()--lol:)end)end
randRecursive()
Another variant:
function atRandomPeriod()for i=1,9000do
Core.yield(math.random(20,30))local randVoice = Sound.new("sounds/voice"..math.random(1,17)..".mp3")
randVoice:play()
randVoice=nilendend
Core.asyncCall(atRandomPeriod)
Or something else maybe?
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
First variant should be ok since your callback doesn’t use up values from the calling function, so no memory issue here. It isn’t even recursive since it is called in an event handler. But second variant is easier to understand imho.
Guys how to properly break async loops? For some reason my trigger doesn't work:
local allowPulse=truelocalfunction pulse(obj,trigger)local i=0while trigger==truedo
obj:setAlpha((math.sin(i))^2)
i+=0.04
Core.yield(true)endend
Core.asyncCall(pulse,mySprite,allowPulse)--I'm trying to stop loop after 3000ms:local timerDelayed = Timer.delayedCall(3000, function() allowPulse=falseend)--Trigger is switched to false, but loop doesn't stop!
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
i think it sends only the value and not a pointer to your var, so it is always true if it's true at the beginning. you could e.g. change "while trigger==true do" to "while allowPulse==true do" and it should work i think. otherwise, to send a pointer instead of the value, somebody else should be able to help.
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Comments
I've opened their file 'cfg/scheme-picker.lua', changed:
How to chage it?
(ultimately I want it to be the same as in Gideros, did anybody tune a Zerobrane theme to be Gideros-like? )
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Guys how to perform certain action after sound completed?
it doesn't work for me:
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
(I've seen somewhere that it's better to avoid event listeners whenever we can, is it true?)
Or some other method is better?
Variant #1 without dispatcher:
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: Apollo14
Likes: Apollo14
https://deluxepixel.com
Should we include 64bits libs to every app?
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
I strongly encourage everyone to have a try at 64bit before google enforces it, to be sure your apps actually work ok in 64 bit.
Likes: totebo, antix, Apollo14, SinisterSoft
I feel like my code is nowhere near to an optimal solution
Is there something else better?
First i thought it would work like that:
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: Apollo14, MoKaLux
https://deluxepixel.com
in my main.lua I added Google's test key:
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: SinisterSoft
Likes: antix, Apollo14
https://deluxepixel.com
Uploading finished. someKey4 valueAssigned --why 4 is first? someKey1 valueAssigned someKey5 valueAssigned someKey3 valueAssigned someKey2 valueAssigned
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: Apollo14
Likes: Apollo14
https://deluxepixel.com
Can you provide a basic example? I just don't get it, in what situations it may be needed?
Parameters 'true' and [number of seconds to wait] are pretty much self-explanatory
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Calling Core.yield(true) disable autoyield, and makes sure the thread is further executed without interruption until it calls Core.yield(true/number) again.
To go back to autoyielding mode, you need to call Core.yield(false)
Likes: Apollo14, SinisterSoft
It seems there have to be LOTS of counters, multipliers, boosts, etc.
And they have to be used extremely frequently, probably most of them every frame.
Perfomance-wise what is better: to keep them all in one table, or in separate vars?
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: Apollo14
https://deluxepixel.com
Likes: Apollo14
https://deluxepixel.com
Likes: Apollo14
a single table, doesn't matter its size and nested tables, should count as a single variable and it's easy to save.
Then you can go local to operate/process entries, and save the result back to the table.
Likes: antix, Apollo14
update:uh, I had to add 'tween1.dispatchEvents=true'
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: Apollo14
Is it a good practice to create infinite recursive functions or they should be avoided? (app is intened to be active for long periods of time, memory leaks are extremely undesired)
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: Apollo14
For some reason my trigger doesn't work:
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
to "while allowPulse==true do" and it should work i think.
otherwise, to send a pointer instead of the value, somebody else should be able to help.
Likes: Apollo14
Fragmenter - animated loop machine and IKONOMIKON - the memory game
I've decided to create a table with triggers (though I'm not sure if it is an optimal way):
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)