-
Posts
321 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by xtreampb
-
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)
-
jeez, it only takes one to ruin it for the rest of us :/
-
So after a quick, prompt to mentoring session from Josh about how to use Lua, I learned a lot. Hear are just a few things. Each Lua project has its own virtual stack. Here is what this means. Each Leadwerks project, when running, creates it own virtual, global, stack. You can use this just like a normal stack in C/C++ except is done in a more explicit manner. In C, you call functions and the function along with the parameters are pushed onto the stack. When you exit the function, the function and it's parameters are popped off the stack. This is all handled mostly behind the scenes and new programmers are typically not aware of the stack or the heap. Now if your just using Lua, this tid bit of information may not hear you. But if, your using C with your Lua game (or Lua with your C game) then this may help you. Josh has kindly taken a good bit of work out of interacting with the global Lua stack with his Interpreter class. Here pushing and popping items onto and off the lua stack is more manageable. Lets look at one of my uses of the interpreter class to send my world object from my C code, to my lua script. //done in C++ world = World::Create(); Interpreter::PushObject(world); Interpreter::SetGlobal("World"); the above code creates a world in my C++ project, pushes this object onto the global lua stack, which is a virtual stack, and sets the key for this object to "World". Now to access my world object in my lua script is this: --done in my App.lua start() script self.world=World thats it. i can now use my world object inside my script. As easy as this is, it isn't complete. As with any stack programming, it has to be balanced and just calling it in the script doesn't make it balanced. In the C code, before you do anything with the interpreter, it was reccommended to store the size of the unmodified lua stack with: int stacksize=Interpreter::GetStackSize(); Once you are done pushing things onto the stack, set the size of the stack to it's previous, unmodified size with: Interpreter::SetStackSize(stacksize); This is just one of the many things I learned about Lua from Josh. I'm thinking that once I get comfortable enough with it, that I'll write a tutorial about this. Let me know what you think. Remember you can watch the development of this project at www.twitch.tv/xtreampb. Stream is most active between 8:00 PM and 11:00 PM. Stop by and say hi, ask questions and give suggestions.
-
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)
-
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.
-
So as many of you may know, before the release of Leadwerk 3.0 I was working on a castle defense type game. With the release of Leadwerks 3.0, I was unable to get my models to import properly. It has been a while since then as I didn't have any ideas for a game for me to work on, as well as time and inspiration to work on one. I also got a new job as a C# developer which will help me become a better programmer. I've also been taking classes and just life in general. I have recently gotten a new idea for a game and have been inspired to create it. Talking with some game developers that work with my company they feel it is a good idea. Arena is a game based on the grind elements found in other popular games where you fight monsters to get drops and experience. Right now there is a plan for 2 Arena maps and a gauntlet to run. I plan on this game being an internal competition on the server where players will directly battle each other for glory, compare times, and even have cooperative aspects where players fight along side one another to be the best team in the server. There will be few different ways to be a champion of a server but there only one champion of each aspect of the game. Players will be able to select and spec out classes, enchant weapons and armor and even combine enchantments to devastate their opponents whether it be human or not. For players who like a challenge, the hard core mode will make you select your strategy carefully. Dying in a hardcore arena or tournament will cause you to loose your equipment and stats. Tread carefully. This game is currently in a proof of concept stage where I'm putting together rough drafts to the maps to play on along with a rough combat, loot and experience system. You can watch this game as it develops on my twitch account at www.twitch.tv/xtreampb Keep an eye out as this develops for special opportunities may become available.
-
Hello all, So i have a C++/Lua hybrid project. I would like to access and temporary store data held in a lua script object/entity when a change the map. As this is a C++ project, i have to do my map changes in my C++ back end as my app::Loop is in my C++ source. How would i change maps first off in C++ i know I can set the new map name in my entity using the changemaptrigger script. but that does nothing b/c i'm in a cpp project. I know this isn't well written and seems like rambling. I need to change maps when my character collides with the trigger and i would like that handled in lua. When i change maps i want to retain the character information like health and any other entity (or reference to entity) associated.
-
I thought that once the navmesh was generated, it could be updated realtime without much conflict. Such as, in the editor adding another navigation obstical would cause that area of the navmesh no longer reachable. I thought you could observe this in the editor. Been a while so i may be wrong.
-
Sounds great. I'm sure the community would love what ever you can provide.
-
cool so i'll use a pivot and create the emitter to play that will last long as i need it to and then recreate it every time
-
noob question, what is a one shot emitter?
-
So i'm not really looking for much atm. I'm just doing some prototyping and prof of concepts. just a few weapons like a standard sword, Knight shield (use the shape not the graphics on the shield), great sword, Bow and arrow (please have separate models), Leather and armored hands, and a mace. if you have time, one of these would be nice, but I'm not quite sure how to implement this in leadwerks. Lots of joints (might be easier to use soft bodies but not sure if LE has this implemented or not). So i would do this last if you have time/want to do it. Mourning star or spiked flail (I would like the chain to be as long as the stick it is attached to). I think it would be a good idea to put these on the workshop so that others can use them and expand them.
-
I'm looking for some decent real(ish)-(b/c of the free) medival weapons. Does anyone know where i may find some?
-
I have an issue with the model origin not being the same :/ Moving onto the next project starting with new models. I'll come back to it later i guess
-
Is there a tool to convert LE 2.x GMF assets to MDL assets?
-
or you cold have a ladder flag and if the character controller is on a ladder as indicated by the flag, set the mass of your character to 0 and when the flag indicates that the player is no longer on a ladder, the mass is then set back to the value previously. I think this would have a less of an effect on the computer.
-
so i had a similar question. you can try this topic
-
how do you expose functions to lua? not real experienced in this and i am curious
-
So idk if this will help you but i'm attaching a link to the new location of all the LE 2.5 documentation. I would highly recommend you bookmark this if you are still using LE 2.X http://www.leadwerks.com/werkspace/page/Documentation/le2 as far as your particular issue. I'm going to assume that you've tried turning off sweep collisions correct? If i'm understanding your issue properly is that when your character runs and jumps, when it contacts the wall, it gets "stuck" and doesn't slide down the wall. Or are you stating that when you walk to the edge of a wall b/c it is too big it doesn't fall down the wall.
-
Your talking about wrapping our own C++ functions and bind them using lua++ or luabind (or something like that)
-
well DOS games are all 2D so entirely new graphics would have to be created to make the games 3D as your wanting. Other than that it would be like making a new game with the exception of the story and game play has already been planned and thought out for you. Make sure that if you do this and distribute it at all that you have proper licenses.
-
i was using steam LE + CPP DLC only. Nothing extra (except vs 2013 ultimate to build my code). It was working earlier that day before i updated my projects. After i updated my projects it didn't work any more.
-
yea i can't stand Obj-C
-
Is it possible to get LE 3.1 to build and run on a mac as it is now? I know LE 3.0 is and that was a big selling point for me.