1
Hellos and Byes / Hey mates

While I don't think I'll be using Sphere for anything for a while, it's interesting to follow the development of the Sphere-compatible engines.
Community for the Sphere game engineThis section allows you to view all Show Posts made by this member. Note that you can only see Show Posts made in areas you currently have access to.

I was speaking of adding server-client type facilities that specifically address multiple games running in one instance. I'm just going to leave it be, one game per engine instance, for the foreseeable future.
It's true that it does happen (I do the same thing, testing server-client functions without worrying about the network, using two machines, etc.). But having two games share the same backend (more like how a web browser works) would be tremendously complicated. Simple in theory--but it would be a LOT of work to implement, and would cause at least some overhead when only one game is running.
Running two instances of the engine at once is still quite possible, though. That should always be possible.

Considering a debugger, it would be fairly simple to make a rudimentary piping plugin for TurboSphere that would let a second instance examine the JS stack on another instance.
But V8 already has GDB debugging integration. Or so they say--TurboSphere is always distributed with a V8 library that has that enabled. But there is, as with almost everything Google does, no documentation on how it works or how to use it.

Yeah, my library is a pain to add things on to it. It's very "class heavy" - like how compilers are written. So adding a new feature means adding a lot of little stuff, most of which is boilerplate stuff that I can't seem to get rid of effectively.
For.prototype.add = function (num) {
this.nodes.push(new AddNode(num))
return this
}
function AddNode(num) { this.num = num }
AddNode.prototype.compile = function () {
return 'a+=' + this.num + ';'
}
For([1, 2, 3]).add(1).toArray() // [2, 3, 4]For.addFilter('even', function (element) { return element % 2 == 0 })
For.addMapper('add', function (element, index, amount) { return element + amount })
For.addEvaluator('sum', function (accumulator, element) { return accumulator + element })
For.range(10).even().add(5).sum() // 45
The above is how 80% of the library is implemented; which is why you can see how it is so fast. It runs at nearly the speed of traversing your standard every-day link list. That's the whole secret. I really want to expand to a binary tree, but such a format is not always easy to use when given an already linear array, but my hope would be to add binary searching to it - crazy stuff for a 0.3.0 release someday in the future.

Also, brony alert! (Bronies are cool, I bear no ill will against them)

Huh, I thought it was called For.js because, when I read it, it reads as 'forges'.
It was named because it was intended to allowed you to write for loops with a higher-level syntax, but really it just became a faster clone of Lazy.js with a completely different implementation and some cool features.
alpha123: There already exists a library called lo-dash (a pun on Underscore), naming it Dash might imply a nonexistent connection and confuse people. I'm thinking that might be why Radnen chose not to use it.

Sure. Link is only very fast in Chrome, it is fast (faster than Lazy) in other browsers, but I don't think it's a universal solution. In Sphere it's not all that great (esp. on small arrays), so I've been using a different code called 'List.js' for arrays where I do one thing to it, and Link if I need to do more than one thing.
Well yeah, that was true (and still is), I don't really like the name Dash. It's basically just a pun on all the other similarly named libraries with no real meaning of its own other than "this is fast"--which is useful info, but not really the #1 priority with a library like this. Otherwise you'd just roll your own for loops! :-).

Hence the original name For.js, but I decided that it wasn’t the greatest idea to name a library after its implementation (which is subject to change; I’m not sure generating for loops at runtime is the best choice in some circumstances).
) It’s getting pretty close to having a full API; it’s not nearly as comprehensive as Link’s yet, but one of its main features is that it’s fairly easy to extend.
Link(array1).zip(array2).each(function ([a, b]) {
// do whatever
})
Do you have a link for json2.js?
Alpha123: I had the exact same idea, but then I realized how much trouble it would be to create a feature complete thing like Lazy. Also, it's kinda like cheating.

My trick is to back out of execution when you no longer need it.
It has, after all far more optimization potential, but at the expense of a lot of creator-struggle.
Oh, and in Sphere Query2 at least works, but it is flawed: Sphere's JS has bad stack-frame performance, so much so it can be worse that Query at times. So a for-loop generator like yours is perhaps the only best option. But in a good environment like Chrome, it's starting to be clear just how much faster than Lazy my code is by witnessing the speed gains from their more powerful stack frame handling.
function (s, l, b, p, f, a) {
for(;a=s[b],b<l;++b){if(a%2==0){a=a+1;a=a/3;if(Math.floor(a)==a){f(a,b)}}
}