JavaScript or Flash for multiplayer webgame? - javascript

I was recommended these two languages as a good option for multiplayer web game development, but I don't know what are restrictions of these languages in terms of game development. I personally like JavaScript, but I'm not sure about client-server communication and security.
Game is going to be 2D turn based strategy.

Shortest answer: Flash.
Short answer: Flash is your best option at the moment, but it's entirely possible to make a good quality game with javascript, there's libraries out there that make the drawing part really easy.
Long answer: For action heavy games, such as a fast paced platformer or a fighting game, Flash is your best option. Flash is also the only option if you want to be able to sell your game to various portals, since they have not yet opened up the ability to license HTML5/Javascript games.
However, Javascript is a viable game development language. Angry Birds on Google+ (and in the chrome store) uses Javascript, and only uses Flash for audio. In fact, audio is currently the biggest challenge, and there's slowly more solutions to that as well. Combine that with stuff like socket.io and the emerging WebGL, and you've achieved parity with most Flash and Unity games.
That said, there are drawbacks to Javascript. Namely, it is much harder to protect the code from being stolen or hacked, and depending on various factors, you're cutting out a subset of users who might be running IE8 and below. There are solutions to these problems, and there is one major drawback of Flash (doesn't work on iOS), but generally, these should be pointed out.

if to be short, it's too hard to draw via javascript. So if you game deals with graphics or animation, it better to use actionscript. IMHO, actionscript is the best if you want to design browser game, javascript will be needed to deal with browser only (if that'll be needed).
UPD: take a look at Haxe. It's multi-platform language. You can target both flash and JS on Haxe.

I would recommend Flash, unless you care about the iOS audience. Having a socket running in your multiplayer game is extremely valuable, and easy to accomplish. Meanwhile, unless you want to demand a specific browser from your users, the never ending headache of browser/platform incompatibility, especially in something as javascript intensive as a multiplayer game, makes Flash the obvious choice. And of course, performing animations is what flash is best at. Achieving similar results in HTML is in many cases impossible, but in all cases MUCH more work.
Oh, and welcome to Stack! :)

Go javascript. But you should look at http://socket.io/ if you go the javascript route

Related

Comparison between HTML5/js and flash-like

the framework html5/js is now easily usable to make application and game http://html5games.com/ and even major online game site started using it http://www.kongregate.com/html5-games.
My question is: in term of foreseeable future is html5/js going to be developed with an eye to game development? i mean, is this being considered by the dev-team? and at present time is html5 offering support, compatibility, portability and tools comparable to long date standard like flash?
I'm not asking for the best way to develop an interactive site, browser game or animation; I am interested in the usability of HTML/javascript in game and animation development because i prefer it over flash.
You can replace your Flash development workflow with this set of tools:
Pixi: Fast WebGL 2d rendering and scene graph
Babylon: Fast WebGL 3d rendering and scene graph with integrated physics and collision
Tweenjs or Greensock: Tween algorithms
Howler: Sound using the WebAudio API
Proton: particle effects
P2 or PhysicsJS: 2d physics
PathfiningJS: A* and other pathfinding algorithms
HammerJS: Multitouch events
Or you could use a higher-level framework like Phaser, Grapefruit, Goo Engine or Playcanvas (or dozens of similar ones) that wrap all this stuff up for you.
However, In 2014, HTML5/JavaScript is just a compile target. That means you can author with any language and environment you like and just compile to HTML5.
If you like working in Flash and AS3, you can continue to do so:
http://www.openfl.org
Flash still has a lot to offer:
There's a complete set of tools to make graphics and animation
Great API to satisfy your needs to create rich and interactive content
Lots and lots of free libraries and frameworks make by the community
Overall great performance
That being said JS already can do all the advanced things and even 3d at a near native speed. You have libraries like ThreeJS and others that allow access to the GPU and that means very fast rendering!
The problem is that different browsers cannot agree on what features to include by default. For example Chrome has the most variety of canvases to render graphics, while Internet Explorer continues to be a pain for the web-developers. And that's where flash has the upper hand again, as it runs 99% equally on all platforms and all browsers. I would still choose Flash for non-mobile development, but you definitely can make content that would run great on HTML5/JS.
Then it all comes down to the actual development:
JavaScript is non-strict type language, and that quickly becomes an issue on larger projects
JavaScript does not have classes. It can fake them, but these wouldn't be real classes.
JavaScript pushes you to write deep nested/hard-to-debug code much more.
There's a lack of libraries and frameworks that would work well across multiple platforms.
The choice of tool is up to you. In the current scene I see that Flash cannot be ruled out completely because of how much it can already to; at the same time JavaScript can give you really great performance even now and it will get only stronger in the future.

