ZDoom Haxe scripting test

Discuss all aspects of editing for ZDoom.
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

ZDoom Haxe scripting test

Postby mmm » Sun Jul 04, 2010 10:14 pm

Hey, folks.

I've been playing around with ZDoom source code over the weekend and managed to hook up the Haxe scripting language. I thought some of you might be interested in that so here's a link to the modified source code (no windows binaries, sorry, I'm a linux programmer): http://dl.dropbox.com/u/8725839/zdoomneko.7z

You can check out what Haxe language is here: http://haxe.org/doc. In short, it's very close to ActionScript/JavaScript. The variables are strictly-typed though. Haxe compiler translates .hx code files into Neko VM .n bytecode which is hooked up in ZDoom binary through calls to libneko. To compile the ZDoom code you will need libneko and libneko headers in addition to the usual dependencies. In the latest Ubuntu (10, and probably in 9 also, but I haven't checked) you can simply do "sudo apt-get install haxe neko neko-dev" to get all you need to play around with the code. The src/script* files contain everything related to the scripting on the engine level. If you want to take a look at what changes I made to the engine, find "mmm" string, it's mostly one-liners for script callback here and there.

The file script.n needs to be in the same folder as ZDoom executable. That's the bytecode generated from files in the script/ folder. To generate a new script.n file, you must run "haxe script.hxml" command in script/ folder. There is some basic stuff for the prototype. Files in script/lib/ folder are low-level interfaces to the ZDoom engine. Take a look at script/Main.hx, script/Actors.hx, script/Players.hx, that's where the user-level action is. It's a simple mini-game on top of Doom where all monsters drop blue bottles which give 1 experience on pickup. Each 10 experience raises player level and each level gives +20 max health in addition to the starting 50. Player dying does not reset his level/exp.

The modification is nowhere close to completion, there's just a few callbacks here and there to get a feel for it. And there are probably bugs there as well.

Re: ZDoom Haxe scripting test

Postby Gez » Sun Aug 01, 2010 6:17 am

Didn't notice this thread earlier. Odd that nobody seemed to have looked into it.

Not sure if this is really worth it though; Randy is (slowly...) working on a scripting system (see DoomScript).
Joined: 06 Jul 2007

Re: ZDoom Haxe scripting test

Postby Salad Viking » Sun Aug 01, 2010 11:58 am

I would put my faith in Haxe over DoomScript. I don't think even Randy takes DoomScript seriously at this point.
User avatar
Salad Viking
There's too much blood in my sugar system.
Joined: 20 Apr 2010
Location: In high orbit

Re: ZDoom Haxe scripting test

Postby Nash » Sun Aug 01, 2010 12:48 pm

Whoa, looks like somebody went ahead and did their own thing. :O This Haxe thing seems really powerful. Are you saying that low level engine stuff is exposed to the modder with this scripting system? That's bloody amazing.

Checking it out now...

EDIT: Argh no binaries. Maybe that's why this isn't getting any attention. Everyone is probably like "cool! ... so what does this do again?"
User avatar
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: ZDoom Haxe scripting test

Postby Akira_98 » Sun Aug 01, 2010 2:37 pm

Nash wrote:Argh no binaries. Maybe that's why this isn't getting any attention. Everyone is probably like "cool! ... so what does this do again?"

This. I would have been tempted to try to compile it myself, but the example only shows something that has been done in ACS/Decorate before. :?
User avatar
Well excuse me, princess.
Joined: 27 Jun 2010
Location: AC District 7

Re: ZDoom Haxe scripting test

Postby Enjay » Mon Aug 02, 2010 5:01 am

Yeah, I tried a quick build and, not surprisingly, it failed due to the missing neko files. Unfonrtunately I didn't have the time nor the inclination to install the additional stuff needed to get them.
User avatar
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
Joined: 15 Jul 2003
Location: Scotland

Return to Editing (Archive)

Who is online

Users browsing this forum: No registered users and 1 guest