1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Why Volition's LUA scripting is so limited?

Discussion in 'Ask Volition!' started by Henry08, Mar 31, 2018.

  1. I am not programmer so correct me if I am wrong. When I investigated mission files I found that not so much was controlled by LUA
    There are dialog conversation, checkpoints and UI mainly. One thing that really disappointed me that you can't control car and characters spawn. It's looks like they was placed manually and then baked to chz file. There is no global variables for every car and character, for every mission there are new local variable that was prescribed in zone file. Also I think that many actions are hardcoded and you don't have any access to them with LUA.
     
  2. Quantum

    Quantum Modding patch tester

    I don't work at Volition, but I am a programmer and I have worked with the LUA scripts and Knobby a bit, so I'll give my best answer from what I've learned:

    The LUA scripts are used to make it easy for the mission designers to build and modify missions quickly without going through a whole compile and build of the system. Most of the system is written in the C++ language, which is a compiled language that requires a build phase whenever a change is made. C++ is a much more complex language to learn and become proficient at, and if written incorrectly it can easily break the entire system. C++ runs much faster than LUA, which is why it is used for any real-time aspects of the system (e.g. graphics streaming and AI). But LUA is simple and can be written by fairly inexperienced programmers, which makes it easier for mission designers to work with. So the C++ developers provide a limited set of functions to the LUA programmers so they can do only what they NEED to do in order to write missions, and no more than that. Since LUA runs much slower than C++, they try to keep as much in C++ as possible. The C++ part is the "hardcoded" part you mentioned.

    Volition also provides a World Editor to their mission designers so they can set mission "nav points". These nav points are only loaded when that part of the map is loaded, and it notifies the LUA code when certain events happen. That way, the LUA code just sits and waits and doesn't take any time away from the system unless a specific point is reached and a specific action occurs. Those nav points are those "spawn points" you mentioned that are "baked to" the files. Volition's World Editor makes it much easier to set nav points on the map, because they can do it graphically and they don't have to worry about coordinates like you would in LUA. They just create the nav points in the World Editor, and name them, and then LUA can use them by name. If you want to learn more about nav points, see my tutorial: How to Move a Nav Point, but I know you've already posted in that topic so you know what's there.

    Unfortunately, we don't have access to the World Editor, which limits what we can do as modders significantly. The World Editor is a huge and complex piece of software that is integrated into many aspects of their development environment, and is not something they can easily just take out and release as a product for users to work with, even if they wanted to.

    If Volition wants to correct any of this information, please do. Sadly, Knobby is gone, and he was so helpful here in the past.
     
    Last edited: Apr 2, 2018
    Corrodias and Henry08 like this.
  3. So sorry to hear that he's gone :(
     
  4. Quantum

    Quantum Modding patch tester

    Me too. At least he left of his own volition.