Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

26. April 2012

 

I am noticing from search traffic that this is an extremely common question, people seem to want to know if you can use C++ with the PS Studio SDK.VitaCpp

 

 

Simple answer and you aren’t going to like it.

 

 

No, no you can’t.

 

 

 

I wouldn’t hold your breath either, it’s the mono runtime behind the scenes that is providing the portability across devices.  If you want native C++ support you need to have access to the full development suite.  Even becoming a PSN developer to develop PSN Mini games requires well over 1000$.

 

 

 

If for some reason you prefer C++’s syntax over C# ( this may in fact be a sign of insanity by the way… ), you *might* and I emphasize *might* be able to take advantage of this project CPlusPlus, at some point, but even then you would have to write pure CIL code.  Without native access, there would be very little point using C++ in this situation.

 

 

 

Therefore for all intents and purposes, no you cannot use C++ with PlayStation Suite. C# is the only game in town and I wouldn’t expect to see that change any time soon. 

Programming , ,

26. April 2012

 

In this tutorial we are going to manually manage the game loop manually.  Additionally we are going to look at the various ways of handling input from the gamepad.  This tutorial builds on the code we developed in the previous tutorial.  As you may recall, we created a “Hello World” sprite and centered it to the camera.  This time, we are going to give the user the ability to control the sprite’s position and size using the gamepad.

 

 

Let’s get straight to the code:

 

using System; using System.Collections.Generic; using Sce.Pss.Core; using Sce.Pss.Core.Environment; using Sce.Pss.Core.Graphics; using Sce.Pss.Core.Input; using Sce.Pss.HighLevel.GameEngine2D; using Sce.Pss.HighLevel.GameEngine2D.Base; using Sce.Pss.Core.Imaging; namespace HelloWorld { public class AppMain { public static void Main (string[] args) { Director.Initialize(); Scene scene = new Scene(); scene.Camera.SetViewFromViewport(); var width = Director.Instance.GL.Context.GetViewport().Width; var height = Director.Instance.GL.Context.GetViewport().Height; Image img = new Image(ImageMode.Rgba,new ImageSize(width,height),new ImageColor(255,0,0,0)); img.DrawText("Hello World", new ImageColor(255,0,0,255), new Font(FontAlias.System,170,FontStyle.Regular), new ImagePosition(0,150)); Texture2D texture = new Texture2D(width,height,false,PixelFormat.Rgba); texture.SetPixels(0,img.ToBuffer()); img.Dispose(); TextureInfo ti = new TextureInfo(); ti.Texture = texture; SpriteUV sprite = new SpriteUV(); sprite.TextureInfo = ti; sprite.Quad.S = ti.TextureSizef; sprite.CenterSprite(); sprite.Position = scene.Camera.CalcBounds().Center; scene.AddChild(sprite); Director.Instance.RunWithScene(scene,true); bool gameOver = false; while(!gameOver) { Sce.Pss.HighLevel.GameEngine2D.Director.Instance.Update(); if(Input2.GamePad.GetData(0).Left.Release) { sprite.Rotate(Sce.Pss.HighLevel.GameEngine2D.Base.Math.Deg2Rad(90)); } if(Input2.GamePad0.Right.Release) { sprite.Rotate(Sce.Pss.HighLevel.GameEngine2D.Base.Math.Deg2Rad(-90)); } if((Sce.Pss.Core.Input.GamePad.GetData(0).Buttons & GamePadButtons.Up) == GamePadButtons.Up) { sprite.Quad.S = new Vector2(sprite.Quad.S.X += 10.0f,sprite.Quad.S.Y += 10.0f); sprite.CenterSprite(); } if((Sce.Pss.Core.Input.GamePad.GetData(0).Buttons & GamePadButtons.Down) == GamePadButtons.Down) { sprite.Quad.S = new Vector2(sprite.Quad.S.X -= 10.0f,sprite.Quad.S.Y -= 10.0f); sprite.CenterSprite(); } if(Input2.GamePad0.Circle.Press == true) gameOver = true; Sce.Pss.HighLevel.GameEngine2D.Director.Instance.Render(); Sce.Pss.HighLevel.GameEngine2D.Director.Instance.GL.Context.SwapBuffers(); Sce.Pss.HighLevel.GameEngine2D.Director.Instance.PostSwap(); } Director.Terminate(); } } }

 

 

 

