Jump to content

Rick

Members
  • Posts

    7,936
  • Joined

  • Last visited

Everything posted by Rick

  1. OK Guppy was right, you need to link vs source. If you do source you'll end up eventually with an error message talking about multiple VM's. So what I did was create an empty DLL project. In project properties link against E:\Steam\steamapps\common\Leadwerks Indie Edition\Library\Windows\x86\lua51.lib and include header path E:\Steam\steamapps\common\Leadwerks Indie Edition\Include\Libraries\lua-5.1.4. Note these are probably different on your system but this is just where your LE engine is installed. Make sure you put dbl quotes around the entire path in VS when you are adding these locations. Then I tested with the following code and it worked. #define DLL_EXPORT extern "C" __declspec(dllexport) extern "C"{ #include "lua.h" #include "lauxlib.h" #include "lualib.h" } #define PI (3.14159265358979323846) static int miles_to_km(lua_State *L) { double miles = luaL_checknumber(L, 1); double km = miles * 1.609; lua_pushnumber(L, km); return 1; /* one result */ } /* end of miles_to_km */ static int circle_calcs(lua_State *L) { double radius = luaL_checknumber(L, 1); double circumference = radius * 2 * PI; double area = PI * radius * radius; lua_pushnumber(L, circumference); lua_pushnumber(L, area); return 2; /* one result */ } /* end of miles_to_km */ static const luaL_Reg testlib[] = { { "miles_to_km", miles_to_km }, { "circle_calcs", circle_calcs }, { NULL, NULL } }; /* ** Open msg library */ DLL_EXPORT int luaopen_msglib(lua_State *L) { luaL_openlib(L, "test", testlib, 0); return 1; } In App:Start() -- load our custom DLL package.loadlib("LuaDLLTest.dll", "luaopen_msglib")() System:Print(test.miles_to_km(40)) Sorry about going down the adding source instead of linking. I swear I did that before but I guess I was wrong. Wouldn't be the first time. The main issue between source vs linking is this Lua VM. Since when you link you share the lua51.dll VM I guess vs when you add the lua source to your DLL the lua51.dll and your DLL now have 2 VM's created and lua doesn't like that.
  2. If you mean http://www.armchairgeneral.com/uploads/reviews/UFO/reload.jpg then yes you can make that.
  3. Yeah check out the workshop as there are a lot of free models (we call them models in 3D games).
  4. To be a realist here doing a multiplayer game for your first game is being too big for you britches. Multiplayer games are the hardest games to code for. You should aim for a single player first.
  5. I believe people did convert to Steam edition before.
  6. Oh nice someone finally did that. I exposed a bare min a year ago or so but yeah this could be big. Once could use this for a nice little easy framework for LE. Only sending string data seems like it won't be the most efficient but should be good enough for a lot of apps.
  7. If I have time tonight I'll put together a little example. Doing this is still beneficial and it can help add many other 3rd party functionality to the Lua version.
  8. Nothing stops anyone from doing this. It could get trickier to save it as an LE .map file though, Josh did release the Map class that shows the .map format, but it changes fairly regularly so you'd have to account for that. I personally would make my own map file, but then you wouldn't be able to edit it in the LE editor which I'm not sure if that's a requirement you would have. However, I wouldn't use the save/load I made since that was more specific to just game data instead of the entire level itself. I would personally use sqlite3 as the map file. It's very fast, has a lua implementation for it, and you can easily open it up with a db editor for visually see it.
  9. Remove that lib file and try it. If you have the source code of Lua in the project you don't need the lib file anyway, and if it's not statically built then it would be relying on another DLL which could be the issue. Or try putting some lua.dll in the same directory as your DLL, although not needing it would be more ideal.
  10. You need to define your luaopen_power with int __declspec(dllexport) Otherwise the function isn't visible by things outside the DLL itself. I generally make a define like #define DLL_EXPORT __declspec(dllexport) int DLL_EXPORT luaopen_power(lua_State *L) { lua_register(L, "square", isquare); lua_register(L, "cube", icube); return 0; } Also I'm not sure if your functions inside need to be static. Play around with that.
  11. You don't need lua.exe on your computer. The LE executables is basically the "Lua.exe" as it runs the lua code. Show me your C++ DLL code. I'm not sure if that's referring to package.loadlib() or it can't find luaopen_power. Are you running in sandbox mode? Be sure you aren't. Look at this example code. Also, I noticed in your code you were using static classes. IF you still have issues remove all that and just go straight C to just make sure you can get easy examples like this working. Then you can play around with organizing things differently. It's just best to make a working simple example of this process first. http://lua-users.org/wiki/CreatingBinaryExtensionModules
  12. You don't have to include the lib files too. It's an either or thing. Either all source, or header + lib. The lib file is a compiled version of the cpp files. http://lua-users.org/wiki/LoadLibrary
  13. I did point him to trying that, but the other option is making a DLL project and loading that DLL in Lua, so that's what he's trying to do now.
  14. Yes. Those functions are actually defined in the .cpp files which is why you were getting those errors, because you didn't have them included. If you include all the headers and source to your project folder then you don't do C:\ anything in your include. If you type #include you should see them. It'll be relative to your project.
  15. In C++ there are a couple options to including a library. You can include a .lib file and the headers only OR you can include all source if it's available to you. That's cpp and h files. I suggested including all the source (.h & .cpp) because it's easier for someone new than going into the config properties and adding .lib file (I think anyway). Did you copy all source and header files to your local project AND add all of those files to your project?
  16. Give Josh the map! He's willing to look at it so take advantage of that
  17. I always thought one of the big benefits of a deferred renderer was that you could have as many lights as you wanted? Josh keeps saying the hit a deferred renderer takes is right up front but then you can have any number of lights without issue. This is probably more of a poly count/entity count issue I would think. That seems to be the biggest issue these days in performance. Making things have shorter view range seems to help.
  18. This has been a conundrum since the LE 2 days. We have asked for a way to be able to make separate instances in the editor. Maybe by holding a key combination down when dragging in a model. Seeing Josh's view on having an option on the materials in another thread I would be surprised he adds this option in. The atlas shader works, but if your giant texture is too big (I think it was 8000 something in size we tried) things start getting unstable in the editor and some intel gfx cards don't seem to support it. So depending on how man variations you want there can be limitations with the atlas shader. Instances are more efficient and the majority of the time you want instanced models, but Josh really still needs to give us a way for when we don't via the editor. I mean ideally an editor of a game engine would give the users ALL of it's API functionality via the editor as well. However I think he added this functionality after the editor was already done.
  19. It's interesting that when I open this up in Notepadd++ that's not line 465 for me. Anyway it's saying that your pickInfo variable doesn't exist. You need to declare it as: local pickInfo = PickInfo() before this. Now you'll look above and see pickInfo being used in other places so why can't it be use here right? Well it's declared local in those other places and anything declared local inside any block (if, loop, etc) will ONLY be visible inside that and nested blocks. Not outside that block. So if you trace updward you'll see pickInfo declared inside the if self.canLookAround then if block (about a 40 lines into that if block). Your current error is inside the if window:KeyHit(Key.E) then if block. Those 2 blocks are at the same level so that pickInfo in the first block is ONLY visible and usable inside that block. This is a variable scope issue and it's important to understand variable scope (where variables can be seen). Ideally, I think this entire function should just declare local pickInfo = PickInfo() as the first line inside of it and then you don't have to worry about all of these other pickInfo declarations.
  20. Does it highlight a line when it fails? Line 465 to me looks like a comment so that's lua being not very helpful in it's error line number. The error must be happening in a call to the Pick() function. It's saying the 4th argument, which to us will be the 3rd because there is a magic lua argument as the 1st that we don't see. So whatever is the 3rd parameter to some pick function that should be getting highlighted on the error, it's saying that value is nil, null, nothing and it should be something.
  21. It might be more than a few. I don't recall. Download this http://luajit.org/download/LuaJIT-2.0.3.zip and just copy them to your VS project dir. Then go into VS and include all these existing files into your project. It should work then.
  22. Some screenshots of physics setup on all 3 and the final result might help us solve this puzzle better.
  23. I knew I wasn't going crazy It matters. Nothing new is drawn if you don't sync. It'll just be the last thing that was drawn on the screen. Syncing draws everything. 2D and 3D. If you have your normal App.lua and comment out the sync call you'll get a white screen.
  24. It would have to be tested with terrain. Not sure if you can get the mix of textures that the terrain allows. That's probably the biggest use case for foot step sounds honestly.
  25. Bold request I think you'd need a SetType() as well and then add a way to do this via the material editor.
×
×
  • Create New...