Spherical forums

Sphere Development => Engine Development => Topic started by: Fat Cerberus on November 07, 2016, 03:35:53 pm

Title: Oozaru 0.6.3 - Sphere in the browser
Post by: Fat Cerberus on November 07, 2016, 03:35:53 pm
Oozaru is a browser-based implementation of Sphere, coded in JavaScript and designed to work in modern browsers without plugins.  It is currently in beta, but is planned to implement the entire Sphere v2 API so that it'll be able to run any game the desktop implementation, neoSphere, can.

Like neoSphere, Oozaru's source code is hosted on GitHub and is licensed under the terms of a BSD-style license.

Oozaru 0.6.3 - December 22, 2023 - Release Notes (https://github.com/spheredev/oozaru/releases) - GitHub Repo (https://github.com/spheredev/oozaru)
Works with the Oozaru Support plugin included with Sphere Studio.

Title: Re: Oozaru: Sphere for the Web
Post by: Fat Cerberus on November 08, 2016, 12:09:39 am
If anyone's curious about the name, it's another Dragon Ball Z reference:
http://dragonball.wikia.com/wiki/Great_Ape

These are basically obligatory for minisphere-related projects now.  If Debian can have Toy Story characters then I can have DBZ ones dammit ;)
Title: Re: Oozaru: Sphere for the Web
Post by: DaVince on November 08, 2016, 10:51:24 am
Besides a platform-neutral editor, this is one of the things I have been looking forward to most when it comes to Sphere. You're doing awesome work. :)
Title: Re: Oozaru: Sphere for the Web
Post by: Fat Cerberus on November 08, 2016, 11:08:04 am
Yeah, implementing the Dispatch API was the tipping point.  With that implemented, the goal of Sphere-in-the-browser was suddenly in sight and I jumped on the opportunity.  I know I may have scoffed at the idea of a WebSphere in the past, but mostly that was just me being a grinch and not wanting to learn Web development.  I'm much more comfortable with JavaScript now (and I've been keeping up with the latest features even if Duktape doesn't support them :)), so... well, why the hell not? :D
Title: Re: Oozaru: Sphere for the Web
Post by: Fat Cerberus on February 05, 2017, 10:42:30 am
I haven't worked on this in a while; module support complicates things, as browser JS doesn't support them at all.  It's even more of an issue now that ES2015 modules (import/export) are first-class citizens in Sphere v2.  What I'll probably have to do is add a special mode to Cell that combines all the scripts into a single file, like what Browserify does for Node.js modules.  One more reason for Sphere developers to write a Cellscript, I suppose. ;)
Title: Re: Oozaru: Sphere for the Web
Post by: DaVince on February 05, 2017, 11:16:40 am
I see how that can complicate things! I've recently gotten a little more excited about Sphere again, even though I barely have time to work on anything like a game. Would definitely like to contribute on the simpler elements once you got that figured out though!
Title: Re: Oozaru: Sphere for the Web
Post by: Fat Cerberus on August 22, 2017, 07:20:52 pm
Good news: Browsers are finally starting to get support for ES6 modules:
https://jakearchibald.com/2017/es-modules-in-browsers/

That will remove a big barrier for Sphere v2 in the browser, since .mjs is now the preferred way to write v2 code.  Otherwise you end up needing Babel/TypeScript + a require() shim. :-\
Title: Re: Oozaru: Sphere for the Web
Post by: Fat Cerberus on October 27, 2018, 04:53:10 pm
So after having left this project to languish for a year and almost giving up on it entirely, I picked it back up about two weeks ago and started hacking away... and now it can run the kh2Bar demo!

It currently requires an up-to-date version of Chrome or Safari but this serves as a very nice proof of concept.  The entire Galileo API is implemented (I think), the Keyboard API somewhat works, and it even reads the data from
game.json.

If anyone wants to test it out you'll need to checkout the Git repo and set up a local web server; I'll see about posting it online eventually.

