home home

downloads files

forum forum

docs docs

wiki wiki

faq faq

Cube & Cube 2 FORUM


BananaBread: Porting Cube 2 to the Web

by kripken on 05/04/2012 00:02, 143 messages, last message: 11/10/2016 01:26, 82169 views, last view: 03/29/2024 02:02

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

Go to first 20 messagesGo to previous 20 messages    Board Index    Go to next 20 messagesGo to last 20 messages

#104: Re: ..

by Quin on 08/12/2012 18:20, refers to #103

Censoring it won't help me, we see them anyway, but at least the post gets hidden once I've seen it :P

reply to this message

#105: ..

by kripkenstein on 08/17/2012 04:51

We are thinking about putting some stuff in the loading screen. I assume it's ok to say "powered by Sauerbraten" or something like that, and to put the Cube 2 logo there?

reply to this message

#106: Re: ..

by Q009 on 08/17/2012 05:03, refers to #105

I guess it would make more sense if it would say "Powered by Cube 2 Engine", since Sauerbraten is just a game on it :)

reply to this message

#107: ..

by kripkenstein on 08/17/2012 05:57

Oh right, yeah :)

reply to this message

#108: 1.0 Launch

by kripkens on 08/28/2012 19:02

We finished and launched 1.0,

https://developer.mozilla.org/demos/detail/bananabread

reply to this message

#109: Re: 1.0 Launch

by kripkens on 08/28/2012 19:02, refers to #108

Hmm this forum doesn't linkify https, so here is a clickable link

http://developer.mozilla.org/demos/detail/bananabread

reply to this message

#110: Re: 1.0 Launch

by Zorg on 08/29/2012 11:23, refers to #109

Win 7, Chrome 21.0.1180.83 m

1. Starting "Arena":
- Download ok
- gets stuck at Preparing
- Settings -> Toole -> Development Tools -> Concole shows all decrunched packages and the last line is "z'eed packages"

2. Starting "Two Towers":
- Everything works, game starts
- After running around (when approaching the water) Chrome suddenly shows dark blue error page

3. Starting "Lava Chamber":
- Downloading works
- While Preparing, Chrome shows suddenly dark blue error page
- Console gives warning "Resource interpreted as Font but transferred with MIME type application/octet-stream" for all the loaded fonts

4. Starting "Arena" again: no change

5. Starting "Two Towers" again: stuck in Preparing (same as Arena in 1.)

Music worked fine during all this. Hope this is of any help.

reply to this message

#111: Re: 1.0 Launch

by suicizer01 on 08/29/2012 19:20

Everything seems to work for Firefox 15.0; there are still some small things which could be improved.

The wooden textures have some less parallax-scaling (as it looks like plastic right now).

When you try to use backspace when deleting some of the symbols in the console line, it happens that Bananabread is being returned to it's home-page, which is pretty annoying as the loading-time of everything still takes a lot of time.

Personal stuff isn't being saved yet, too bad.

The framerate seems to be very unstable, while I'm sure I'm not having the worst pc out here. So it pretty much kills the idea of actually playing matches against someone else with that.

There seems some purple material in edit-mode which crosses all over the 3th map in edit-mode, what is that actually?

You can see magnificent improvements. I like that though.

reply to this message

#112: Re: 1.0 Launch

by kripkens on 08/29/2012 22:57, refers to #110

Thanks for the feedback!

@Zorg: Chrome has some bugs on this demo, looks like they are stuff you ran into. First is that it fails to load sometimes, I am working on a workaround, this build might work better http://dl.dropbox.com/u/80664946/index.html - or just reload a few times, it should eventually work.

Second is the blue error page, do you mean the tab crash page with "Aw, Snap"? If so, then this is a known Chrome bug on this type of code.

There are bug reports on both, I can find the links if you want.

@suicizer01

I am fixing the backspace bug right now actually :)

Performance needs improvement, I agree. One reason for the demo is to help benchmark and optimize browsers and emscripten.

