Author Topic: blocklandjs  (Read 4775 times)

blocklandjs is back
(after like three rewrites lmfao)
features in this rework:
  • a full tcp stack
  • an event loop that'll use 30% of your cpu if you don't let it sleep every millisecond
  • es6 modules... a feature not even node.js supports natively (you have to enable it through a stupid flag lol)
  • a libuv implementation that'll knock your socks off (asynchronously)
  • the best god damned bridge between torquescript and javascript you've ever seen
  • comes with your own 14 year old asian as your little tech support man
  • it's pretty darn fast
  • asynchronous filesystem operations, binary i/o is supported

"alright i'm convinced, how do i download this?"
get the latest release here
"how can i trust you haven't backdoored this dll"
really you can't but if you don't trust the dlls i put out, i provide the libraries and the project file to compile it yourself, get them here
"where's the documentation"
here
"why can't i use require like node.js"
use this code instead
Code: [Select]
import('ModuleName').then((mod) => {ModuleName = mod;});
"how the hell do i install modules"
throw them in a folder in your addons, and name the entry point or main file index.js
"why don't you provide classes that do everything for me"
because i don't believe in the weed that the node.js developers were smoking when they decided that evalling about 50 modules worth of code upon startup was a good idea, as well as the principal of NIH.
"i found an issue how the hell do i report it"
make a new issue here
"but why"
because torquescript is really slow and i don't like the syntax of it (i haven't used torquescript for like a year)


download: here

example projects i've done so far: sorta functioning http server

« Last Edit: March 06, 2018, 02:06:31 AM by Metario »

« Last Edit: March 06, 2018, 02:06:48 AM by Metario »

Super cool, excited to see what all this will be used for. Have a bunch of ideas popping around.

Super cool, excited to see what all this will be used for. Have a bunch of ideas popping around.
you could actually expose all of the json stuff from v8 and expose it to torquescript
and have a faster json parser then jettison :o

fun fact: you can rewrite a lot of engine functions too to be faster - note that this dll isnt to obviously cause problems with the game (making stuff worse), its to expand those functions to do more than what we want

i remember i rewrote some functions just for infinite mining script to be much faster, but i never publicly tested this mode sadly in javascript - now that this javascript dll is much stable than last time i probably could make a mod entirely in javascript



Any ideas on what I should make as a first javascript BL add-on?
« Last Edit: February 19, 2018, 10:29:17 PM by Kyuande »


wuts next? bullet.js for blockland????????????????????????????

Imagine making new physics in bljs....

Imagine making new physics in bljs....
1. would be pain in the ass, 2. would be buggy in the ass, 3. nah too much work in the ass

Kyunde make asynchronous brick loading/saving (It might already be but I never bothered to research whether it's single thread)
« Last Edit: February 21, 2018, 10:58:37 AM by PhantOS »

Kyunde make asynchronous brick loading/saving (It might already be but I never bothered to research whether it's single thread)
it's not asynch seeing as it's using torkscript
you could do this alot faster with bljs's libuv implementation as it provides an asynchronous file writing/reading part: see http://blocklandjs.readthedocs.io/en/latest/JavaScript/libuv/fs.html#uv.fs.read

it'll spawn a new thread so the game and the engine will not be stuck on writing the file out
« Last Edit: February 21, 2018, 12:17:43 PM by Metario »

I would recommend that you create a threadpool which keep the threads alive and then send the action to the pool which puts it into a thread. This makes it possible to stack work without having way too many threads launched. Also keep in mind to copy over all data that is used in current thread to make sure it is not altered. This means that it will slow the process a bit if the data is huge(Mentioned below).

Also, as you say that reading is asynchronous, but how would writing work? Saving parts of a file? Saving the whole file as one big string?

I would recommend that you create a threadpool which keep the threads alive and then send the action to the pool which puts it into a thread. This makes it possible to stack work without having way too many threads launched. Also keep in mind to copy over all data that is used in current thread to make sure it is not altered. This means that it will slow the process a bit if the data is huge(Mentioned below).

Also, as you say that reading is asynchronous, but how would writing work? Saving parts of a file? Saving the whole file as one big string?
http://docs.libuv.org/en/v1.x/threadpool.html
libuv already does this internally- no need to worry about it.

Writing can be done sequentially, or as a one-shot method. The offset method can be used to write onto the end of files (or just using the append flag)

Imagine remaking the event system using bljs, would make stuff much faster

You'd probably be able to raise the too many events quota extremely high