BananaBread: Porting Cube 2 to the Web |
by kripken
on 05/04/2012 00:02, 143 messages, last message: 11/10/2016 01:26, 82816 views, last view: 04/29/2024 09:21 |
|
Over the last month I've been working to get Sauerbraten running on the web, here is a demo of what I have so far:
http://syntensity.com/static/bb/client.html
Press the "fullscreen" button below the screen, then press "GO!".
That is the Sauerbraten C++ code, compiled to JavaScript and WebGL. It runs at 60fps on my laptop on both Firefox and Chrome, but note that it has not been optimized *at all* yet. I'm posting here because I just got what you see in the demo to work, not because it's finished ;) In particular, the code is not optimized or even minified, and when you press "GO!" it loads an ugly level that I made (I have no artistic talent). So ignore the performance, download time, and artwork. This is just a very very early demo.
Note that you need a very recent browser for the demo to work 100%. Firefox Nightly (15) has fullscreen and pointer lock, for example, but earlier versions don't, the same is true for Chrome. Stable versions of those browsers probably will not work so well, you'll need dev versions (nightly or beta for Firefox, canary or beta for Chrome).
So again this is just a very early demo, but I think this is enough to show the approach can work. Actually we knew this could work already because Mandreel did it,
http://dl.dropbox.com/u/6873971/data/cube2/index.html
But Mandreel is a closed-source compiler that costs money while this demo was made with emscripten, a free open source compiler (that I work on). All the tools and all the code here are open, here is the engine code https://github.com/kripken/BananaBread (hardly any is changed, though) and here is the compiler http://emscripten.org/ So this project will end up with something Sauerbraten and other Cube 2-using projects can use, if they want, unlike Mandreel's tech demo.
Another difference is Mandreel apparently just wanted a tech demo of walking through a small map, that's what they have, whereas the goal in this project is to get all the rest of Sauerbraten working: Rendering other characters, bot AI, weapons, editing (actually a lot of editing already works in the demo!) etc. Basically we aim to get everything working, minus multiplayer since web browsers can't support that yet. But even that should be possible later this year when web browsers get WebRTC support, so we should be able to get the entire game :)
Why is this worth doing? In my opinion, two main reasons:
1. To promote 3D games on the web using open technologies. 3D games are starting to appear on the web, but generally they depend on nonstandard and/or closed source technologies like Flash. This project uses only 100% open and standard technologies, JavaScript and WebGL. We need open technologies to win.
2. To give back to the Sauerbraten community. While running on the web has disadvantages, it does have one huge advantage - all you need is a web browser to run the game. You don't need to download and install an application, which stops most people visiting your game's website from actually playing the game. Imagine if anyone visting the Sauerbraten website could just click and jump right into a game, we could get a lot more people in the community that way!
The current status of this project is that I will continue to work on the rest of the missing features, like model rendering, that are not yet running in the demo. We have permission to use geartrooper's models, and we should be getting some maps from gk, so we should have what we need for some nice results :)
In summary, this is just an early demo, but I think it shows that this can work. There is a lot left to do so help is of course welcome. Btw, this can work for any Cube 2-based project, of course, not just Sauerbraten, so if Red Eclipse, Sandbox etc. want to run on the web as an option we can make that happen too (in fact the porting from C++ to JavaScript is 99% automatic, so almost nothing specific would need to be done), if any project is interested in that then let's work together on it!
- kripken
|
|
Board Index
|
|
#84: .. |
by kripkenstein
on 06/17/2012 19:39
|
|
Yeah, texture compression is only present in dev versions of browsers. It will show up in Firefox 15 (10 weeks from now I think).
I did upload a new version to
http://www.syntensity.com/static/night/high.html
which should ignore texture compression. Might need to do control-shift-R to reload without the browser cache to get it.
reply to this message
|
|
#85: .. |
by kripken
on 06/20/2012 21:19
|
|
Update with some early texturing and mapping from gk,
http://syntensity.com/static/night3/bb.html
Those maps use compressed textures (DXT) so I am afraid they will only work on recent dev versions of browsers, not stable releases. But you can install dev versions alongside the normal ones, for example here is a link to the Firefox dev build,
http://nightly.mozilla.org/
Otherwise, this stuff will land in stable releases in about 10 weeks I think (which is about when the maps should be done, hopefully).
The low map is small, medium is larger but not much lit yet, and high is a huge map that barely works in browsers, it's just to test. But be careful with loading the high one, it will take a lot of memory and resources on your machine!
Also new in this version is use of Crunch to compress DXTs for smaller downloads. We decompress .crn to .dds files in the browser. This is still experimental but seems to work so far.
Note that the current textures there have been heavily crunched, so they are low-quality. We are still figuring out how much to do.
reply to this message
|
|
#86: .. |
by kripkenstein
on 06/25/2012 05:40
|
|
version 0.2 with 3 wip maps from gk:
http://www.syntensity.com/static/night5/bb.html
reply to this message
|
|
#87: .. |
by kripkens
on 08/08/2012 22:44
|
|
This project is close to completion, just a few weeks left til we publicly launch some stuff.
We are thinking about what to call it. Would it be ok to call the port of the engine itself "Sauerbraten JS", "Cube 2 JS" (or sauerbraten.js / cube2.js)? The name could help promote Sauerbraten that way. But only if Sauerbraten wants that, of course - thoughts?
reply to this message
|
|
#88: Re: .. |
by geartrooper2
on 08/09/2012 00:51, refers to #87
|
|
javabraten
reply to this message
|
|
#89: Re: .. |
by eihrul
on 08/09/2012 01:19, refers to #87
|
|
Or you could just keep calling it BananaBread. Hey, it's a food item! :)
reply to this message
|
|
#90: .. |
by kripkenstein
on 08/09/2012 04:44
|
|
Heh, I like javabraten. Or maybe scriptbraten ;)
We could leave it BananaBread, but some people didn't like the name apparently.
reply to this message
|
|
#91: Re: .. |
by eihrul
on 08/09/2012 05:09, refers to #90
|
|
Some people don't like the name Sauerbraten apparently. What is your point? :)
reply to this message
|
|
#92: Re: .. |
by suicizer01
on 08/09/2012 17:23, refers to #90
|
|
+1 for Javabraten, even though Bananabread isnĀ“t a bad name also.
reply to this message
|
|
#93: Re: .. |
by eihrul
on 08/09/2012 17:53, refers to #92
|
|
Let's please stop perpetuating the myth that JS has anything to do with Java. If you're going to go in that vein, may as well be: Embraten. :P
reply to this message
|
|
#94: .. |
by kripkens
on 08/10/2012 02:03
|
|
Hmm yeah, javabraten does run the risk of java/js confusion, good point...
Other names people suggested to me:
jCube
jCubey (as in jQuery ;)
or something related to forging/improving stuff (which has several meanings in this project),
project anvil
bladesmith
crucible
windtunnel
reply to this message
|
|
#95: Message censored by administrator |
by Quin
on 08/10/2012 02:17, refers to #94
|
|
|
#96: Re: .. |
by Quin
on 08/10/2012 02:17, refers to #94
|
|
I dunno, BananaBread sounded ample good to me too.
reply to this message
|
|
#97: .. |
by Zamwa
on 08/10/2012 05:05
|
|
CubeEngineGL
reply to this message
|
|
#98: .. |
by geartrooper2
on 08/10/2012 15:14
|
|
Perpetuate the Java in Java Script.
Javabraten!
reply to this message
|
|
#99: .. |
by Razgriz
on 08/10/2012 20:55
|
|
I just keep reading BananaBreed for some reason. Well, there's jEdit, a script editor based on java (script??). Might as well go with jCube2
reply to this message
|
|
#100: .. |
by kripkens
on 08/11/2012 02:57
|
|
We decided to stay with BananaBread in the end. After a marathon 1.5 hours on irc following the feedback here and other places, no suggestion convinced the other people working on this project that it was worth switching to. (I was rooting for "Windtunnel" myself, but oh well.)
Sorry for the drama ;)
reply to this message
|
|
#101: Re: .. |
by Razgriz
on 08/11/2012 12:20, refers to #100
|
|
NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO- cough.
reply to this message
|
|
#102: Re: .. |
by Quin
on 08/12/2012 05:31, refers to #101
|
|
Thanks for breaking the page width, Razgriz..
reply to this message
|
|
#103: Re: .. |
by Razgriz
on 08/12/2012 16:11, refers to #102
|
|
Sorry! i wasn't expecting the forum to not break long lines. Feel free to censor it :P
reply to this message
|
|
|
Board Index
|
|