Jump to content

xtreampb

Members
  • Posts

    321
  • Joined

  • Last visited

Posts posted by xtreampb

  1. So based off the documentation found at http://www.leadwerks.com/werkspace/page/api-reference/_/command-reference/collision-r778 I set a 'floor' to be of type debris and my sphere brush to be type prop, the brush shouldn't fall through right? That is what i'm experiencing and wonder if it is because i am using a character controller instead of a ridged body. If i set the 'floor' to be of type scene and my brush to be of type character, works as expected.

     

    Is there as way to define my own collision types and how they should interact with the existing ones?

  2. I have a sphere brush object that I am using needs to use entity navigation (be a character controller) but also needs to float. When i set gravity mode to false, it hovers but it doesn't move. When gravity mode is default, it falls to the floor but then navigates.

  3. So I just frustratingly figured out that if you wrap the entity navigation functions in an if check (in lua) then the actual movement doesn't happen if it results to true. It would be nice to denote this in the API documentation. I'll put a comment in there for future reference.

  4. So idk if it is my model or what but when i try to import an FBX model it just copies it and the .mdl file is never created. I've tried by beta and release branches with no luck.

     

    attached is the file i was trying to convert

     

    Reaper.fbx

     

    Resolution:

    I was able to pull up the old LE 2.X engine and files. Opened the tools and rand the obj2gmf.exe file (because i got my hands on an obj version) and then changed the extension to from gmf to mdl. the fbx2gmf also failed.

  5. Is there a way lua, C++ or both to still have gravity turned on for some objects and off for others? Would I need to create another world and have the entities that aren't affected by gravity assigned to this world? Can I even draw two worlds to the camera. I don't see why not just some meticulous management of objects.

  6. Hello Everyone,

     

    My current employer (Grover Gaming) is actively hiring programmers. We are looking for both game developers who are familiar with Unity and have a understanding of C#. Not only are we looking for game developers, we are also hiring .net developers. We use the .net framework with the C# development language and WPF to create our user interfaces. Let me know if you or anyone you know may be interested.

     

    Sincerely,

     

    ~Xtreampb~

  7. so i have this code in C++

    Entity *spawn = world->FindEntity("Spawn");
    
    
    Entity *player = Prefab::Load("Prefabs/Player/FPSPlayer.pfb");
    player->SetPosition(spawn->GetPosition());
    player->SetRotation(spawn->GetRotation(),true);
    

     

    problem is, my player isn't being rotated. It's position is being set, but it isn't being rotated. Could someone give me some insights please?

  8. Loading my simple, small map takes a good bit of time. Is it possible to make my Map::Load(std::String) multi-threaded? I would like to load each entity using a separate thread from a pool of threads. So something like:

    Map::Load(std::String PathToMap, int numThreads);
    

     

    it would create numThreads +1. spool one thread to manager the other threads and will receive the result (returning entity) from each thread. If there are other entities to load, will then begin loading another entity with the recently returned thread. once all entites are loaded, the map object is then sent to back to the main thread. This would allow me to create like a loading screen that isn't stalled.

     

    I suppose i could do this myself, i would just need to know how the map::load function finds it entities (gets it's list and path)

  9. Got this figured out with the gracious help of our engine creator, Josh. Key Points. Use the global stack.

     

    C++

    Interpreter::PushObject(your_object_pointer);
    Interpreter::SetGlobal("global_variable_name_used_in_lua_to_access_previously_pushed_object");
    

     

    lua

    self.object=global_variable_name_used_in_lua_to_access_previously_pushed_object
    --yes the global name is case sensitive
    

     

    the global object can now be used in any script (unless josh comes by and tells us otherwise)

    • Upvote 2
  10. ok so this is what i got and it works until i try to access objects creating in my C++ code

     

    app.lua

    --This function will be called once when the program starts
    function App:Start()
    
    --Initialize Steamworks (optional)
    --Steamworks:Initialize()
    
    --Set the application title
    --[[self.title="MyGame"
    
    --Create a window
    local windowstyle = Window.Titlebar
    if System:GetProperty("fullscreen")=="1" then windowstyle=windowstyle+Window.FullScreen end
    self.window=Window:Create(self.title,0,0,System:GetProperty("screenwidth","1024"),System:GetProperty("screenheight","768"),windowstyle)
    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()
    self.world:SetLightQuality((System:GetProperty("lightquality","1")))
    
    --Load a map
    local mapfile = System:GetProperty("map","Maps/start.map")
    if Map:Load(mapfile)==false then return false end--]]
    
    return true
    end
    --This is our main program loop and will be called continuously until the program ends
    function App:Loop()
    
    --If window has been closed, end the program
    --if self.window:Closed() or self.window:KeyDown(Key.Escape) then return false end
    
    --Handle map change
    if changemapname~=nil then
    
    --Clear all entities
    self.world:Clear()
    
    --Load the next map
    Time:Pause()
    if Map:Load("Maps/"..changemapname..".map")==false then return false end
    Time:Resume()
    
    changemapname = nil
    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
    --Toggle statistics on and off
    if (self.window:KeyHit(Key.F11)) then self.showstats = not self.showstats end
    if self.showstats then
    self.context:SetColor(1,1,1,1)
    self.context:DrawText("FPS: "..Math:Round(Time:UPS()),2,2)
    end
    end]]--
    
    --Refresh the screen
    --self.context:Sync(true)
    
    --Returning true tells the main program to keep looping
    return true
    end
    

     

    my C++ code

    #include "App.h"
    
    using namespace Leadwerks;
    
    App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {}
    
    App::~App() { delete world; delete window; }
    
    bool App::Start()
    {
    //Initialize Steamworks (optional)
    /*if (!Steamworks::Initialize())
    {
    System::Print("Error: Failed to initialize Steam.");
    return false;
    }*/
    
    window = Leadwerks::Window::Create("Arena",500,500);
    
    context = Context::Create(window);
    
    world = World::Create();
    
    window->HideMouse();
    
    std::string mapname = System::GetProperty("map", "Maps/start.map");
    Map::Load(mapname);
    
    window->SetMousePosition(context->GetWidth() / 2, context->GetHeight() / 2);
    
    int stacksize = Interpreter::GetStackSize();
    
    //Get the global error handler function
    int errorfunctionindex = 0;
    #ifdef DEBUG
    Interpreter::GetGlobal("LuaErrorHandler");
    errorfunctionindex = Interpreter::GetStackSize();
    #endif
    
    //Create new table and assign it to the global variable "App"
    Interpreter::NewTable();
    Interpreter::SetGlobal("App");
    
    //Invoke the start script
    if (!Interpreter::ExecuteFile("Scripts/App.lua"))
    {
    System::Print("Error: Failed to execute script \"Scripts/App.lua\".");
    return false;
    }
    
    //Call the App:Start() function
    Interpreter::GetGlobal("App");
    if (Interpreter::IsTable())
    {
    Interpreter::PushString("Start");
    Interpreter::GetTable();
    if (Interpreter::IsFunction())
    {
    Interpreter::PushValue(-2);//Push the app table onto the stack as "self"
    #ifdef DEBUG
    errorfunctionindex = -(Interpreter::GetStackSize() - errorfunctionindex + 1);
    #endif
    if (!Interpreter::Invoke(1, 1, errorfunctionindex)) return false;
    if (Interpreter::IsBool())
    {
    if (!Interpreter::ToBool()) return false;
    }
    else
    {
    return false;
    }
    }
    }
    
    //Restore the stack size
    Interpreter::SetStackSize(stacksize);
    
    
    
    return true;
    }
    
    bool App::Loop()
    {
    if (window->Closed())
    return false;
    
    if (window->KeyHit(Key::Escape))
    return false;
    
    //Get the stack size
    int stacksize = Interpreter::GetStackSize();
    
    //Get the global error handler function
    int errorfunctionindex = 0;
    #ifdef DEBUG
    Interpreter::GetGlobal("LuaErrorHandler");
    errorfunctionindex = Interpreter::GetStackSize();
    #endif
    
    //Call the App:Start() function
    Interpreter::GetGlobal("App");
    if (Interpreter::IsTable())
    {
    Interpreter::PushString("Loop");
    Interpreter::GetTable();
    if (Interpreter::IsFunction())
    {
    Interpreter::PushValue(-2);//Push the app table onto the stack as "self"
    #ifdef DEBUG
    errorfunctionindex = -(Interpreter::GetStackSize() - errorfunctionindex + 1);
    #endif
    if (!Interpreter::Invoke(1, 1, errorfunctionindex))
    {
    System::Print("Error: Script function App:Loop() was not successfully invoked.");
    Interpreter::SetStackSize(stacksize);
    return false;
    }
    if (Interpreter::IsBool())
    {
    if (!Interpreter::ToBool())
    {
    Interpreter::SetStackSize(stacksize);
    return false;
    }
    }
    else
    {
    Interpreter::SetStackSize(stacksize);
    return false;
    }
    }
    else
    {
    System::Print("Error: App:Loop() function not found.");
    Interpreter::SetStackSize(stacksize);
    return false;
    }
    }
    else
    {
    System::Print("Error: App table not found.");
    Interpreter::SetStackSize(stacksize);
    return false;
    }
    
    //Restore the stack size
    Interpreter::SetStackSize(stacksize);
    
    Leadwerks::Time::Update();
    world->Update();
    world->Render();
    context->Sync(true);
    
    return true;
    }
    
    

     

    what i want to do is be able to access my world object and such from my lua script to change the world as shown in the change world tutorial.

     

    In the future i would like to be able to access the entity that caused to collision in my C++ code to retain it between map changes. If not retain the entity itself, then a table of some sort to pass from the entity to the c backend and once the map is loaded, the stored data is used to reconstruct my entity.

×
×
  • Create New...