The top portion of the code is completely unchanged, our new additions start at the line:

Director.Instance.RunWithScene(scene,true);

 

The key addition here is the second parameter “true”.  This bool is telling the Director singleton that we are going to handle the game loop ourselves, this means we need to call 4 methods manually ( described in a moment ).  Next up we create a bool gameOver, which is going to control when we exit our game loop.  Obviously we don’t want to exit right away, so we default it to false.  Speaking of game loops, that’s what the while line does, loops over and over until gameOver is set to true.

 

Now in each iteration of our loop, there are four methods we have to call, Update(), Render(), GL.Context.SwapBuffer() and PostSwap().  Update() tells the director we have moved on to the next frame, Render() draws the frame, SwapBuffers displays what Render() drew on the backbuffer to the screen (makes it visible) and finally PostSwap() tells the director we’ve finished swapping buffers and it must be called after SwapBuffers().  Those four combined represent a complete game loop, all the rest of the code handles input from the game pad.

 

Just to make something perfectly clear here, I am using 3 different ways to check for input, *you won’t do this in your code*.  I am just doing it to illustrate all of your different options in one example.  You should just pick one ( probably Input2 ) and use only it.  Lets look at them one at a time.

 

if(Input2.GamePad.GetData(0).Left.Release) { sprite.Rotate(Sce.Pss.HighLevel.GameEngine2D.Base.Math.Deg2Rad(90)); }

 

 

This method is the most likely way you will deal with Input.  Input2 is a wrapper around the Input object to make things a bit simpler.  GetData takes a parameter telling it which control ( controller 1, controller 2, etc ) you want to poll, returning a GamePadData object, representing the state the controller is in.  We are then checking if the “Left” button has been released.  In the case Left is released, we then rotate our sprite 90 degrees.  Rotate takes an angle value in radians, so we use the Math.Deg2Rad() helper function to convert from degrees to radians.  Of course you could have passed the radian value in instead of converting, 1.5709633 is 90 degrees in radians, it’s just a bit harder to look at.

 

if(Input2.GamePad0.Right.Release) { sprite.Rotate(Sce.Pss.HighLevel.GameEngine2D.Base.Math.Deg2Rad(-90)); }

 

 

This if statement is almost identical to the last one, but instead of using GetData(0), we use a handy alias (GamePad0) that represents exactly the same thing.  The only other difference is, in this case we are checking to see if the “Right” button has been released, and we are rotating by a negative value ( the other way ) if it is.

 

 

if((Sce.Pss.Core.Input.GamePad.GetData(0).Buttons & GamePadButtons.Up) == GamePadButtons.Up) { sprite.Quad.S = new Vector2(sprite.Quad.S.X += 10.0f,sprite.Quad.S.Y += 10.0f); sprite.CenterSprite(); } if((Sce.Pss.Core.Input.GamePad.GetData(0).Buttons & GamePadButtons.Down) == GamePadButtons.Down) { sprite.Quad.S = new Vector2(sprite.Quad.S.X -= 10.0f,sprite.Quad.S.Y -= 10.0f); sprite.CenterSprite(); }

 

 

This time we are using Input directly, using Input instead of Input2.  As you can see, the results are a bit more “raw”.  In this case we have to use bit masking to determine if a given button is pressed and there is no Released option.  In this case we are checking for the “Up” and “Down” buttons.  In the event that the user is pressing Up or Down, we are modifying the Scale of the quad our hello texture is pasted on.  Remember initially Quad.S is equal to the size of the screen in pixels.  If we press Up, we scale the image up 10 pixels in size, if we press down, we shrink it by 10 pixels in size.

 

 

