Page 1 of 1

Screw DoomScript, Add LuaJIT

Posted: Sun Dec 28, 2014 12:31 pm
by Tribeam3rd
Hello Devs of Zdoom, I welcome you to take conideration in adding LuaJIT to ZDoom.

Heres why:
  • DoomScript still hasn't happened.
  • LuaJIT exists.
  • Why, oh why, would you wanna put in so much work into making a shittier language? when this is already made, tested, stable, powerful, and fast?
  • Theres no way you will get the power, speed, dynamicness, and the stability in DoomScript that LuaJIT has.
  • There must be a good reason all these developers thought Lua was a good idea to add to their games: https://en.wikipedia.org/wiki/Category: ... ideo_games
  • Very small footprint, both hard drive and memory usage.
  • You still have complete control over what abilities people can do on your engine.
  • Adding LuaJIT to ZDoom shouldn't be that hard.
  • Curious about Lua's abilities? look what Garry's Mod did to the source engine.(the entire thing is built on Lua)
  • Modders do not have to compile anything, and you could force them to keep everything open source(Lua can be compiled into bytecode if left unchecked)
  • If you wanted, you can allow modders to load scripts during runtime, this means(in some cases) modders do not have to restart ZDoom to test changes.
  • Take all the bullshit of each text lump and you could mash it into 1 language, seriously, why does each text lump have it's own special syntax? that's annoying, confusing, and just plain messy.
  • SRB2 added Lua(not LuaJIT) and their modding capabilities surpassed that of anything ZDoom will ever dream of doing, and their modding scene is booming.
  • I could go on and on...
Cons:
  • The syntax isn't C like(is this really a con?)
  • Lua's dynamicness, if you don't set you're own standards on how modders should mod, can get messy.
  • You'll have disable a lot of Lua stuff for security reasons, I'd sandbox a whitelist of Lua stuff myself.
Benchmark:
  • I did a benchmark of C, LuaJIT, Python, and Lua using a monty hall problem script, with a billion iterations.
  • C = 13 seconds
  • LuaJIT = 40 seconds
  • Python&Lua = 1hour 30min(I stopped it at 1:30 becuase it was enough to get the point across)

    More performance info on LuaJIT vs Lua can be found here: http://luajit.org/performance_x86.html
You probably have your doubts, but I say try it.
Do a proof of concept type thing, a rough draft if you will, see how it goes.

Re: Screw DoomScript, Add LuaJIT

Posted: Sun Dec 28, 2014 12:36 pm
by Snarboo
Someone would have to implement it independently. I know Graf Zahl is not fond of Lua, and I believe a few other developers have argued against it in the past too.

You mention SRB2, and I'm curious what the mod community for that is like now.

Re: Screw DoomScript, Add LuaJIT

Posted: Sun Dec 28, 2014 12:46 pm
by Graf Zahl
The big problem with this is that it still needs to be integrated into the engine so that it has access to the class hierarchy and everything. DECORATE as it is still needs to fit in here
Just having a scripting language is not enough - it has to play well with the rest of the system, too, and unlike games that were designed around Lua that isn't the case here.

Re: Screw DoomScript, Add LuaJIT

Posted: Sun Dec 28, 2014 12:56 pm
by Tribeam3rd
Lua isn't just a scripting language that you have to build your system around, it's built to work the other way around.

Lua is built and ready to be added to anything, and allows you a C API to manipulate it anyway you so choose, I think you should learn up on it before you go assuming things like that.

Re: Screw DoomScript, Add LuaJIT

Posted: Sun Dec 28, 2014 1:37 pm
by Graf Zahl
Provide a proof of concept and we may continue.

What you posted so far sounds like pure advertisement and that I'm completely immune to.

Re: Screw DoomScript, Add LuaJIT

Posted: Sun Dec 28, 2014 3:09 pm
by Tribeam3rd
Making a quicker example rather than self teaching myself C++ and the engine to prove something that might not even happen, maybe SRB2 is an example enough to consider the idea? It's built on an extremely modified Doom Legacy engine is extremely different from ZDoom(gotta be some kind of similarity somewhere though right?),
They've added Lua with much success, it's open source, so maybe take a look at their example?

