MESS (Macro Entity Scripting System) - a custom compile tool Created 3 years ago2020-10-03 23:51:31 UTC by Captain P Captain P

Created 3 years ago2020-10-03 23:51:31 UTC by Captain P Captain P

Posted 3 years ago2020-10-03 23:51:31 UTC Post #344746
A 'few weeks' turned into a few months, but hey, it's finally here!

MESS is a Half-Life level compile tool that helps automating various tasks. It provides a templating system and several macro entities for creating template instances, which can be customized with a basic scripting system. Here are some of the things you can do with it:
  • Duplicating complex entity setups as if they were a single entity.
  • Covering terrain and other surfaces with props.
  • Turning a single brush into multiple entities.
MESS can be downloaded here (direct download link: mess_1.1.zip). For a full introduction, take a look at the readme and the entity guide. Also be sure to check out the example maps!
Here's what a template looks like, and how it can be instantiated:
Landmine templateLandmine template
Landmine instancesLandmine instances
There are also several example maps to get you started:
Loading embedded content: Vault Item #6451
I still have several other ideas I want to incorporate into this tool, such as a custom .fgd system (for creating entity 'aliases' for frequently used templates), a more general collision mask system (to make random level generation more viable), a viewer tool for seeing MESS expansion results in 'real-time', and perhaps support for external script files... but that's for later.

Please let me know if you find this tool useful, or if you encounter a problem with it, or if you have ideas for other features!
Posted 3 years ago2020-10-04 11:24:43 UTC Post #344747
Amazing concept! I'll have to try this out soon.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 years ago2020-12-05 00:58:25 UTC Post #345013
MESS 1.1 is now available! :)

The big changes in this version are a new 'rewrite rule' system for creating custom template-based entities, and support for J.A.C.K. map files (for template maps). The rewrite rule system makes it possible to create your own .fgd files, with custom entities like monster_warp or rh_rat, along with instructions for MESS to 'rewrite' these entities to macro-inserting entities that use a monster_warp.rmf or rh_rat.jmf template map.

Download links:
  • MESS 1.1 - The compile tool itself.
  • example maps - Updated example maps. Be sure to check out the new rathunt example, and its use of the custom rh_rat and rh_message_system entities!
Documentation:
  • Readme - An introduction to MESS, and instructions on how to get started.
  • Entity guide - Like TWHL's entity guide, but for MESS' macro entities.
  • Rewrite rules - For creating custom entities, and telling MESS to rewrite them to template-inserting entities.
  • Scripting system - Documentation for MScript, the scripting language used by MESS. See the functions section for a list of functions, many of which are new in 1.1.
Full list of changes:
  • Added a 'rewrite rule' mechanism, for creating template-based entities.
  • Added support for J.A.C.K. template map files (.jmf).
  • Added several string, math, trig, color, flags and directory-related MScript functions.
  • Added a not operator to MScript (alternative for !).
  • MScript now converts none function arguments to the default value for the parameter's type, for non-optional parameters.
  • Added a 'REPL' mode, for interactive testing of MScript expressions.
  • The special spawnflag<N> attributes now start at 0, not 1.
  • The template_name attribute is now a target_destination, so J.A.C.K. can show links between macro entities and the templates they're using.
  • Added MScript documentation.
Bugfixes:
  • Fixed that .rmf files without cameras failed to open.
Posted 3 years ago2020-12-07 00:33:14 UTC Post #345035
Bumping this just to remind myself to try it
Oskar Potatis Oskar Potatis🦔
Posted 2 years ago2021-07-29 20:26:56 UTC Post #345813
Awesome tool! I am currently making a train map and this allows me to just focus on detailing the carriage instead of mindless copypasting to make a 16 car train.

A few feature suggestions:
  • Make the macro_insert scale property a vector, so you could stretch one axis, and flip another axis.
  • Have it so the macro_insert's angles be used to make rotated instances. Maybe have a spawnflag to turn this behaviour on/off. I can even see {rnd(360)} being useful here.
Again, quite a lovely piece of work you've managed over here, I am impressssss'd!
Posted 2 years ago2021-07-30 11:36:33 UTC Post #345817
Thanks!

The problem with scaling is that it also affects the 'scale' attribute of point entities. But I could split that up into two attributes: one for entities ('Scale') and one for geometry ('Geometry scale'). That would also solve the problem where you want to scale up geometry but not entities. As for negative scales, that's currently not working correctly, I'll have to look into that.