Finally, we check ( using the Input2 method ), if the user has pressed the Circle button, in which case we set gameOver to true, causing our loop to exit and our program to end.

 

 

One thing to notice at this point is how we scaled the sprite.  Unlike rotate, we didn’t call a method, instead we modified the Quad.S(cale) property.  The actual transformation matrix of a node ( which SpriteUV is derived from ) is actually determined combining the Position, Scale, Skew and Rotation+Angle+RotationNormalize properties.  Therefore modifying any of these properties will translate the node accordingly.

 

 

Now run our game, if we press left or right, we rotate 90 degrees, while pressing up or down scales the images.  Finally press Circle to exit.

 

 

helloworld2

 

 

One last thing I suppose needs covering… how exactly do you press Left, Right, or Circle on the simulator?

Left directional key
Cursor key: ←

Up directional key
Cursor key: ↑

Right directional key
Cursor key: →

Down directional key
Cursor key: ↓

Square button
Alphabet: A

Triangle button
Alphabet: W

Circle button
Alphabet: D

Cross button
Alphabet: S

SELECT button
Alphabet: Z

START button
Alphabet: X

L button
Alphabet: Q

R button
Alphabet: E

 

 

Sadly, you cannot currently emulate the analog sticks using the simulator.  Obviously you can on the Vita device.

 

EDIT: Oops, forgot to include the project source code, which you can download here.

Programming , , ,

24. April 2012

 

 

There is a charter somewhere that states all tutorial series must start with the ubiquitous Hello World tutorial, and who am I to break the charter?  So that is exactly what we are going to do here, a simple Hello World. This is as much about getting up and running with PS Studio than it is about C# coding, as there are a couple small gotchas.  By the end of this tutorial you should be able to create, configure and run an application.  In future tutorials, I will assume you have these abilities.

 

If you haven’t already, download and install PlayStation®Suite SDK from here.  The install is pretty straight forward, take the defaults, next next next, done.  If you want some idea of what you just installed check out this post.  Now fire up PssStudio from your start menu.  Once loaded, select File->New-Solution, like this:

 

image

 

 

In the “New Solution” dialog, on the left hand side expand C# then select PlayStation Suite.  Select PlayStation Suite Application on the right, then fill in whatever name you want ( I  am using HelloWorld ).  This should automatically fill in Solution Name, it is your choice if you want to create a subdirectory or not, in this case I will.  Fill out the dialog like this:

 

image

 

 

Click OK, and your solution will be created.  Now we need to add an app.cfg file to your application, or it will fail to run.  Note, this is not that same as a .NET application configuration file.  In the Solution Explorer, right click your project name ( HelloWorld in my case ), then select Add->New File… like such:

 

 

image

 

 

Choose Misc on the left, then Empty Text File, name it app.cfg and click New.

 

image

 

The newly created file will open in the text editor, fill it in with the following:

 

memory: resource_heap_size : 16384 managed_heap_size : 16384 input: gamepad : false touch : false motion : false

 

 

This file is telling what kind of machine your application is targeting.  If you forget this step, the simulator pss.exe will just max out a CPU core, never responding.  Now in the Solution panel, locate and double click AppMain.cs, this is where our application code will reside.

 

image

 

 

The actual process of doing Hello World on Vita is actually incredibly involved, as you need to do almost everything yourself.  In this example however, I am going to take advantage of GameEngine2D, which is an included 2D Game engine that makes many of the drudge worthy tasks much easier.  That means we need to add a reference to GameEngine2D.  Adding a reference is simply saying “I am going to use the code included in this library” In order to add a reference to GameEngine2D, right click on References and choose Edit References… like such:

 

image

 

