Jump to content

pracedru

Members
  • Posts

    13
  • Joined

  • Last visited

Posts posted by pracedru

  1. I have tried to remove my Leadwerks folder from the Documents folder, but it didn't work.

    If i start Leadwerks from terminal i get:

     

    libpng warning: Application jmp_buf size changed

    Segmentation fault (core dumped)

  2. Its not just the model viewer.

    The model from the Crawler works fine in the Leadwerks model viewer and the model imported from blender does not work in game.

     

    If i can't do animations with Blender and import to Leadwerks. Does any one know another solution that can be used?

    This is really a showstopper for me right now sad.png

  3. I didn't show how I actually made the App class into a singleton, however Roland's example is exactly right. This is only to do c++ calls from lua. I haven't actually figured out how to call lua scripts from c++ yet. I suppose I can figure that out by looking at the implementation in the default code in a leadwerks project.

    • Upvote 1
  4. Here is how i made it possible to call C++ from LUA.

     

    I want to build Multiplayer game in Leadwerks. But i couldn't find networking libraries and threading libraries that would make it usable in Lua. So i build a Networking client in C++ with libcurl and libpthread . But i want to still use the Lua scripting on the prefabs since a lot of work is already done for me here. And also programming in Higher level languages is just faster.

     

    I decided to use the libtolua++ libraries, since this is already build into Leadwerks.

     

    I work on Ubuntu 15.04. Here the tolua++ libs are installed with:

     

     

    sudo apt-get install libtolua++5.1-dev

     

    The tolua++ program needs a pck file which shall contain the c++ like seudo code that is translated into lua classes.

     

    My package:

     

    $#include "shot.h"
    
    class ShotListener {
    ShotListener();
    ~ShotListener();
    void shot(Object* oEntity, float damage);
    float getHealth(Object* oEntity);
    };
    

     

    I have made two functions. One to emit shots detected on the Entities from the Lua scripting. Another to get the current health status from C++ side.

     

    My actual ShotListener.h class looks like this:

     

    #pragma once
    #include "App.h"
    #include "Leadwerks.h"
    using namespace Leadwerks;
    class ShotListener {
    private:
    public:
    
    ShotListener(void) {
    }											
    ~ShotListener(void){}						
    void shot(Object* oEntity, float damage) {
     App *app = App::getInstance();
     Entity * entity = (Entity*)oEntity;
     app->entityShot(entity, damage);
     return;
    }
    float getHealth(Object* oEntity) {
     App *app = App::getInstance();
     Entity * entity = (Entity*)oEntity;
     float value = app->getEntityHealth(entity);
     return value;
    }
    };
    

     

    As you can see i changed the default App class into a Singleton so that i can get the App object from the instances of ShotListener that is used from Lua.

    Having placed these two files in the same folder i ran the following function from the terminal:

     

    tolua++5.1 -o tolua_shot.cpp -H tolua_shot.h -n Shot shot.pkg
    

     

    This generated two files tolua_shot.cpp and tolua_shot.h that i included in my C++ project along with the shot.h file.

     

    This way i can do a

     

    self.shotListener = ShotListener:new()

     

    In the Script:Start() function in mu Lua objects

     

    and a

     

    self.shotListener:shot(self.entity, self.hits)

     

    When Hurt is called in the Lua object.

     

    After this i just had to sort out all the Segmentation error bugs because of multithreading.

     

    I forgot to mention that the ShotListener Lua also needs to be initialized in the main.cpp before app->Start() with the following:

     

    if (Interpreter::L==NULL) Interpreter::Reset();

    tolua_ShotListener_open(Interpreter::L);

    • Upvote 4
  5. Hi, further to my previous post, I have a test .blend, a very simple cube mesh, with 2 bones, an IK target bone and a single action.

     

    http://marchingcubes.com/leadwerks_test.blend

     

    and the result:

     

    http://marchingcubes.com/leadwerks_test.mdl

     

    When i export this to leadwerks using the leadwerks blender exporter, load it in the model viewer, and assign a material with animation support e.g. the crawler material, the animation does play, but I get the mesh flickering in and out of existence at various frames.

     

    I am on ubuntu 14.04, using leadwerks 3.3 from steam, blender 2.72 and the latest blender exporter from this site.

     

    Hopefully you can reproduce and/or suggest a fix for me, I would really like to get this resolved as a solid pipeline for doing armature-driven animation from blender is essential to my work.

     

    I Also have this issue.

    I run Blender and Leadwerks on Linux.

    I have tried to do the Blender Work and exporting in Windows and importing in Leadwerks on Linux, but with the same result. I havent tried to Import on Windows Leadwerks since i dont have a Windows machine with OpenGL 4 support :(

    I am running my Windows build environment in Virtualbox. So i can run Blender and build the solution in Visual studio.

  6. I have an Issue when I import Models from Blender that are animated with bones and armatures.

    I have the Leadwerks export plugin installed in Blender but you can also export with FBX.

    However the result is similar.

     

    I have made a video about it and uploaded it on youtube:

     

     

    Sometimes i can get a half model appearing with animations in Leadwerks and other i can only get a few faces appearing.

    • Upvote 1
  7. Since i didn't have a solution to do a server-client data layer in Lua i decided to build one in C++. This is mainly due to being more familiar with multi threading in C++, And this kind of stuff needs to be in a separate thread from the 3D rendering thread, in my opinion.

    But i still wanted to use LUA for prefab scripting and all the other neat stuff Leadwerks.

     

    Here is what i did to make this work:

     

    I installed tolua++ on my development machine with

     

    sudo apt-get install libtolua++5.1-dev

     

    I build a class named ShotListener.h

     

    #pragma once
    #include "App.h"
    #include "Leadwerks.h"
    using namespace Leadwerks;
    class ShotListener { //tolua_export
    private:
    public:
    //tolua_begin
       ShotListener(void) {
       }											    // constructor 1
       ~ShotListener(void){}											 // destructor
       void shot(Object* oEntity, float damage) {
        App *app = App::getInstance();
        Entity * entity = (Entity*)oEntity;
        app->entityShot(entity, damage);
        return;
       }
       float getHealth(Object* oEntity) {
        App *app = App::getInstance();
        Entity * entity = (Entity*)oEntity;
        float value = app->getEntityHealth(entity);
        return value;
       }
    };
    

     

    I Made the App class into a Singleton, so that any Lua script can instantiate the ShotListener and call functions from the App.

    I made a tolua++ ShotListener.PCK file to match the ShotListener class:

     

    $#include "shot.h"
    
    class ShotListener {
    ShotListener();
    ~ShotListener();
    void shot(Object* oEntity, float damage);
    float getHealth(Object* oEntity);
    };
    

     

    In the terminal i used the following command to make the ShotListener.PCK into actual C++ code:

     

    tolua++5.1 -o tolua_shot.cpp -H tolua_shot.h -n ShotListener shotlistener.pkg

     

    This created two files tolua_shot.cpp and tolua_shot.h.

     

    These i included in my project along with the ShotListener.h file.

     

    In the main.cpp i added the following before the app->Start()

     

    if (Interpreter::L==NULL) Interpreter::Reset();
    tolua_ShotListener_open(Interpreter::L);
    

     

    Hi then had a ton of debugging to avoid segmentation error bugs related to multithreading. But in the end it works.

  8. I also have this issue on linux.

     

    I have found a workaround, that makes all the faces appear,( by searching the animation in the Ladwerks Model editor and finding a frame where all the faces are shown and then saving.)

    This is a huge setback in my project. I can't continue if i cant make animations work.

×
×
  • Create New...