Irrlicht for Web Development

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Irrlicht for Web Development

Post by LunaRebirth »

Hey all!
I've read a lot on using C++ as a web development language. While I read it isn't a smart idea to do, it can be done.
I was wondering if I were to try web development with C++ and irrlicht, could this be done?
With Emscripten being implemented recently, I don't see why not.

Reason I want to use C++ is because I already have all the networking set up on my program and it uses Lua script for scripting in real-time. Would be awesome if I could port it to the web and script a website-looking program
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Irrlicht for Web Development

Post by CuteAlien »

Irrlicht is maybe 90% there. Calls not suported yet by WebGL driver:
- drawStencilShadowVolume
- drawVertexPrimitiveList without VBO
- Things using drawVertexPrimitiveList:CParticleSytemSceneNode, VideoDriver:drawIndexedTriangleList, VideoDriver:drawIndexedTriangleFan
- Things using VideoDriver:drawIndexedTriangleList: CBillboardSceneNode (changed now in trunk), COctreeSceneNode without VBO (but that can use VBO's now always).
- Things using VideoDriver:drawIndexedTriangleFan: CSkyBoxSceneNode

In a typical app I would say - everything works except particles.

Note that if you do that - every lib you use in your application needs to have a emscripten port. For some you might be able to get them working just by recompiling - some (like Irrlicht) will need a little bit more work.
The libraries which are already coming with emscripten are c standard library and SDL.
I suppose for networking you will have to put some work into it.

Generally emscripten works rather nice for me so far. But I'm not done yet with my application as I had to work on something else in between. What is harder is debugging. And I haven't managed yet to get it working on Windows (probably because my VS installation is somewhat messed up - and I didn't try the other options yet).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Irrlicht for Web Development

Post by LunaRebirth »

When can I expect it wont be impractical to use Irrlicht to build a website?

Assuming I only work with IGUI buttons, images, text, editboxes, and lists, is it already practical enough for the task?

I'm awaiting a tutorial for setting it up with Emscripten, it would be amazing to be able to compile these things for web-use, as I'm not interested in moving to a different engine or language
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Irrlicht for Web Development

Post by CuteAlien »

Please don't use Irrlicht to build a website if you only need the gui-stuff. As much as I love Irrlicht ... it is the wrong tool for that. It can help if you quickly need 3D in the website and already coded it in c++. But if you need only UI then you are far better off with html + Javascript. The Irrlicht UI is not native to the web (so for example stuff like resizing texts wouldn't work) and adds overhead (5MB to load for the library). Also learning new stuff is fun and will make you a better programmer :-)

Building Irrlicht for emscripten is pretty trivial by the way (example is in svn ogl-es branch in folder examples/01.HelloWorld_emscripten). At least once you managed to set up emscripten. That can be somewhat tricky if you are unlucky (I had to compile it for my Linux system and failed to get it working on Windows... but for others it might work at once...).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Irrlicht for Web Development

Post by LunaRebirth »

Well the problem is that I've spent a lot of time coding a server and client with complex networking that is cross-platform compatible.
I recently wanted to add it to Web support with 2D and 3D, but it's written in C++. Moving to a different language would mean redoing a lot of code, which isn't something that really interests me.
Redoing the massive amounts of code and effort I've put into my project for the past few months doesn't sound appealing.

Are there any other ways to go about this?
I'm stubborn for the fact that I enjoy using Irrlicht.
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Irrlicht for Web Development

Post by CuteAlien »

Moving the Irrlicht part might work. But the network part... depends. If you used sockets then emscripten might have a wrapper. From what I did see with a quick google check right now there also seems to be some support for enet. What did you use again for your network?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Irrlicht for Web Development

Post by LunaRebirth »

Yes I am using sockets
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Irrlicht for Web Development

Post by CuteAlien »

I guess then you can give it shot. Thought as mentioned I haven't used it yet on Windows, so I'm not yet of too much help to set it up there. I'll get to it hopefully within next few weeks.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Irrlicht for Web Development

Post by LunaRebirth »

I'll try it out, see if I can get it working when I have the time. If not, I'll find an alternative.
Thanks CuteAlien
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Irrlicht for Web Development

Post by CuteAlien »

With some more experience by now... porting to emscripten still is work. Especially when it comes to loading files (basically easiest way I found so far is pre-loading all files which are needed - after that one can work as usual).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Re: Irrlicht for Web Development

Post by sudi »

Would be good to know what you are trying to port to the web.
Then someone might be able to give some actual advice.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Irrlicht for Web Development

Post by LunaRebirth »

Sudi wrote:Would be good to know what you are trying to port to the web.
Then someone might be able to give some actual advice.
I've been building a real-time online program where anyone can create a server to share with the world, and edit it while people watch.
Kind of like an RPG Maker or something, but online and with 2D + 3D.
All images download from the server host. Very few images will be delivered with the app
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Re: Irrlicht for Web Development

Post by sudi »

I would really say that irrlicht is then the wrong choice to run it in a browser. Rewrite it in Javascript or leave it as a standalone programm.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Post Reply