Then a dialog will pop up, locate Sce.Pss.HighLevel.GameEngine2D and check the box to it’s left.  Then click OK.

 

image

 

 

Now we can add a using entry to tell our code to use the newly referenced library.  This is where we run into a bug in MonoDevelop ( PS Studio ).  Look at the following auto-completion screenshot:

 

image

 

 

Hmmm… where is HighLevel?  We added the reference, it should be there.  Well, on adding a new reference it seems the intellisense/auto-completion isn’t updated properly.  I live by auto-complete so this is a big deal to me.  Simply close and re-open your solution and presto:

 

 

image

 

 

Thankfully, you don’t really need to add references all that often, so while it’s inconvenient to have to exit and restart, its not the end of the world.  PS Studio loads quickly enough to barely notice.

 

 

Alright, finally time for the code!

 

 

using System; using System.Collections.Generic; using Sce.Pss.Core; using Sce.Pss.Core.Environment; using Sce.Pss.Core.Graphics; using Sce.Pss.Core.Input; using Sce.Pss.HighLevel.GameEngine2D; using Sce.Pss.HighLevel.GameEngine2D.Base; using Sce.Pss.Core.Imaging; namespace HelloWorld { public class AppMain { public static void Main (string[] args) { Director.Initialize(); Scene scene = new Scene(); scene.Camera.SetViewFromViewport(); var width = Director.Instance.GL.Context.GetViewport().Width; var height = Director.Instance.GL.Context.GetViewport().Height; Image img = new Image(ImageMode.Rgba, new ImageSize(width,height), new ImageColor(255,0,0,0)); img.DrawText("Hello World", new ImageColor(255,0,0,255), new Font(FontAlias.System,170,FontStyle.Regular), new ImagePosition(0,150)); Texture2D texture = new Texture2D(width,height,false, PixelFormat.Rgba); texture.SetPixels(0,img.ToBuffer()); img.Dispose(); TextureInfo ti = new TextureInfo(); ti.Texture = texture; SpriteUV sprite = new SpriteUV(); sprite.TextureInfo = ti; sprite.Quad.S = ti.TextureSizef; sprite.CenterSprite(); sprite.Position = scene.Camera.CalcBounds().Center; scene.AddChild(sprite); Director.Instance.RunWithScene(scene); } } }

 

 

PHEW!  Pretty long for a Hello World eh?  Truth of the matter is, had I not used GameEngine2D it would have easily been 4 or 5 times longer!  We will cover what is going on behind the scenes ( the stuff GameEngine2D is handling ) in a later post.  For now, just assume this is the way it works, at least while you are getting started.  Now lets take a quick walk through the code and look at what’s happening here.

 

First we add our additional includes, Sce.Pss.HighLevel.GameEngine2D and Sce.Pss.HighLevel.GameEngine2D.Base.  Our app consists of a single method, Main, as the event loop is actually managed by the Director.

 

Speaking of which, that is what the first line does, initializes the Director singleton.  A singleton is a globally available object that is allocated on it’s first use.  Director is the heart of your game, even though most of the complexity is hidden away.  Remember, you have full source code for GameEngine2D available if you want to peek behind the curtain.

 

Next up we create a Scene.  Again, Scene is an abstraction provided by GameEngine2D which can be thought of as a collection of visible “stuff”, the bits and pieces that compose what we want to display to the user and the Camera used to display them.  We then call SetViewFromViewport() which creates a camera sized to the window. Generally without GameEngine2D, you would have to do this yourself, setting up an orthographic project.

 

The next two lines get the width and height, as reported by the Director’s OpenGL context.  We then create an Image the same dimensions as our viewport.  The Image class is used to hold binary image data, such as from a PNG or JPG file, but in this case we are create a new blank image.  Once we create our Image, we call it’s DrawText method to draw our “Hello World” message.  ImageColor represents the color we want to draw the image ( red in this case ), Font represents the font to draw the text in ( there aren’t really many options here ), while ImagePosition represents the location within the image to draw the text at.

 

