Ttiki Posted September 24, 2020 Share Posted September 24, 2020 Hello. So, it's been around three to four days now I've been trying to publish my game as a standalone including only used file. I know it's a pretty basic function but the game is just a little demo. I already publish it here without include only used files, which made the game bigger in size. I manually deleted unwanted files that won't be useful to the game but I really don't want to always manually delete useless files and I'm sure it's not efficient. A lot of files aren't used but are still include. The problem is, whenever I publish a standalone game only including use files, the game crash the second it opens. When I went to see the log I saw it was because of an Assert problem: Quote Initializing Lua... Warning: Lua sandboxing disabled. Executing file "C:/Users/clement/Desktop/IntroTest/Scripts/Error.lua" Executing file "C:/Users/clement/Desktop/IntroTest/Scripts/Main.lua" Executing file "C:/Users/clement/Desktop/IntroTest/Scripts/Menu.lua" Initializing OpenGL graphics driver... OpenGL version 460 GLSL version 460 Device: GeForce GTX 660/PCIe/SSE2 Loading font "C:/WINDOWS/Fonts/Arial.ttf"... Loading shader "C:/Users/clement/Desktop/IntroTest/Shaders/Drawing/drawprimitive.shader"... Loading component "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/Panel.lua..." Executing file "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/Panel.lua" Loading texture "C:/Users/clement/Desktop/IntroTest/Materials/Resources/logo.tex"... Loading component "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/Button.lua..." Executing file "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/Button.lua" Deleting script "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/Button.lua" Loading component "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/Button.lua..." Executing file "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/Button.lua" Loading shader "C:/Users/clement/Desktop/IntroTest/Shaders/Drawing/drawimage.shader"... Loading shader "C:/Users/clement/Desktop/IntroTest/Shaders/Drawing/drawtext.shader"... Loading component "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/Tabber.lua..." Executing file "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/Tabber.lua" Loading component "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/Label.lua..." Executing file "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/Label.lua" Loading component "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/ChoiceBox.lua..." Executing file "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/ChoiceBox.lua" Loading component "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/TextField.lua..." Executing file "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/TextField.lua" Loading component "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/Slider.lua..." Executing file "C:/Users/clement/Desktop/IntroTest/Scripts/GUI/Slider.lua" Loading map "C:/Users/clement/Desktop/IntroTest/Maps/start.map"... Loading texture "C:/Users/clement/Desktop/IntroTest/Materials/Common/bfn.tex"... Loading component "C:/Users/clement/Desktop/IntroTest/scripts/intro.lua..." Executing file "C:/Users/clement/Desktop/IntroTest/scripts/intro.lua" Jostatu Animation beginning Looped 1 Loading texture "C:/Users/clement/Desktop/IntroTest/Materials/Resources/Startup/startup1.tex"... Error: Failed to load texture "C:/Users/clement/Desktop/IntroTest/Materials/Resources/Startup/startup1.tex" Loading shader "C:/Users/clement/Desktop/IntroTest/Shaders/Misc/occlusionquery.shader"... Loading shader "C:/Users/clement/Desktop/IntroTest/Shaders/Lighting/ambientlight.shader"... Loading texture "C:/Users/clement/Desktop/IntroTest/Materials/Resources/splash.tex"... Error: Assert failed. So I dig up inside the data.zip folder to see if the file was here, and in fact IntroTest/Materials/Resources/splash.tex was in the data.zip. The problem actually comes from IntroTest/Materials/Resources/Startup/startup1.tex. There wasn't any Startup folder. See the hierarchy of my files in the picture below to help you understand: I use this texture files for a splash screen. In the code I iterate through each frames with a Wait of 10ms between each frames using coroutines. You can find the code below. It's pretty basic and probably very bad, I wrote it a few months ago when I was re-learning Lua for a billionth times. --Intro start "video" screen. --Display Jostatu, Leadwerk logo. function Script:Start() menuenable = false alpha = 1 self.x = window:GetWidth() self.y = window:GetHeight() self.imgData = { pos = {x = 0, y = 0}, alpha = 0 } --Coroutine declaration self.intro = coroutine.create(Intro) end function Script:UpdateWorld() if coroutine.status(self.intro) ~= "dead" then coroutine.resume(self.intro, self) end end --This function will be called after the world is rendered, before the screen is refreshed. --Use this to perform any 2D drawing you want the entity to display. function Script:PostRender(context) context:SetBlendMode(Blend.Alpha) context:SetColor(Vec4(1, 1, 1, alpha)) if frametexture ~= Texture:Load("Materials/Resources/splash.tex") then context:DrawImage(frametexture, 0,0,self.x,self.y) else context:DrawImage(frametexture, self.x / 2 - 500,self.y / 2 - 200) --Align image to center (widnows width / height : 2 - widht / height of image : 2) end context:SetBlendMode(Blend.Solid) end -- helper function to wait x ms function Wait(ms) local time = Time:GetCurrent() while Time:GetCurrent() < time + ms do coroutine.yield() end end function FadeOut() for c = 1, 0, -0.01 do alpha = c Wait(10) end end function FadeIn() for c = 0, 1, 0.01 do alpha = c Wait(10) end end function Intro() --Jostatu intro video System:Print("Jostatu Animation beginning") [[--================================================================================================================= THIS IS WHERE THE FRAMES ARE ITERATING, AND TEXTURE ARE BEING LOADED WITH THE ACTUAL FRAME =================================================================================================================--]] local frame = "Materials/Resources/Startup/startup" for framenb = 1, 14 do System:Print("Looped "..framenb) frametexture = Texture:Load(frame..framenb..".tex") Wait(50) end System:Print("Jostatu animation done") Wait(1000) --First fadeout FadeOut() --Leadwerk splashscreen System:Print("Changing image to Leadwerk engine splash screen") frametexture=Texture:Load("Materials/Resources/splash.tex") --First fadein FadeIn() Wait(1500) --Last fadeout FadeOut() end In the editor the intro plays nicely, everything is ok. But when I publish the game, as a standalone, only including used files, well it crashes with the error we've talked above because Leadwerk do not include the Startup folder in the publish process: I've created a blank project, only including needed files for the startup intro. Same, so it's not coming from my game but from Leadwerk. You can download this blank project below if you want to see by yourself. I've also included the leadwerk project if you want to explore in the editor. Thank you very much for your help. I'm sorry if I miss something big and it's obvious ? IntroTest.zip 2 Just making games for fun. Currently working on T3-L4 Link to comment Share on other sites More sharing options...
Marcousik Posted September 30, 2020 Share Posted September 30, 2020 I tested it. It will run as expected if you don't select "only includes used files" I suppose the publishing procedure ignores the folder "Materials/Resources/Startup/startup" 1 Link to comment Share on other sites More sharing options...
Josh Posted September 30, 2020 Share Posted September 30, 2020 So this is caused by a script that is loading a procedurally generated file name and not checking to make sure the file was loaded? If that is the case, you can just add each used file name in a comment in the script, and it will trigger the routine to include those files. 1 2 My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Marcousik Posted September 30, 2020 Share Posted September 30, 2020 Quote local frame = "Materials/Resources/Startup/startup" for framenb = 1, 14 do System:Print("Looped "..framenb) frametexture = Texture:Load(frame..framenb..".tex") Wait(50) end Yes this seems to be the problem. 1 Link to comment Share on other sites More sharing options...
Ttiki Posted October 1, 2020 Author Share Posted October 1, 2020 Thank you very muc for your help. 14 hours ago, Josh said: So this is caused by a script that is loading a procedurally generated file name and not checking to make sure the file was loaded? If that is the case, you can just add each used file name in a comment in the script, and it will trigger the routine to include those files. I will try this when I get home, thank you. ? Just making games for fun. Currently working on T3-L4 Link to comment Share on other sites More sharing options...
Russell Posted October 16, 2020 Share Posted October 16, 2020 Kaixo Ttiki!! Do you finally solve this problem? It also happened to me and I had to solve it by loading the textures on the faces of several BOXES (out of the player view) to solve the problem and for "only used files" option to put the files in the zips in the Standalone publish. But if you have achieved/solve this through code, could you tell me how you have done it? I don't quite understand what you said @Josh in this line: On 9/30/2020 at 6:10 PM, Josh said: So this is caused by a script that is loading a procedurally generated file name and not checking to make sure the file was loaded? If that is the case, you can just add each used file name in a comment in the script, and it will trigger the routine to include those files. But i'm sure will be useful to me once I know how to write that example of code. How do I solve this problem using code? How have you solved it Ttiki? Thank you very much!! Link to comment Share on other sites More sharing options...
Russell Posted October 16, 2020 Share Posted October 16, 2020 If i use this line of code: --frametexture=Texture:Load("Materials/MisTexturas/Dialogos/Dialogo1.tex") --frametexture=Texture:Load("Materials/MisTexturas/Dialogos/Dialogo2.tex") --frametexture=Texture:Load("Materials/MisTexturas/Dialogos/Dialogo3.tex") --frametexture=Texture:Load("Materials/MisTexturas/Dialogos/Dialogo4.tex") --frametexture=Texture:Load("Materials/MisTexturas/Dialogos/Dialogo5.tex") --frametexture=Texture:Load("Materials/MisTexturas/Dialogos/Dialogo6.tex") --frametexture=Texture:Load("Materials/MisTexturas/Dialogos/Dialogo7.tex") --frametexture=Texture:Load("Materials/MisTexturas/Dialogos/Dialogo8.tex") --frametexture=Texture:Load("Materials/MisTexturas/Dialogos/Dialogo9.tex") In my script... Is it enough??? I'm trying with the INTRO project put in this thread and works for me... I will try it with my project... Link to comment Share on other sites More sharing options...
Russell Posted October 16, 2020 Share Posted October 16, 2020 I can not believe it!! It works !! By simply writing them like this and COMMENT them, it works for me!! Do you know the amount of f***ing boxes with the textures that I have had to create throughout the 19 damn maps of FotoMuseo so that I don't get the assert error??? Now I can remove them and with a commented line of code for each of the .tex that I load on the screen along the game is enough!! Many thanks team!!! 1 1 Link to comment Share on other sites More sharing options...
Josh Posted October 16, 2020 Share Posted October 16, 2020 You can even just write the file name like this: --Dialogo9.tex 1 My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts