Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Gideros 2016.10 released! - Page 3 — Gideros Forum

Gideros 2016.10 released!

13

Comments

  • @mertocan Let us know how you get on compiling Gideros.

    Likes: pie

    +1 -1 (+1 / -0 )Share on Facebook
  • May be there is a sense to remove this thread from announcement?

    Likes: antix

    +1 -1 (+1 / -0 )Share on Facebook
  • HubertRonaldHubertRonald Member
    edited April 2017

    Unfortunately the solution is to reinstall Sierra!
    Hi @john26 I tried the above but still I've got some problems in Android Studio
    Edit: I'm using Gideros 2017.3.1

    my init.lua has the next:
    local device,b,c,d,e = application:getDeviceInfo()
    print("\ninit line 227: \ninfo Device: \n -"..device.." \n -"..tostring(b).." \n -"..tostring(c).." \n -"..tostring(d).." \n -"..tostring(e))
     
    local isPluginAvailable, err = pcall(function() require 'gaming' end)
    if isPluginAvailable then require 'gaming' end
     
    print(	"\ninit line 231: \n -".."isPlugiAvailable ".."gaming"..": "..tostring(isPluginAvailable),
    		"\n\n -errorPlugin: "..tostring(err),
    		"\n\n -Plugin.So: "..tostring(gaming)
    	)
    print("\n")
    Running the above (for different plugins) in Android Studio (Emulator and device) I've got this (summary):
    image

    My folder structure looks like,
    |--app: 
    |--|--src: 
    |--|--|--main 
    |--|--|--|--jniLibs 
     
    |--|--|--|--|--armeabi 
    |--|--|--|--|--|--libads.so
    |--|--|--|--|--|--libbitop.so
    |--|--|--|--|--|--libfacebook.so
    |--|--|--|--|--|--libflurry.so
    |--|--|--|--|--|--libgaming.so
    |--|--|--|--|--|--libgideros.so
    |--|--|--|--|--|--libgooglelicensing.so
    |--|--|--|--|--|--libgoogleplay.so
    |--|--|--|--|--|--libgvfs.so
    |--|--|--|--|--|--libjson.so
    |--|--|--|--|--|--liblfs.so
    |--|--|--|--|--|--liblsqlite3.so
    |--|--|--|--|--|--liblua.so
    |--|--|--|--|--|--libluasocket.so
     
    |--|--|--|--|--armeabi-v7a 
    |--|--|--|--|--|--libads.so
    |--|--|--|--|--|--libbitop.so
    |--|--|--|--|--|--libfacebook.so
    |--|--|--|--|--|--libflurry.so
    |--|--|--|--|--|--libgaming.so
    |--|--|--|--|--|--libgideros.so
    |--|--|--|--|--|--libgooglelicensing.so
    |--|--|--|--|--|--libgoogleplay.so
    |--|--|--|--|--|--libgvfs.so
    |--|--|--|--|--|--libjson.so
    |--|--|--|--|--|--liblfs.so
    |--|--|--|--|--|--liblsqlite3.so
    |--|--|--|--|--|--liblua.so
    |--|--|--|--|--|--libluasocket.so
     
    |--|--|--|--|--x86 
    |--|--|--|--|--|--libads.so
    |--|--|--|--|--|--libbitop.so
    |--|--|--|--|--|--libfacebook.so
    |--|--|--|--|--|--libflurry.so
    |--|--|--|--|--|--libgaming.so
    |--|--|--|--|--|--libgideros.so
    |--|--|--|--|--|--libgooglelicensing.so
    |--|--|--|--|--|--libgoogleplay.so
    |--|--|--|--|--|--libgvfs.so
    |--|--|--|--|--|--libjson.so
    |--|--|--|--|--|--liblfs.so
    |--|--|--|--|--|--liblsqlite3.so
    |--|--|--|--|--|--liblua.so
    |--|--|--|--|--|--libluasocket.so
     
    and so on
    So ads plugin and gaming plugin crash because are true (isPluginAvailable) but modules are "nil"

    any suggestion @john, @hgy29 or sombody
    Thanks

    P.D. my application running (Android Emulator and device) if I block ads plugin and gaming plugin

    I forgotten gideros doesn't construct apk file neither install it on my android device. Also when I export full project (I did verify and configurated in all plugins that I needed in gideros console) for android studio (no old version) myAppActivy.java, manifest.xml, string and app gradle aren't configurated default in android studio so I did it manually.
    summaryBugs.png
    955 x 280 - 42K
  • hgy29hgy29 Maintainer
    @HubertRonald,

    Ads and Gaming plugins have multiple backends, hence you have to create the correct instance yourself: ads=Ads.new("backend")
  • HubertRonaldHubertRonald Member
    edited April 2017
    @HubertRonald,

    Ads and Gaming plugins have multiple backends, hence you have to create the correct instance yourself: ads=Ads.new("backend")
    @hygy29 It's correct but the issue is in "Ads" is "nil" also "Gaming" is "nil" though
    .
    local isAdsAvailable = pcall(function() require 'ads' end)
    local isGamingAvailable = pcall(function() require 'gaming' end)
    print (isAdsAvailable,isGamingAvailable )
    -- you get true and true respectively (Android Studio)
    This a big problem because app always goes to crash because in Android Studio or Emulator
    .
    if isAdsAvailable then require 'ads' end -- isAdsAvailable is true
    if isGamingAvailable then require 'gaming' end -- isGamingAvailable is true
    --[[
    you get the next:
    Ads equal to "nil"
    Gaming equal to "ni"
    ]]
    Hence the system said to you hey!! libgaming.so and libads.so are "available" but both -Ads and Gaming- are "nil"

  • HubertRonaldHubertRonald Member
    edited April 2017
    Ah! also "error" (when you use pcall) is "nil" in facebook, flurry, Ads, googlelicensing and Gaming- I suppose that mean there isn't error or maybe I'm losing something, I don't know
  • hgy29hgy29 Maintainer
    Yes, that would mean there is no error actually. Maybe I was mislead because in the code you posted you were printing 'gaming', while you should have printed 'Gaming'. Can you double check ?
  • HubertRonaldHubertRonald Member
    edited April 2017
    Yes @hgy29 you're right! :)

    But in Android Studio Build / Analyze Apk I see
    System.loadLibrary("gaming") --It's in proyect --in Gideros Code I use global var. Gaming
    System.loadLibrary("ads") --It's in proyect --in Gideros Code I use global var. Ads
    System.loadLibrary("facebook") --It's in proyect
    System.loadLibrary("flurry") --It's in proyect
    System.loadLibrary("googlelicensing") --It's in proyect
    System.loadLibrary("googleplay") --It's in proyect
    For that reason "pcall" does not catch any error in Android Studio
    So I checked files android.mk for review its paths and so I moved gideros studio to:
    /Applications/Gideros\ Studio/
    Also install in android Studio the next
    Add C and C++ Code to Your Project --though it is not strictly necessary

    Well, with these new winds my problem inicial persistent
    for example:
    facebook: attempt to call method 'setAppId' (a nil value) -- no error with "pcall" and facebook is true
    Gaming: attempt to index field 'gaming' (a nil value) -- no error with "pcall" and Gaming is true
    flurry: index '__userdata' cannot be found -- no error with "pcall" and Gaming is true
    So i don't know what be able to happen, well 'Ads', 'googlelicensing' and 'googleplay' don't crash, Although, I suppose this is because they should be tested in alpha or beta version in "google play console"

    Any new ideas are welcome :)
  • HubertRonaldHubertRonald Member
    edited April 2017
    Hi again :)

    As plugins.so are tables, I used this script (thx @ar2rsawseen) in Gaming (global variable)
    function printR (t, indent, done)
      done = done or {}
      indent = indent or ''
      local nextIndent -- Storage for next indentation value
      for key, value in pairs (t) do
        if type (value) == "table" and not done [value] then
          nextIndent = nextIndent or
              (indent .. string.rep(' ',string.len(tostring (key))+2))
              -- Shortcut conditional allocation
          done [value] = true
          print (indent .. "[" .. tostring (key) .. "] => Table {");
          print  (nextIndent .. "{");
          printR (value, nextIndent .. string.rep(' ',2), done)
          print  (nextIndent .. "}");
        else
          print  (indent .. "[" .. tostring (key) .. "] => " .. tostring (value).."")
        end
      end
    end
    and after (in Android Studio)
    Running-> print(Gaming): table: 0x936911ac
    Running-> printR(Gaming): I've got this:
    [deleteState] => function: 0x9369151c
    [loadAchievements] => function: 0x93691370
    [loadScores] => function: 0x936913b0
    [REVEALED] => 1
    [__gc] => function: 0x936911f0
    [incrementAchievement] => function: 0x936912ec
    [login] => function: 0x93691208
    [showLeaderboard] => function: 0x93691244
    [HIDDEN] => 2
    [__index] => Table {
             {
               [deleteState] => function: 0x9369151c
               [loadAchievements] => function: 0x93691370
               [loadScores] => function: 0x936913b0
               [REVEALED] => 1
               [__gc] => function: 0x936911f0
               [incrementAchievement] => function: 0x936912ec
               [login] => function: 0x93691208
               [showLeaderboard] => function: 0x93691244
               [HIDDEN] => 2
               [__index] => table: 0x936911ac
               [new] => function: 0x936911d0
               [__basename] => EventDispatcher
               [showAchievements] => function: 0x936913d0
               [UNLOCKED] => 0
               [ALL_PLAYERS] => 1
               [FRIENDS] => 0
               [logout] => function: 0x936912b8
               [ALL_TIME] => 2
               [WEEK] => 1
               [TODAY] => 0
               [__classname] => Gaming
               [loadState] => function: 0x93691470
               [reportAchievement] => function: 0x93691410
               [updateState] => function: 0x936914a8
               [resolveState] => function: 0x936914e0
               [revealAchievement] => function: 0x93691330
               [reportScore] => function: 0x93691280
             }
    [new] => function: 0x936911d0
    [__basename] => EventDispatcher
    [showAchievements] => function: 0x936913d0
    [UNLOCKED] => 0
    [ALL_PLAYERS] => 1
    [FRIENDS] => 0
    [logout] => function: 0x936912b8
    [ALL_TIME] => 2
    [WEEK] => 1
    [TODAY] => 0
    [__classname] => Gaming
    [loadState] => function: 0x93691470
    [reportAchievement] => function: 0x93691410
    [updateState] => function: 0x936914a8
    [resolveState] => function: 0x936914e0
    [revealAchievement] => function: 0x93691330
    [reportScore] => function: 0x93691280
    so "attempt to index field 'gaming' (a nil value)"
    maybe i'm trying to index a nil value, but in previous report you can see that is all there

    Again... Any new ideas are welcome :)
  • I use something like this and it works fine:
    pcall(function() require "gaming" end)
    if Gaming then
    	if android then
    		if kindle then
    			gaming=Gaming.new("gamecircle")
    		else
    			gaming=Gaming.new("googleplay")
    		end
    	elseif ios then
    		gaming=Gaming.new("gamekit")
    	end
    	if gaming then
    		gaming:addEventListener(Event.LOGIN_COMPLETE,function()
    			print("gaming LOGIN_COMPLETE")
    			login=true
    here is an example for iab:
    pcall(function() require "iab" end)
    if IAB then
    	if android then
    		if kindle then
    			iab=IAB.new("amazon")
    			iab:setProducts({adfree="adfree",orange="unlockorange",pink="unlockpink",yellow="unlockyellow"})
    		else
    			iab=IAB.new("google")
    			iab:setUp(googleLicence)
    			iab:setProducts({adfree="adfree",orange="unlockorange",pink="unlockpink",yellow="unlockyellow"})
    		end
    	elseif ios then
    		iab=IAB.new("ios")
    		iab:setProducts({adfree="adfree",orange="unlockorange",pink="unlockpink",yellow="unlockyellow"})
    	end
     
    	if iab then
    		--iab:setConsumable("orange","pink","yellow")
    		iab:addEventListener(Event.AVAILABLE,function(e)

    Likes: HubertRonald

    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
  • Another example for socket:
    pcall(function() require "socket" end)
    if socket then
    	mime=require("mime.core")
    end
    And json:
    pcall(function() require "json" end)
    .
    .
    .
    tactics={}
    if json then
    	local loop=1
    	while true do
    		local filename="tactics/"..loop..".txt"
    		if file_exists(filename) then
    			local file=io.open(filename,"r")
    			if file then
    				local originaldata=file:read()
    				if originaldata then
    					local t=json.decode(originaldata)
    					if t then

    Likes: HubertRonald

    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
  • SinisterSoftSinisterSoft Maintainer
    edited April 2017
    Here is an example of using pcall to send data to a server, just in case somehow the json messes up...
    if not pcall(function()serverlink:callMethod("updatePositions",json.encode(playerData),json.encode(shared)) end) then
    	print("Server can't send data: json incorrect!")
    end

    Likes: HubertRonald

    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
  • Hi @hgy29
    Some strange has happened... I saw the report crash in Android Studio
    FATAL EXCEPTION: GLThread 181
    Process: com.CompanyName.MyAppName, PID: 18691
    com.giderosmobile.android.player.LuaException: SocialMedia/Achievements.lua:279: attempt to index field 'gaming' (a nil value)
    I export.. assets only (two boxes checked) and the line 279 is a comment, I added more lines in White and the crash is in the same line (279)

    I'm really baffled because I don't get out of this mistake

    Any suggestion thanks

    Pd. Only I want to Clarify something, I've tested with and without upgrade gradle
  • Here is an example of pcall calling a function that has a reply, but you need to know if the call to the function failed and if it didn't then you need to know the reply from the function:
    local result,reply=pcall(Shader.new,shaderV,bloomF,Shader.FLAG_FROM_CODE,{
    	{name="vMatrix",type=Shader.CMATRIX,sys=Shader.SYS_WVP,vertex=true}, 
    	{name="fColor",type=Shader.CFLOAT4,sys=Shader.SYS_COLOR,vertex=false}, 
    	{name="fTexture",type=Shader.CTEXTURE,vertex=false},  }, 
    	{{name="vVertex",type=Shader.DFLOAT,mult=3,slot=0,offset=0}, 
    	{name="vColor",type=Shader.DUBYTE,mult=4,slot=1,offset=0}, 
    	{name="vTexCoord",type=Shader.DFLOAT,mult=2,slot=2,offset=0}, })
     
    if result then
    	bloomShader=reply
    else
    	print("bloom shader error:",reply)
    end

    Likes: HubertRonald

    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
  • SinisterSoftSinisterSoft Maintainer
    edited April 2017
    @HubertRonald re that error, look at the line just after/before 279.

    can you post a code snip, indicating the line number for each line.
    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
    edited April 2017
    Here is another pcall example to check if the new firebase plugin has been installedL
    pcall(function() require "firebase" end)
    if firebase then
    	print("firebase ok")
    else
    	print("firebase not installed")
    end
    Here is a check for flurry, I use a global called flurryId that I set at the start of my code with the ID that flurry give me for my game (the id is different per platform so I use the application:getDeviceInfo to check for the device and set the appropriate flurryId) :
    if flurryId then
    	pcall(function() require "flurry" end)
    	if flurry ~=nil and flurry.isAvailable() then
    		flurry.startSession(flurryId)
    	end
    end
    Here is a message routine to send to either/both of them that checks to see if they have been setup:
    function message(mess,param)
    	if firebase then
    		if param==nil then
    			firebase:analyticsEvent(mess)
    		else
    			firebase:analyticsEvent(mess,param)
    		end
    	end
    	if flurry and flurry.isAvailable() then
    		if param==nil then
    			flurry.logEvent(mess)
    		else
    			flurry.logEvent(mess,param)
    		end
    	end
    end
    .
    .
    .
    message("Game launched")

    Likes: HubertRonald

    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
  • HubertRonaldHubertRonald Member
    edited April 2017
    Hi @SinisterSoft thanks for your answer

    I have tried as you indicate in your codes (I like them), but still the crashes in Android Studio are maintained.

    Maybe there's something worth with my process from Gideros to Android Studio I'm new to this too.

    I'll keep trying if I find the fault.
  • @HubertRonald re that error, look at the line just after/before 279.

    can you post a code snip, indicating the line number for each line.
    ok
    line 84: local Achievements = Core.class(EventDispatcher)
    :
    :
    line 87: function Achievements:init(player)
    line 88:
    line 89: self:deployGaming()
    :
    :
    line 271: pcall(function() require "gaming" end)
    line 272: function Achievements:deployGaming()
    line 273: --ini conditions
    line 274: if Gaming then
    line 275: 
    line 276: self.gaming.isLoaded = false
    line 277:
    line 278: --print("googleplay GameServices")
    line 279: self.gameServices = Gaming.new("googleplay") --<<--- Here's where code crash
    line 280: 
    :
    :
    line 362: return Achievements
  • It looks like you call deployGaming before you require gaming?
    My Gideros games: www.totebo.com
  • hgy29hgy29 Maintainer
    edited April 2017
    It looks like your error
    com.giderosmobile.android.player.LuaException: SocialMedia/Achievements.lua:279: attempt to index field 'gaming' (a nil value)
    doesn't match your code, since there is no attempt to index 'gaming' here:
    line 279: self.gameServices = Gaming.new("googleplay") --<<--- Here's where code crash
    Are you sure the error you got wasn't from a previous version of your source code ?
  • @Hi Tobedo

    It's a Class Achievements.. it's like when create local math function (This is outside the class functions but it's available for each one of them)
    local MyClass = Core.class(Sprite)
    local rand = math.random
     
    function MyClass:inti()
        print(rand())
        delployGame()
        print(rand())
    end
     
    function MyClass:deployGame()
        print(rand())
    end
     
    Return MyClass
    or if you only need in deployGame
    local MyClass = Core.class(Sprite)
     
    function MyClass:inti()
        delployGame()
     
    end
     
    function MyClass:deployGame()
         local rand = math.random
         print(rand())
    end
     
    Return MyClass
    But as I said before

    Not only Gaming, but also other plugins... my problem inicial persistent
    facebook: attempt to call method 'setAppId' (a nil value) -- no error with "pcall" and facebook is true
    Gaming: attempt to index field 'gaming' (a nil value) -- no error with "pcall" and Gaming is true
    flurry: index '__userdata' cannot be found -- no error with "pcall" and Gaming is true

    So i don't know what be able to happen, well 'Ads', 'googlelicensing' and 'googleplay' don't crash, Although, I suppose this is because they should be tested in alpha or beta version in "google play console"


  • HubertRonaldHubertRonald Member
    edited April 2017
    It looks like your error
    com.giderosmobile.android.player.LuaException: SocialMedia/Achievements.lua:279: attempt to index field 'gaming' (a nil value)
    doesn't match your code, since there is no attempt to index 'gaming' here:
    line 279: self.gameServices = Gaming.new("googleplay") --<<--- Here's where code crash
    Are you sure the error you got wasn't from a previous version of your source code ?
    Hi @hgy29
    Yes! I modified the code with some suggestion of @SinisterSoft... so some line up and other down but the crash happened always in this line in the case Gaming
    with facebook and flurry too in its same line.

    so "attempt to index field 'gaming' (a nil value)"
    maybe i'm trying to index a nil value, but in previous report you can see (Running-> print(Gaming): table: 0x936911ac) that is all there

    Maybe there's something worth with my process from Gideros to Android Studio I'm new to this too.

    Errors is not isolated with Gaming this also applies to facebook and flurry.
  • hgy29hgy29 Maintainer
    Well, I don't know for flurry and Gaming (but I think @SinisterSoft can confirm it does work ok), but I use Facebook in my own app on both Android and iOS, with automatic plugin export, and everything works fine.

    Oh, I just checked, there is no setAppId() function in facebook plugin!!! :)
    +1 -1 (+2 / -0 )Share on Facebook
  • It's possibly the line before with you not putting something like this in your code...
    self.gaming={}
    before you use
    self.gaming.loaded=false


    Likes: HubertRonald

    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
  • I just tried this on line 5 in my program:
    gaming.loaded=true
    The next line with code on it was line 7

    The error was:
    main.lua:7: attempt to index global 'gaming' (a nil value)
    stack traceback:
    main.lua:7: in main chunk
    The error is that I didn't put
    gaming={}
    Before the
    gaming.loaded=true
    So that is the solution for you.

    Likes: HubertRonald

    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
  • You need to create a table before you start using it in Lua, Lua isn't really object oriented and having a var.whatever is really just an entry in a table pointed to by var called whatever. So create the table and your problem should be gone.

    Likes: HubertRonald

    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
  • Hi @hgy29 and @SinisterSoft thanks for your tips :) I'm going home to try them
    +1 -1 (+2 / -0 )Share on Facebook
  • HubertRonaldHubertRonald Member
    edited April 2017
    Thanks guys! ( @hgy29 and @SinisterSoft) I got it! :)

    @hgy29... How can I buy your "firebase" plugin?

    Cheers
  • @HubertRonald - so what was the solution? Had you missed out defining the table?
    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
  • HubertRonaldHubertRonald Member
    edited April 2017
    @HubertRonald - so what was the solution? Had you missed out defining the table?
    Yes @SinisterSoft I forgot completely that
    ---------------------------------
    sumamos.lua                           --|
    function sum(a,b) return a+b end      --| it's sumamos module
    ---------------------------------
     
    isAvailable, error = pcall(function() require 'sumamos' end)
     
    -- isAvailable = True
    -- error=nil (nothing)
     
    --So
    -- s={}
    s.x, s.y= 2 , 4
    print(sum(s.x, s.y))<----- crash because I don't define first s={}
    With respect Facebook plugin I use my own old class (2013) so currently there is no setAppId() as said @hgy29

    Edit: still this method -setAppId()- is here for iOS though it's deprecated.

    and flurry well I think use "firebase" plugin but first I wanted to be secure If I might export to android correctly

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.