builder
quickjs-emscripten
builder | quickjs-emscripten | |
---|---|---|
23 | 21 | |
541 | 1,130 | |
0.7% | - | |
7.1 | 9.4 | |
27 days ago | 23 days ago | |
Handlebars | TypeScript | |
MIT License | GNU General Public License v3.0 or later |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
builder
-
Official Stormgate Gameplay Reveal AMA Thread with Frost Giant Studios
We have a partnership with Hathora (https://hathora.dev/) so that our infrastructure can scale globally with high performance so we can provide the best user experience possible despite the realities of playing games over the internet. We also have some big plans around using rollback that we've covered elsewhere that we're cautiously optimistic about.
-
Game Development Resources for Intermediate Developers
For multiplayer/server-less games, try Hathora
-
Show HN: Building an infinitely scalable multiplayer game
I cofounded Hathora (https://hathora.dev/) last year and we've been working on making it easier for smaller teams and individual developers to build scalable multiplayer games. We think the serverless model is the simplest approach, allowing you to dynamically provision a new instance of your game server when users or your matchmaker requests a new session.
We made this .io style demo to showcase this approach, and we're releasing the source code and documentation alongside with it.
-
Multiplayer hosting and scaling
Hey I'm the creator of https://hathora.dev/ which aims to provide a super simple deployment and scaling experience for session-based games. It's based on containers and can deploy any kind of game server. Check it out and see if it meets your needs!
- Hathora: Serverless cloud platform for multiplayer games
-
Scalable WebSocket Architecture
At Hathora, our mission is to make it easier for developers to build, launch, and scale multiplayer games. One of the core technologies we have built is the Hathora Coordinator, which is our fully managed multi-tenant implementation of a Stateful Router.
-
Ask HN: Any solo game developers here?
Hi there! I started a company this year focused on multiplayer server infrastructure. We also built a multiplayer game framework for Typescript that has gotten 400+ stars on Github in the past few months: https://github.com/hathora/hathora
Would love to connect and exchange notes about multiplayer development -- if you're interested, my email is on my profile.
- Ask HN: What stack for a multiplayer board game?
-
How Do Video Games Stay in Sync? An Intro to the Fascinating Networking O (Cont)
I've been working on my own realtime networking engine[0] and I think there are a few important points related to network syncing that are not mentioned in this article:
1) Bandwidth. The users internet can only handle so much network throughput, so for fast paced games (where you're sending data to each client at a rate of 20+ frames per second) it becomes important to optimize your per-frame packet size. This means using techniques like binary encoding and delta compression (only send diffs).
2) Server infrastructure. For client-server games, latency is going to be a function of server placement. If you only have a single server that is deployed in us-east and a bunch of users want to play with each other in Australia, their experience is going to suffer massively. Ideally you want a global network of servers and try to route users to their closest server.
3) TCP vs UDP. Packet loss is a very real problem, and you don't want clients to be stuck waiting for old packets to be resent to them when they already have the latest data. UDP makes a major difference in gameplay when dealing with lossy networks.
[0] https://github.com/hathora/hathora
-
Do you want or plan to make a multiplayer game? What is stopping you?
I built a bunch of multiplayer games in the past and am now working on a framework to try and make it easier for others to do so: https://github.com/hathora/hathora
quickjs-emscripten
-
New QuickJS Release
Based on your comment below I think you figured out the difference - but if you're looking to execute JS, you can pick between ShadowRealm (where available, or using a polyfill) or my library quickjs-emscripten.
Pros of quickjs-emscripten over ShadowRealm:
- You can use quickjs today in any browser with WASM. ShadowRealm isn't available yet, and polyfills have had security issues in the past. See https://www.figma.com/blog/an-update-on-plugin-security/
- In ShadowRealm eval, untrusted code can consume arbitrary CPU cycles. With QuickJS, you can control the CPU time used during an `eval` using an [interrupt handler] that's called periodically during the eval.
- In ShadowRealm eval, untrusted code can allocate arbitrary amounts of memory. With QuickJS, you can control both the [stack size] and the [heap size] available inside the runtime.
- quickjs-emscripten can do interesting things with custom module loaders and facades that allow synchronous code inside the runtime to call async code on the host.
Pros of ShadowRealm over QuickJS:
- ShadowRealm will (presumably?) execute code using your native runtime, probably v8, JavaScriptCore, or SpiderMonkey. Quickjs is orders of magnitude slower than JIT'd javascript performance of v8 etc. It's also slower than v8/JSC's interpreters, although not by a huge amount. See [benchmarks] from 2019.
- You can easily call and pass values to ShadowRealm imported functions. Talking to quickjs-emscripten guest code requires a lot of fiddly and manual object building.
- Overall the quickjs(-emscripten) API is verbose, and requires manual memory management of references to values inside the quickjs runtime.
[interrupt handler]: https://github.com/justjake/quickjs-emscripten/blob/main/doc...
[stack size]: https://github.com/justjake/quickjs-emscripten/blob/main/doc...
[heap size]: https://github.com/justjake/quickjs-emscripten/blob/main/doc...
[benchmarks]: https://bellard.org/quickjs/bench.html
-
Extism Makes WebAssembly Easy
The thing I want to achieve with WebAssembly is still proving a lot harder than I had anticipated.
I want to be able to take strings of untrusted code provided by users and execute them in a safe sandbox.
I have all sorts of things I want this for - think custom templates for a web application, custom workflow automation scripts (Zapier-style), running transformations against JSON data.
When you're dealing with untrusted code you need a really robust sandbox. WebAssembly really should be that sandbox.
I'd like to support Python, JavaScript and maybe other languages too. I want to take a user-provided string of code in one of those languages and execute that in a sandbox with a strict limit on both memory usage and time taken (so I can't be crashed by a "while True" loop). If memory or time limit are exceeded, I want to get an exception which I can catch and return an error message to the user.
I've been exploring options for this for quite a while now. The furthest I've got was running Pyodide inside of Deno: https://til.simonwillison.net/deno/pyodide-sandbox
Surprisingly I've not found a good pattern for running a JavaScript interpreter in a WASM sandbox yet. https://github.com/justjake/quickjs-emscripten looks promising but I've not found the right recipe to call it from server-side Python or Deno yet.
Can Extism help with this? I'm confident I'm not the only person who's looking for a solution here!
-
Node on Web. Use Nodejs freely in your browser with Linux infrastructure.
"Safely execute untrusted Javascript in your Javascript, and execute synchronous code that uses async functions" quickjs-emscripten, NPM
-
Sandboxing JavaScript Code
This maybe, as a start?
https://github.com/justjake/quickjs-emscripten
-
Hacker News top posts: Nov 20, 2022
QuickJS Running in WebAssembly\ (17 comments)
-
QuickJS Running in WebAssembly
The library was inspired by Figma’s blog posts about their plug-in system: https://github.com/justjake/quickjs-emscripten#background
-
Show HN: Run unsafe user generated JavaScript in the browser
If you need to call into user-generated Javascript synchronously or have greater control over the sandbox environment, you can use WebAssembly to run a Javascript interpreter: https://github.com/justjake/quickjs-emscripten#quickjs-emscr...
QuickJS in WebAssembly is much slower than your browser's native Javascript runtime, but possibly faster than async calls using postMessage. As an added bonus, it can make async functions in the host appear to be synchronous inside the sandbox using asyncify: https://emscripten.org/docs/porting/asyncify.html.
-
Why Would Anyone Need JavaScript Generator Functions?
You can use One Weird Trick with generator functions to make your code "generic" over synchronicity. I use this technique to avoid needing to implement both sync and async versions of some functions in my quickjs-emscripten library.
The great part about this technique as a library author is that unlike choosing to use a Promise return type, this technique is invisible in my public API. I can write a function like `export function coolAlgorithm(getData: (request: I) => O | Promise): R | Promise`, and we get automatic performance improvement if the user's function happens to return synchronously, without mystery generator stuff showing up in the function signature.
Helper to make a function that can be either sync or async: https://github.com/justjake/quickjs-emscripten/blob/ff211447...
Uses: https://cs.github.com/justjake/quickjs-emscripten?q=yield*+l...
-
Why Am I Excited About WebAssembly?
This seems like a pretty nice, recently enabled way of getting a sandboxed js environment: QuickJS compiled to WASM: https://github.com/justjake/quickjs-emscripten.
What are some alternatives?
adama-lang - A headless spreadsheet document container service.
wasmtime - A fast and secure runtime for WebAssembly
nakama - Distributed server for social and realtime games and apps.
wasmer - 🚀 The leading Wasm Runtime supporting WASIX, WASI and Emscripten
Godot Card Game Framework - A framework which comes with prepared scenes and classes to kickstart your card game, as well as a powerful scripting engine to use to provide full rules enforcement.
wizer - The WebAssembly Pre-Initializer
gridia
rr - Record and Replay Framework
platelet - Dispatch system for emergency volunteer couriers.
go - The Go programming language
among-us-tutorial
iPlug2 - C++ Audio Plug-in Framework for desktop, mobile and web