Page 2 of 2

Re: ZDCode II - The pretty language that compiles to DECORAT

PostPosted: Wed Nov 20, 2019 11:15 am
by Gustavo6046
I am in the process of adding a condition system, where one can use AND, OR and NOT to check conditions (which are state action templates that jump a given number of states only in the desired condition). Those are special macros that can be used as components in conditions (in statements like while, if, etc.).

Code: Select allExpand view
class FrogBoots extends Inventory {
    set Inventory.MaxAmount to 1;
}

class Tired extends Inventory {
    set Inventory.MaxAmount to 3;
}

class FrogZombie extends ZombieMan replaces ZombieMan {
    condition<Offset> C_HasInventory(InventoryName, Amount = 1) {
        TNT1 A 0 A_JumpIfInventory(InventoryName, Amount, Offset);
    }

    condition<Offset> C_Closer(Distance) {
        A_JumpIfCloser(Distance, Offset);
    }

    condition<Offset> C_OnFloor() {
        A_JumpIf(z < floor + 1, Offset);
    }

    label Spawn {
        TNT1 A 0;
        TNT1 A 0 A_Give("FrogBoots");
        goto Super.Spawn;
    }

    macro Jump {
        TNT1 A 0 {
            A_FaceTarget();
            ThrustThingZ(0, 30, 0, 0);
            ThrustThing(angle * 256 / 360, 25, 1, 0);
        }
    }

    label See {
        if (HasInventory("Tired"))  POSS ABCD 10 A_Chase;
        else                        POSS ABCD 4  A_Chase;

        sometimes 15 if (C_HasInventory("FrogBoots") && !C_Closer(128) && !C_HasInventory("Tired", 3) && C_OnFloor()) {
            TNT1 A 0 {
                A_Give("Tired", 1);
                inject Jump;
            };
        }
   
        sometimes 20 TNT1 A 0 A_Take("Tired", 1);

        loop;
    }
}


ZDCode will internally use offset jumps to compute these conditions in the generated DECORATE output.

CBM wrote:anything in zcode II that will make generation of actors based soly on frame information very easy?


What exactly do you mean frame information?

Also, a complete specification & documentation of the language is still in the todo list. I haven't gotten to do it yet.

Re: ZDCode II - The pretty language that compiles to DECORAT

PostPosted: Wed Nov 20, 2019 1:24 pm
by TDRR
Gustavo6046 wrote:Also, a complete specification & documentation of the language is still in the todo list. I haven't gotten to do it yet.

If it helps, i have been doing a tutorial of sorts that runs through various use-cases of ZDCode. Thing is, i don't have many use cases for all of the new features ZDCode has.
I only got basic conversion from DECORATE to ZDCode, and usage of functions and macros to this point. If you think it may be useful to you i can send it over though it's not much.

SLADE should support ZDCode, that would be really awesome. At least compiling from SLADE directly instead of compiling and putting that into the .pk3, and syntax highlighting would be cool but just that would be nice. Ever thought of asking SLADE's dev for such a thing?

Re: ZDCode II - The pretty language that compiles to DECORAT

PostPosted: Fri Nov 29, 2019 8:12 pm
by Gustavo6046
I took a brief break from ZDCode, but development will resume either Saturday or Sunday.

Good night.

Re: ZDCode II - The pretty language that compiles to DECORAT

PostPosted: Sun Mar 29, 2020 8:32 pm
by Gustavo6046
A new update has come out! Welcome to ZDCode 2.6.1. Template classes, abstract labels and macros, many things that can be parametrized (from expressions to repeat and chance values to freaking sprite names!), and much, much more! You're excited? So am I! It's available in the GitHub repository. You can run it using Python and "dist/zdcode.pex", which comes with all the libraries needed to run it. You'll still need Python 3, though.

Re: ZDCode II - The pretty language that compiles to DECORAT

PostPosted: Tue Mar 31, 2020 9:42 am
by Kappes Buur
Gustavo6046 wrote:A new update has come out! Welcome to ZDCode 2.6.1.


It appears that Github has only up to 2.5.

Re: ZDCode II - The pretty language that compiles to DECORAT

PostPosted: Tue Mar 31, 2020 3:01 pm
by Gustavo6046
That's odd. Its latest commit is the 2.6.4 one, and that should be reflected when you download ZDCode in either the pex or source format. I'm not sure what you mean.

Re: ZDCode II - The pretty language that compiles to DECORAT

PostPosted: Tue Mar 31, 2020 3:31 pm
by Kappes Buur
Gustavo6046 wrote:I'm not sure what you mean.


When I click on the Github link in the OP I get this

Spoiler:


releases 2.5.0 and below

Re: ZDCode II - The pretty language that compiles to DECORAT

PostPosted: Tue Mar 31, 2020 7:07 pm
by Gustavo6046
Oh. I forgot to add a Release. Thank you for pointing this out!

I will still be unable to annex a .exe file. Remember, this is still Python, and even the top freezers (like PyInstaller) can't build against a system other than the host one! And using Wine does not seem to fix this. However, I will add a .pex file, which requires only the Python runtime, and does not need any further setup. Win win!

Re: ZDCode II - The pretty language that compiles to DECORAT

PostPosted: Mon Apr 06, 2020 11:25 am
by Gustavo6046
I feel like I should have addressed this question waaay ago.

TDRR wrote:SLADE should support ZDCode, that would be really awesome. At least compiling from SLADE directly instead of compiling and putting that into the .pk3, and syntax highlighting would be cool but just that would be nice. Ever thought of asking SLADE's dev for such a thing?


I think sirjuddington has more to worry about than a random convoluted Python project that compiles a silly syntax to a language superseded to ZScript. This thing would have made so much more sense a few years ago, when "DoomScript" was but a rumor.

Besides, I was thinking, maybe we should instead make the ecosystem, where ZDCode projects are bundled into a single DECORATE file. In fact, this ZDCode part would just be an extension to the actual ecosystem, whose actual job would be to build PK3 files from a filesystem project. So I don't have SLADE in mind right now.

Re: ZDCode II - The pretty language that compiles to DECORAT

PostPosted: Fri May 01, 2020 1:27 pm
by Gustavo6046
v2.8.0 is out! Conditional flow is now great again!

Code: Select allExpand view
    macro Tick_Chase {
        TNT1 A 0 A_FaceTarget(2);

        // bite if possible!
        TNT1 A 0 A_JumpIfTargetInsideMeleeRange("Melee");

        // "more realistic eye movements"
        sometimes 15 ifjump A_JumpIfTargetInLOS($offset, 15) {
            x 4 TNT1 A 0 A_SetAngle(angle + Random(-5, 5));
        };

        // chase!
        ifjump A_JumpIfTargetInLOS($offset) TNT1 A 0 {
            A_FaceTarget(12);
            A_Recoil(-0.55);
        };

        // can't see target... :c
        else {
            TNT1 A 0 A_ClearTarget;
            goto Idle;
        };
    };


...and A_Jump(255) pays for it!

Re: ZDCode II - The pretty language that compiles to DECORAT

PostPosted: Sun May 17, 2020 3:48 pm
by Gustavo6046
You know what? Since it is often needed to interoperate between separate lumps (like keeping TEXTURES, SNDINFO, DECORATE, ACS stuff, etc in sync with each other), I will
slowly deprecate ZDCode II in favor of something much larger, much prettier, and a powerful, convenient all-in-one modding and project organization solution. Please hang on as I work on the ZDK!


EDIT: This idea for ZDK (or Zad) is actually not a good idea and has been scrapped. I was instead thinking about having it being a framework to generate ZDoom mods with definitions in a language like Python. Probably not Python.