Saving personal stuff should be done, hopefully I'll have time soon or someone will submit a pull request.

That edit mode bug is weird, I see it too. Have not had time to investigate yet.

reply to this message

#113: OPUS

by oibaf on 09/01/2012 08:56

Does it support opus coded? It could reduce donwload size and also be used as a test for this new codec. Will this eventually need to be implemented in Cube before to have in BananaBread?

reply to this message

#114: ..

by kripkenstein on 09/01/2012 20:23

It could already support opus. Emscripten (the compiler used to convert the sauerbraten code to JS) implements the SDL stuff as a thin layer over the browser APIs. So trying to load an opus file in the web version of sauerbraten would try to load it in the browser. If the browser supports opus, this would work.

(But I believe only Firefox supports opus right now, so this wouldn't work everywhere.)

reply to this message

#115: Menu key

by oibaf on 09/02/2012 19:24

I'd suggest to change the menu key because ` is not available on my keyboard (to use it I have to use a key combination but that doesn't work in game).

Other than that it works great, this is very impressive it's running in a browser!

Thanks!

reply to this message

#116: ..

by kripkenstein on 09/02/2012 19:36

I added bindings to 0 for the menu in the testing version,

http://dl.dropbox.com/u/80664946/index.html

It isn't in the stable demo yet though, should be pushed in a few days.

reply to this message

#117: Re: 1.0 Launch

by Zorg on 09/09/2012 19:18, refers to #112

Kripken:

Sorry for getting back to you that late. The link with the workaround for Chrome (http://dl.dropbox.com/u/80664946/index.html) worked. I'm getting some "sound lags" though. That is, game keeps running smoothly, but every 5 or so seconds, there is no sound for maybe .5 second.

And yes, the blue screen was the "oh snap" one :)

Not sure whether is's supposed to be like that, but whatever resolution I chose, the game only runs in the top left third of the screen (in fullscreen mode, meaning everthing else is black).

Again, I'm just hoping this is of some help for you. Game looks amazing btw :)

reply to this message

#118: Re: 1.0 Launch

by kripkenstein on 09/09/2012 21:21, refers to #117

@Zorg: Thanks, yeah, all those are known bugs in Chrome. They were reported, hopefully they'll get around to fixing them soon.

reply to this message

#119: Physics Engine

by oibaf on 09/10/2012 11:31

It would be nice to have support for a Physics Engine.

reply to this message

#120: ..

by oibaf on 09/10/2012 11:31

Oops, wrong thread...

reply to this message

#122: Bananabread maps on Sauerbraten

by oibaf on 11/11/2012 16:03

Is it possible to use BananaBread art content with sauerbraten standard engine?

reply to this message

#123: OGLES 2.0 Compatible.

by JayDoran on 11/27/2012 03:22

Kripken,

Is the webgl compilable version of Saur you created compatible with OGLES 2.0 calls? I looked at the source but it still contains GlBegin calls and such that are not found in OGLES.

How did you get around this? I'm seriously considering porting the Saur\Tesseract Engine over to Android and IOS and it would save a lot of work if part of the 3d rendering system and shaders were already at least semi-compatible.

reply to this message

#124: ..

by kripken2 on 11/27/2012 04:48

For BananaBread I wrote a translation layer in JS. The goal was to not hack up Cube 2 itself.

The translation layer could also be in C++, it would be not too hard to convert ours into C++ in fact. There is also regal which was mentioned in the other thread, I don't know how mature it is though and for some reason it is huge.

reply to this message

Go to first 20 messagesGo to previous 20 messages    Board Index    Go to next 20 messagesGo to last 20 messages


Unvalidated accounts can only reply to the 'Permanent Threads' section!


content by Aardappel & eihrul © 2001-2024
website by SleepwalkR © 2001-2024
53417061 visitors requested 71176929 pages
page created in 0.064 seconds using 10 queries
hosted by Boost Digital