node.js vs c#?

So we have two things going in parallel here.

We have this Native / Mono / Direct OpenGL (ES) thing going here that gets ported like mad to all the different platforms to get it running. Of course Unity is in this boat, UE4 is in this boat, the major game engines in this boat.

However on the flip side of this we have this node.js / asm.js / webgl / three.js / more radical browser enhancement thing going. Which has the interesting thing where, the developers of this paradigm don’t have to port their stuff like mad to everything, but rather it’s on the burden of the platform to provide a proper interface to run this stuff smoothly.

Now understandably the JS and WebGL side of things is nowhere near as developed in the high-end department as Unity 5 or Unreal. But it’s moving fast, and node.js has Google behind it. Xamarin is nifty and C# is probably one of the greatest products MS has made. But really I can very easily see js through node and asm becoming the true high performance cross platform language which all vendors make their own implementation for. Xamarin and Unity have to actively update and maintain Mono for all the platforms, huge amount of work. What happens when all platforms just maintain their own node.js or asm.js implementation? Essentially we end up with a high performance language that is already available on everything. And at that point developing in mono or c# actually turns out to be the one that takes a lot more run around.

Of course Unity’s greatest asset is it’s editor, not Mono. And someone would have to make a js based game engine and editor to compete with Unity. But again, fast moving.

One big quarrel of this however all rests on me assuming that one can write more optimized and ideal JS directly. But could il2cpp actually allow mono to compete with directly written JS?

This isn’t a very well thought out thought, I know, thats why I am posting it here. Has anyone else done any thinking along these lines? Have you come to any conclusions?

Last I checked Node.js was a framework for writing socket-based server applications in JavaScript. So how does it play into any of this?

Perhaps you’re really trying to compare is JavaScript/HTML5/WebGL vs. native.

2 Likes

Node is used primarily for writing server based applications. But Node can actually be used to do anything, it is a general purpose framework as far as I’ve read into it. To me, it seems to represent the effort to take JS into the domain of generalized programming language.

In the same way C# and .NET were initially directed and marketed to the server side application sector as well.

That was never the case. Both WinForms and ASP.NET were available with the first public release of .NET way back in 2003.

Here’s a link to the API docs for Node.js. Can you spot anything in there that hints at any significant client-side functionality? Or can you think of any examples of client-side applications that were made in Node.js that are not command-line utilities? I would be particularly interested in any game-related client side examples.

EDIT:
Fixed WebForms to WinForms

First issue is performance, which I don’t think is going to be that great compared to native. It will be good enough for a lot of cases, but I don’t see it being enough for a lot of people.
Second issue is “cross compatibility” (in scare quotes). The likelihood that something doesn’t play perfectly on another platform is pretty high (controller support for instance). I don’t know enough about future js stuff, but I would have to imagine there won’t be much support for extensions/plugins, or at best is spotty. I haven’t done anything web related in years, but I can’t imagine we’ve really gotten that close to a world that’s standards compliant.

The JS is generated by Unity, and for the web env, just at it generates the specific bytecode for the other platforms. I’m sure what you are thinking here. C# in the editor part is scripting, it isn’t actually running C# on iOS for example. It is just used to build the native deployment.

Also, there are already Unity-ish editors running in browser. Of course this limited to web deployment. But they are still pretty cool.

Yea, it is still an issue. But like most js libs the conditional stuff is handled under the hood. I think standards compliant will never actually happen, but the middleware/libs can pick up the slack. (to a degree).

Haven’t messed with js for years but the best thing going for it imo has always been the open standards and community libraries. JS is a great language, I love it, but it’s definitely not as fast as compiled languages. Performance across various browsers fluctuates significantly.

For a stress test I made this years ago, the tiles are drawn based off 2 arrays that have 150,000 entries each, the sprite sheet has 10 tiles to choose from, the reason they’re repeating is because I laid out 1 room, then copied and pasted the values into the array to get to 150,000, while using a second array with 150,000 entries that tell whether a tile is walkable or not.
The map is 32,000 pixels wide, 19,200 pixels tall, tiles are 64px x 64px

The arrays are like this, just single dimension:
0,0,0,9,9,9,0,0,0,0,
0,9,9,9,9,9,9,9,4,0,
0,9,9,9,9,9,9,9,9,0,
9,9,9,9,9,9,9,9,9,9,
9,9,9,9,9,9,9,9,9,9,
9,9,9,9,9,9,0,9,9,9,
0,9,9,9,9,9,0,1,2,0,
0,9,9,9,9,9,9,9,9,0,
0,3,9,9,9,9,9,9,9,0,
0,0,0,9,9,9,0,0,0,0,

I’m not an ASP.net affluent by any means. But as I understood it, a web form was just a container that visual studio used to represent a dynamic page. But ultimately that web form is rendered to HTML on the server side, then sent to the client. C# and .NET was a framework that still ran all server side initially. The place C# is being used now, to program games, desktop applications, to be the interface layer between the windows kernel and applications. This was not it’s initial role, it all came afterwards, .NET was initially all a web oriented thing, as the name .NET applied.

