Jump to content

drakth

Members
  • Posts

    46
  • Joined

  • Last visited

Posts posted by drakth

  1. I don't think, this is possible...

    I tried to get rid of LUA a few times, since it is driving me nuts that I can't really check my games for memory leaks because the LUA-interpreter allocates and disallocates memory randomly (see e.g. this thread: http://www.leadwerks.com/werkspace/topic/9505-tons-of-memory-leaks-in-leadwerks/).

    Also, if you don't use LUA, this is only wasting performance and memory, so I would absolutely love to see the possibility to turn off LUA (/ to not turn it on in first place).

    Interesting!

  2. Hello thanks for your reply Eirik,

     

    Yes, i got to the same conclusion, tho i wasn't trying to do a mix of LUA and C++ :P.

     

    I don't think i like much the idea of not being able to choose between C++ or LUA project.

     

    Someone correct me if i'm wrong, but if i don't want to use LUA i should have to remove all those code thingy about interpreter, right?

     

    Yeah the LOOP thing was annoying thats why i figured it was a LUA thingy.

  3. I added the World::Create() but i still get the error (and a black screen), it seems to create the world load textures and stuff but nothing appears on screen, and when pressing escape y get the same error because of the code i added in app:loop() which is weird :-/

  4. Yes, i saw the project folders, and added code to the app.cpp, but still doesn't seem to work.

     

    any code after the next block of code doesn't seems to be executed until i close the window.

     

    std::string scriptpath = "Scripts/Main.lua";
    if (FileSystem::GetFileType("Scripts/App.Lua") == 1) scriptpath = "Scripts/App.Lua";
    //Invoke the start script
    if (!Interpreter::ExecuteFile(scriptpath))
    {
    System::Print("Error: Failed to execute script \"" + scriptpath + "\".");
    return false;
    }
    

     

    This code seems to be something LUA related. From what i see on my old projects this code wasn't there before, so i guess it got added on one of lasts updates, strangely my previous projects works fine, but new ones doesn't.

     

    I'm attaching the example and error file.

     

    Thank you.

     

    Edit: attached the zip file.

    post-9082-0-99019900-1435371638_thumb.jpg

    Nova.zip

  5. Hello everyone,

     

    After while i got back with Leadwerks, and i dont know if im doing something wrong or what is happening, but i cant seem to get anything to work with C++ it seems like its only being setup to use LUA.

     

    Yes, i have the standard edition :)

     

    I have created an example project (download link below!), it should load the level and have a basic FPS player (hopefully it works since i cant test it!)

     

    When i use one of my previous projects it works fine and i can do stuff, but when i started a new project (tried with blank and marble) it only seems to be working for LUA, not C++.

     

    Download Link:

    https://onedrive.live.com/redir?resid=614054867A013815!845&authkey=!APfWFon2GrPb4LU&ithint=file%2czip

     

    Any help would be appreciated.

     

    Thank you.

  6. Hello everyone!

     

    I read about the summer games tounament thingy and decided to try do a small game.

     

    So, i started leadwerks and made a new project.

     

    From what i read there is no difference now between a C++ or LUA project so, i went to Visual Studio and opened the solution.

     

    I saw there are quite several changes from the last time i used it, so i added some code i had from a previous project for a FPS.

     

    It compiled ok, but all i see is a black screen.

     

    So i went looking in detail at App.cpp

     

    Noticed stuff that wasnt there before. From debugging i see the code seems to be using Lua instead of C++???

     

    Yes, i have the standard edition.

     

    The code i mention is the following:

     

    std::string scriptpath = "Scripts/Main.lua";
    if (FileSystem::GetFileType("Scripts/App.Lua") == 1) scriptpath = "Scripts/App.Lua";
    //Invoke the start script
    if (!Interpreter::ExecuteFile(scriptpath))
    {
     System::Print("Error: Failed to execute script \"" + scriptpath + "\".");
     return false;
    }
    

     

    My code is after this part so it only gets executed when exitting the game (?).

     

    Should i place the code somewhere else?

  7. Hi everyone,

     

    Im trying to add a skybox to the default FPSPlayer.lua script.

     

    As it says at this webpage:

    http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/camera/camerasetskybox-r824

     

    However when i add the line:

    Texture* skybox = Texture::Load("Materials/Sky/skybox_texture.tex");

     

    It gives me this error:

    '=' expected near '*'

     

    If i remove the * then gives me another error and so on... any help?

     

    Thanks.

     

    Ok, on the link at my OP, the section of LUA contains C++ code and viceversa.

     

    Someone should fix that :)

  8. Thanks Rick,

     

    That fixed the issue. However, i think there is also not working right, with the default weapon prefab. Cause on other project i have, fixing the FPSPlayer script, didnt fix the crash, however as soon as i removed the autopistol prefab it worked fine.

     

    Also thanks for the debugging tip.

     

    Should i report this on the bug forums?

  9. This is the content of app.lua:

     

    --This function will be called once when the program starts
    function App:Start()
    
    --Set the application title
    self.title="MyGame"
    
    --Create a window
    self.window=Window:Create(self.title)
    self.window:HideMouse()
    
    --Create the graphics context
    self.context=Context:Create(self.window,0)
    if self.context==nil then return false end
    
    --Create a world
    self.world=World:Create()
    
    --Load a map
    --local mapfile = System:GetProperty("map","Maps/start.map")
    self.mapFile = "Maps/start.map"
    if Map:Load(self.mapFile)==false then return false end
    self.mapFile = ""
    
    return true
    end
    function App:SwitchLevel(name)
    self.mapFile = name
    end
    function App:ShouldSwitchLevel()
    if self.mapFile ~= "" then
     --self.world:Release()
     self.world:Clear()
    
     self.world = World:Create()
     Map:Load(self.mapFile)
     self.mapFile = ""
    end
    end
    
    --This is our main program loop and will be called continuously until the program ends
    function App:Loop()
    self:ShouldSwitchLevel()
    
    --If window has been closed, end the program
    if self.window:Closed() or self.window:KeyDown(Key.Escape) then return false end
    
    --Update the app timing
    Time:Update()
    
    --Update the world
    self.world:Update()
    
    --Render the world
    self.world:Render()
    
    --Render statistics
    self.context:SetBlendMode(Blend.Alpha)
    if DEBUG then
     self.context:SetColor(1,0,0,1)
     self.context:DrawText("Debug Mode",2,2)
     self.context:SetColor(1,1,1,1)
     self.context:DrawStats(2,22)
     self.context:SetBlendMode(Blend.Solid)
    else
     self.context:SetColor(1,1,1,1)
     self.context:DrawText("FPS: "..Math:Round(Time:UPS()),2,2)
    end
    
    --Refresh the screen
    self.context:Sync(false)
    
    --Returning true tells the main program to keep looping
    return true
    end
    

     

    I tried loading the 2nd level instead of the 1st one, and it loads fine, it seems to crash when called from the script.

     

    The second level is just a platform with a another object where you can collide and will take you again to the first level.

     

    Thanks.

  10. Hi everyone,

     

    I recently updated a test project on the Project Manager (update button) and suddently a lua script stopped working. The script is supposed to load another level when the player collides with an object.

     

    Here is the script:

     

    Script.entered = false
    Script.exited = false
    Script.hadCollision = false;
    Script.Map = "" --Path
    function Script:UpdatePhysics()
    if self.entered then
    if self.hadCollision == false then
     if self.exited == false then
     self.exited = true
     self.component:CallOutputs("TriggerExit")
     self.entered = false
     end
    end
    end
    self.hadCollision = false
    end
    function Script:Collision(entity, position, normal, speed)
    self.hadCollision = true
    if self.entered == false then
    self.component:CallOutputs("TriggerEnter")
    App:SwitchLevel(self.Map)
    self.entered = true
    self.exited = false
    end
    end
    

     

    The script seems to fail at the line:

     

    App:SwitchLevel(self.Map)

     

    With the error Attempt to call method 'SwitchLevel' (a nil value)

     

    Any ideas?

     

    Thanks.

  11. I got the DLC from steam to the standard version, and noticed some things.

     

    1) When making a C++ project the maps doesnt automatically load for me when i open the project, it does if it is a LUA project.

     

    2) I tried the basic FPS Controller on the C++ project but all it does is move like a freecam (i might be doing something wrong here), it works fine in a LUA project.

     

    Am i doing something wrong?

  12. Hi Rick!

     

    Yes, it seems the start() function isnt called again, i called the start() function in the Draw() (Probably not a good thing) and it fixed the error.

     

    I discovered by pure chance what you just told me about the prefab :D, i just set it to hidden, one question tho, if i set it to hidden i suppose it cant be pushed?

     

    Now the doubt i have is, i dont want the object appearing at <0,0,0> when i load it, but then im not sure how to fix that, cause if i move it after its created, the player might see as its created and moved.

     

    Any help would be appreciated, and im looking forward to your tutorial! :D

  13. Hi everyone,

     

    So, im still doing some prototypes, playing with stuff and testing how everything works.

     

    The idea was to have a switch that when triggered it would spawn a monster, so far that parts works well, (and if i manage to fix all the issues im having i'll post it on the tutorials thread), the problems im having are 2 basically.

     

    1) When i press the trigger, the monster spawns but it doesnt appear where the object with the spawner script is, it appears somewhere else on the scene, the monster is a crawler i saved as prefab.

     

    2) When i spawn a second monster i get an error :( (see attached files)

     

    I also notice a delay (probably the models loading) when the monster spawns but this delay makes the whole game freeze while it loads, is there a way to "preload" the models and stuff or some other way to avoid this "delay"?

     

    Any help would be appreciated, thanks.

    post-9082-0-73757800-1390257967_thumb.jpg

    post-9082-0-33812100-1390257984_thumb.jpg

×
×
  • Create New...