tdauth / tenet

Tenet-style prototype map for Warcraft III: Reforged
0 stars 0 forks source link

Improvement of concept and features #1

Open tdauth opened 3 years ago

tdauth commented 3 years ago

Concept:

Missing features of time inversion:

Optimizing the time line updates:

Custom models:

tdauth commented 3 years ago

Some example code on the change events:

interface ChangeEvent
    public method isDifferent takes ChangeEvent changeEvent returns boolean
    public method onChange takes nothing returns nothing
    public method restore takes nothing returns nothing
endinterface

struct ChangeEventUnit extends ChangeEvent
    private unit whichUnit

    public method getUnit takes nothing returns unit
        return whichUnit
    endmethod

    public stub method onChange takes nothing returns nothing
    endmethod

    public stub method restore takes nothing returns nothing
    endmethod
endstruct

struct ChangeEventUnitPosition extends ChangeEventUnit
    private real x
    private real y

    public stub method onChange takes nothing returns nothing
        set this.x = GetUnitX(this.getUnit())
        set this.y = GetUnitX(this.getUnit())
    endmethod

    public stub method restore takes nothing returns nothing
        call SetUnitX(getUnit(), this.x)
        call SetUnitY(getUnit(), this.y)
    endmethod

endstruct

struct ChangeEventUnitFacing extends ChangeEventUnit
    private real facing

    public stub method onChange takes nothing returns nothing
        set this.facing = GetUnitFacing(this.getUnit())
    endmethod

    public stub method restore takes nothing returns nothing
        call SetUnitFacing(this.getUnit(), this.facing)
    endmethod

endstruct

struct ChangeEventUnitHp extends ChangeEventUnit
    private real hp

    public stub method onChange takes nothing returns nothing
        set this.hp = GetUnitLife(this.getUnit())
    endmethod

    public stub method restore takes nothing returns nothing
        call SetUnitLife(this.getUnit())
    endmethod

endstruct

struct ChangeEventUnitMana extends ChangeEventUnit
    private real mana

    public stub method onChange takes nothing returns nothing
        set this.mana = GetUnitMana(this.getUnit())
    endmethod

    public stub method restore takes nothing returns nothing
        call SetUnitMana(this.getUnit())
    endmethod

endstruct

struct ChangeEventUnitDeath extends ChangeEventUnit

    public stub method onChange takes nothing returns nothing
        call KillUnit(this.getUnit())
    endmethod

    public stub method restore takes nothing returns nothing
        // TODO ressurrect with dummy spell
    endmethod

endstruct

struct TimeFrame
    ChangeEvent array changeEvents[100]
    integer latestChangeEventIndex

    public method onChange takes nothing returns nothing
        local integer i = 0
        loop
            exitwhen (i == latestChangeEventIndex)
            call this.changeEvents[i].onChange()
            set i = i + 1
        endloop
    endmethod

    public method restore takes nothing returns nothing
        local integer i = 0
        loop
            exitwhen (i == latestChangeEventIndex)
            call this.changeEvents[i].restore()
            set i = i + 1
        endloop
    endmethod

    public method addChangeEvent takes ChangeEvent changeEvent returns integer
        call this.changeEvents[this.latestChangeEventIndex] = changeEvent
        set this.latestChangeEventIndex = this.latestChangeEventIndex + 1
    endmethod

    public method update takes nothing returns nothing
        local integer i = 0
        loop
            exitwhen (i == 100)
            call this.changeEvents[i]
            set i = i + 1
        endloop
    endmethod

endstruct

// TODO get unit orders and store events until they stop or die

function TriggerFunctionOrderStop takes nothing returns nothing
    call GroupRemove(movingUnits, GetTriggerUnit()
endfunction

function TriggerFunctionOrderMove takes nothing returns nothing
    call GroupAdd(movingUnits, GetTriggerUnit()
endfunction
tdauth commented 3 years ago

Most of the changes are done:

Missing invert stuff:

Concept of changing events of an inverted object:

tdauth commented 3 years ago

Further thoughts on interactions with inverted objects: When an inverted unit walks over a landmine it would mean in the movie that the landmine has exploded before and now should see the explosion in reverse. This is because events in the movie have already happened from the perspective of inverted objects but will still happen from the perspective on non-inverted objects.

In our map one can change events, so it is possible to kill/destroy inverted objects and to change their timeline. This allows more interesting scenarios. You can kill inverted units and prevent their actions by placing mines on their predefined path.