[REL/WIP] rEventHandler - A PA engine process event framework

Discussion in 'Mod Discussions' started by elmauru, March 13, 2014.

  1. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I don't want to stop you from doing stuff, don't worry. Just trying to understand if this can help me with the stuff I do :)
    thetrophysystem likes this.
  2. masterdigital

    masterdigital Uber Alumni

    Messages:
    438
    Likes Received:
    833
    Computed functions do buffer their results. The stored function will only be called if the observable inputs change. Running lots of scripts will slow down your game, so thinking about optimization is useful.
  3. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    This mod appears to be causing double dispatch of server_state events (at least) I'll investigate further after I patch Linger to ignore the second game_over state.
    zweistein000 likes this.
  4. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Looks like both the mods process_message and the common.js process_message are firing; I assume this applies to all engine events. Perhaps the Coherent version upgrade changed it from single dispatch to multi-dispatch? The upside is that now it should be a lot easier to make additional handlers without having to reproduce the game's own handler pipeline.
  5. elmauru

    elmauru Member

    Messages:
    46
    Likes Received:
    27
    might be, I think it could be the scene changes. I will take a look at this. Need to shovel in an update anyway
  6. elmauru

    elmauru Member

    Messages:
    46
    Likes Received:
    27
    Ok, i think i figured it out- it does not duplicate handlers before the end of live_game it seems,*. I will fix this in the next update.

    *nvm, turns out to be more annoying than that

    ** this is fixed now
    Last edited: April 16, 2014
  7. chrisjshull

    chrisjshull Member

    Messages:
    68
    Likes Received:
    38
    This mod (v1.2) makes the chat box never close on 68331.
  8. sleepykid12

    sleepykid12 New Member

    Messages:
    28
    Likes Received:
    9
    Yeah, if you have the mod enabled the chat box won't close which means you have to use the task manager to close the program. It is pretty annoying.
  9. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    I think it was ko deferred keeping the chat box open but for me I can press enter to tell it to close and then it disappears when I drag the map around.
  10. LmalukoBR

    LmalukoBR Well-Known Member

    Messages:
    327
    Likes Received:
    278
    This mod seems to be broken i have the exact same problem.
  11. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    Please consider depatching callbacks with a timeout to allow for rescheduling.

    E.g.:
    PHP:
    // Looks like this now
    callback(payload);
    // But should look more like this
    setTimeout(function() {
        
    callback(payload);
    }, 
    0);
    Why? Because that way you make sure to return control ASAP. Don't worry about overhead, the JS event queue is specifically designed for doing such a thing. Also allows Uber to tweak the priorities if they should ever feel like messing with the event queues of the JS engine used.

    I *think* Coherent might even be so smart to prioritize mouse and keyboard events over user generated events by default which is just what you want as it keeps the system responsive for critical, synchronous tasks, but I'm not positive about that.
  12. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    You'd horribly break quite a lot of code by that kind of thing.
    thetrophysystem likes this.
  13. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    Just made a pull on the repo, fixed a bunch of syntax errors. If its gona be a standard, it should be a good one :)


    Sidenote:
    Think about not using
    Code:
    with(foo){}
    This is generally considered bad practice. I would instead just do
    Code:
    var self = this;
    self.foo(baz).bar(bek);
    So pretty much use 'var self = this;' instead. It also seams to be the standard in the PA files so maybe follow that for consistency

    If it seams like I'm just picking on it, I'm not. I'm just trying to be helpful.
    Last edited: August 7, 2014

Share This Page