Do frameworks provide better performance than pure JS coding or not?

Recommended Posts

I'm just wondering about that question. If we don't use any frameworks such as: Phaser, impactJS, Panda2 etc.. and code our game with just 2d canvases and JavaScript then are we going to face any performance issues ? Of course using one of those game engines make a lot of sense but as I said I'm just curious about that because I'm coding my first platform/shooter game with only JS and canvases that's why I don't know performance difference between them.

Share this post

Link to post

Share on other sites

Not 100% sure but my ideology is "If you can create something on your own, DO IT".

It depends on your game and your programming skills. If you want to make something small try to code it with pure JS.

But if want to make something bigger, research for the suitable framework/engine for your needs.

In your case Phaser is perfect for platformers since there are couple pretty well written and documented Physics(ARCADE, P2, NINJA). So yeah, go and try it.

I actually already started with pure JS and I completed %80 of my game. Currently I've around 7000 lines of codes and after I finished my game, I'll show in this site. It is not that big game but it has mechanics such as: physics, collision, shooting, animation, sounds, interaction etc.. I didn't prefer any framework because the reason is: this'll be my first HTML5 game and I also wanted to practise JS that's why I'm coding with pure JS.

Next time I'll learn Phaser. Thanks for your answer.

Share this post

Link to post

Share on other sites

My suggestion if you arent guru use frameworks. And gurus using frameworks also.

Now on plane javascript u have to care about many factors: canvas,webgl,resolutions, engine design, game design, resouces, .., a lot of other problems which are solved by ways smarter and experienced people than you.

Also by using frameworks you are learning different patrerns and ways to solve certain problems.

In your case PIXI/Phaser can do more, based on performance and ease of development.

Im not a guru but I have some experience. Fix me if im wrong.

Share this post

Link to post

Share on other sites

My suggestion if you arent guru use frameworks. And gurus using frameworks also.

Now on plane javascript u have to care about many factors: canvas,webgl,resolutions, engine design, game design, resouces, .., a lot of other problems which are solved by ways smarter and experienced people than you.

Also by using frameworks you are learning different patrerns and ways to solve certain problems.

In your case PIXI/Phaser can do more, based on performance and ease of development.

Im not a guru but I have some experience. Fix me if im wrong.

I agree with you. For a person just like me, Phaser or other frameworks would suit better. But also coding with pure JS, may improve our JS knowledge much better because we'll face many problems and get a chance to design our project structure as we want. Thank you for your answer.

Share this post

Link to post

Share on other sites

I agree with you. For a person just like me, Phaser or other frameworks would suit better. But also coding with pure JS, may improve our JS knowledge much better because we'll face many problems and get a chance to design our project structure as we want. Thank you for your answer.

Okay. Maybe for small project, that should run in Your browser and maintiance is not needed, practice js on it.

But when you deal with bigger project and have to solve real problems like maintability, reusability,cross-platform, design at whole,.., you need really good practice and experience. If you are not new kind of genius you have to trust on the patterns.

For me, Im in the level that I can create everything in some ways. I can do good design based on other similar solutions. A lot of people stuck on that level of skill.Long time I asked myself how to do it right. I read a lot and reached that point - it is easy to coding and it is hard to create good, clear, design(application). And to create good, big application you need experience on many projects,frameworks, patterns,libraries. When just understand some principle in good code, you absorb that part in abstract way and can solve similar problems with it.

I want to say this is it but it is too complex. Dont waste too much time on that skill(js syntax or similar easy steps).Be more constructive.
Good luck. Im curios about the end result.

Share this post

Link to post

Share on other sites

Okay. Maybe for small project, that should run in Your browser and maintiance is not needed, practice js on it.

But when you deal with bigger project and have to solve real problems like maintability, reusability,cross-platform, design at whole,.., you need really good practice and experience. If you are not new kind of genius you have to trust on the patterns.

For me, Im in the level that I can create everything in some ways. I can do good design based on other similar solutions. A lot of people stuck on that level of skill.Long time I asked myself how to do it right. I read a lot and reached that point - it is easy to coding and it is hard to create good, clear, design(application). And to create good, big application you need experience on many projects,frameworks, patterns,libraries. When just understand some principle in good code, you absorb ﻿that part in abstract way and can solve similar problems with it.

I want to say this is it but it is too complex. Dont waste too much time on that skill(js syntax or similar easy steps).Be more constructive.
Good luck. Im curios about the end result.

I understand you, as a newbie programmer I can tell you making platform/shooter games with pure JS is not easy. I'm not saying it is impossible because I don't want to discourage anyone. In my opinion, anyone can try and succeed it but you have to learn and implement concepts such as: physics, collision, shooting, sprite animations, loading etc.. that's why I spent so much time. I don't even know that game is good enough to attract players but at least I learnt many new things in this journey so I'm happy with that. You guys will decide whether this game good or not

Link to post

Share on other sites

However, on the flip side (not you) I find it incredibly arrogant when I hear the advice 'a custom solution will always be best'.

(open-source) Modules are often created by excellent developers, usually supplemented by other excellent contributors, tested by loads of other developers using it, subject to years of active development and improvements and solve specific problems with a laser focus. The only advantage a custom solution has is that modules/frameworks usually have to be flexible and generic enough to fulfil a number of use-cases, which compromises their design. 'Besting' all the advantages they bring, however, is no small task, even if your team has greater 'skill' than all those developers working on the off-the-shelf solution, it's potentially years worth of work and incremental improvements which aren't easy (or can be impossible) to replicate.

Share this post

Link to post

Share on other sites

However, on the flip side (not you) I find it incredibly arrogant when I hear the advice 'a custom solution will always be best'.

(open-source) Modules are often created by excellent developers, usually supplemented by other excellent contributors, tested by loads of other developers using it, subject to years of active development and improvements and solve specific problems with a laser focus. The only advantage a custom solution has is that modules/frameworks usually have to be flexible and generic enough to fulfil a number of use-cases, which compromises their design. 'Besting' all the advantages they bring, however, is no small task, even if your team has greater 'skill' than all those developers working on the off-the-shelf solution, it's potentially years worth of work and incremental improvements which aren't easy (or can be impossible) to replicate.

Thank you very much for your suggestion.

Share this post

Link to post

Share on other sites

You can squeeze a surprising amount of performance out of raw WebGL, especially for tiled backgrounds and sprites which share the same sprite sheet. In my experience, some WebGL-accelerated frameworks sometimes do a poor job of rendering these things: namely by making way too many draw calls. However, using the 2d canvas API is almost always going to be slower than WebGL.

I think you made the right choice using the 2d API for your first game!