Jump to content

What is TypeScript? And other matters


Julz57
 Share

Recommended Posts

Ok all, ANOTHER dumb question(s(?)).

I keep reading about Phaser, JavaScript, TypeScript and Nodejs and this and that and how all somehow magically integrates with Phaser, compilers and web pages (HTML5) to simplify the programming.

Well I am not a magician and I don't even have my outfit yet. Think Harry Potter meeting Hagrid for the first time. I'm Harry and Hagrid is Phaser. Diagon Alley is where these magical tools reside and I'm still waiting for my ticket to catch the Hogwarts Express where all will be revealed. So I'm excited, a little(?) bit unsure and looking forward to learning so much but I haven't even got a single thing for Hogwarts. I do have a Public Library card, aka Google, and have been using it.

I'm looking to use Phaser Editor which will simplify things under the bonnet for me. Is that my ticket to Hogwarts? So do I need to worry about the above or just go for it and get my fingers dirty with coding? And then just pick things up along the way as my needs grow?

I'm afraid that I could keep procrastinating for ever about my best entry point into Phaser. Help!

I think that I have answered my own question but second opinions appreciated.

Thanks

PS: Anyone from Slytherin need not respond

Link to comment
Share on other sites

Mornin',

Frankly (in my personal opinion), I wouldn't worry about integrations and builds with Phaser until you've got a good grasp on how it generally works. You don't need to use TS to use Phaser basically, so I'd just dive in and start monkeying around with it using standard JS at this stage (looking at the examples, other sites such as game mechanic explorer as a starting point). Otherwise you're going to scare yourself away, as there's a lot to learn. But taking it step by step will allow you to keep your confidence and keep the fun aspect of it all in check.

However, that being said, you could very much benefit from looking at TypeScript also. In brief it's a 'superset' of JS that keeps you on the straight and narrow, allowing for best practices when it comes to compiling down to actual JS (that's a very very brief summary). Also, you briefly mentioned Node.js, you can also write apps for it using Typescript too (since it's just JS at the end of the day).

So, in short, don't worry too much about the details just yet. Getting a grasp is a great place to start, so if I were you I'd get your hands dirty with Phaser, and if you've got time have a look at how TS works. Then, when you're confident on both, you can bring them together in a sublime union of magical intrigue.

I hope this helps in some way to take you forwards, and feel free to PM me for any extra help.

Good luck out there! 

 

Link to comment
Share on other sites

Hey Julz, I agree with drunkenoodle's advice, just get going with 'plain' vanilla JS for now and worry about the other bells and whistles later.

As a brief bit of web dev history -> jQuery was a library that made working cross-browser with crappy browser apis a lot easier, it was sooo good and sooo successful that it became near ubiquitous for a while and in some cases it meant that developers (particularly experienced devs from other languages who just wanted to get going quickly with web programming) learnt jQuery idioms without knowing why they existed or what was actually happening 'under-the-hood'. When cross-browser issues diminished and crappy browser apis got better jQuery lost its usefulness as there were equally easy and safe patterns without the need of the jQuery library, however, those devs that know jQuery well but JS not-so-well suddenly had a lot of problems, mostly related to how JS actually works, so they had to learn more about the language and it was a huge step back for them. The moral, I think, being to learn the basics of the craft first before adding stuff on. JS tooling is abundant presently but if you don't know why that tooling does what it does then you're going to hit another massive hillock when that tooling changes or is superseded by something else.

How does this relate to TS, ESNext, Babel etc?

Well, here's a very brief summary of each tech you mentioned?

JS -> Turing complete language, won the browser language battle. Required to write almost anything you want surfaced on the web as its the only language your platform (the browser) understands.

Phaser -> JS library providing abstractions to canvas API (a browser API) and various other browser APIs (such as grabbing user input). Also provides state functions for helping to structure an application, and lots of other goodies to help create boilerplate code (stuff most projects need but is not application/business logic) to get going producing apps/games quickly and efficiently. Is opinionated about how you should write your code (not a bad thing).

NodeJS -> A runtime executing JS i.e. lets you run JS outside of the browser. Most JS tooling uses node to run tasks on your computer or server. Also used to create web services i.e. code running on a server to either serve pages to your browser or to serve data when something (i.e. a browser request) asks for it.

TypeScript -> Provides additional language level features missing or implemented differently to vanilla JS. Browsers (and node) do not understand it so you must run a process (called transpilation) to convert your TS source code into code that can be run in the browser or in node. Babel is in the same class, it is a tool that allows access to language level features that browsers do not yet support (or only have partial support). Back in the day CoffeeScript was also in this class of tooling.

I'd agree you can ignore the TS and Node stuff for now and concentrate on JS and Phaser stuff to get a client-side (runs by itself in the browser) app up and running.

Personally, TS is a footgun for me. I have many arguments as to why I don't like it, but those same arguments are easy to find with your Library Card!

 

Link to comment
Share on other sites

Hi,

Thanks for both posts.

I went to the link to game mechanics and found it very good. The link there to game design fundamentals was great as well. So thanks for the links. Will use them as a reference and will need to read again to try to fully grasp all the concepts of game mechanics and design.

Loved the examples there as well.

Yes I keep trying to start, read too much, get confused and repeat the cycle again and again and again. ;( 

Even tried to load Phaser Editor onto my system but could not get it going with Linux Lite as the OS. Tried the additional commands in the  Command line to set it up but keep getting errors. Have already messaged about this and I know it is not your issue here. I am very new to Linux  also as I only managed to revive the laptop I am typing on just before heading away for a holiday. I never thought that I would have the good fortune of finding Phaser whilst away. So at least one REAL positive there.

So while i try to work things out I think I will fiddle in Sandbox and see what I can do there.

So again thanks for the posts. Hand holding of noobs is cherished by the noobs!

Link to comment
Share on other sites

Quote

So while i try to work things out I think I will fiddle in Sandbox and see what I can do there.



@Julz57 The phaser examples are super convenient when fiddling around, in your case of the vision game the display section must be useful. If you have trouble getting things started I am also available to help out, by pm, for emergencies : I often use teamviewer for remote support (sister).

Link to comment
Share on other sites

@samid737 Thanks. yes I have been reviewing all the examples at Phaser.io as well as others on different websites. The graphics tinting of sprites and background colour changes are probably the two greatest options in Phaser for the required games. Thinking they will be super fast especially given that most sprites will be grouped as well. Only a palette of 4 colours which I am sure can be further optimised at some stage if need be.

Some of the game examples are also awesome and easily adapted to my needs.

Thanks for the offer of help. I like trying to do things on my own which is good and bad. Sometimes it is just getting my foot into the door before it closes. And hopefully it doesn't close too fast and break my toes. LOL.

Sometimes I feel so close to being there and next it is like I am in a different country. Having no formal training in coding makes things interesting at times. My profession was the antithesis of that of a programmer but then logic is logic. I am currently learning the language let alone the rules. Delphi coding was relatively easy for me as the rules were VERY flexible. I could fudge my way through it all!

One of my other problems is that I am using a laptop that died during its last Windows 10 update and I have installed Linux Lite to have something while travelling. Making everything just a little more awkward as not sure of the set up processes for installing programs etc.  Linux and Windows OS are like chalk and cheese. Windows is the chalk but its taste is familiar so I have adapted to it. But will be home soon and this time will be used for reading as much  as possible about Phaser coding, games cycles, game logic, game design,..... so not wasted really.

Cheers :)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...