Look at all this here:
https://www.npmjs.org
Lots of people have written libraries to use node for tons of different purposes. Server and client. It will continue to grow.

It’s really making JS head in the direction of how python is, general purpose. The one thing about node.js though is, it has google behind it. Google has the resources to make it a huge contender against everything else if they keep rolling with it.

@imbarns, look into modern node.js and asm.js performance. Really, it’s getting pushed to being a contender in language performance. It’s one of the hottest areas of R&D right now at Mozilla and Google.

Unity’s webGL solution does in the end output javascript, so what are you looking for on top of that? Having written a decent amount of node.js code at this point I don’t find anything particularly magical about it, in fact it’s a bit of a mess with it’s callback style and/or promises.

Watching the trends of technological tools over the years, rarely is it something amazingly ‘magical’ about any particular tech that makes it standardize. It’s rather the companies backing it, and how widely applicable it is. In that regard, node I see is in a better position than C# and Xamarin.

node still requires an interpreter to run it. Its not pure JavaScript. As for client side, you are thinking of people that are using the MEAN stack which uses Mongo DB as a data store, node for the server side and AngularJS for the client side. Angular us another google initiative and it’s very cool but not as nice for large apps as they’d have you believe. My current consulting contract is building an enterprise application using angular for the front end and C# Mvc WebApi for the backend. Angular comes with a lot of headaches and big changes even in dot releases that break tons of stuff.

All of that being said, JavaScript in general is a nightmare at a professional level. It is far top fragile and almost impossible to unit test in a meaningful way without a massive time and effort investment. I would give node a giant thumbs down in terms of game development, coming from someone who spends day in and day out writing massive data driven applications.

1 Like

Many don’t know that “JavaScript” was initially called “God forgive us JavaScript”.

Of all wide used languages this is the most horrible abomination of mankind.

What kind of game you gonna make when it can simply not to work while looking like “all right, no errors”?

5 Likes

Had that issue today. Ended up reverting a file from source control and never figured out what the problem was. Just a nice message saying Angular Load Error or something to that effect but zero errors in the console.

Which is why all these transpilers(typescript, coffeescript, haxe, dart, etc.) that convert their source to JavaScript keep being invented, because it is so godawful for large projects. But then in the end you now have to debug whether it is an issue with your code, or the javascript that your transpiler generated which makes it even more of a mess.

3 Likes

But nobody is “backing” Javascript, they are just including it. And while some types of tech do standardize, languages pretty much never will, mostly because they are used by programmers and every programer will happily tell you why the one they use is better than everything else.

Also JS is just sitting the middle of some things, its not like it is running by itself. It’s running on top of the OS. When you build a game in Unity, you script in C# (or JS/Boo), that gets interpreted by Python(Boo) for the engine(C/C#?, not sure), which then builds it out for a platform. (Java/C#/ObjectiveC/C/C++/JS/whatever). Even if you write in JS(US), it is still getting converted to Python and the engine before it converted to JS. If you are building for the web, it uses JS which talks to the OS. While JS is great for making something that runs in browsers, its still a layer removed. A stand alone build for Mac/Win is always going to perform better and deeper integration that browser/JS version. Unless there was JS operating system (horror), JS will remain a convenience layer.

2 Likes

You’re understanding it wrong. WinForms, i.e. the libraries used to write desktop windows applications, was part of the .NET framework since version 1.0.

Thanks for the link, but can you point me to a single package that actually demonstrates Node.js being used to make any client side functionality that is relevant to desktop application development or, even better, game development? Because I can’t find any

Would you provide a link to a resource that backs this claim? Because I’m not aware of Google announcing or even attempting to go out of their way to support Node.js in any way. If anything, Google seems to be throwing all their weight behind Go on the server side and Angular on the client side.

Are you sure you’re not confusing Node.js with something else? Because you’re presumptions seem to be all over the place.

Citation really needed. Google has yet to do anything to optimize for asm.js, which needs browser support to be able to squeeze that last bit of performance out of JavaScript. Also you seem adamant on mixing Node with asm.js and a bunch of other technologies that have nothing in common other than that they are somehow related to JavaScript in the end.

6 Likes

I think there is some confusion, google is not backing node.js and never has, that would be joyent. Google does develop the javascript v8 engine which compiles javascript to bytecode the first time it is run and speeds it up considerably, which node runs on. This makes sense because they are a web company and so they want javascript to run as fast as possible in browsers, but they show no indication of wanting to extend it to the server side which is actually where node.js is most commonly used.

Google came up with dart to improve upon javascript’s shortcomings, and they back Go for server side stuff which is really next evolution of C and is used in some of their big products like YouTube.

1 Like

Yes there is some confusion on my part. Namely I’m repeating things that I have heard thrown about from node.js developers I have encountered. Thank you for the replies.