Page 1 of 1

ZDCode II: The language that compiles to compatible DECORATE!

Posted: Sat Oct 20, 2018 12:45 am
by Gustavo6046
ZDCode II: The language that compiles to compatible DECORATE!

ZDCode is a compiled language that will be converted into DECORATE. It is compatible with most versions of DECORATE, depending on however you use it (but won't use DECORATE anonymous functions).

Either way, it's a powerful language, where you can use if and while statements, X-blocks (which repeat a statement or block thereof N times), and you can fold multiple actions into a single frame. You can also call functions, so you don't need to worry about where you called it, what jumps to do; keeping track of those annoying things sucks, doesn't it?

Alright, enough nonsense! Take this example:

Code: Select all

class RunZombie inherits ZombieMan replaces ZombieMan #2055
{
    set Gravity to 0.4; // high up...
    set Speed to 0;
    is NOBLOCKMONST;
    set Speed to 0;

    label See
    {
        POSS AB 5 A_Recoil(-0.7);
        TNT1 A 0 A_Chase;
        POSS A 0 A_FaceTarget();
        POSS AB 4 A_Recoil(-0.7);
        TNT1 A 0 A_Chase;
        POSS A 0 A_FaceTarget();
        POSS ABCD 3 A_Recoil(-0.7);
        TNT1 A 0 A_Chase;
        POSS A 0 A_FaceTarget();
        goto RunLoop;
    };

    function Jump
    {
        while ( z == floorz )
        {
            POSS A 5 [Bright];
            POSS A 11 ThrustThingZ(0, 30, 0, 1);
        };
        POSS AB 2 A_Chase;
    };

    label RunLoop
    {
        x3
        {
            POSS ABCD 2 A_Recoil(-0.7);
            TNT1 A 0 A_Chase;
            POSS A 0 A_FaceTarget();
        };

        if ( health > 5 )
            call Jump;

        loop;
    };
}
As you can see, throwing it into ZDCode will output a bunch of obnoxious and barely indented DECORATE, but hey, it works perfectly! You're not meant to touch the output, after all!

Image

You can get the latest compiler binaries over at GitHub.

Re: ZDCode II: The language that compiles to compatible DECORATE!

Posted: Sat Oct 20, 2018 5:10 am
by Ru5tK1ng
Very interesting. How does it handle online?

Re: ZDCode II: The language that compiles to compatible DECORATE!

Posted: Sat Oct 20, 2018 8:13 am
by Ivan
I can't check your github, it seems to be down for me. Also there's no sample output.

Re: ZDCode II: The language that compiles to compatible DECORATE!

Posted: Sat Oct 20, 2018 2:20 pm
by Ænima
Interesting. Kinda defeats the point of learning DECORATE proficiency, but i guess it makes things easier with complex logic loops!

Good idea.

Re: ZDCode II: The language that compiles to compatible DECORATE!

Posted: Sun Oct 21, 2018 2:50 pm
by Gustavo6046
OH, the GitHub link has a small typo. Fixed.

If you check the source tree, you can see the sample output in the Examples folder, with the .dec extension. Let me just upload the new structure...

EDIT: If one has Python 3, they can also perform

Code: Select all

pip install -U zdcode
python -m zdcode MyStuff.zc2 MyStuff.dec

Re: ZDCode II: The language that compiles to compatible DECORATE!

Posted: Tue Oct 23, 2018 10:23 pm
by Gustavo6046
Got syntax highlighting?
Image
Visual Studio Code has! You just have to install an extension!

Re: ZDCode II: The language that compiles to compatible DECORATE!

Posted: Sun Sep 13, 2020 11:44 pm
by Gustavo6046
Just came by to update, for the potential onlookers, this thread is currently primarily moved to the ZDoom forums, even though one of its core tenets is compatibility with Zandronum, and legacy ZDoom derivates (neither of which are the focus of a development team inebriated in caffeine and C++), and bla bla bla...

BUUUT.

Even though I don't really use the Zandronum forums nowadays, I'll try to be a responsible guy or something for once, and log in to check in here, and answer all of your questions.

As for ZDCode, it is still undergoing active development, and in fact already has a bunch of interesting features that already makes it significantly more useful than it was just months ago. It's relatively stable, and includes, among other things, a system for producing PK3 outputs, and a configuration system (it will be deprecated as soon as a better one is implemented, don't worry).

Also, the Visual Studio Code plugin is discontinued. ZDCode changes too often at the moment, as it is still expanding and incorporating new features, although it's not in such an early stage as it was when I first made this topic.

Thank you for your consideration.