browser for creating mobile game app

I don't know whether my question belongs here but I am asking it anyways. Why is there not a lot of shift in creating the game using HTML5 rather than creating a native game app, especially for mobile application? While I understand completely and assuming my understanding to be correct, for desktop games, a native game can use the graphics card in the computer taking the hefty load of graphics processing off from the CPU. What is the case for mobile browser? Does the mobile browser allowed to have the equal amount of processing resources as the native app? As far as I think, the processor is all and all in mobile phones. If this is correct then, I would think it would be more easier to create game with browser.
Is my understanding correct? Am I missing something here? What is the catch if I want to create game app using HTML and javascript?
A game as a native app would usually be written in a much more efficient language than javascript, for example Java on Android or Objective-C on iOS. Javascript is usually interpreted as it is run (as far as I know), and this affects the performance. Also, while you can obfuscate javascript to hide the implementation (if you want to protect your code), it isn't as effective as compiling a native app (I don't know how hard it is to reverse-engineer Java though).
However, WebGL is becoming more popular, and lets javascript code use hardware acceleration to accelerate graphics. When this is well supported on mobile devices, it might be feasible to make a complex game in the web browser. It certainly makes it more portable, and you could put it in a native WebView (or similar), for it to act like a native app.
Some examples here: http://www.chromeexperiments.com/webgl/
There's a couple potential drawbacks for HTML 5, one of which has already been pointed out, is a potential performance hit. This is sorta a big one, especially for devices that aren't capable of using WebGL. The other really big one for me anyways, is bandwidth use. Most phones (at least in the USA) are on fairly restrictive data plans, and thus if you're accessing the game via HTML 5, you're potentially eating into your bandwidth use every time you play, meanwhile a native app is downloaded once, and that's the last of the data usage...input lag is another biggie, particularly if your game requires specific timing. Granted, as speeds get faster on mobile devices this becomes less and less of an issue, but it will never be equal to what can be done locally on a native app. Lastly, as was pointed out, code hiding, you may or may not care about, but it's easier to do on a native app.

