[HN Gopher] Show HN: Unity like game editor running in pure WASM
___________________________________________________________________
Show HN: Unity like game editor running in pure WASM
In the wake of all the Unity nonsense, just wanted to toss the
Raverie engine into this mix :) We're building off a previous
engine that we worked on for DigiPen Institute of Technology called
the Zero Engine with a similar component based design architecture
to Unity. Our engine had a unique feature called Spaces: separate
worlds/levels that you can instantiate and run at the same time,
which became super useful for creating UI overlays using only game
objects, running multiple simulations, etc. The lighting and
rendering engine is scriptable, and the default deferred rendering
implementation is based on the Unreal physically based rendering
(PBR) approach. The physics engine was built from the ground up to
handle both 2D and 3D physics together. The scripting language was
also built in house to be a type safe language that binds to C++
objects and facilitates auto-complete (try it in editor!) This
particular fork by Raverie builds both the engine and editor to
WebAssembly using only clang without Emscripten. We love Emscripten
and in fact borrowed a tiny bit of exception code that we'd love to
see up-streamed into LLVM, however we wanted to create a pure WASM
binary without Emscripten bindings. We also love WASI too though we
already had our own in memory virtual file system, hence we don't
use the WASI imports. All WASM imports and exports needed to run
the engine are defined here: https://github.com/raverie-us/raverie-
engine/blob/main/Code/... The abstraction means that in the
future, porting to other platforms that can support a WASM runtime
should be trivial. It's our dream to be able to export a build of
your game to any platform, all from inside the browser. Our near
term road-map includes getting the sound engine integrated with
WebAudio, getting the script debugger working (currently freezes),
porting our networking engine to WebRTC and WebSockets, and getting
saving/loading from a database instead of browser local storage.
Our end goal is to use this engine to create an online Flash-like
hub for games that people can share and remix, akin to Scratch or
Tinkercad. https://github.com/raverie-us/raverie-engine
Author : TrevorSundberg
Score : 352 points
Date : 2023-09-26 17:58 UTC (5 hours ago)
(HTM) web link (raverie-us.github.io)
(TXT) w3m dump (raverie-us.github.io)
| araes wrote:
| I like the concept. My GPU and browser weep with lag. Its a very
| impressive slideshow.
|
| I finally managed to highlight the starting sphere after several
| tries. At first I wasn't sure if it was loaded.
|
| Of course, I'm only using a 1.8 GHz Celeron with onboard GPU and
| 8GB Ram in Firefox, so... not exactly high-end stuff.
| TrevorSundberg wrote:
| I'd be curious if it runs any better under Chrome. Seems a lot
| of people are hitting Firefox issues. I'll be sure to test
| Firefox regularly though.
| damon_c wrote:
| How do I add WASD controls to the camera?
| benkillin wrote:
| Why invent your own scripting language instead of using one of
| the infinity other existing languages?
| TrevorSundberg wrote:
| This project was made in 2012 when there weren't that many
| languages, especially not ones that bind to C/C++ (and we're
| type safe). LUA was the primary embeddable language back then,
| and C# wasn't even open source yet :)
| robotnikman wrote:
| Working great so far on Firefox!
| TiredGuy wrote:
| The Spaces feature reminds me of how Movie Clips were used in the
| old days of Macromedia Flash, where I'd put many different often-
| independently-running clips overlayed on top of each other to
| encapsulate different behavior. Of course Spaces sounds even more
| flexible. Very neat.
|
| I'm not seeing documentation linked in the readme or within the
| github project. Are there how-tos and tutorials anywhere?
| TrevorSundberg wrote:
| Not yet, the port is still a work in progress. For the old Zero
| docs you can go here:
|
| https://github.com/zeroengineteam/ZeroDocs
| GabeIsko wrote:
| Very cool! I can't seem to get the script editor open in the demo
| though.
| Ashwinning wrote:
| Holy wow, opened this on my phone and it was like unity editor
| was running on mobile with a smooth 3D viewport!
|
| Gotta give this a shot on desktop later.
| TrevorSundberg wrote:
| The mobile version needs a lot of work! But we'd love to
| support the full editor on phones eventually :P
| a2128 wrote:
| This looks great! Some feedback - I clicked on the link and tried
| to find out if it's on GitHub. I looked in Help > About but it
| didn't seem to have much. Then I clicked on Help > Documentation
| and it brought me to a 404
| TrevorSundberg wrote:
| Ah sorry about that, this is still a big work in progress. A
| lot of the old links have died so we're porting over things
| like documentation still. I'll add a back-link to the github!
| hnreport wrote:
| What's Digipen's stature now days?
| pathartl wrote:
| The summer workshops for HS students at DigiPen helped launch me
| into a programming career :)
|
| No experience with Zero, but when I did the workshop in 2008 we
| used the .NET-based engine. I forget the name of it and the
| backup I have is in a pile of unlabeled burnt CDs.
| adamrezich wrote:
| it was ProjectFUN, same name as the summer workshop program--I
| wish I still had a copy of it, or at least the game I made with
| it that same summer!
| pathartl wrote:
| It's sitting on some old drive somewhere. I'll probably do
| some digging at some point and put it on archive.org, if only
| for preservation.
| WatchDog wrote:
| Cool project.
|
| Is there any way to scale the UI for high dpi displays?
|
| On a 2:1 display, the fonts look aliased, if I set the browser
| zoom to 50%, the UI looks crisp, but everything is a bit small to
| be useful.
| iddan wrote:
| I fail to understand why not use the native browser rendering
| engine, or at least SVG for the UI. It must be cheaper in
| resources (memory, network, cpu), easier to make accessible and
| easier to render
| jjcm wrote:
| Anecdotally, in the very early days Figma rendered its UI
| entirely in canvas, but we eventually switched over to React
| for the UI. It ended up being far easier for development
| cycles and for accessibility/integration with existing
| browser features.
| solardev wrote:
| I thought you guys recently rewrote everything to be in
| WebGL instead?
| rileyphone wrote:
| Go inspect the source and see for yourself, the UI is
| normal HTML.
| pests wrote:
| I think their UI is react but the actual drawing canvas
| is WebGL.
| TrevorSundberg wrote:
| I always thought it was so cool Figma just rendered to a
| canvas! Oddly enough I ran into this at my previous job
| doing browser isolation when we got a bug report that Figma
| wasn't displaying properly in our browser.
|
| Makes sense to switch the rest of the UI to react though,
| just for how many people know it.
| TrevorSundberg wrote:
| The main reason was just because this engine was entirely
| built for native platforms originally in C++ (not for the
| Web). This is a port, hence why the UI is running in
| WASM/WebGL.
| Matheus28 wrote:
| To OP:
|
| The fix is setting canvas width to window.innerWidth *
| window.devicePixelRatio, and height to window.innerHeight *
| window.devicePixelRatio. Then use CSS to maximize the canvas on
| the screen.
| TrevorSundberg wrote:
| Thanks, I'll make the fix!
| pineapple_sauce wrote:
| DPI is not correct on MacOS
| TrevorSundberg wrote:
| Thanks for this info! I had a feeling that we weren't handling
| DPI scaling correctly, but don't have a Retina screen to test
| it on.
| CobrastanJorji wrote:
| How are Raverie spaces different from Unity scenes?
| TrevorSundberg wrote:
| To be honest I haven't spent much time in Unity. Back in the
| day you either had to parent objects to the camera to make UI,
| or use a completely different UI system. It sounds like now
| Unity scenes can be overlaid on top of each other, is that
| correct?
| icemelt8 wrote:
| It lags very slow on macbook m1 pro 14 inch chrome
| diogenes4 wrote:
| Tinkercad and scratch were never tied to a browser! Why go with
| wasm?
| TrevorSundberg wrote:
| I'm fairly certain the native version of Scratch is just a
| browser with Scratch running in a web view. I'd also mention
| that WASM isn't tied to a browser either (despite being called
| WebAssembly, it's now widely used outside of browsers). You can
| in fact make native executables now from a WASM binary.
| notpushkin wrote:
| Very slow load in Firefox - stuck on "Downloading Runtime". No
| error in console, and the .wasm file is stuck in the loading
| stage in the Network tab - a few minutes first time, 20 seconds
| now (with cache cleared). No such problems in Chromium. Weird!
|
| Overall though it's a cool project. Personally I would prefer if
| it was a desktop app as well (with better integrations and less
| overhead - and certainly with hi-res support!). Congrats on the
| launch!
| GabeIsko wrote:
| Worked fine for me in Firefox.
| notpushkin wrote:
| Probably some very flaky issue then. My current ISP isn't
| very reliable, although everything else seems to work fine
| right now.
| TrevorSundberg wrote:
| I haven't done a lot of testing with Firefox, I'll take a look!
| kaliqt wrote:
| So I take it that this would be the highest performing + most
| customizable engine for web deployment due to its deep WASM
| nature? What about rendering, does it use WebGPU?
| TrevorSundberg wrote:
| I'm sure there are higher performing engines out there, but it
| certainly should be easily deployed to any site. For rendering,
| this engine currently just uses WebGL. It was built on OpenGL
| originally (with a swappable renderer backend so we could
| target other 3d APIs). Eventually we may support WebGPU when
| support grows among the other browsers.
| meheleventyone wrote:
| Poking the code it looks like it's based on an OpenGL renderer
| translating to WebGL2.
| raytopia wrote:
| I'd guess Threejs or Babylonjs would be because they're web
| first but regardless super cool project!
| sansseriff wrote:
| This is hitting my gpu super hard (Radeon Pro 560X, near-4k) with
| just the default ball scene. Frame rates are dipping very low
| just orbiting around. Does anyone know if there could be a WebGL
| optimization issue?
| a_JIT_pie wrote:
| I'm getting a really nice smooth experience on my Intel HD
| Graphics 620 (7th gen intel integrated graphics, old and slow).
| Also just looking at the default ball scene, and I was really
| impressed how smooth it was on my system. I'm using chrome.
| meheleventyone wrote:
| I suspect this is possibly down to the use of readPixels and
| how slow that is on various devices. The engine seems to run
| in a worker and render to an offscreen canvas then transfer
| the image data in JS to the main thread before drawing it to
| a canvas there.
| TrevorSundberg wrote:
| It almost sounds like it's not using your dedicated graphics
| card. Do other WebGL demos run alright for you?
| sansseriff wrote:
| Yes I can run about 200 jellyfish in this demo with similar
| GPU load, resolution, and frame rate.
| https://akirodic.com/p/jellyfish/
|
| Maybe not the most helpful comparison haha. Anyways, great
| work, this is very impressive
| Narishma wrote:
| That's WebGL. This engine seems to use WebGL2.
| h4zel wrote:
| Same experience here. I'm able to run other webgl projects
| fine, including the jellyfish project you linked, but this
| engine blows up my gpu. Strange
| sakras wrote:
| Wow you guys wrote Zero Engine? I used it in summer camps at
| DigiPen a long time ago, I really enjoyed using it and
| programming in Zilch (I wrote an AI that played a galaga clone!).
| This Unity fiasco had me wondering how Zero was doing. Seems like
| it's going to have a resurgence! Super exciting!
| TrevorSundberg wrote:
| That's so cool! Zilch was my baby, that makes me so happy :D
| adamrezich wrote:
| Zero/Zilch was great, and I wish DigiPen would've stuck with
| it! I heard that these days, they don't even have students
| make games from scratch anymore, and everyone just uses Unity
| or Unreal instead--any idea if that's true? it would be a
| bummer if it were, because striving to make a cool engine
| (especially once Zero was there as something to aspire to!)
| was like _the_ best and most useful part of my time at
| DigiPen.
|
| glad to see the spirit of Zero still going strong through
| Raverie, though!
| TrevorSundberg wrote:
| I heard the same thing and I really hope what they're doing
| is for the best. It would have fundamentally changed my
| path if I didn't get that core low level experience of
| building game engines.
| wahnfrieden wrote:
| do you know what engine was in use or development during
| around 2002-2003? the engine was somewhat baked but flexible
| and had entry points where you drop c++ snippets in, I
| believe with a GUI
| sakras wrote:
| Was it a 2D game engine? I recall before using Zero I used
| an engine called ProjectFUN, which is similar to what you
| described. That was around 2013 though, not 2002.
| what-no-tests wrote:
| > Our end goal is to use this engine to create an online Flash-
| like hub for games that people can share and remix, akin to
| Scratch or Tinkercad.
|
| AMAZING.
|
| Hackable games are such a great in-road for new developers, and
| for anyone who takes an interest in software because of gaming.
| TrevorSundberg wrote:
| Really want this to be a great learning tool!
| darknavi wrote:
| Trevor! I loved your CS elective at DigiPen on designing
| programming languages with grammars.
|
| Many of the students you taught are working on Minecraft now. I'm
| using so many fundamentals taught by you and my time at DigiPen
| when designing the Minecraft scripting API today.
|
| Glad to see you're still rocking it.
| [deleted]
| TrevorSundberg wrote:
| Awwww I'm so glad it's been helpful! One of these days I'll get
| back into teaching ;) I'd love to see the scripting interface
| you're working on too, I spent so much time making Minecraft
| mods back in the day and I always wanted some kind of dynamic
| scripting.
| nullifidian wrote:
| Do you know anything about any WASM developments that will enable
| pure WASM interaction with the browser's Web-APIs at no or at a
| low cost without the JS layer? Sometimes I look at
| https://github.com/WebAssembly/proposals and it's very confusing.
| There are the type imports proposal(years away), the almost
| complete GC proposal(which is apparently only for GCd languages,
| but not for anything browser<->wasm), the component model(which
| looks and sounds as something not for the browser use case), JS
| String Builtins (which will provide faster JS strings, but not
| DOM) and ECMAScript module integration (which will turn WASM
| modules into ES modules, but Web-APIs aren't ES modules so no
| luck). Sometimes I read contributor interactions and it looks as
| if providing such functionality isn't their priority or even in
| their plans, and for the majority the WASI + component model for
| the cloud, crypto and similar use cases are more important.
| CryZe wrote:
| Reference types technically already allow for calling directly
| into the browser APIs as reference types allow wasm to pass
| JavaScript objects around. So if you import all the relevant
| web apis, you don't really need any (almost any?) intermediate
| JS anymore, because you can just forward the JS objects between
| the individual API calls.
|
| The only real need for JS would be to initialize the wasm
| module in the first place.
| TrevorSundberg wrote:
| I really yearn for this myself. I would love to see a "pure
| wasm" browser where the pages are just wasm and the "browser"
| just provides a bunch of platform imports like WASI. I agree
| with you though, seems like it's not a priority for them. One
| of these days...
| csjh wrote:
| I believe that's at least part of what the GC proposal is
| moving towards.
| meheleventyone wrote:
| This is super cool, it's great to see a pure WASM offering in
| this space. It does chug quite a bit on my M1 Mac Pro though!
| mdaniel wrote:
| heh, I got a kick out of there being a Project > Exit (bound to
| alt-f4!) which didn't actually exit anything but it thankfully
| did stop the tab from taking over my machine, so ... win-win?
| TrevorSundberg wrote:
| Still a lot of hold overs from being a native app :P
|
| Good find though!
| ccvannorman wrote:
| This is awesome! What would you say are the primary differences
| between Raverie and PlayCanvas.com?
| TrevorSundberg wrote:
| I haven't tried PlayCanvas yet, but it looks great. I think the
| primary difference is that this engine is a learning tool
| primarily, and doesn't have any intention to compete with
| bigger name engines.
| kruhft wrote:
| [flagged]
| [deleted]
| 3836293648 wrote:
| Yet another reminder that WebGL is terrible in Firefox. Looking
| forward to webgpu being standardised and widely used instead.
| levkk wrote:
| Same experience here, getting really low fps just moving around
| in an empty scene.
| hutzlibu wrote:
| The current status seems to be, chrome is also way ahead of
| firefox with webGPU. They just don't have the manpower anymore,
| so I would not get my expectations up high and just use chrome
| for games and co amd be happy if webgpu comes to mobile FF at
| all. Or petition mozilla into rehiring some engeneers..
|
| And with this concrete project I cannot compare, because on my
| mobile nothing loads, neither on ff or chrome.
| Animats wrote:
| The WGPU people have a new, faster version coming out and
| Firefox integration is in progress.[1]
|
| [1] https://github.com/gfx-
| rs/wgpu/pull/3626#issuecomment-173417...
| hutzlibu wrote:
| So there is hope? Sounds good.
| hoistbypetard wrote:
| It's been sitting on "downloading runtime" for a very long time.
|
| That makes me think this must be a challenge to host. What are
| the pain points to hosting it?
| TrevorSundberg wrote:
| The runtime is currently about 37MB, and when served with gzip
| it's around 11MB compressed. Once it's downloaded it should be
| cached and quickly startup. I think a lot of the challenge is
| going to be spent getting the binary to be smaller, or
| potentially breaking it up into separate individually loadable
| parts.
| laserDinosaur wrote:
| This looks amazing, and I really hope it gains some traction.
|
| That being said, one of the biggest annoyances I had trying to
| switch to Godot from Unity is that their Scene view doesn't
| reflect the Game view at runtime (you can see the hierarchy, but
| there's no visuals, no gizmos, no debug raycasting or
| colliders)[1]. It seems this engine has the same missing feature?
|
| [1]https://github.com/godotengine/godot-proposals/issues/7213
| TrevorSundberg wrote:
| If you hit space bar to bring up the command selector and hit
| Edit In Game, you should get a view that shows you all the
| debug draw, gizmos, etc. Hopefully this answers what you're
| referring to.
___________________________________________________________________
(page generated 2023-09-26 23:00 UTC)