Help - Search - Members - Calendar
Full Version: Results of Technical Contest #2
The Black Wyrm's Lair - Forums > Mod development resources & discussion > Modding Contests
Baronius
Technical Contest #2 has come to its end.

The winner is

Razfallow

He achieved the Technical Modding Cross. This award is given to those mod developers who proved their skills in a task of a technical contest of BWL. Razfallow can also choose a forum portrait from our gallery, and a custom subtitle.

Razfallow got 98 points from 100. When checking the solution, I focused only on the important things, and didn't examine minor details. The most important is that the creatures behave in the game according to the contest's specifications.

The 2 points he lost are because bwcc_m.baf contains the two script blocks in wrong order. The requirements say that the mage "casts Shield, and then he casts Melf’s Minute Meteors.", and not in reverse order.

On a side note, his cleric script solution had 14 blocks, with 126 "effective" lines (so newline characters, OR statements and IF-THEN-RESPONSE statements are excluded). The reference implementation has 13 blocks, with 70 "effective" lines.


Congratulations, Razfallow!

Razfallow
QUOTE
The 2 points he lost are because bwcc_m.baf contains the two script blocks in wrong order. The requirements say that the mage "casts Shield, and then he casts Melf’s Minute Meteors.", and not in reverse order.

Ups, that's pretty stupid of me. Next time I have to read requirements at least twice wink.gif

Could I see your reference implementation, please?
Baronius
Sure.
Razfallow
QUOTE
If he has been attacked by an enemy in the last script round and his hit points
are below 60%, he casts Draw Upon Holy Might (he has one memorized
instance). If he fails to cast Draw Upon Holy Might, he casts Spiritual
Hammer. If he has successfully received the hammer, a state transition happens
to S3.
CODE
IF
  Global("bwcc_clericState", "global", 0)
  !HaveSpell(CLERIC_DRAW_UPON_HOLY_MIGHT)
  !StateCheck(Myself,STATE_DRAWUPONHOLYMIGHT)
  HaveSpell(CLERIC_SPIRITUAL_HAMMER)
THEN
  RESPONSE #100
    Spell(Myself, CLERIC_SPIRITUAL_HAMMER)
END


This is almost correct, but cleric will cast Spiritual Hammer, even when he succesfully casts DUHM. He just needs to wait 10 rounds, and when the spell's effect wears off he will cast Spiritual Hammer.

QUOTE
If the Fighter is alive but has been attacked by fire at least 5 times so far and
Resist Fire/Cold hasn’t been cast yet, he casts Protection from Fire on the
Fighter, and will not cast Resist Fire/Cold any more. He has one memorized
instance of Protection from Fire. When Protection from Fire has been
(successfully or unsuccessfully) cast, the Cleric must immediately move to the
next, fourth check (to learn whether the Fighter needs to be cured from
Feeblemind). That is, instead of following the usual priority order (i.e. instead
of restarting from Step 1), the conditions of Step 4 must be evaluated.

CODE
IF
  Global("bwcc_clericState", "global", 0)
  HaveSpell(CLERIC_PROTECTION_FROM_FIRE)
  See("bwcc_f")
  GlobalGT("bwcc_fireCounter", "global", 4)
THEN
  RESPONSE #100
    Spell("bwcc_f", CLERIC_PROTECTION_FROM_FIRE)
    Continue()
END
IF
  GlobalLT("bwcc_clericState", "global", 2)
  HaveSpell(CLERIC_CURE_DISEASE)
  See("bwcc_f")
  StateCheck("bwcc_f", STATE_FEEBLEMINDED)
THEN
  RESPONSE #100
    Spell("bwcc_f", CLERIC_CURE_DISEASE)
END


This definetely doesn't work as is written in requirement, because it checks step 4 before cleric starts to cast Protection from Fire not after.

Actions from block with Contineu() are stored in action list and other blocks are evaluated to the end of a script or until some block (without Continue()) returns true then its actions are added to action list, and all actions stored in action list are executed.

(Same with State 2)
Baronius
QUOTE
This definetely doesn't work as is written in requirement, because it checks step 4 before cleric starts to cast Protection from Fire not after.
It isn't a big issue, but strictly speaking, in this case it means some unnoticeable difference in the game (even if it doesn't have any practical consequences for the tester/player).

Actually, this part of the specification didn't perfectly reflect the practical goal I tried to express, I have spoken about this with someone else as well. Strictly speaking, you're right with that. This is why I've written things (in the discussion in the announcement thread) such as this:
QUOTE
Although the requirement also includes "instead of restarting from Step 1", solutions which use a correctly handled global variable will also be accepted
and
QUOTE
[..]This also guarantees that the next character who the Cleric helps if needed will be the Fighter in all circumstances.


Consequently, the practical goal was supposed to be that the order of actually executed actions is fixed. That is, assume the Fighter has been attacked by fire at least 5 times so far (and Resist Fire/Cold hasn’t been cast yet), he is feedbleminded too, and the Cleric gets an attack while casting Protection from Fire. In this case, the practical goal was to ensure that the Cleric casts Cure Disease instead of trying to cast Draw Upon Holy Might. I tested it more times and it worked with the reference implementation as well as with your submission.

So in this case, I believe that the difference in the order of condition checks has only theoretical significance; the actions are added to the action list in the correct order even if the condition checks precede the execution of actions. So the sentence "when Protection from Fire has been (successfully or unsuccessfully) cast, the Cleric must immediately move to the next, fourth check" should actually end with "move to the next, fourth step", i.e. the next actions that are executed should be those in Step 4. But strictly speaking, your solution is more robust, precise for the current wording of the requirements in question.

It would be problem if the conditions included triggers with so-called side-effects (like an expression of array[++i] in programming) and the result of the side effects wouldn't be invariant. For example, instant triggers which immediately set certain variables, and thus might influence the behaviour of actions. Fortunately, this can't happen in this case, as far as I've noticed.

QUOTE
This is almost correct, but cleric will cast Spiritual Hammer, even when he succesfully casts DUHM. He just needs to wait 10 rounds, and when the spell's effect wears off he will cast Spiritual Hammer.
Good spot! Reference implementation deserves penalty points wink.gif A new block is needed and some lines, so it means one more block, +4 effective lines for the script altogeher. Of course, I noticed it has some other minor flaws as well (I made it in a short time), e.g. it checks all types of Spiritual Hammers in the inventory, despite the fact that the creature file for the contest is fixed (i.e. has constant level, unless the Cleric had a level-up before the battle tongue.gif Just kidding).

Nice work with the scripts, they seem to be robust and completely correct (apart from the negligible accident with the Mage).

By the way, I might have not mentioned it yet that you can send me a PM with your portrait choice / subtitle choice; I'll be online so I can quickly set them for you.
Sir-Kill
congrats Raz!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.