Jump to content

Ywa

Members
  • Posts

    256
  • Joined

  • Last visited

Posts posted by Ywa

  1. Hi folks,

     

    I'm trying to draw some text on top of my 3D world. I have my rendering code after my world update & render, but it still only shows my 2D stuff with a black background. I've read about PostRender hooks, but it only seems to be available to entities. How can I fix this to work with my normal game logic? Because adding a chat via an entity doesn't seem to make much sense to me.

     

    Thanks in advance.

  2. I didn't know I could load a map with a callback. This will work perfect. Thanks CrazyCarpet.

     

    And I agree with the unique naming. I would also like to have everything in lower case (filenames and entity names).

  3. Give the name of the entities in the map unique names and use that. If they are run-time entities then you would need to save them off yourself anyway since you can't save them in the LE map.

    I'll consider 'syncing' by name yes. Although I would still have preferred some sort of ID system.

     

    Thanks

  4. It would double the number of builds I have to do every time I update Leadwerks, and it doesn't cause any problems, so I prefer to leave it as is.

    But why is that optional initialization command there then? What does it do?

  5. GetAddress would not work in my case because I want the same ID on 2 different apps with the same scene (map). So I want to know what entity ID a map entity is. And it should be the same on the other app.

  6. I've exposed the ENET library to Lua in my project. I'm considering making it open-source once my project matures a bit more. :) Standard Leadwerks edition is required though, unless Josh would allow me to distribute the customized binaries.

  7. Hi guys,

     

    Is there a way to get some sort of unique entity ID (or index in scene)? In the C++ headers I see some possible variables, but none seems to be documented in the Wiki. And I would like to have something in Lua.

     

    Thanks in advance.

  8. Hi,

     

    In my 3.2 project with both C++ and Lua I can't disable the use of Steam. Thus everytime it says I'm playing 'Spacewar'. Very annoying for my friends to see me constantly go in and go out that game. Is there a way to disable it? I did comment the SteamWorks initialization. Which doesn't seem to make a difference (thus this makes it a bug).

  9. Hi,

     

    It would be very handy to know if a window is on the foreground (active) or not. As far as I know there's no way to detect this in Lua. Can this be added?

     

    Thanks in advance.

     

    Edit: I already mimicked this function in my own application. But would be nice to have this out-of-the-box.

  10. Yes, I've managed to get it somewhat working.

     

    For others who want a solution aswell:

    - Make sure to name your tolua++ package something else than luacommands. I used luacom

    - Write a header file for your lua-gluecode (example is down here).

    - Make sure you call the right function in the main.cpp code (code also down here).

     

    lua-gluecode.h

    #pragma once
    #include "Leadwerks.h"
    
    using namespace Leadwerks;
    
    /* Exported function */
    TOLUA_API int tolua_luacom_open (lua_State* tolua_S);
    

     

    Before App->Start() in main.cpp

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

     

    Edit: Hereby I also include an example class header which is succesfully parsed by tolua++.

     

    #pragma once
    #include "Leadwerks.h"
    
    using namespace Leadwerks;
    
    class Net { //tolua_export
    private:
    ENetHost * client;
    public:
    //tolua_begin
    int red;
    
    Net(void);                          // constructor 1
    ~Net(void);                         // destructor
    
       bool Start(const bool isClient);
    void Think(void);
    
    };
    //tolua_end

    • Upvote 1
  11. Hi everyone,

     

    I want to expose a class and it's functions to Lua. This is the header I want to have converted:

    #pragma once
    #include "Leadwerks.h"
    
    using namespace Leadwerks;
    
    class Net { //tolua_export
    private:
    ENetHost * client;
    public:
    //tolua_begin
    Net(void);
    virtual ~Net(void);
    
    virtual bool Net::Start(const bool isClient);
    virtual bool Net::Think();
    
    };
    //tolua_end
    

     

    Which returns the following lue-gluecode.cpp when using the automatic converter (which I include in the project):

    /*
    ** Lua binding: luacommands
    ** Generated automatically by tolua++-1.0.92 on 03/02/14 10:30:32.
    */
    
    #ifndef __cplusplus
    #include "stdlib.h"
    #endif
    #include "string.h"
    
    #include "tolua++.h"
    
    /* Exported function */
    TOLUA_API int tolua_luacommands_open (lua_State* tolua_S);
    
    #include "Net.h"
    
    /* function to release collected object via destructor */
    #ifdef __cplusplus
    
    static int tolua_collect_Net (lua_State* tolua_S)
    {
    Net* self = (Net*) tolua_tousertype(tolua_S,1,0);
    Mtolua_delete(self);
    return 0;
    }
    #endif
    
    
    /* function to register type */
    static void tolua_reg_types (lua_State* tolua_S)
    {
    tolua_usertype(tolua_S,"Net");
    }
    
    /* method: new of class Net */
    #ifndef TOLUA_DISABLE_tolua_luacommands_Net_new00
    static int tolua_luacommands_Net_new00(lua_State* tolua_S)
    {
    #ifndef TOLUA_RELEASE
    tolua_Error tolua_err;
    if (
    !tolua_isusertable(tolua_S,1,"Net",0,&tolua_err) ||
    !tolua_isnoobj(tolua_S,2,&tolua_err)
    )
    goto tolua_lerror;
    else
    #endif
    {
    {
    Net* tolua_ret = (Net*) Mtolua_new((Net)());
    tolua_pushusertype(tolua_S,(void*)tolua_ret,"Net");
    }
    }
    return 1;
    #ifndef TOLUA_RELEASE
    tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
    return 0;
    #endif
    }
    #endif //#ifndef TOLUA_DISABLE
    
    /* method: new_local of class Net */
    #ifndef TOLUA_DISABLE_tolua_luacommands_Net_new00_local
    static int tolua_luacommands_Net_new00_local(lua_State* tolua_S)
    {
    #ifndef TOLUA_RELEASE
    tolua_Error tolua_err;
    if (
    !tolua_isusertable(tolua_S,1,"Net",0,&tolua_err) ||
    !tolua_isnoobj(tolua_S,2,&tolua_err)
    )
    goto tolua_lerror;
    else
    #endif
    {
    {
    Net* tolua_ret = (Net*) Mtolua_new((Net)());
    tolua_pushusertype(tolua_S,(void*)tolua_ret,"Net");
    tolua_register_gc(tolua_S,lua_gettop(tolua_S));
    }
    }
    return 1;
    #ifndef TOLUA_RELEASE
    tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
    return 0;
    #endif
    }
    #endif //#ifndef TOLUA_DISABLE
    
    /* method: delete of class Net */
    #ifndef TOLUA_DISABLE_tolua_luacommands_Net_delete00
    static int tolua_luacommands_Net_delete00(lua_State* tolua_S)
    {
    #ifndef TOLUA_RELEASE
    tolua_Error tolua_err;
    if (
    !tolua_isusertype(tolua_S,1,"Net",0,&tolua_err) ||
    !tolua_isnoobj(tolua_S,2,&tolua_err)
    )
    goto tolua_lerror;
    else
    #endif
    {
    Net* self = (Net*) tolua_tousertype(tolua_S,1,0);
    #ifndef TOLUA_RELEASE
    if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
    #endif
    Mtolua_delete(self);
    }
    return 0;
    #ifndef TOLUA_RELEASE
    tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
    return 0;
    #endif
    }
    #endif //#ifndef TOLUA_DISABLE
    
    /* method: Net::Start of class Net */
    #ifndef TOLUA_DISABLE_tolua_luacommands_Net_Net__Start00
    static int tolua_luacommands_Net_Net__Start00(lua_State* tolua_S)
    {
    #ifndef TOLUA_RELEASE
    tolua_Error tolua_err;
    if (
    !tolua_isusertype(tolua_S,1,"Net",0,&tolua_err) ||
    !tolua_isboolean(tolua_S,2,0,&tolua_err) ||
    !tolua_isnoobj(tolua_S,3,&tolua_err)
    )
    goto tolua_lerror;
    else
    #endif
    {
    Net* self = (Net*) tolua_tousertype(tolua_S,1,0);
    const bool isClient = ((const bool) tolua_toboolean(tolua_S,2,0));
    #ifndef TOLUA_RELEASE
    if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Net::Start'", NULL);
    #endif
    {
    bool tolua_ret = (bool) self->Net::Start(isClient);
    tolua_pushboolean(tolua_S,(bool)tolua_ret);
    }
    }
    return 1;
    #ifndef TOLUA_RELEASE
    tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'Net__Start'.",&tolua_err);
    return 0;
    #endif
    }
    #endif //#ifndef TOLUA_DISABLE
    
    /* method: Net::Think of class Net */
    #ifndef TOLUA_DISABLE_tolua_luacommands_Net_Net__Think00
    static int tolua_luacommands_Net_Net__Think00(lua_State* tolua_S)
    {
    #ifndef TOLUA_RELEASE
    tolua_Error tolua_err;
    if (
    !tolua_isusertype(tolua_S,1,"Net",0,&tolua_err) ||
    !tolua_isnoobj(tolua_S,2,&tolua_err)
    )
    goto tolua_lerror;
    else
    #endif
    {
    Net* self = (Net*) tolua_tousertype(tolua_S,1,0);
    #ifndef TOLUA_RELEASE
    if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Net::Think'", NULL);
    #endif
    {
    bool tolua_ret = (bool) self->Net::Think();
    tolua_pushboolean(tolua_S,(bool)tolua_ret);
    }
    }
    return 1;
    #ifndef TOLUA_RELEASE
    tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'Net__Think'.",&tolua_err);
    return 0;
    #endif
    }
    #endif //#ifndef TOLUA_DISABLE
    
    /* Open function */
    TOLUA_API int tolua_luacommands_open (lua_State* tolua_S)
    {
    tolua_open(tolua_S);
    tolua_reg_types(tolua_S);
    tolua_module(tolua_S,NULL,0);
    tolua_beginmodule(tolua_S,NULL);
    #ifdef __cplusplus
    tolua_cclass(tolua_S,"Net","Net","",tolua_collect_Net);
    #else
    tolua_cclass(tolua_S,"Net","Net","",NULL);
    #endif
    tolua_beginmodule(tolua_S,"Net");
    tolua_function(tolua_S,"new",tolua_luacommands_Net_new00);
    tolua_function(tolua_S,"new_local",tolua_luacommands_Net_new00_local);
    tolua_function(tolua_S,".call",tolua_luacommands_Net_new00_local);
    tolua_function(tolua_S,"delete",tolua_luacommands_Net_delete00);
    tolua_function(tolua_S,"Net__Start",tolua_luacommands_Net_Net__Start00);
    tolua_function(tolua_S,"Net__Think",tolua_luacommands_Net_Net__Think00);
    tolua_endmodule(tolua_S);
    tolua_endmodule(tolua_S);
    return 1;
    }
    
    
    #if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
    TOLUA_API int luaopen_luacommands (lua_State* tolua_S) {
    return tolua_luacommands_open(tolua_S);
    };
    #endif
    

     

    I also added the required inclusion in main.cpp:

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

     

    However, when launching the project (compilation is fine) it gives an error at my App.lua script. Script runs fine without the lua-gluecode.cpp inclusion.

     

    errorleadwerks_32dc.png

     

    First couple of lines:

    require "Scripts/libs/math.lua"
    require "Scripts/libs/table.lua"
    require "Scripts/libs/dataDumper.lua"

     

    Removing these lines as a test causes the script to hang at the creation of Window.

     

    Does anyone have any idea what's going on here?

     

    Thanks in advance!

  12. If it's about protecting multiplayer games, why not do a consistency check? (CRC32 or whatever) You could even make a server configuration option to allow modded clients or not. So people can still make mods to use when the server allows it (e.g. when playing with friends).

  13. RMClient_2013-08-22_10-30-29-19_c2d6.png

     

    Decided to do some work on the main menu. Changed music, added options screen (W.I.P.) and improved the server browser. Game itself is coming along nicely too. Added serverside Lua support.

     

    Lua support is a bit different than Leadwerks's. We use a packages system to load and unload scripts on-the-fly. Loaded packages will be, at a later point, send to clients so it can also execute clientside Lua.

     

    The following code adds the Liberty City statue from GTA4 (which I ported for placeholding).

    local function CreateMap()
    --Statue
    local statue = ents.Create( ENT_MODEL )
    statue:SetMeshModel( "abstract::stat_hilberty01.gmf" )
    statue:SetPhysModel( "abstract::stat_hilberty01.phy" )
    statue:SetPos( Vector(20, 18, 0) )
    end
    hook.Add( "gtatestmap.OnLoad", "CreateGTATestMap", CreateMap )

    • Upvote 2
  14. If it's a bust, consoles will be dead forever in my eyes, and I'll never play another game on the TV (haven't in probably 5+ years now). I'm not paying $400+ for a console then $60+ for it's games, and I won't be buying anything like that for my kids either. They have went over the pricing line for me after PS2. Ouya is sort of the last hope to get things back on the pricing track for me and consoles. Hope it works out.

    The PS4 is going to be $399. And if you don't want games at their release date the prices aren't that high anyways. Consoles aren't that expensive anymore compared to PC gaming.

  15. This is a project I started working on somewhere in 2011. Haven't done much with it the past year, but since a week I started working on it again, and making quite some progress.

     

    Currently features:

    - 'Awesome Van' with lights

    - 3 power-ups: Ability to shoot ducks, drop landmines (seen in background at second screenshot) and do a kamikaze

    - Simple and boring map

    - Full online multiplayer support (stresstests have yet to be done) supported by ENet

    - Synced props

    - Health & basic damaging (especially from landmines)

    - Speedmeter (blue bar) and chat

    - Server browser

    - Working console

     

    It's mainly a hobby thing, although I do plan on making a proper release sometime soon. And with 'proper release' I mean something that works and is fun to play.

     

    To-do for now:

    - Destruction Derby gamemode

    - Fix handling & tire radius

    - Add more power-ups/weapons

     

    RMClient_2013-06-27_16-53-11-80_280e.png

    RMClient_2013-06-27_16-53-52-28_54de.png

    RMClient_2013-06-27_17-29-05-03_1e52.png

    • Upvote 3
  16. pfff, then i don't know, lol. Last stupid question, have you tried it to run it as admin ? smile.png

    Even though I'm admin already I tried that. No difference.

    Thanks for trying to help me out though. ;)

     

    We use Windows 7 here and have no problems. Once I added the VC2010 redistrib we haven't seen any issues at all.

    'we haven't seen any issues at all'? My post is about an issue with it. And it certainly is related to something the Editor uses.

    As far as I can see it might be related to loading an Internet Explorer/webbrowser frame. Is it possible to make a build without that feature? (guess it's related to the opening screen, since that looks HTML-ish)

×
×
  • Create New...