Staredit Network > Forums > SC1 UMS Theory and Ideas > Topic: An essay on abstract nonsense...
An essay on abstract nonsense...
Mar 5 2009, 1:42 pm
By: Wormer  

Mar 5 2009, 1:42 pm Wormer Post #1



An essay on abstract nonsense of wishfull thinking about utopian trigger editor.

I am totally taken up with an idea of an *ideal* trigger editor. What are one's expectations? What features are must for such an editor? Lets turn our imagination on. I want to share my thoughts and will imagine a trigger editor being a part of my favorite maps editor SCMD.

We are pushing mapmaking to the limit, aren't we? But when it comes to triggering one impacts considerable problems having their beginning in big amounts of information he is dealing with. As a result it is hard to manage and edit all that information.

Firstly, there are fierce indignations levelled at the lack of ability to organise triggers well. One can think of organising triggers using comments, the problem is comments eat up precious map resources, the string limit in particular. People want to organise their triggers without using up strings. Trigger comments are kind of external meta-information about triggers which is used throughout development process only. Moreover one can think of more complex ways of organising triggers unlike simple textual identification. One may wish to divide triggers on logical groups performing logically atomic task. Ususlly these groups are just solid blocks of triggers simply following one another, but there are cases when totally diversed triggers can make up a group and one trigger may be part of different groups. One may want to observe and manage these groups seperately. This is the place where now fashionable idea of labels or tags come in handly.

Since talk is considering trigger organization I should mention one more thing: naming objects. Let's take me for example. Sometimes I do want to use *different* names for the same objects. The reason I'm thinking of this object differently in several cases. Let's take a Terran Marine. Terran Marine is a unit, but I am using it as a death counter timer for players in my map and want to refer to him accordingly. Also I am using deaths of Terran Marine as a counter which holds progress of players for a computer, so I want to refer to him as a progress counter in this way. You can see that Terran Marine plays logically different roles and I dont want to mix them up. Moreover I might probably wish to change the timer death counter unit for players later, keeping the Terran Marine for the progress counter for computer. I can easily do this with global substitution (or something) when I have different names for logically diversed Terran Marine occurances.

The same thing concerns conditions and actions too. The most vidid example here might be EUD conditions. I wish to refer to an obscure EUD condition
Deaths(Player2, Exactly, 256, UnitID:1061) as to self explanatory EUDKeyPressedA(). Moreover when I want to check value at some adress I dont wish to calculate extended player value, but simply input the addres here like EUDCond1161(0x596A58, Exactly, 256). These are only EUD examples but I might want to mark out non EUD triggers as well. For example give self explanatory names for triggers working with my personal death counters like MyTimer(Add, 10), where 10 is not number of trigger loops but just time in game seconds.

Secondly, people have always invented tools to reduce the amount of tedious work. What I mean is that one may have a pattern of thousand triggers in his head but implementing all of those one by one is not a work for a white man. My imaginable trigger editor should contain abilities for easy triggers replication following one or another pattern the person might think of.

It becomes obvious all this meta information about triggers organisation should be stored somewhere. Of course, this might be a separate binary file which can be read only by the trigger editor program, but I have another solution. As far as SC map is actualy an MPQ archive we can store this info as a separate file inside of the map. One cant find a better place as the map itself! This file should be a text file written on a special language which allows to specify everything I discussed before. The file can be found inside MPQ for example: "\scmd\scenario.trigger".

The language should be designed the way to allow easy triggering for new users but also should give an opportunity for experienced mappers to specify advanced triggers. This could be achieved the next way: the language should allow to refer to the raw conditions and actions data of chk format specified in the wiki. It's *native* conditions and actions have the following form:
Code
RawCondition(dword, dword, dword, word, byte, byte, byte, byte,  byte, byte)
RawAction(dword, dword, dword, dword, dword, dword, word, byte, byte, byte,  byte, byte, byte)

But it's not handy to use them in that form. To achieve useability one can define new conditions and actions in some kind of *header files* stored along with the main triggers in the map's archive. There might be some kind of *standart* library with definitions of some standart triggers for new users. The best way to explain is to show an example of how it might work:
Code
enum Unit { TerranMarine, ZergZergling, ProtossZealot, ... }
enum Player {
    Player1 = 0, Player2, Player3, Player4, Player5, Player6, Player7, Player8,
    Player9, Player10, Player11, P12, Neutral = P12, ... }