Flash vs HTML5 game development for web & mobile [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am an experienced AS3 programmer, and I've done Flash apps and games on the browser and on mobile (via Adobe AIR, e.g., on Android).
I am about to start developing a game (basic 2D platformer with pixelart graphics. Think about Super Mario World) targeted to both web and mobile platforms. Thus I'm searching for easy deployment to these two kinds of platforms, having basically the same source code.
I'm divided between choosing ActionScript 3.0 (Flash) or HTML5/JavaScript for developing this game.
My main question is, for those who've experienced the same situation before:
What is the safest way to go?
In other words, are there serious disadvantages with one of these frameworks that disallows me to develop multiplatform 2D games?
Or am I just dreaming and practical multiplatform (web and mobile) game development is not so possible? (does someone know how Rovio did it with Angry Birds?)
Here are some pros and cons that I already know:
Pros for AS3/Flash:
The state-of-art for web games.
I'm experienced with it.
(Almost) concealed source code.
On the web, it's browser-independent.
Can run as a "native" app on iOS and Android through Adobe AIR. It's not the best performance experience ever, but I know that you can get playable performances with it.
Cons for AS3/ Flash:
Performance on AIR for mobile is not optimal, so I might end up having to abandon a really cool but expensive feature (or even several features).
People are saying HTML5/Javascript will substitute it.
Pros for HTML5/Javascript:
It's possible to do Flash-quality games using, e.g., engines like ImpactJS or Akihabara.
Seems to be more stable and well supported on mobile in the future.
Deployment as native app is possible through PhoneGap, appMobi, etc.
Cons for HTML5/Javascript:
I have some basic knowledge of this technology.
Source code is wide open exposed.
Performance/behaviour is browser-dependent.
Lacks a solid framework or engine which is free of co$t$.
I've decided to forget about HTML5 for cross-platform game development, and specially for deployment to mobile.
The cons I've pointed out for Flash are much lighter than the cons for HTML5. Basically, for the pixelart kind of games, Flash on mobile performs really well, specially if using some nice engine like Flixel.
For example, the Flixel game Robo Run has great performance both on Android and Flash Player in a browser. I don't have an iOS example for the same game, but I believe it would perform as good as on Android.
Plus, Flash performance on mobile shouldn't be an increasing problem since the hardware on these devices just gets better and better.
After thinking about this HTML5 vs Flash issue for several months, I think there's no point adventuring in HTML5 cross-browser compatibility since Flash has proven to be a sort of Java for 2D games.
I think you have outlined the pros and cons pretty effectively. If cross platform and mobile web development is your top priority, Flash is a good choice. You will have all of the drawbacks you have identified.
If you use javascript/HTML such as the impact engine, you will have a different set of problems, and far less compatibilty on the web side.
However, if having the game be the best it can be, you will need to look elsewhere, because as of the present, there is no code once publish anywhere solution.
Unity 3D has good 3D and 2d mobile capabilities.
Appcellerator may also be your cup of tea.
http://www.appcelerator.com/
But in the final analysis, nothing will beat making different versions for different platforms. in terms of performance, and being best suited to the device. Be sure to evaluate how well your chosen solution allows you to monetize your app as well. You'll likely be building multiple versions just to accomodate differences in revenue models and ad serving capabilities.
=== Update ===
In March of 2012 Adobe updated flash for iOS and Android to include support for OpenGL graphics, 3D and 2D graphics are now possible using flash as a single code base for iOS and Android. The speed is good, and you also can deply the same game to web. Its a great tool. The one drawback is that flash relies on "extensions" to connect to native OS capabilites such as Intents on android or Game Center on iOS. If you plan on using native capabilities extensively, look out for this as an obstacle to development.
As ScanPlayGames said, html5 sound is a big issue. There are some neat WebGL ports though. Dominic at Impact has been doing some amazing stuff. He's got the best framework out there.
Rovio did a port using Google Web Toolkit for the chrome store.
I work for AppMobi. We've got a tool called DirectCanvas for iOS (Android will be coming soon) that increases the performance of games in the webview. One of our partners is developing a game that has the concept of Angry Birds (object A is propelled to destroy other objects). So Box2d support is there (the main thing holding us up from releasing). The performance is awesome, and the average joe doesn't know it's a webview game.
And trust me, you wont' be wasting your time doing development on mobile first for desktop then. We've got some stuff up our sleeves.
I'm a Flash games developer too and did some research on how to migrate to HTML5. There are a lot of obstacles if you come from the Flash/ActionScript3 world. One of those things is JavaScript itself - i know many people like JavaScript, but if you are used to AS3 it is hard. Another thing is the problem with sounds (as mentioned above). The most important thing is that i don't want to start from scratch and i want to use my skills or even migrate code from the past.
To make a long story short i ended up with Googles new programming language called Dart. This language compiles to JavaScript in therefore runs on all modern browsers. The most important thing is that Dart is very similar to ActiontScript3! Then i did an open source library which provides all the Flash API you need for games (The Display List, Bitmaps, Sounds, ...) - i tried to make the library as compatible as possible with the Flash API to simplify the process of porting the source of a game. In the end it was pretty easy because you only need to change a few things.
The game i have migrated:
An ActionScript to Dart comparison:
Some other samples and the link to the source:
I think a big disadvantage of Javascript is that it cannot detect picture's transparent regions so that it can stop reacting while mice hover or click on it.
Since HTML5 was released, any new solution has been created?
I have worked with some people who did a very graphics intensive HTML5 application and the worst thing was doing the sound I remember...every browser had to be done differently. Go look for some open source html 5 game frameworks where people have already done the grunt work of testing across browsers...there are some pretty good ones I think. You dont want to have to be the one QA-ing across environments.

Can I use JavaScript to do the same what Adobe Flash does?

Is JavaScript capable of doing the same what Flash does? And if it is the case, can it be a good idea to switch from Adobe Flash to JavaScript?
No, JavaScript cannot do what Flash does.
Maybe HTML5 w/ canvas,JavaScript w/ JQuery,CSS3, some Webkits and some SVG/JPG to handle pictures and animations can make an attempt at what Flash was 5-10 years ago.
Video
JavaScript - There is only one implementation I know that slice the video into JPEGs then dram it onto the canvas. No clue what happens if one wanted to stream a file.
<video> tag - Best thing to come along. I would not lie. But this is not JavaScript.
Audio
JavaScript - I remember once it could be used for MIDI files but then it needed compatibility checks based on the browser
<audio> tag - Same reasoning as <video> tag, it is not JavaScript
Animation
These are three places I know making the cream of the crop that can be made with JavaScript.
Mr.Doob's Playground
Spiderman Animation
SmokeScreen Flash to JavaScript
Note well.
Do not talk about Apple Demos ... that is a joke and all marketing. They have only optimized for their browser (Safari)
Also do not talk about what Steve did or did not say. He is a pro at marketing. The other steve (Steve Wozniak) is the engineer.
(1) I highly respect because Mr.Doob really pushed that <canvas> and JS . (2) Was great animation that could be accomplished by a teenager in Flash IDE 5 years ago ... way too much effort to make something so simple. (3) Is really good yet you start with the Flash File ^.^
Lines Of Code
In many cases ActionScript, better yet the Flash IDE make animation a breeze with half the lines of codes (or maybe even simple drag and drop on timelines) than JavaScript. Libraries such as JQuery were brought in to try to shorten the amount of code. Even then in most cases less code/implementation was needed in ActionScript.
Accessibility and Performance
This is in the hands of the developer and has nothing to do with the language. Flash is capable of providing deep linking with SWFAddress (Ajax), page resizing (Stage Scale) and so forth. People constantly talk about performance with Flash, yes this is true but this is poor design on the developer for memory management.
Updates
JavaScript will be limited by the <canvas> and other elements to achieve what Flash can do.How ? If issues started to occur in HTML5, what would you do ? Send in a bug request ? No ... you will wait a next 3-5 years for HTML6 specification.
Suggestion
I suggest looking through Mr.Doob's work, Webby Awards and google the best of Flash Websites. Look at them carefully see if you can bring up case studies. Like this one : Creating marketing platforms with Adobe Flex Website under study : http://www.bombaysapphire.com/
And a word to a wise , one of your favorite websites - YouTube, would not have survived if it was not for Flash :D
Hell you can use javascript to "do" flash!! Check this out! Smokescreen
On a serious note, flash has its own advantages. Like e.g. games and some very specialized apps like audio video editing etc. Maybe javascript and HTML5 is not there yet, but its getting close!
Is JavaScript capable of doing the same what Flash does?
No, definitely not. While both share some capabilities, like animations and interactive interfaces, JavaScript's and Flash's design philosophies differ fundamentally, and in terms of features in those fields, Flash is certainly way, way ahead.
And if it is the case, can it be a good idea to switch from Adobe Flash to JavaScript?
It might, depending on what exactly you are doing in Flash. If you outline that in more detail, you will certainly get more concrete answers.
Here's a response to Apple's recent trumpeting of HTML5 - Jump back in time with HTML5. There's still plenty of reasons to use Flash!
The Apple HTML5 demos (left parts)
only work with Safari (4.7% of all
users on all devices). Some HTML5
features work, others won't work on
other browsers. As a matter of fact,
HTML5 is not really a standard at all.
The Flash TODAY demos (right parts)
show how 97% of all websurfers can
experience Flash the way it is
supposed to be today & tomorrow: fresh
& innovative. By the way, these
Flash-examples are extremely hard or
simply impossible to build with
HTML5
Depends on what functionality you are looking for. While javascript has much evolved recently and many frameworks were introduced it cannot be compared to Flash in terms of creating rich web interfaces. I think though that progressively new concepts will be introduced like HTML5, usage of the GPU and HTML + javascript might one day fill the gap.
Javascript is vast. But it cannot replace Flash.! The biggest Advantage of using flash is hiding the source code.. Which in Javascript is nt applicable always.!
Flash is Used in Animation of Cartoons and 3D web sites etc.. Of course u cannot create a front end competing to Flash..
One good solution would be => If you want ur site to hav good programming properties den go for javascript..
If U want ur site to be good in Front end design den go for Flash!!
Although flash has its scripting language [Actionscript] its not dat much flexible as javascript!!!!

Tools for HTML 5

Everyone keeps saying flash is dead, silverlight is dead, and the future is HTML 5. Most technical people I've talked to seem feel that this is a generally accepted fact. Just a matter of when the spec will be finalized, and when each major browser will finally incorporate all the individual features. But it seems to me there's a big elephant in this room: where are the tools?
Flash. Maybe on it's way out, but it had one hell of a designer. It had drawing tools, layers, timeline support, tweening, etc. It made building rich UI and animations REALLY EASY, which is why it's everywhere. Without flash I'm assuming we turn to canvas? We can't be planning on doing all our UI in code? Where is my 'Canvas Studio MX'?
Video. So we agreed on a totally open/free format with ogg vorbis. Sweet. Is there a good open source set of libraries out there for converting/authoring an ogg file?
Javascript. If we jump on board the HTML5 bus, we're pretty much all agreeing that the engine runs only on Javascript right? Is there some really effective JS IDE out there? Notepad++ is good, but is there something that can make refactoring a really huge application NOT a PITA? And here I'm referring to the fact that JS is dynamically typed, and so today it seems really difficult to get A)Intellisense, and B)Refactoring Support(Rename Method, Get Reference Count etc.). Either the language needs to change, or we need a really smart editor.
Maybe I'm raving here, but I'm a web dev by profession, and I would LOVE to get away from propietary compilers and overcomplicated,convoluted 'super tools' that cause more problems that they fix. But these points seems like real problems to me, and I'm surprised they aren't being given more attention. Or maybe they are, and if so, please feel free to show me the light :)
Web developers come from a variety of backgrounds ranging from Computer science to Graphic design. The coding environment they use reflects this variety and whilst some coders are comfortable writing an entire application using only Textmate, some others prefer to work with Aptana, the Flash IDE or Dreamweaver ( no quality comparison here ).
I think your point is valid , if Flash is about to be replaced by HTML5 , the web developers who were using tools such as the Flash IDE will expect tools on the par with what they're used too.
Another way to look at your question could be to wonder if Flash's announced death isn't the death of a certain vision of the web. A vision led by creatives who , not comfortable with the pure coding approach , could nonetheless express themselves with Flash, which to a certain extent , hid some of the complexities of programming or at least made it easier for them to tackle.
I agree that there are some tools missing at the moment and as PatrickS mentions, it depends on your perspective and what you are used too.
A website developer would be fairly happy at the moment. Not much changes for them. They keep the same workflow and as more tools become available they will be added to their environment - and besides, they can get by with just copying-n-pasting with notepad etc.
An animator can currently not do much with HTML5. They require a tool such as Flash IDE. It must also integrate with packages such as illustrator. Could be a while before we see a stable, usable tool.
An Applications developer (which is the area that I fall into) will probably try to avoid HTML5. Simply because JavaScript is not suitable for large applications development. Netbeans at the very least exists and appears to support things like code completion, refactoring etc which will help if you end up having to do some serious JS development- but I suspect it does not match Visual Studio.
A games developer developing something of significance would have the same issues at the applications developer and animator. While yes you can make a game just through code, things like platformers, adventures games etc really need a Flash IDE to layout all the graphic assets. Likewise, for programming, JavaScript will be more pain than AS3 or C#
Flash: There are a number of strong languages that do amazing things without the nice fluffy UI and timeline, layers and such. I'm sure one will come along, but is not a show-stopper, not do many people care right now - so no elephant (IMHO).
Javascript: There is no shortage of places IDE's where you can use Javascript. Sure you can use Notepad if you like, or else Eclipse, TextMate etc... I see an editor as an aid and not a dependency when refactoring code. JS has its problems but to date its proven (again, just my opinion) that it has more to offer to compensate for that.

Categories

Resources