Skip to content

02. Initial setup

phu54321 edited this page Feb 10, 2018 · 5 revisions

Table of Contents generated with DocToc

In this chapter, we'll set up and create a basic euddraft map. The material used in this chapter can be downloaded here.

Terminologies of euddraft

euddraft is basically a scripting tool. It inserts some specially crafted triggers into a map. Note that programming constructs like if, while, and function pointers are implemented with EUD triggers, so scripts that are compiled with euddraft can be run directly in SC:R.

We need three components to create a map with euddraft. basemap, script, and euddraft itself.

  • basemap: Maps with everything except script. You can create the basemap with normal map editors like SCMDraft2.
  • script: Code that gets compiled to triggers. We'll insert these scripts to the basemap using euddraft. We'll use epScript as a scripting language.
  • euddraft: Script compiler.

Basic Basemap

Our basemap looks like this. Simple 8x8 chess plate, One location named 1x1.

basemap

Also, we've set unit names like these.

  • Terran Civilian → Pawn
  • Terran SCV → Rook
  • Terran Marine → Knight
  • Terran Medic → Bishop
  • Terran Ghost → King
  • Sarah Kerrigan → Queen

Our force settings looks like this

  • 1 player (P1), 5 observers(P2-P6), and 2 computer players(P7, P8)
  • P7, P8 owns white and black pieces.

Map settings

That's everything needed for now. Save the map as basemap.scx on 'chess' folder. Everything we'll do from now happens on this 'chess' folder. Later we'll also create chess.eds and main.eps. These additional files should also reside in this 'chess' folder.

First euddraft map

Every euddraft script can have three basic functions. onPluginStart, beforeTriggerExec, afterTriggerExec. You don't have to know everything right now, so I'll try to keep things simple. Right now, just remember that

  • Code inside onPluginStart gets executed only once.
  • Code inside afterTriggerExec gets executed every time other trigger runs.

We'll create a simple script that prints 'Hello World' every frame. Create main.eps file and put this code.

function afterTriggerExec() {
    DisplayText("Hello World!");
}

Next, we'll create a main.edd and put this code.

[main]
input: basemap.scx
output: chess.scx

[main.eps]
[eudTurbo]

Finally, associate .edd file with euddraft.exe you've extracted on the last chapter. See [https://support.microsoft.com/en-us/help/18539/windows-7-change-default-programs] for more info. Next, open main.edd. If you've followed the chapter correctly, you'll see a black screen with white texts, like this.

euddraft running screen

While this black backgrounded window is open, euddraft will check periodically whether the source file (main.eps, main.edd, basemap.scx, or anything in chess folder) have changed and will automatically recompile the map as needed.

After a while (1-10 seconds) you will hear a clear crystal(??) sound, and you will have 'chess.scx' inside chess folder. This is your output map. basemap with main.eps script compiled in. Try running that map in StarCraft. You'll see Hello World flooding like this.

Output map

Remember that the code inside afterTriggerExec gets executed every trigger loop? This means DisplayText action (Display Text Message, you know?) you wrote in main.eps gets executed every trigger loops. In this map our trigger loops every frame (0.042 seconds on fastest), so 'Hello World' is printed out every 0.042 seconds.

Main.edd

Congratulations! You've created the first euddraft map. Before closing this chapter we'll check what we've written in main.edd.

[main]
input: basemap.scx
output: chess.scx

[main.eps]
[eudTurbo]

edd file is short of 'euddraft daemon' files. daemon means something that runs indefinitely. If you haven't closed that main.edd screen yet, add a newline to main.edd and save it.

[main]
input: basemap.scx
output: chess.scx

[main.eps]

[eudTurbo]

Now euddraft daemon will recompile the map automatically. Daemons mean something that runs indefinitely and does something on events. Here euddraft daemon will recompile your map as you change any of the source files.

Back to the code. main.edd consists of three sections. [main] section, [main.eps] section, and [eudTurbo] section. [main] section tells euddraft what map to use as a basemap, and where to output its final product. Here main.edd says that we want to use 'basemap.scx' as an input basemap, and we'll output our generated map to 'chess.scx'.

Other sections like [main.eps] and [eudTurbo] means what script to put inside our chess.scx. We've apparently put main.eps script to the map, but what does [eudTurbo] mean? eudTurbo is a script that makes trigger loop every frame. The eudTurbo script is bundled with euddraft.

That's all for this chapter. See you in the next chapter!