enum NComp { AtLeast, AtMost, Exactly = 10 }

long offset1161 = 0x58A364
Location lHomeArea = 13

define RawCondition(dw1, dw2, dw3, w, b1, b2, b3, b4,  ub5, ub6) Condition(dw1, dw2, dw3, w, b1, b2, b3, b4)
define RawAction(dw1, dw2, dw3, dw4, dw5, dw6, w, b1, b2, b3,  ub4, ub5, ub6) Action(dw1, dw2, dw3, dw4, dw5, dw6, w, b1, b2, b3)

define Condition(0, 0, 0, 0, 0, 22, 0, 0) Always()
define Condition(0, p, qn, ut, c, 15, 0, 0) Deaths(Player p, NComp cmp, TUnit ut, long qn)

define Deaths((Player)(adress - offset1161)/4, cmp, 0, n) EUDCond1161(long adress, NComp cmp, long n)
define EUDCond1161(0x596A58, Exactly, 256) EUDKeyPressedA()

define Action(0, SID(text), 0, 0, 0, 0, u, 20, 0, 0) LeaderBoardKills(String text, Unit u)
define LeaderBoardKills(text, (Unit)(u+228)) LeaderBoardDeaths(String text, Unit u)

define Action(l, 0, 0, 0, p, s, u, 11, n, 0x08) CreateUnitWithProperties(Player p, Unit u, byte n, Location l, CUWPSlot s)
define CreateUnitWithProperties(p, u, n, l, s) CUWP(Player p, Unit u, byte n, LocationID l, CUWPSlot s)

Trigger {
Tags: "micro" "mysys"
Owners: Player1 Player11 Force2
Conditions:
    Alwyays()
Actions:
    CUWP(CurrentPlayer, TerranMarine, 12, LID("Home Area"), S16)
    PreserveTrigger()
}


I have not finally came up with a finished idea how this is working, but it seems that main features have already went into my head. Well actually I've not written even a half of what I have in my head. There is just too much to write! What I've written is just the main ideas. The idea is this is not a finished essay! You all can participate! I want to hear your opinions! Please tell me how do you like it, write your thoughts, suggestions, expectations! Let's imaginate together, who knows, probably some day this will become a reality!

Post has been edited 2 time(s), last time on Mar 5 2009, 2:03 pm by Wormer.



Some.

Mar 5 2009, 9:40 pm O)FaRTy1billion[MM] Post #2

👻 👾 👽 💪

Macros would be win. Assign a label with arguments to a bunch of code...


I started an editor...


;o
Concept trigger "editor" I made. All values are inside a txt file that is parsed. You could completely overhaul the entire format with minimal effort.

About it:
Rather than using specific text values, I've just assigned a list of labels that replace specific values. You could put 0 or "Terran Marine" and they would be interpreted as the same thing. Any label will have quotes, unlike SCMD, which is just terrible with that (I could not tell you what goes in quotes and what doesn't).
I haven't made it export a whole list of triggers, though.

Post has been edited 3 time(s), last time on Mar 5 2009, 9:46 pm by FaRTy1billion.



TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
MapSketch - New image->map generator!
EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
\:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

Mar 6 2009, 6:36 am Wormer Post #3



Farty, how are you going to store these triggers? Or are you going to reverse engineer triggers and generate new text (like SCMD does) every time one loads the map? How are you going to store comments and other custom text formatting in the last case?

You know, I am more interested in the underlying *language* design itself than an editor superficial appearance.

EDIT:
By the way, when I hear "macros" I usually think of initial text preprocessing with a macro processor which makes nessesary textual substitutions everywhere (even in comments) before it passed to the main parser. Are your "labels" working in the same way? Is there a way to specify my own "labels" for a particular map and use them along with standart ones. Can I somehow attach my own "labels" specification to the map? Is it possible to define aliases of the same value (I mean differently named "labels" which substituted to one value)? How do you plan to solve problems with reverse engineering an information about aliased "labels" from raw triggers data?

