Schoening : I suppose that when you say "Why is it that these things are best done with plugins that use straight up Javascript instead of using Construct2 directly?", you mean for example doing the Pathfinding with events inside C2.
As a plugin maker, I can explain some reasons, perhaps Ashley is going to add a few things.
- C2 is in fact a big game framework, and leike every game framework, you have a main gameLoop(), which contains the various events, and that one is run at each step, 60 times per seconds (in C2, those are the events listed inside the editor, that you add with the mouse).
- when you use events, you need to conform to C2's mode of working, which is event-based (a paradigm of programming, you can also see reactive programming in the litterature).
- some algorithm are easier dealt with a functionnal or modal way of developping (something you can do with Javascript, C/C++, Java, etc...)
- Ashley has baked a lot of checks, memory reuse, smart tricks and the like inside C2's engine. That means that every event you add inside the loop in the editor is going to be efficient regarding the use of graphics, sounds, browser access, memory, etc... However, in a plugin, you often deal with pure mathematic problem (like crawling a graph => pathfinding, face recognition => decisions trees, etc...). Those "mathematical" problems doesn't need all teh tools and gear needed for media handling that C2 provide, but they pass them anyway if you use events.
- So if you have a JS plugin, you can defer small specialized work to a small JS function, that bypass C2 workline, or in some case (webworkers and all that) can execute parallel to C2's main thread.
TL;DR : C2 handle all the gamefield that you can leverage in a JS plugin where you concentrate on only a small problem, helping you being faster in that particular case.