ZDCode II: The language that compiles to compatible DECORATE!

Looking for Resources for your mod/project? Want to share some of your creations so others can use them? Post them here!
Post Reply
User avatar
Gustavo6046
 
Posts: 54
Joined: Thu Nov 19, 2015 7:36 pm
Location: Porto Alegre, Brazil
Contact:

ZDCode II: The language that compiles to compatible DECORATE!

#1

Post by Gustavo6046 » Sat Oct 20, 2018 12:45 am

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.
Last edited by Gustavo6046 on Sun Oct 21, 2018 2:50 pm, edited 1 time in total.

User avatar
Ru5tK1ng
Frequent Poster Miles card holder
Posts: 794
Joined: Fri Jun 01, 2012 9:04 pm

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

#2

Post by Ru5tK1ng » Sat Oct 20, 2018 5:10 am

Very interesting. How does it handle online?

User avatar
Ivan
Addicted to Zandronum
Posts: 2219
Joined: Mon Jun 04, 2012 5:38 pm
Location: Omnipresent

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

#3

Post by Ivan » Sat Oct 20, 2018 8:13 am

I can't check your github, it seems to be down for me. Also there's no sample output.
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===

User avatar
Ænima
Addicted to Zandronum
Posts: 3523
Joined: Tue Jun 05, 2012 6:12 pm

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

#4

Post by Ænima » Sat Oct 20, 2018 2:20 pm

Interesting. Kinda defeats the point of learning DECORATE proficiency, but i guess it makes things easier with complex logic loops!

Good idea.
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !


ZandroSkins
: a pack made by our community

User avatar
Gustavo6046
 
Posts: 54
Joined: Thu Nov 19, 2015 7:36 pm
Location: Porto Alegre, Brazil
Contact:

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

#5

Post by Gustavo6046 » Sun Oct 21, 2018 2:50 pm

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

User avatar
Gustavo6046
 
Posts: 54
Joined: Thu Nov 19, 2015 7:36 pm
Location: Porto Alegre, Brazil
Contact:

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

#6

Post by Gustavo6046 » Tue Oct 23, 2018 10:23 pm

Got syntax highlighting?
Image
Visual Studio Code has! You just have to install an extension!

User avatar
Gustavo6046
 
Posts: 54
Joined: Thu Nov 19, 2015 7:36 pm
Location: Porto Alegre, Brazil
Contact:

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

#7

Post by Gustavo6046 » Sun Sep 13, 2020 11:44 pm

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.

Post Reply