QConstruct (Lua scripting for quake III)

Locked
Hxrmn
Posts: 17
Joined: Fri Jun 11, 2010 5:52 am

QConstruct (Lua scripting for quake III)

Post by Hxrmn »

QConstruct is a quake3 mod that allows anyone with at least some knowledge of the lua programming language to create simple small modifications for the Quake 3 engine without touching a single line of C code. These scripts can be executed in realtime while the game is running, which allows for rapid prototyping.

Through the use of hooks and bindings to the quake3 engine, users can assign their own responses to particular events that happen in-game.

Lua is a high-level programming language, usually used for providing scripting access for lower-level code. (see http://www.lua.org/pil/)


I have been developing this modification for almost 2 years now. At this point I really need some feedback and possibly some help from testers. The mod is very unorganized but moderately stable and it may take some messing around to figure it out. You can download the mod here http://code.google.com/p/quakeconstruct/ (Windows Only)
Make sure you read the readme.txt file, it's kind of important.

[lvlshot]http://quakeconstruct.files.wordpress.com/2009/04/shot0009.jpg[/lvlshot]

Development Blog here http://quakeconstruct.wordpress.com/
Wiki here http://quakeconstruct.wikispaces.com/
Email here Hxrmn@comcast.net
Videos here http://www.youtube.com/view_play_list?p ... 805470729E

Questions, comments, discourse?
Last edited by Hxrmn on Tue Jun 15, 2010 1:06 am, edited 1 time in total.
Perle
Posts: 65
Joined: Sat Mar 07, 2009 4:08 pm

Re: QConstruct (Lua scripting for quake III)

Post by Perle »

Hi man. Still some work on this? Nice to read from you.
[b][url]http://www.per-thormann.de/[/url][/b]
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: QConstruct (Lua scripting for quake III)

Post by ^misantropia^ »

Looks neat, Hxrmn. But is there a reason why it's win32-only? A quick peek at the SVN repository indicates you are distributing the Lua interpreter as source. Shouldn't it build on all platforms?
bludshot
Posts: 65
Joined: Thu Nov 26, 2009 6:14 am

Re: QConstruct (Lua scripting for quake III)

Post by bludshot »

This is cool!

My current project still has a ton of things to be done in it, so, until I get all that done I won't be able to investigate if or how I could make use of this with my project.

So I guess my point is, very cool lua mod, I support the cool stuff you are doing, but I won't be able to play with it being knee deep in my own mod currently.
Hxrmn
Posts: 17
Joined: Fri Jun 11, 2010 5:52 am

Re: QConstruct (Lua scripting for quake III)

Post by Hxrmn »

^misantropia^ wrote:Looks neat, Hxrmn. But is there a reason why it's win32-only? A quick peek at the SVN repository indicates you are distributing the Lua interpreter as source. Shouldn't it build on all platforms?
It should build on all platforms but I still haven't decided on how to do it.
Currently it's loaded via DLL which is a windows only thing.

I could use static libraries or just integrate the lua source code with the mod's source code (it didn't work the first time I tried it).

Might branch the svn for that so the changes are easily reversible.
User avatar
Eraser
Posts: 19175
Joined: Fri Dec 01, 2000 8:00 am

Re: QConstruct (Lua scripting for quake III)

Post by Eraser »

Is there some kind of API described somewhere that we can code against?
Hxrmn
Posts: 17
Joined: Fri Jun 11, 2010 5:52 am

Re: QConstruct (Lua scripting for quake III)

Post by Hxrmn »

Eraser wrote:Is there some kind of API described somewhere that we can code against?
I'm working on one here http://quakeconstruct.wikispaces.com/.
It's far from finished, but I'll get the basics finished soon.
User avatar
Eraser
Posts: 19175
Joined: Fri Dec 01, 2000 8:00 am

Re: QConstruct (Lua scripting for quake III)

Post by Eraser »

If it's stable enough with a proper API description I'd be very interested in messing around with it :) I'm not familiar with Lua though, but never too old to learn. Why the choice for Lua by the way and not, for instance, JavaScript?
Hxrmn
Posts: 17
Joined: Fri Jun 11, 2010 5:52 am

Re: QConstruct (Lua scripting for quake III)

Post by Hxrmn »

Eraser wrote:If it's stable enough with a proper API description I'd be very interested in messing around with it :) I'm not familiar with Lua though, but never too old to learn. Why the choice for Lua by the way and not, for instance, JavaScript?
I went into the project knowing Lua, not Javascript (although I do know some javascript now). Lua seemed like the logical choice at the time. Plus Lua is faster than Javascript. :)

Btw, I will be working on the documentation wiki more this week.
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: QConstruct (Lua scripting for quake III)

Post by ^misantropia^ »

Hxrmn wrote:Plus Lua is faster than Javascript. :)
Check out Google's V8 JavaScript engine, the one used in Google Chrome. I bet you a sixpack it'll outperform Lua on most tests.
Hxrmn
Posts: 17
Joined: Fri Jun 11, 2010 5:52 am

Re: QConstruct (Lua scripting for quake III)

Post by Hxrmn »