As for producing rotated instances, that's exactly what macro_insert's 'Angles' property is for. Can you show me the results you get and what you expected to get? As well as the attributes of the macro entities involved?
Posted 2 years ago2021-07-30 16:46:15 UTC Post #345822
I haven't gotten around messing with angles. I didn't realize it's already implemented because it's not mentioned in readme nor apparent in the FGD/object properties dialog, that is, you need to go read the documentation.

Also, can you clarify how macro_remove_if works? Do you apply it to template brush, or you wrap geometry with them, like macro_template? How does condition work? Do you put just keyvalue.contains('string') or it still needs braces i.e. {keyvalue.contains('string')}?

Lastly, what is the behaviour of brushes when their center handles are within the bounding box of macro_template, but some vertices are out of bounds?
Posted 2 years ago2021-07-30 23:10:41 UTC Post #345823
Here's the documentation for macro_remove_if:
macro_remove_if
Used inside templates. When an instance of a template is created, anything inside the bounding box of this entity is excluded from that instance if the removal condition is true.

Attributes
  • Removal condition (condition) - The condition that determines whether the contents of this entity must be excluded. none (empty) and 0 will prevent removal.
So yeah, you put it around brushes and entities just like you do with macro_template. The condition attribute behaves the same as other attributes, so you'll need braces if you want to use scripting. Even though that's almost always what you want, I decided that consistent attribute behavior was more important than shaving off a few braces. Both macro_template and macro_remove_if only apply to things that are fully inside their bounding box.

For an example on how to use macro_remove_if, take a look at examples\templates\rathunt\message_system.rmf. It's a template map that omits certain entities based on the attributes of the instance-creating entity, and it also uses a macro_remove_if to limit the recursion of a sub-template.
Posted 2 years ago2021-08-03 01:17:10 UTC Post #345833
Help, I got an expression error and -log does nothing!
Posted 2 years ago2021-08-03 07:26:46 UTC Post #345834
You'll need to specify a log level (off, error, warning, info or verbose). Try setting it to warning or verbose and see if that gives you enough information. If that doesn't help, then what sort of error are we talking about? What does the expression look like?
Posted 2 years ago2021-08-03 20:22:20 UTC Post #345836
I don't know how I missed that, sounds amazing! I've discussed this with my... employers and they agree with me that it has limitlesssssssssssssssssss... potentialllllllllllllllllllll. :)
Posted 2 years ago2021-08-04 09:26:32 UTC Post #345837
Help, I got an expression error and -log does nothing!
Sorry, I put the switch after the path (for clarity in the Run Map dialog) but the program only supports switches before paths. IDK how C# works, but with python standard library argparse switches can be anywhere. Haven't checked with VHLT if the same limitation applies there.

Also, I opened several issues on github. They're all enhancement requests, but I can't figure out how to tag as such.
Posted 2 years ago2021-08-04 10:53:43 UTC Post #345838
As far as I understand putting options/switches before (positional) arguments is a fairly wide-spread convention. C#'s standard library doesn't have anything for command-line parsing, so it's a trade-off between managing a dependency versus writing your own.

I marked your Github issues as enhancements. I think they're all good ideas that shouldn't take too much time to implement. Right now I'm working on finishing up SpriteMaker but I think I can spend some time on a MESS update after that.

Did you manage to resolve your expression error? One way to debug things would be to add a 'dummy entity' inside a template, using its attributes for 'logging' things. I also find it useful to have a compile mode in JACK that only runs MESS and then opens the modified map file with JACK.
Posted 2 years ago2021-08-04 12:40:17 UTC Post #345840
Microsoft is developing a command line parsing library if you're open to using something non-standard: https://github.com/dotnet/command-line-api

It's in beta but it's pretty good already. I use it for some tools and it works well.
Posted 2 years ago2021-08-05 02:49:12 UTC Post #345847
Microsoft is developing a command line parsing library if you're open to using something non-standard:
Oh my fucking god, that's love at first sight.
...or sounds like it at least.
Posted 2 years ago2021-08-05 16:24:33 UTC Post #345852
Did you manage to resolve your expression error?
yeah, once I reverted to the very last backup that I managed to save before jack removes it, just before the big oopsie. no more problems after that, after I realized the positional switch thingy, and -log now works.
You must be logged in to post a response.