Now that we have created an image, we need to create a texture out of it.  Textures are most often thought of as the images mapped around 3D objects and in a way, that is still what we are doing here.  GPUs have no concept of image files or pixels, they deal only with textures.  That is why we copy our image data into the texture, using the SetPixels method of Texture2D and the ToBuffer() method of Image, to turn the images pixel data into an array Texture2D can use.  At this point we are done with our Image, so we Dispose() it.

 

We next create a TextureInfo object and assign our newly created Texture to it.  TextureInfo caches UV location information about the texture, as well as taking ownership of the texture itself.  More importantly, it’s a TextureInfo object that Sprite expects, so that is what we create.  Speaking of sprite, that is what we create next in the form of a SpriteUV.

 

Since modern GPUs don’t really deal with pixels anymore, everything is pretty much made out of textured polygons and SpriteUV is no exception.  It is essentially a rectangular polygon that faces the camera with our image textured on it, all sprites are.  Next up we set the sprite’s Quad ( the rectangle the texture is plastered to ) to be equal to the size of our texture, which in this case is the same size as our view.  We now position our sprite smack in the middle of the view.

 

Now that we created our Image data, copied that image data into a Texture2D that was then assigned to a TextureInfo object, which in turn was assigned to a SpriteUV, we are now ready to add that fully textured sprite to our scene, which we do by calling AddChild().  Yeah, it sounds very convoluted, but you will find it natural very soon and generally you just load your textures from file anyways, greatly simplifying this process.

 

Anyways, now that we have our scene populated with our texture, which is the same size as the screen, we go ahead and tell the Director to do it’s thing, via RunWithScene().  You can think of this as the game loop, although the internals of what it’s doing are hidden from you.

 

 

Don’t worry, it’s really not as complicated as it seems.  Now lets take a look at the fruits of our labour.  To run it in PS Studio, select the Run menu and either choose Start Without Debugging or Start Debugging, depending if you want to be able to debug or not, like such:

 

image

 

 

And presto, all our hard work resulted in…

 

image

 

May not be much to look at, but you successfully created a game you can run on a Vita!

 

Speaking of which, if you need details of running on an actual device instead of in the simulator, read this post.

 

The complete project file for this tutorial are available for download here.

 

 

 

Continue on to Hello World Part 2: Hello Harder.

Programming , , ,

20. April 2012

 

Ok, I really need to come up with a shorthand version for that!  PS SDK?

 

 

Anyways, right off the hop here are two problems people might run into.  If you start a new project, an app.cfg file is NOT created.  However, the emulator pss.exe will just sit there and spin using up 100% of one of your cores.  To fix it, in your Playstation Suite project, make sure you add an app.cfg, like the following:

 

 

memory: resource_heap_size : 16384 managed_heap_size : 16384 input: gamepad : false touch : false motion : false

 

 

Next, Playstation Suite Studio is based around MonoDevelop and seems to have some serious issues with auto completion.  If you add a reference to an assembly ( such as Sce.Pss.HighLevel.Model ) and aren’t getting auto-completion on it, save your project, close it and re-open and auto-completion will work for that assembly from now on.   Yes, this is a pain in the butt and if I come up with a better solution/fix in the future I will let you know.

 

Sony has a Visual Studio plugin in the works, which will be nice as intellisense generally works more or less flawlessly in Visual Studio.  Fingers crossed Visual Studio support comes soon, no offence to MonoDevelop.

Programming

23. March 2012

 

 

Have you ever read a technical book and thought to yourself “Man, the author of this book must be a gigantic jerk!”?  I can honestly say, I never have until now!

 

 

