Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Quick questions about Gideros&Lua - Page 9 — Gideros Forum

Quick questions about Gideros&Lua

1679111214

Comments

  • hgy29hgy29 Maintainer
    Google play service plugin isn’t up to date. I think it needs 7.8 or lower. Use gaming plugin instead

    Likes: Apollo14

    +1 -1 (+1 / -0 )Share on Facebook
  • SinisterSoftSinisterSoft Maintainer
    Make sure you have changed the number for all the plugins that need it - you may have missed one.

    Likes: Apollo14

    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
    +1 -1 (+1 / -0 )Share on Facebook
  • antixantix Member
    I've been using 9.2.0 for play services.. try that

    Likes: Apollo14

    +1 -1 (+1 / -0 )Share on Facebook
  • hgy29 said:

    Google play service plugin isn’t up to date. I think it needs 7.8 or lower. Use gaming plugin instead

    I've tried 'Gaming' plugin instead (11.0.4), now player is exported and it works, thx!.
    > 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)
    +1 -1 (+2 / -0 )Share on Facebook
  • Apollo14Apollo14 Member
    edited July 2018
    Guys why doesn't Profiler print my results? I've tried to follow code of @SinisterSoft in the article about Rad operator vs math.rad function.
    In my console I just get:
    Number of tests:	10000000
    While I'm expecting something like that:
    Number of tests: 10000000
    keepInRange1 11.387515123518
    keepInRange2 9.3995061483975
    keepInRange3 9.056655447766
    I've created empty project, all I have in my 'main.lua':
    maxIterations@1000000
    local randomSeed,random=Core.randomSeed,Core.random
    randomSeed(1,1)
     
     
    function keepInRange1()
    	randomSeed(1,1); local tempStorage,tempNum=0,5
    	for i=1,maxIterations do
    		tempNum=random(0,-100,100)
    		tempStorage=math.min(math.max(1, tempNum), 10)
    	end
    end
     
     
    function keepInRange2()
    	randomSeed(1,1); local tempStorage,tempNum=0,5
    	for i=1,maxIterations do
    		tempNum=random(0,-100,100)
    		if tempNum < 1 then tempStorage=1
    		elseif tempNum > 10 then tempStorage=10
    		else tempStorage=tempNum end
    	end
    end
     
     
    function keepInRange3()
    	randomSeed(1,1); local tempStorage,tempNum=0,5
    	for i=1,maxIterations do
    		tempNum=random(0,-100,100)
    		tempStorage=10><(1<>tempNum)
    	end
    end
     
    Core.profilerReset()
    Core.profilerStart()
    for loop=1,10 do
    	keepInRange1()
    	keepInRange2()
    	keepInRange3()
    end
    Core.profilerStop()
     
    -- print the results of the profiler
    result=Core.profilerReport()
    print("Number of tests:",maxIterations*10)
     
    for k,v in pairs(result) do
    	local found=false
     
    	for k2,v2 in pairs(v) do
    		if found and k2=="time" then print(v1,v2) end
    		if k2=="name" and string.sub(v2,1,4)=="test" then v1=v2 found=true end
    	end
    end
    > 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)
  • hgy29hgy29 Maintainer
    This is because in @Sinistersoft example, the functions under test were called 'testXXX', and he filtered out non matching functions when showing the results. change "test" to "keep" in the last inner loop test

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
  • SinisterSoftSinisterSoft Maintainer
    Yes, I perhaps should have explained that a bit more in the blog post.

    If anyone else wants to write some blog posts to help others then please get in touch and I'll add access for you. :)
    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
  • SinisterSoftSinisterSoft Maintainer
    @Apollo14 Can you post the results here, I'd be curious for the results.
    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
  • Apollo14Apollo14 Member
    edited July 2018
    hgy29 said:

    This is because in @Sinistersoft example, the functions under test were called 'testXXX', and he filtered out non matching functions when showing the results. change "test" to "keep" in the last inner loop test

    Wow, now it works, THX!

    If anyone else wants to write some blog posts to help others then please get in touch and I'll add access for you. :)

    I'd love to contribute to blog, pls add me to it, my google acc: https://plus.google.com/109522810093247090916

    P. S. It seems that we should avoid standard math library at all costs. It's almost 3x slower, although code may look cute, compared to other variants.
    tempStorage=math.min(math.max(minRange, tempNum), maxRange)
    Probably it would be good to add macro operators to replace slow math.sin/math.cos/math.sqrt? (or they can be replaced already?)

    Also in some Lua tutorials it is said that localizing math library is helpful, but it didn't make significant difference in this case (neither localizing math. inside function or loop (keepInRange4,keepInRange5), nor localizing it in the beginning of a 'main.lua' file)
    Number of tests:	10000000
    keepInRange1	10.318172679762
    keepInRange2	3.4653780657264
    keepInRange3	3.3482103390496
    keepInRange4	9.9247725611831
    keepInRange5	10.399366280858
    function keepInRange1()
    	randomSeed(1,1); local tempStorage,tempNum=0,5
    	for i=1,maxIterations do
    		tempNum=random(0,-100,100)
    		tempStorage=math.min(math.max(1, tempNum), 10)
    	end
    end
     
     
    function keepInRange2()
    	randomSeed(1,1); local tempStorage,tempNum=0,5
    	for i=1,maxIterations do
    		tempNum=random(0,-100,100)
    		if tempNum < 1 then tempStorage=1
    		elseif tempNum > 10 then tempStorage=10
    		else tempStorage=tempNum end
    	end
    end
     
     
    function keepInRange3()
    	randomSeed(1,1); local tempStorage,tempNum=0,5
    	for i=1,maxIterations do
    		tempNum=random(0,-100,100)
    		tempStorage=10><(1<>tempNum)
    	end
    end
     
    function keepInRange4()
    	randomSeed(1,1); local tempStorage,tempNum=0,5
    	local mathMin,mathMax=math.min,math.max
    	for i=1,maxIterations do
    		tempNum=random(0,-100,100)
    		tempStorage=mathMin(mathMax(1, tempNum), 10)
    	end
    end
     
    function keepInRange5()
    	randomSeed(1,1); local tempStorage,tempNum=0,5
    	for i=1,maxIterations do
    		local mathMin,mathMax=math.min,math.max
    		tempNum=random(0,-100,100)
    		tempStorage=mathMin(mathMax(1, tempNum), 10)
    	end
    end

    Likes: SinisterSoft

    > 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)
    +1 -1 (+1 / -0 )Share on Facebook
  • SinisterSoftSinisterSoft Maintainer
    @Apollo14 I need an email address to add you to blogger, you can pm me it if you want.
    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
  • SinisterSoftSinisterSoft Maintainer
    I also updated my code - for some reason I used random number generator 1, when they actually start from 0. There isn't a selection yet so I don't think it matters. I re-ran and had the same results.
    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
  • olegoleg Member
    edited August 2018
    guys, help find the cause of the error
    in the previous version of gideros there is no such error
    :app:incrementalReleaseJavaCompilationSafeguard
    :app:compileReleaseJavaWithJavac
    :app:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
    :app:compileReleaseJavaWithJavac FAILED
     
    BUILD FAILED
     
    Total time: 22.832 secs
    C:\212121\mimimi Cat\1\mimimi Cat\tmp\app\src\main\java\com\giderosmobile\android\plugins\ads\frameworks\AdsAdmob.java:432: error: method does not override or implement a method from a supertype
    <a href="https://forum.giderosmobile.com/profile/Override" rel="nofollow">@Override</a>
    ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    1 error
     
    FAILURE: Build failed with an exception.
     
    * What went wrong:
    Execution failed for task ':app:compileReleaseJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.
     
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    Exec returned: 1
    Export failed! See details above.
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
  • olegoleg Member
    Gideros 2018.6.2 there is no mistake

    Gideros 2018.6.3 -error ads plugin
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
  • hgy29hgy29 Maintainer
    edited August 2018
    Seems like your AdsAdmob.java file is corrupted around line 432. Just checked, it is fine here with 2018.6.3

    EDIT: Looking closer at the error log you have, you are using an outdated version of admob libs
  • olegoleg Member
    @hgy29 "EDIT: Looking closer at the error log you have, you are using an outdated version of admob libs"

    admob libs are not updated with gideros?

    how to update them?
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
  • hgy29hgy29 Maintainer
    Specify a higher 'google service' version in the plugin's settings. @SinisterSoft will know better than me.
  • olegoleg Member
    edited August 2018
    hgy29 said:

    Specify a higher 'google service' version in the plugin's settings. @SinisterSoft will know better than me.

    I have a version 11.0.4 to the greater is not updated

    @SinisterSoft
    How did you upgrade to 12.0.1?



    edit:
    Apollo14 said:

    hgy29 said:

    Google play service plugin isn’t up to date. I think it needs 7.8 or lower. Use gaming plugin instead

    I've tried 'Gaming' plugin instead (11.0.4), now player is exported and it works, thx!.
    crutch...

    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
  • I use Google Play Services 12.0.1 with Admob on Android. I had to alter the Admob plugin slightly for it to work. See this (resolved) issue:

    https://github.com/gideros/gideros/issues/394

    I guess this will go out in the next Gideros version.

    Likes: oleg

    My Gideros games: www.totebo.com
    +1 -1 (+1 / -0 )Share on Facebook
  • @SinisterSoft @hgy29 does Luasocket work for html5 exported apps? (if we need to connect to NoobHub server)
    > 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)
  • hgy29hgy29 Maintainer
    yes and no, it works in that the plugin is available, but you can't do UDP nor TCP in html5, so UDP is just not supported and TCP maps to websocket with luasocket. Basically forget luasocket for HTML5 except if you know your server is websocket capable.

    Likes: Apollo14

    +1 -1 (+1 / -0 )Share on Facebook
  • hgy29 said:

    yes and no, it works in that the plugin is available, but you can't do UDP nor TCP in html5, so UDP is just not supported and TCP maps to websocket with luasocket. Basically forget luasocket for HTML5 except if you know your server is websocket capable.

    So instead of TCP-based Noobhub server we'll need some websocket-based server?
    (like this one? https://github.com/lance-gg/lance )

    Or there's built-in functionality in Facebook API for basic PVP multiplayer?
    > 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)
  • or probably this server is suitable?
    https://github.com/gamestdio/colyseus
    (it already supports html5 Defold and Construct)
    > 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)
  • hgy29hgy29 Maintainer
    Seems to be suitable, yes
  • olegoleg Member
    totebo said:

    I use Google Play Services 12.0.1 with Admob on Android. I had to alter the Admob plugin slightly for it to work. See this (resolved) issue:

    https://github.com/gideros/gideros/issues/394

    I guess this will go out in the next Gideros version.

    how did you upgrade your libraries to 12.0.1 ??

    my android studio updates only to 11.0.4
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
  • Oh really? I upgraded it like normal, with the built in upgrade tool, to the latest release.
    My Gideros games: www.totebo.com
  • olegoleg Member
    totebo said:

    Oh really? I upgraded it like normal, with the built in upgrade tool, to the latest release.

    I updated everything yesterday and I have a version 11.0.4 - maximum
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
  • Has the LuaSocket plugn changed recently? I had NoobHub working with a login/chat system and it worked just fine with TCP/IP.
  • antix said:

    Has the LuaSocket plugn changed recently? I had NoobHub working with a login/chat system and it worked just fine with TCP/IP.

    I'm testing NoobHub, everything works fine.
    (I've connected to @Overtorment 's test VPS, didn't setup my own server yet)
    > 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)
  • @oleg Sorry I didn't reply earlier, I've been on holiday for a few days.

    Google changed the location where the files for google play were grabbed from. You may have an old version of the gradle build file, look at this:

    C:\Program Files (x86)\Gideros\Templates\AndroidStudio\Android Template\app

    You will see a build.gradle file, edit it (it's a text file) and it should have this section:
    repositories {
    	maven {
    		url "<a href="https://maven.google.com" rel="nofollow">https://maven.google.com</a>"
    	}
       flatDir {
           dirs 'libs'
       }
    }
    That says where the new repository is that google wants (in order to find 12.0.1, etc).

    If you don't have that then try downloading and installing 2018.6.3 again as I remember for a few hours there was a version available without that fix (it also showed as 2018.6.3).

    Be careful as there is also a build.gradle file in C:\Program Files (x86)\Gideros\Templates\AndroidStudio\Android Template so don't change that one.

    Likes: Apollo14

    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
    +1 -1 (+1 / -0 )Share on Facebook
  • @oleg Sorry I didn't reply earlier, I've been on holiday for a few days.

    Google changed the location where the files for google play were grabbed from. You may have an old version of the gradle build file, look at this:

    C:\Program Files (x86)\Gideros\Templates\AndroidStudio\Android Template\app

    You will see a build.gradle file, edit it (it's a text file) and it should have this section:
    repositories {
    	maven {
    		url "<a href="https://maven.google.com" rel="nofollow">https://maven.google.com</a>"
    	}
       flatDir {
           dirs 'libs'
       }
    }
    That says where the new repository is that google wants (in order to find 12.0.1, etc).

    If you don't have that then try downloading and installing 2018.6.3 again as I remember for a few hours there was a version available without that fix (it also showed as 2018.6.3).

    Be careful as there is also a build.gradle file in C:\Program Files (x86)\Gideros\Templates\AndroidStudio\Android Template so don't edit that one.

    Likes: oleg

    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
    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.