C++ Developer moving to Web

Started by
15 comments, last by LJ_1102 10 years, 9 months ago

Hi all,

I am looking for a bit of advice and possibly some guidance. I programmed in C++ for a good three years. I also used SFML and OpenGL for 1 of the 3 years. I haven't programmed in it in about 6 months though because I have been so concentrated on trying to learn some web programming. Now what I did was I went on Code Academy, finished the Web fundamentals, Jquery, and Javascript courses.

I am at a point where I feel I have a grasp on how to program for the web, but no clue really how develop for the web. I can open a text editor, include the needed documents, and a bow grow when clicked, but where do I learn how to make an actual good looking website? Code Academy taught me how to do some neat things with my code, but never how to make a nice, full fledged website.

So I am at the point where I want to try making a small 3D sandbox game and a nice website to encase it. I know this will require WebGL, server side programming, maybe a few helper libraries, and website designing knowledge. I was wondering if someone could point me in the right direction of where to learn those skills.

TL;DR?

My Goal: 3D Web Sandbox Game

I have learned thoroughly:

C++

OpenGL

SFML

I have sort of learned:

HTML

CSS

Javascript

Jquery

I want to learn:

Node.js or PHP? (Some server side language)

General Web design (I kinda know CSS but that doesn't mean I know how to make stuff look nice)

WebGL

Three.js? (I have heard of this, not sure if I should learn it or WebGL, or both)

Any advice, links to great tutorials, or guidance on completing my goals would be greatly appreciated.

Thanks in advance! smile.png

Advertisement

The server side language depends on what you want todo,

if you want it to communicate with your game(f.e. using websockets) you should go into node.js

also because you do not have to learn another language then since node.js is javascript.

Also creating a game using plain WebGL will propably take you ages since you have to write a lot of boilerplate code.

imho using three.js is also not a good idea, since everything more complex i've seen that was made with it was pretty slow.

I would recommend taking a look at other frameworks out there, google will help you find them.

In addition to that I highly recommend that you read JavaScript: The Good Parts and use a jslinter to achieve some proper javascript skills,

I dont know the quality of code academy but there are huge differences in the opinions about what is good javascript.

Giving a pointer to general web design is not that easy, its actually an intuition thing i guess.

Take a look at Twitter Bootstrap and see how they're structuring their code and how their design elements look like.

Hope that helps.

Jan F. Scheurer - CEO @ Xe-Development

Sign Up for Xe-Engine™Beta

Since you already know C++, perhaps you can also consider playing with Wt: http://www.webtoolkit.eu/wt

// and/or CppCMS: http://cppcms.com/

Wt has WebGL support:

http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WGLWidget.html

Here's a tutorial on using Wt with WebGL:

http://demos.vicomtech.org/x3dom/test/functional/Wt_WebGL/Wt-WebGL_Lessons.htm

You may also find the following thread helpful:

http://comments.gmane.org/gmane.comp.web.witty.general/8883

PHP is the devil, its a crap language that succeeded because it was at the right place at the right time with the right price tag. Now there is a huge volume of code available for it, but that is about the only positive.

Node is the current buzz-word darling, but truth is, I am a huge fan of it. There are some huge benefits of having JavaScript on the server as well as the client. I actually did a tutorial series you might be interested in. It covers creating A simple JavaScript app using Node, cocos2D, YUI and Heroku. On top of that, I've done a series of math tutorials in EaselJS as well as a Cocos2D tutorial series. Apparently the Cocos2D api has changed again though, resulting in a few things not working. Cocos2D is one of those love or hate it style libraries.

The earlier recommendation of "The Good parts" is solid, but that book is mostly useless to you until you've used the language for a little while.

Picking up a good editor is also a big help. I highly recommend you try the 30 day trial of WebStorm, it's excellent and makes working in JavaScript a delight, especially if you are used to working in an IDE.

There are a few things you are going to have to get used to with JavaScript programming. First is the fact DOM programming is a horrible experience. It really is, working across browsers is just miserable, there is a reason people use jQuery or YUI and similar libraries.

Second, learn to think asyncronously... that is the biggest stumbling block with C++ programmers moving to JavaScript.

Third, JavaScript is not C++... it feels a hell of a lot like C++ at first, but it isn't and the faster you can come to terms with that, the happier you will be. Probably the worst part of it is the fact you can basically turn JavaScript into C++... DONT. JavaScript is a prototype based language and a dynamic ( not compiled ) language. There is a lot of power in those two traits.

Fourth, JavaScript is a horrible language. It's the kernel of an excellent language with some really really really really stupid design decisions. The book ( The Good Parts ) covers a lot of the warts and strengths of JavaScript. The biggest flaw with JS is it's wayyyyyyyyyyyyyy to easy to create a global variable or clobber an existing variable... there is no concept of namespaces, modules or private variables and it hurts the language. ( There are work arounds and changes to the language in the works ). There are languages built over JavaScript that make working with it much more pleasant, such as TypeScript, Dart and Coffeescript, but when starting out, I suggest sticking to straight JavaScript.

Fifth, embrace Microframeworks, its a common trend with JavaScript and its a very cool one. Instead of large overarching libraries that do everything and the kitchen sink, you slot in a small focused library, that work with other libraries. There are a few that you simply need to know though... jQuery is all but ubiquitous now, although I actually prefer YUI. On top, check out Underscore ( a library that extends the language of sorts ) and Require.js ( a module system... that is all but *groan* required ). I also highly recommend the previously mentioned EaselJS.

Finally, have fun. The browser is infuriating to work in, but JavaScript is a ton of fun and remarkably powerful in certain regards.


Third, JavaScript is not C++... it feels a hell of a lot like C++ at first, but it isn't and the faster you can come to terms with that, the happier you will be. Probably the worst part of it is the fact you can basically turn JavaScript into C++... DONT. JavaScript is a prototype based language and a dynamic ( not compiled ) language. There is a lot of power in those two traits.

Couldn't have put it better! Word up for that one!

Jan F. Scheurer - CEO @ Xe-Development

Sign Up for Xe-Engine™Beta

If you already know C++ then you might want to bypass learning a web language and use something like Emscripen (https://github.com/kripken/emscripten?).

It is basically a C++ to Javascript compiler. It works quite differently to things like coffeescript and typescript but the outcome is even better. You put in typical C++ code including smart pointers, STL etc... and it generates either a .js file or a .html file complete with a console, webgl rendering context or canvas component as output. Can't get simpler than that ;)

Quite a few companies are using this now, it is also getting popular in porting well known game engines to the web such as Epic's Unreal engine and Unity's web player engine.

I use it at work and for my personal projects and it is pretty awesome since it provides development libraries for things like SDL, glut, GL out of the box.

http://tinyurl.com/shewonyay - Thanks so much for those who voted on my GF's Competition Cosplay Entry for Cosplayzine. She won! I owe you all beers :)

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.

Thank you very much for all of your replies! I have mixed feelings in the posts here. Most people here seem to think JavaScript is useful, but also full of traps that will land you in a pile of crap! :D. Some others also seem to push towards using C++ for Web, which actually sounds very appealing because I LOVE C++. So now I am at a point where I think I should learn java script for Node.js and web pages. Then use C++ and Wt or Emscripen for the game.

Some questions:

  1. Does the above sound reasonable?
  2. Should I use Emscripen or Wt for web pages? Or will regular java script work better for small interactive things on the web page?
  3. Does Emscripen or Wt easily support external JS libraries?

BTW I have found this to expand my website design knowledge. Does it look like it will be useful?

Thanks again! All your words and advice are very helpful :)

It is my understanding that Wt is more for server side related code but am not sure how well it integrates with server side node.js.

Emscripten integrates with Javascript pretty well. Below are a few ways officially supported by the project. You might want to have a browse through and evaluate if this additional effort is worth it. (For my uses, it definately is! ;)

https://github.com/kripken/emscripten/wiki/Interacting-with-code

https://github.com/kripken/emscripten/wiki/embind

Though not supported by the Emscripten project, I made a small tool to allow me to inline Javascript within C++ code (in a similar way to how you can with ASM). This pretty much offers best of both worlds in that you can do the majority of your work in C++ but also get a 100% javascript environment to interact with libraries and APIs etc...

http://www.mutiny3d.org/doku.php?id=iffe

http://tinyurl.com/shewonyay - Thanks so much for those who voted on my GF's Competition Cosplay Entry for Cosplayzine. She won! I owe you all beers :)

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.

Simply put, people using C++ on the web, are doing so because they are unwilling to learn another language.

... this is not recommended.

Simply put, people using C++ on the web, are doing so because they are unwilling to learn another language.

... this is not recommended.

Okay so then I guess I will just continue learning java script. I am willing to learn another language. I guess now I just have to weed out the bad of java script with the help of the resources suggested above and then learn the Micro-frameworks. Any recommendations on micro frameworks that I can use to help me make games (mostly in the graphics section of things but sound would be good too)?

This topic is closed to new replies.

Advertisement