This review of sorts covers two different Javascript books I’ve read recently; two very different books with two very different goals.  As I have been working with Node and more recently Appcelerator, I decided I needed to polish up my Javascript skills, as things are much different these days than the DOM manipulation I traditionally used Javascript for.  I started out by searching for “Javascript closure” on Safari Books Online and it brought me to Javascript: The Good Parts, it was short and I was suffering insomnia so I read it that evening.  The book left me with so many questions that I ended up reading/contrasting it against Javascript: The definitive guide.  Aside from both books being about Javascript and both having colons in their titles, these two books couldn’t be further apart!

 

 

 

Let’s start with the Javascript: The Good Parts review.

 

 

First off, it’s worth mentioning the author, Douglas Crockford.  If you’ve never heard of him, he is the guy originally responsible for drafting the JSON standard and Yahoo’s head JavascriptJavascriptTheGoodParts guy, responsible for projects like the yUI library.  Simply put, this man knows his stuff when it comes to the topic.  Sadly, he knows it too and doesn’t let you forget it.  Many times in the book he pushes his opinion as fact, and often on very odd things ( like never use ++ operators ).  He often makes sweeping statements that really don’t work in a black and white world.  That said, if you can get over the personality ( or you aren’t sensitive to such things ), this is a wonderful little book.

 

 

I do mean little too, as this book weighs in at a mere 176 pages.  Amazingly enough there is a ton packed in to those 176 pages and even more amazingly, a great deal of it could be pruned and would make this a superior book ( such as the regular expressions chapter ).  A good example of what could be pruned out completely are the absolutely bizarre charts this book is littered with.  Here is one for example:

 

 

whitespace

 

 

That chart was meant to explain Javascripts whitespace rules… did it help you, even slightly?  You could have more concisely and effectively conveyed all of that information in a sentence or two.  I found that over and over, the author being overly clever or complicated leaves the reader baffled on what should be a pretty simple concept.  He does the exact same thing with code examples too, consider this code sample regarding inheritance:

 

var Cat = function (name) { this.name = name; this.saying = 'meow'; }; // Replace Cat.prototype with a new instance of Mammal Cat.prototype = new Mammal( ); // Augment the new prototype with // purr and get_name methods. Cat.prototype.purr = function (n) { var i, s = ''; for (i = 0; i < n; i += 1) { if (s) { s += '-'; } s += 'r'; } return s; }; Cat.prototype.get_name = function ( ) { return this.says( ) + ' ' + this.name + ' ' + this.says( ); }; var myCat = new Cat('Henrietta'); var says = myCat.says( ); // 'meow' var purr = myCat.purr(5); // 'r-r-r-r-r' var name = myCat.get_name( ); // 'meow Henrietta meow'

 

 

Notice how half of it is taken up by a purr() method which is overly convoluted and has nothing to do with the lesson at hand.  It simply causes the reader to have to dedicate a few more cycles to deciphering an example ( which is completely irrelevant to the topic at hand ), while allowing the author to feel just a little bit more clever. 

 

These kinds of things happen over and over and it makes reading the book more difficult than it should be, for no good reason.  The other major problem with trying to decipher the code samples in this book are the errors, my god the errors!  See every technical book is going to have a certain number of errors, but for a 176 page book, this one has far more then it’s share.  Just take a look at the errata.  Nothing makes learning a new concept more difficult than following code that doesn’t work!  When you are new to a subject, you assume the code you are working from is correct and it’s your newbishness that is the source of the problem.  That often simply isn’t true with this book, when you read it, if you encounter problems be sure to check the errata before you bash your head off the wall with frustration.

 

 

Next up is determining who this book’s audience is, which is a problem the author obviously struggled with.  Consider the following two paragraphs taken from the preface:

 

This is a book about the JavaScript programming language. It is intended for            programmers who, by happenstance or curiosity, are venturing into JavaScript for the   first time. It is also intended for programmers who have been working with JavaScript at a novice level and are now ready for a more sophisticated relationship with the language. JavaScript is a surprisingly powerful language. Its unconventionality presents some challenges, but being a small language, it is easily mastered.

 

Followed a paragraph later by:

 

