Maras

Noob starting with Phaser - TypeScript or JavaScript?

Recommended Posts

What would you recommend for a beginner HTML5 game developer with no knowledge of JS?

 

I just test the waters and so far I like TypeScript much more than pure JS. The code is nicely readable for me (I am currently working with AS3), but there are basicly no tutorials on TypeScript and when I do not know anything about JavaScript, it could be in the end even harder than to learn JavaScript, right?

 

Thanks for your answers!

Share this post


Link to post
Share on other sites

I am not familiar with TypeScript, but I know much about JavaScript.

 

However, I went and searched what TypeScript is actually. Overfly simplifying I could say that it is almost the same as CoffeeScript: Language which is above JavaScript and are eventually complied to JavaScript.

 

Therefore, the question you need to ask yourself is that whether you rely on higher level language to write your code or write JavaScript straight instead.

 

From personal experience I can say that learning more languages is better, but if you are not familiar with JavaScript I would definitely learn JavaScript over TypeScript. The reason being, that if you eventually end up working in a company doing webdev or even gamedev there is still a higher change that they are using JavaScript over TypeScript. Moreover, this question is somewhat similar to "should I use jQuery or not?". The thing is, that if you really wan't to learn how to program - using jQuery or TypeScript is (at least imho) sort of "cheating", but you will get things done faster.

 

In summary, there is a change that you are more productive with higher level frameworks, scripts and tools, but the true learning is achieved by working with lower level languages. Yes, TypeScript is not that "high level", but I would first try out JavaScript before resulting to use TypeScript. And like you said, there is more information from JavaScript than TypeScript.

 

If you are having hard time to get started with JavaScript, I know how you feel - But I actually started learning JavaScript by relaying on jQuery and it took me years to understand and educate myself to be much better with plain JavaScript. It is definitely one of the hardest languages today, because the moment you think you get it right, you are already wrong. (I say this even though I have programmed with c, c++ and other lower level languages). 

 

Luckily, you dont need to learn how to program framework from the scratch, because we got Phaser  :D but building the game with plain JavaScript for self-educating purposes is not a bad idea either.

 

Cheers.

 

Share this post


Link to post
Share on other sites

Hello,

 

You can compile to JavaScript/HTML from almost any other language, so you don't have to choose between JavaScript or Typespscript.

(Typescript actually *is* JavaScript but just with extra optional strong typing.)

 

If you're happy working with AS3, you can keep doing so and just compile to JS/HTML

 

http://www.openfl.org

 

It's 2014, so this stuff works now :)

 

But if you're looking for something new to learn, you can also consider: CoffeeScript, Dart, ClojureScript (yay!).

Or even just use a more mainstream language like C# (with Saltarelle compiler) or Python.

There's also ES6 (The newest version of JavaScript), which you can use with the Traceur compiler.

I use ES6 in daily production code and it's great.

 

Another cross-platform alternative is MonoGame:

 

http://www.monogame.net

Share this post


Link to post
Share on other sites

I am not familiar with TypeScript, but I know much about JavaScript.

 

However, I went and searched what TypeScript is actually. Overfly simplifying I could say that it is almost the same as CoffeeScript: Language which is above JavaScript and are eventually complied to JavaScript.

 

 

 

I agree with most of your post, but this observation you've made is right, but wrong in one critical way.

 

TypeScript is a language like CoffeeScript that compiles to JavaScript.  However, TypeScript is a super set of JavaScript, and this is the critical difference between it and Dart of CoffeeScript, and it's single biggest feature IMHO.  You can take any valid JavaScript file, changes it's extension to ts, and it's a valid TypeScript file.  This means all libraries work out of the box and if TypeScript gets in your way, you can simply work in native JavaScript.  I am actually working on a TypeScript/Phaser tutorial series ( part 1 , part 2 ,  part 3 ) that goes incredibly in depth, as frankly there isn't a lot of TypeScript stuff out there.

 

 

Do I personally recommend TypeScript over JavaScript... that is a resounding "it depends".

 

If you don't know JavaScript yet, no.  It adds a layer of complexity over JavaScript, so when things go wrong they go really wrong.  You can of course start with Phaser and JavaScript, but be ready to question... "Is it me, Phaser, or TypeScript?". 

 