Lets look at some things they've been doing:

Ball and chain:
http://fat.gfycat.com/ClutteredMisguide ... errier.gif

Pushable 3d sectors:
https://dl.dropboxusercontent.com/s/7ch ... b20045.gif

Rendering manipulation:
http://giant.gfycat.com/AdoredReflectingChafer.gif
http://giant.gfycat.com/DiscreteFlawlessCattle.gif
http://giant.gfycat.com/ChillyGrimyBullfrog.gif
http://giant.gfycat.com/OrnateVioletCowrie.gif

SRB2 doesn't have slopes, but that doesn't stop them from using mid textures and building their own physics:
http://giant.gfycat.com/DishonestDental ... ushond.gif

Why not some 3d side scrolling?:
http://giant.gfycat.com/SpicyAssuredBudgie.gif

lets just go full build engine with extra added 3dness:
http://giant.gfycat.com/EnviousSaltyArachnid.gif

Lense Flair with geometry awareness:
http://fat.gfycat.com/InsecureInsistent ... peworm.gif

They can build their own linedef actions...
They can build their own decorate like action specials...
They can iterate through all vertices/linedefs/walls/sectors/floors/ceilings/things/ect in a map(and in some cases manipulate them)

Re: Screw DoomScript, Add LuaJIT

Posted: Sun Dec 28, 2014 3:18 pm
by Graf Zahl
I don't care about SRB. That's not ZDoom. You don't need to prove that Lua can do stuff - what I want to hear from you is why it is 'easy' to integrate it with ZDoom. Since you are certain about this you must know something I don't.

Re: Screw DoomScript, Add LuaJIT

Posted: Sun Dec 28, 2014 3:21 pm
by NeuralStunner
Tribeam3rd wrote:Curious about Lua's abilities? look what Garry's Mod did to the source engine.(the entire thing is built on Lua)
Garry has said that if he had to do it over again, he wouldn't use lua.
Tribeam3rd wrote:The syntax isn't C like(is this really a con?)
Yes. A C-like language would be the smallest hurdle to those familiar with anything else already in the engine.


Moreover I don't think Graf sounds very interested in maintaining such a thing, and he's probably going to be the one doing most of that.

Re: Screw DoomScript, Add LuaJIT

Posted: Sun Dec 28, 2014 3:40 pm
by Tribeam3rd
So let me see if i understand the logic here

You'd rather put in the extra work to build your own VM, bytecode, data structures, syntax, compiler, ect, that would be plagued with bugs and stability problems and couldn't ever reach the performace of LuaJIT?
Rather than put that effort into an already built, far stronger, far more stable, far faster system that was specifically built to be use in existing systems?

Interesting

Re: Screw DoomScript, Add LuaJIT

Posted: Sun Dec 28, 2014 3:53 pm
by edward850
You haven't actually proven that it is any of those things though. All you have said is that it apparently "just is".

Re: Screw DoomScript, Add LuaJIT

Posted: Sun Dec 28, 2014 4:08 pm
by Tribeam3rd
Do some google searching a prove my words wrong then.

Re: Screw DoomScript, Add LuaJIT

Posted: Sun Dec 28, 2014 4:09 pm
by edward850
I doubt Google could ever tell me if a Lua syntax will be faster in ZDoom's existing codebase.

Re: Screw DoomScript, Add LuaJIT

Posted: Sun Dec 28, 2014 4:15 pm
by Gez
Lua was discussed for DoomScript in 2007, and ultimately rejected. Of course that was seven years ago and a lot of things changed since, but in any case, it would have to be Randy's decision ultimately.

Re: Screw DoomScript, Add LuaJIT

Posted: Sun Dec 28, 2014 4:31 pm
by Graf Zahl
Tribeam3rd wrote:Do some google searching a prove my words wrong then.

If that is all you can say, I see no point to let this drag on any longer.