This is not a book for beginners. Someday I hope to write a JavaScript: The First Parts book, but this is not that book. This is not a book about Ajax or web programming. The focus is exclusively on JavaScript, which is just one of the languages the web developer must master.

 

Let me put this in the simplest terms possible This is not a book for beginners!  If you are “venturing into Javascript for the first time”, well frankly you are absolutely screwed if this is the book you chose!

 

 

So I’ve dumped on this book pretty good, it’s short, the author comes across arrogant and I seem to hate at least half of it, so why the hell am I bothering to mention it to you?  That’s because the remaining half of this book is downright excellent.  It basically is the Javascript equivalent of Effective C++, which is one of the best technical books ever written.

 

 

Javascript as a language is an absolute minefield waiting to explode killing ( or at least mentally scaring ) the developer.  It lacks the data hiding facilities that basically every other language in existence has.  More so, it has extremely dangerous but seemingly benign constructs like new and == that are just waiting there to attack you.  Finally, the scoping rules are almost as byzantine as you’d expect from C++! It is far too easy to make a variable global, or mute out an existing variable leading to undesired behavior ( bugs ).  This book helps you to navigate that minefield, probably better than any other book in existence.

 

 

More to the point, most people simply use Javascript wrong ( now there I go sounding arrogant! Winking smile ).  But simple fact is, years of browser based DOM manipulation code written to mimic traditional OO code has lead to many people forming extremely bad habits, myself included.  This book does a very good job of showing you the intricacies of the language, as well as effective work arounds for perceived faults.  Some of these “faults” I disagree with, but I certainly did learn from the exercises anyways.

 

 

So in the end, do I recommend this book?  That’s a tricky one.  I really don’t like the way it is written, I am not keen on the way he teaches ( the choice of illustrations and code examples ), the excessive errors certainly don’t help.  That said, I learned a ton reading this book, in a very short period of time.  Besides, it’s less than 20 bucks!  So in the end, yes I do recommend you read it, much like Effective C++, it will make you a better Javascript programmer.  But for learning the language or as a first book, certainly not.  Fortunately in the regard, we have another book!

 

 

 

Javascript: The Definitive Guide review.

 

 

If Javascript has a bible ( like K&R C for the C Programming Language ), it’s this book.  The Definitive Guide is a much more traditional book, much longer at 1032 pages and with a much more traditional price tag.  This part of the review is going to be much shorter, as essentiallyJavascriptTheDefinitiveGuide there is a lot less to say.  The authors writing style in much more approachable than Javascript:The Good Parts and the code examples are far easier to digest.

 

 

One up or downside to this book, depending on your needs, is the amount of browser/DOM related content.  While Good parts effectively had no content pertaining to using Javascript in the browser ( an area extremely well documented in books and online ), the same is not true for this book.  Fully half of this book is on “client side” Javascript programming.  Then again, even at 50%, this is still a 1000+ page book, so you still got another 500 pages of non-client side Javascript.  Just remember, if you are using Javascript outside of the browser, if it starts with document. it probably isn’t supported.

 

 

The book is basically broken down into 4 sections.  The first is Core Javascript, which covers the language itself, regardless to how it is used.  This section is where you cover concepts like reserved words, objects, arrays etc.  The second is Client Side Javascript, which basically covers using Javascript in the browser, covering topics such as the DOM, jQuery, HTML5, etc.  The final two sections are reference sections for both the core and client side libraries.  These sections are strictly for reference.  Truth is though, with the sad state of the internet on this subject, a handy book reference is quite a useful thing.

 

 

For learning the language and your goto reference book, it’s really hard to beat Javascript: The Definitive Guide.  Taken in tandem, these two books are all you would need to succeed at Javascript development.  The Definitive Guide to get you started, and as a reference as you go along.  Then read Best Parts, to make you a better developer… if you are willing to put up with some annoying attitude that is!

Programming ,

Month List

Popular Comments