If you do know JavaScript, at the very least check TypeScript out.  It solves many problems that aren't going to be addressed until ECMAScript 6 ships sometime in 2034.  This is especially true on complex systems, or projects with multiple programmers.

Share this post


Link to post
Share on other sites

Thanks for your answers, they are really great!

 

I guess I will try to learn both. Some basics of JavaScript and also TypeScript for better code. I guess I might write some reasonable TypeScript code, I have no idea how to make anything what would not be absolute chaos in JS.

 

This blog post from Lee Brimelow made me think about TypeScript in the first place: http://www.leebrimelow.com/why-i-like-typescripts/

 

 

 

Basically TypeScript allows you to use the JavaScript of tomorrow (ECMAScript 6), today.

 

From what I excpeted from TypeScript is that I will be able to write JavaScript in a future just with knowledge gained from using TypeScript now.

 

Is that correct? (I am planning to develop with Flash as long as possible anyway)

 

Thanks!

Share this post


Link to post
Share on other sites

I agree with most of your post, but this observation you've made is right, but wrong in one critical way.

 

TypeScript is a language like CoffeeScript that compiles to JavaScript.  However, TypeScript is a super set of JavaScript, and this is the critical difference between it and Dart of CoffeeScript, and it's single biggest feature IMHO.  You can take any valid JavaScript file, changes it's extension to ts, and it's a valid TypeScript file.  This means all libraries work out of the box and if TypeScript gets in your way, you can simply work in native JavaScript.  

 

Okey, thanks for clearing this out.  :)

 

 

Do I personally recommend TypeScript over JavaScript... that is a resounding "it depends".

 

If you don't know JavaScript yet, no.  It adds a layer of complexity over JavaScript, so when things go wrong they go really wrong.  

 

I agree with you, the extra layer of complexity is for good and bad: You get the benefits of doing things faster, (easier), etc. But if something breaks, you might be in a situation that you need to trace through several plugin and scripts to see the place where the error originates.  :) This stuff is great when it works. I personally use extra libs etc. if I see that they brings me true benefit or it takes years to program the same. I am not going to use typescript, because I dont see the true benefit, at least, not currently. But we'll see.

Share this post


Link to post
Share on other sites

Basically TypeScript allows you to use the JavaScript of tomorrow (ECMAScript 6), today.

 

The JavaScript of tomorrow is actually the JavaScript of today :)

 

https://github.com/google/traceur-compiler

 

The API is stable enough for production use, even though its "official" release date is June 2015.

 

http://www.2ality.com/2014/06/es6-schedule.html

 

The only things being worked on are technical details of the implementation, but that won't effect the API.

 

http://esdiscuss.org/

 

The module loader API might undergo a change, but that's a minor part of the spec and easy to avoid using for now.

 

So if you want to use JavaScript over a compile-to language, like CoffeeScript or ClojureScript, you might as well just leapfrog TypeScript and jump in to ES6 right from the start.

Share this post


Link to post
Share on other sites

From personal experience I can say that learning more languages is better, but if you are not familiar with JavaScript I would definitely learn JavaScript over TypeScript. The reason being, that if you eventually end up working in a company doing webdev or even gamedev there is still a higher change that they are using JavaScript over TypeScript. Moreover, this question is somewhat similar to "should I use jQuery or not?". The thing is, that if you really wan't to learn how to program - using jQuery or TypeScript is (at least imho) sort of "cheating", but you will get things done faster.

 

 

This is pretty relevant I think, I just accepted a job which will require me to code lots of tooling and while I've used lots of other languages I always avoided JS, but I think the time has finally come for me to just really learn it.  So even though I've used Unity and C# for years I'm pursuing my next project in Phaser and JS to hopefully "ease me" into it, can't wait!

Share this post


Link to post
Share on other sites

This is pretty relevant I think, I just accepted a job which will require me to code lots of tooling and while I've used lots of other languages I always avoided JS, but I think the time has finally come for me to just really learn it.  So even though I've used Unity and C# for years I'm pursuing my next project in Phaser and JS to hopefully "ease me" into it, can't wait!

 

hehe, yea. I bet you will learn a lot with that way. Hmm.. I still remember that it was like 10 years ago when some "multimedia" -teacher of mine was amazed when she saw her students writing css & html without using drag & drop features of "Microsoft Frontpage"....  :D  This is getting off-topic, but just saying.. don't hesitate to learn the actual languages

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.