-
Posts
7,936 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by Rick
-
I like this idea and have many times thought about making something similar where you don't actually do anything. You just watch a civilization evolve in front of your eyes. Will check this out when I get home.
-
Not following your question.
-
Programming LE 2 with Lua isn't that far from it. Surprisingly it's not that bad
-
This is why these threads shouldn't be made *sigh*
-
Look at the UpdateController function. Passing your controllers to this function is how you move controllers. http://www.leadwerks.com/wiki/index.php?title=Controllers#UpdateController One of the parameters to UpdateController is a rotation value. One way to point your enemy to your player is to make a pivot. Assign the position of this pivot to your controller each frame. Then use PointEntity on this pivot to your player. Then in the rotation parameter in UpdateController you can take the Y value of this pivot. So basically you are rotating the pivot along it's Y rotation (as if you were just to turn around in real life) and then taking that Y rotation value and telling your controller to use it as it's rotation. You will also want to set your character model Y rotation value to the same thing each frame so your character will rotation also.
-
The most basic way (without pathfinding) is to rotate your enemy controllers toward your main character. Look into PointEntity() to do this rotation.
-
UpdateController() has parameters that move controllers. Physics commands don't work correctly on controllers.
-
Nooooo. Delete the thread. No more holy wars!
-
I think I'd actually use a Mac if I could play more games on it. If I have to switch to another OS to play my PC games then there just isn't any point that I can see to not just use the OS that handles games and everything else. I know more games are being made for both which is nice, but it's probably many years away before it's standard for the big studios to make their games run on both. I mean PC has consoles to compete with too.
-
Careful now. Might want to use your words wiser. Also might want to make sure you are comparing apples to apples in your 30 seconds vs 2 seconds compile situation. There are a ton of features to every compiler and IDE's like to mask all the parameters being passed to a compiler so there is a whole host of situations that could lead to the difference.
-
Ah, yeah sorry that message is because I used Visual Studio to make the DLL and anything you make with Visual Studio requires these run-time DLL's. It's pretty common and you might actually notice this step if you install games from Steam. There should be an actual package for this from MS for free that you can install with your game. It's very common. If you have Visual Studio installed those DLL's are included which is why it didn't error out on me, but you can't expect users to have Visual Studio installed B) http://www.microsoft.com/download/en/details.aspx?id=5555 A lot of games include this and install it for the user. I would appreciate it if you were to make a simple Lua demo with this. I'll then include it with the zip and put it on the code store here in werkspace so others can enjoy.
-
Give this a try: http://dl.dropbox.com/u/1293842/LELuaJoystick.rar File descriptions in zip ================== LEJoystick.dll - Place this in your base leadwerks directory joystick_const.lua - Place this in scripts/constants (this just makes the enums that the C++ library has) joystick_test.lua - Place this in your scripts/games (this loads the dll and calls a couple functions. nothing fancy, you'll have to test out each function. I placed a comment in this file with all the exposed functions and their signatures from C++.) Fire up the editor and change the game script path to the joystick_test.lua file. Run the "game" Since I don't have a joystick I can't test but the function calls seem to be working so would love to know if it works for you. Note: If your base leadwerks directory is different than C:\Leadwerks Engine SDK then inside joystick_test.lua you'll have to change the path of where the dll gets loaded from on your machine. This seems to be one obstacle to get around. loadlib() isn't relative I guess so when deploying you'll have to some how get the path to the base directory the user installed to and pass that to loadlib() to load this library, but that's only when you are deploying for other people who you don't know where they will install it. It would be nice if the editor/game creates a global Lua variable with the exe path for the lua scripts to use.
-
how to succesfully import your own drivable vehicle?
Rick replied to Richard Simpson's topic in General Discussion
A more generic vehicle script could probably be written to allow via the properties window for the user to define each of the 4 tire locations. -
Seems you're still moving the body. If you are using a controller you wouldn't move the body of the model. You would move the controller and then just position your model (not body) to the position of the controller. http://www.leadwerks.com/wiki/index.php?title=Controllers#UpdateController Should give you a pretty good idea of moving the controller. It's been awhile since I've worked with controllers but I think you can PointEntity() on controllers. If not you can just use a pivot and then get the pivots Y value and pass that to the controllers rotation I believe. Just make the pivot follow the controller as well.
-
That's a really good idea! I wonder if all that information is available from the scene itself from inside Lua. Note that with this process this application would only have access to the stuff Lua has access to and nothing more. So it would need model names, and material and texture files to go along. Will have to see if that's all available via the object table in Lua or if it can be retrieved by LE functions from the entities. I would think it's possible as you could get the material(s) attached to an entity, and then get the texture files inside the materials.
-
OK, I'll see what I can come up with.
-
Before I think you had some usage code for this library. Can you post that also so I can see how it's generally used. Also note I will be first doing this for Windows only. I don't use Linux so not even sure how I would create a "DLL" like thing on Linux. The code isn't that scary if we do it just for Windows since the bulk seems to be more for Linux.
-
Yeah I'll give it a shot. I don't have a joystick so testing will be hard for me to do. I can get it so everything compiles and doesn't error out and give you the result and let you test it. It's a pretty big library so might take some time. Do you need every single piece of functionality there? Might be best to slim it down to the min at first anyway to make sure everything is working. Then can add more once we get that part working.
-
So you were able to get this to work in Lua 5.1? When you build a DLL to be used in LE's Lua implementation you have to use the LuaJIT source not the normal Lua source. If you build the above using the normal Lua source it won't translate directly to LE's Lua because the Lua_State variable is slightly different. Get LuaJIT source from http://luajit.org/ and build that in your DLL and it should work in LE.
-
wchris's request and mac's response gave me an idea that I wonder if anyone would find value in and if Josh wouldn't mind if I did. Also if maybe someone thinks I'm over-thinking it. Some people want to add some functionality to the editor. Generally your only option is Lua scripts. This can be slightly awkward for functionality that makes sense to run when a button is pressed since we don't really have that option. My idea was to create 1 model script that acts as a network server but only listening locally on a specific port. You would drag this into your scenes when building your scene., and it generally would be removed when you are 100% complete. Inside this script you would connect commands to functions. These functions would do the editor functionality you are looking for. There would also be an external windows application. This application on startup would connect locally to the same port your lua script is listening on. This program can have anything on it. Buttons, drop downs, whatever helps give and support the kind of functionality someone would want. This would send commands and parameters for those commands to the Lua server script which would in turn fire the Lua functions you've defined in the editor and at that point anything you can do in Lua can be done. The lua script could inventory all objects in the scene and send them to the client so the client can have the names of all the objects as well to support some functionality around that. Just wondering if anyone else would have ideas around some functionality they could add if this was setup.
-
Were you the one trying to get this to work in Lua? If so I wouldn't be opposed to trying to help. I've written DLL's in C++ to be loaded an accessed via Lua so I know how to do that. I think you posted the C++ code. Could you do that again and I could give it a try so you can get this working in LE2's Lua.
-
How did you specifically go about aligning the plane with the terrain? Manual alignment? Some time ago I took a plane put a texture on it, and then via code aligned it's vertices to that of the terrain directly under it, with possibly having the y value be +.01 to avoid clipping into the terrain but being pretty much as close as possible to the terrain. The plane I did followed my mouse so it was doing that real-time and it worked out really well. The more verts you have in the plane the better it'll look when your terrain has some undulation. You could make your plane terrain in a modelling program and texture it so it looks exactly the way you want it, just with more verts in it than you normally would as you'll be manipulating their positions in code to hug the terrain. Then in lua you can run the code 1 time to align it to the terrain. You can now put it anywhere and it should look just fine. I can't get the link to my video that shows this where I am, but if you search youtube for rpiller1 UNtitled 27.avi it should bring it up. The big light blue circle about 1/2 way into the video shows the plane that is being aligned in real-time to the terrain as it follows the mouse and as you can see it goes over some decent sized hills and still looks good. How good it'll look is dependent on how many verts you have. I feel like this will just give you more freedom to place this anywhere you want over any kind of hills. You just have to get the code in the model's lua file.
-
Yeah, I would create a character controller for the characters and update it in their model scripts update method. I would make a global function called GiveGlobalCharacterAttributes(obj) and call that at the start of the class script for each character passing that script object itself. Inside this function is where you could give all the attributes. obj.controller = CreateController(...) obj.health = 100 obj.etc That way if you want to add a global attribute to all these separate character models you have 1 central place to do it. There are other ways to do this also but this is generally the "easiest"
-
You could make a plane that hugs the terrain and put whatever you want for textures on it to get your effect.
-
You might want to add the comment no matter what because in a chunk of code you are trying to comment out there might already be comments and when you uncomment the chunk you wouldn't want to uncomment the original comments.