https://github.com/fatcerberus/oozaru
Title: Re: Oozaru: Sphere for the Web
Post by: Eggbertx on October 27, 2018, 10:03:09 pm
This makes me wish HTML5/Canvas was a more feasible option back when I was working on JavaSphere. If that had been the case, I wouldn't have even bothered with Java. I'm very happy to see that things are starting to come along well with Oozaru, and that miniSphere will finally be getting a proper platform-independent option. When it's more stable, it would be pretty cool to see it uploaded to the server to directly showcase miniSphere instead of pictures alone.
Now if only they would add (better) support for Android to ChakraCore...
Title: Re: Oozaru: Sphere for the Web
Post by: Fat Cerberus on October 27, 2018, 11:41:32 pm
It's funny you say that because a big part of why I shelved Oozaru for a while is that, a year ago, the Web technology wasn't quite there yet.  WebGL was a thing (which I didn't realize at the time--Canvas2D is an awful API to use for game development), but the missing piece, ES module support, wasn't actually a feasible option since browser makers were only just starting to implement it.  I would have had to use a require() shim, which didn't seem ideal since you don't really want to be blocking your code while loading things on the web.  The user will hate you for it, and most likely so will the browser.  And I was just starting to push use of ES modules for Sphere at that point too, so forcing require() for Oozaru felt like a step backwards.

But now that stuff I need is finally widely available, Oozaru will finally see the light of day!  Or, well, the light of a full moon, as the case may be...
Title: Re: Oozaru: Sphere for the Web
Post by: Eggbertx on October 28, 2018, 05:11:28 pm
I wonder if it would be possible to add Oozaru-only (for now) API functions and objects to make games for mobile browsers.
Title: Re: Oozaru: Sphere for the Web
Post by: Fat Cerberus on October 28, 2018, 06:01:57 pm
What kind of functions do you have in mind?
Title: Re: Oozaru: Sphere for the Web
Post by: Fat Cerberus on October 29, 2018, 02:39:43 pm
I finally got SoundStream working today!  It took me forever to get it right and in the process I had to learn how to do sample rate conversion, but now Oozaru can run the sphere-mp3 demo (with a couple small code tweaks to accommodate for the lack of synchronous file loading).

Next I'm going to see about getting this thing to work in other browsers besides just Chrome.  This isn't the late 90s/early 2000s after all. :P
Title: Re: Oozaru: Sphere for the Web
Post by: DaVince on December 04, 2018, 06:47:53 am
What kind of functions do you have in mind?
One thing I can think of is accelerometer support. You see it in use in stuff like racing games, where your phone becomes a steering wheel, or even just simple stuff like Pokémon GO, where putting the phone upside down will turn the screen black to save performance.

I imagine that Oozaru will be able to do more anyway, if we can have access to the JS DOM API.
Title: Re: Oozaru: Sphere for the Web
Post by: Eggbertx on December 06, 2018, 10:30:31 am
What kind of functions do you have in mind?


One thing I can think of is accelerometer support. You see it in use in stuff like racing games, where your phone becomes a steering wheel, or even just simple stuff like Pokémon GO, where putting the phone upside down will turn the screen black to save performance.
Stuff like this, or handling swiping. Though I guess it would technically be possible for a game to do that, but a runtime ES6 helper module would be nice.
Title: Re: Oozaru: Sphere for the Web
Post by: Fat Cerberus on May 31, 2019, 12:00:49 pm
The first proof of concept of Oozaru is up (running the Spectacles battle engine), check it out:


Consider this Alpha 1.  I won't call it a beta, since it's not quite feature-complete yet; sizeable portions of the Sphere v2 API are completely missing and/or inoperable.  Like, the Joystick class exists, but all methods are no-ops.  And almost the entire FS API is missing... that kind of thing.
Title: Re: Oozaru: Sphere for the Web
Post by: DaVince on August 07, 2019, 05:14:16 am
Hey! I haven't been around for a while but this is looking mighty impressive so far, good job! :))
Title: Re: Oozaru: Sphere for the Web
Post by: Fat Cerberus on October 20, 2020, 10:08:47 am
Here's the above demo, now available directly on the SphereDev website:
https://oozaru.spheredev.org/
Title: Re: Oozaru: Sphere for the Web
Post by: Radnen on October 20, 2020, 12:12:59 pm
I have been playing a game called CrossCode lately and it's clearly HTML5 based engine, but they had console releases, which gives me hope on Oozaru... I might think about using Sphere again. I was toying around with Game Maker, but I think it may be easier to build the game in Sphere? How's the performance?
Title: Re: Oozaru: Sphere for the Web
Post by: Fat Cerberus on October 21, 2020, 02:02:59 pm
It uses WebGL, performance seems pretty close to desktop Sphere as far as I can tell.  I had a perf issue a while back where it was really slow on Apple platforms, it turned out it just didn't like me reusing VBOs for Shape.drawImmediate(), even when they were created with the dynamic flag.  It ended up being way faster just to throw away the vertex buffer and create a new one next time.  But otherwise, there are no performance issues that I can see, and even that issue has since been fixed.

There are a few undocumented hoops you have to jump through in order to ensure your code runs as-is in both miniSphere and Oozaru, mainly having to do with module import conventions (they won't be undocumented for much longer, and I'm planning to add a compatibility mode to enforce them), but as long as you don't touch the Sphere v1 API, as long as your game runs on the desktop it should run fine on the Web too. That was, after all, my main goal for Oozaru.  ;)
Title: Re: Oozaru 0.4.0: Sphere for the Web
Post by: Fat Cerberus on December 19, 2021, 01:56:33 am
The first official beta release of Oozaru is finally out: version 0.4.0!
https://github.com/spheredev/oozaru/releases/tag/v0.4.0

To make it as easy as possible to dive in, Sphere Studio 2.2.0 was also just released and supports testing games in Oozaru locally.  Just unzip the Oozaru distribution to a folder of your choice and point the IDE at it and you're good to go!
https://github.com/spheredev/sphere-studio/releases/tag/v2.2.0
Title: Re: Oozaru 0.4.2: Sphere for the Web
Post by: Fat Cerberus on December 22, 2021, 11:35:59 pm
Just released 0.4.2 which removes the requirement to use Chrome.  The engine will now run in Firefox and Safari as well.