Are your actions and conditions typified? For example, player in raw actions data has a long type (4 bytes), but a unit ID is an integer (2 bytes). What happens in case user provided a long value for an integer type? Is there a way to specify expressions as parameters? Looking at the picture I can suppose there might be such possibility because you've specified: "Always Display" | "Unit Type Used", but reverse engineering triggers with arbitrary expressions will loose all information about an expression (exept some particular cases like bit fileds).

Are you planning an option for a user to name actions and conditions, like he does a naming for integer values ("labels")? If yes, how are you going to solve reverse engineering problem in this case.

I am asking because such meta information which is not included in compiled triggers raw data is extremely usefull for organizing triggers.

Post has been edited 2 time(s), last time on Mar 6 2009, 11:13 am by Wormer.



Some.

Mar 6 2009, 5:53 pm O)FaRTy1billion[MM] Post #4

👻 👾 👽 💪

This thing doesn't do more than just viewing a .trg file... It was just a conceptual parser I made one day. A true application of this would probably either have a similar interface plus the ability to export everything to a .txt file of sorts. If you edit in a txt file you could always just recompile and not have to regenerate the data... If it were put into an actual editor, it could store some metadata that gets removed in some sort of "finilazation" function.
(Though this was useful for checking triggers I made for TrigPlug... I modified the data file to parse them.)

Quote from Wormer
You know, I am more interested in the underlying *language* design itself than an editor superficial appearance.
That's what I was showing. ;o I like the idea of having labels = values, so you can use specific values in their place.

Quote
Are you planning an option for a user to name actions and conditions, like he does a naming for integer values ("labels")? If yes, how are you going to solve reverse engineering problem in this case.
[attach=3070]

All labels are defined in data\Values.txt with specific formatting... Stuff like:
Code
# ...
Modifier=At Least;At Most;Set;Cleared;Enable;Disable;Toggle;Set To;Add;Subtract;Exactly;Randomize
Switch.count:Modifier=Set:4;Clear:5;Toggle:6;Randomize:11
# ...

The .txt file includes instructions on how to edit and format it. ;o

Action/Condition format strings are formatted in a similar/same way as other lables.. (and even in the same file)
Condition.cond=stuff
Example:
CountdownTimer(Number Seconds, Modifier Comparison, Flags Flags);
(I'd post a whole section, but that is a bit large. :P)

... Briefings aren't that large. Here is an example:
Code
Briefing=NoAction(Flags);Wait(Time Time, Flags);PlayWAV(WAV WAV, Time Time, Flags);TextMessage(Text Text, Time Time, Flags);MissionObjectives(Text Text, Flags);ShowPortrait(Type:Unit Unit, Player:Portrait Slot, Flags);HidePortrait(Player:Portrait Slot, Flags);SpeakingPortrait(Player:Portrait Slot, Time Time, Flags);Transmission(Player:Portrait Slot, WAV WAV, Modifier TimeModifier, Time Time, Text Text, Flags)


I've assigned each value of an action/condition structure with a name, so the first word (e.g. "Number") is the value (and label set, which can have :value after it to use a different label set (e.g. "Type:Unit", it is stored in the Type field but uses the Unit label set) and the second word (e.g. "Seconds") is just a name for that argument.

Attachments:
TriggerLabelView.png
Hits: 0 Size: 17.18kb

Post has been edited 11 time(s), last time on Mar 6 2009, 6:20 pm by FaRTy1billion.



TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
MapSketch - New image->map generator!
EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
\:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:53 am]
Ultraviolet -- :lol:
[06:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[06:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[06:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[06:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[06:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
[06:48 pm]
Vrael -- Perhaps that utilizes cutting-edge technology and eco-friendly cleaning products?
[06:47 pm]
Vrael -- Do you know anyone with a deep understanding of the unique characteristics of your carpets, ensuring they receive the specialized care they deserve?
[06:45 pm]
NudeRaider -- Vrael
Vrael shouted: I've also recently becoming interested in Carpet Cleaning, but I'd like to find someone with a reputation for unparalleled quality and attention to detail.
beats me, but I'd make sure to pick the epitome of excellence and nothing less.
[06:41 pm]
Vrael -- It seems like I may need Introductions to multiple companies for the Topics that I care deeply about, even as early as Today, 6:03 am.
Please log in to shout.


Members Online: Wing Zero, Roy