^misantropia^ wrote: Check out Google's V8 JavaScript engine, the one used in Google Chrome. I bet you a sixpack it'll outperform Lua on most tests.
I Dunno man, Lua is a very fast language.

Code: Select all

-----------------------------------------------------------
Execution times for recursive F/P factorial(n) to /dev/null
Langs @ 2008     Times:  n=1         n=170       difference
-----------------------------------------------------------
C                      0.000 ms      0.090 ms      0.090 ms
Lua                    0.001 s       0.005 s       0.004 s
Parrot-opt/iterative   0.013 s       0.018 s       0.005 s
Parrot/iterative       0.014 s       0.019 s       0.005 s
V8-Javascript          0.007 s       0.013 s       0.006 s
Ocaml                  0.022 s       0.029 s       0.007 s
Python                 0.013 s       0.027 s       0.014 s
Parrot-opt/recursive   0.013 s       0.029 s       0.016 s
Mozilla-Javascript     0.001 s       0.018 s       0.017 s
Perl                   0.002 s       0.021 s       0.019 s
Nickle                 0.031 s       0.065 s       0.034 s
Parrot/recursive       0.014 s       0.056 s       0.042 s
Ruby                   0.041 s       0.095 s       0.054 s
Lua_on_Parrot          0.303 s       1.314 s       1.011 s
-----------------------------------------------------------
User avatar
Eraser
Posts: 19175
Joined: Fri Dec 01, 2000 8:00 am

Re: QConstruct (Lua scripting for quake III)

Post by Eraser »

Well it doesn't really matter. It's just a tool. If you know how a regular screwdriver works, it's easy enough to figure out how an electric one works as well.
Besides, I read that the semantics of Lua and JavaScript are very similar, they just have a somewhat different syntax.
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: QConstruct (Lua scripting for quake III)

Post by ^misantropia^ »

I counter your impressive stats with a +2 language shootout (admittedly, LuaJIT still whips V8's hiney). I do have a beef with shootout.alioth.debian.org in that tests for the more exotic languages often have incredibly naive implementations. But at least the site admits so itself.
Hxrmn
Posts: 17
Joined: Fri Jun 11, 2010 5:52 am

Re: QConstruct (Lua scripting for quake III)

Post by Hxrmn »

^misantropia^ wrote:I counter your impressive stats with a +2 language shootout (admittedly, LuaJIT still whips V8's hiney). I do have a beef with shootout.alioth.debian.org in that tests for the more exotic languages often have incredibly naive implementations. But at least the site admits so itself.
Well played sir.
bludshot
Posts: 65
Joined: Thu Nov 26, 2009 6:14 am

Re: QConstruct (Lua scripting for quake III)

Post by bludshot »

Although if we're talking about using this stuff for current PCs and not phones or something then wouldn't there be no noticeable difference?
Hxrmn
Posts: 17
Joined: Fri Jun 11, 2010 5:52 am

Re: QConstruct (Lua scripting for quake III)

Post by Hxrmn »

bludshot wrote:Although if we're talking about using this stuff for current PCs and not phones or something then wouldn't there be no noticeable difference?
True, though it kind of depends on what it is your doing with the scripting language.
bitWISE
Posts: 10704
Joined: Wed Dec 08, 1999 8:00 am

Re: QConstruct (Lua scripting for quake III)

Post by bitWISE »

Cool idea. Been a fan of lua since I started playing WoW.
Hxrmn
Posts: 17
Joined: Fri Jun 11, 2010 5:52 am

Re: QConstruct (Lua scripting for quake III)

Post by Hxrmn »

Working on integrating the Bullet physics engine. Got it working on the client but still need to parse the level geometry and network it.
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: QConstruct (Lua scripting for quake III)

Post by ^misantropia^ »

What's the use case? Gary's mod-like, rag doll physics?
Hxrmn
Posts: 17
Joined: Fri Jun 11, 2010 5:52 am

Re: QConstruct (Lua scripting for quake III)

Post by Hxrmn »

Sort of garry's mod like. Ragdolls would require new player models (seeing as how quake3 is all vertex animations). I added a video showcasing the physics on the youtube playlist in my first post.
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: QConstruct (Lua scripting for quake III)

Post by ^misantropia^ »

That's pretty awesome. What's performance like? A while ago, I hacked something up with ODE (rigid body physics only) but performance on anything non-trivial was abominable.
User avatar
Eraser
Posts: 19175
Joined: Fri Dec 01, 2000 8:00 am

Re: QConstruct (Lua scripting for quake III)

Post by Eraser »

Awesome. I see a Half-Life gravity gun coming up :D
Hxrmn
Posts: 17
Joined: Fri Jun 11, 2010 5:52 am

Re: QConstruct (Lua scripting for quake III)

Post by Hxrmn »

The performance is great (doesn't look it in the video because it's fraps). I'm getting realtime accurate simulation on my older 1.2Ghz(single core) PC. Also gravity gun is a possibility. ;)

Also found the Bullet physics code for converting the BSP plane equations to primitives so I can create the map geometry in Bullet. Woot!
Locked