Jump to content

  • Log In with Google      Sign In   
  • Create Account

Browser-Based Game: Best Language?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
20 replies to this topic

#1 Dialects   Members   -  Reputation: 140

Like
0Likes
Like

Posted 27 March 2014 - 04:47 PM

Hi,

 

Although very naively, I have been contemplating finally getting a go at creating/idealising (the two are very distinct!) a game. Amidst such event, I stumbled upon a technical question in need of answer. What's the best language to code a 2D/Text-Based browser-based game on? The question itself may be lacking in depth so I'll list a few game references:

 

- Rail Nation | Travian Games

- OGame | Gameforge

- Brain StormGenia

 

Perhaps this is a good enough draft?

 

 

Thanks in advance,

Dialects



Sponsor:

#2 smr   GDNet+   -  Reputation: 1681

Like
1Likes
Like

Posted 27 March 2014 - 08:07 PM

In the browser itself, barring plugins, you're pretty well limited to JavaScript. There are other languages you can use which can be compiled to JavaScript, but you can't escape the semantics of JS, so any such language is more or less syntactic sugar. They may add some static analysis, but my experience with TypeScript and CoffeeScript has been they are not worth the trouble.

For the server your choices are far more vast. Most contemporary languages have a web app stack (rails, grails, django, flask, ASP.NET MVC, sails, meteor...) that will help keep things organized and prevent you from rebuilding the wheel.

If you are new to programming or have absolutely no bias I'd go with Node.js along with one of the popular full stack frameworks like express or sails. This way you need only learn one language, and there's a chance you could share some code on the client and server side, though this usually is a minimal amount.

#3 BHXSpecter   Members   -  Reputation: 1670

Like
1Likes
Like

Posted 27 March 2014 - 11:30 PM

Only JavaScript? I usually see JavaScript, Java, or HTML5 mentioned for browser game development, but I've not done a browser game so I don't know if those are viable options too or not.


Edited by BHXSpecter, 27 March 2014 - 11:31 PM.

"Through vengence I was born.Through war I was trained.Through love I was found. Through death I was released. Through release I was given a purpose."


#4 HyperV   Members   -  Reputation: 872

Like
1Likes
Like

Posted 28 March 2014 - 02:13 AM

Hi,

 

You can also use Haxe ofcourse.

 

HyperV



#5 Dialects   Members   -  Reputation: 140

Like
0Likes
Like

Posted 28 March 2014 - 04:02 AM

smr

- Thanks for your kind and elaborate post. Given my zero experience with coding, should I go straight to JavaScript or would you recommend getting in touch with another language prior to Js? 

 

BHXSpecter

- I am aware of the difference between Java and Javascript. Not entirely sure what the difference(s) is/are -- just aware that they're different. Are you saying HTML & CSS comes to play when coding a browser-based game, too?

 

HyperV

- Haxe being? Apologies. I'm not much a connoisseur at this point.

 

Edit: Just did a bit of research. By Haxe you mean http://haxe.org/ ? What are the advantages in using Haxe over hard-coding it by scratch and what's the learning curve of the language?

 

 

Thanks in advance,

Dialects


Edited by Dialects, 28 March 2014 - 04:05 AM.


#6 ram64   Members   -  Reputation: 860

Like
1Likes
Like

Posted 28 March 2014 - 04:02 AM

It depends on what is your intended audience. The most obvious solution would be JavaScript because the user won't need any additional plugins. But you should take into account that supporting JS on a wide range of clients is quite hard (especially if you look at Internet Explorer and mobile browsers). The compatibility is not much of a pain if you will use something like Flash (ActionScript), Java Applets (Java) or Unitiy3D (C#) but then the user would need to have the respective plugin installed and also the mobile experience would be limited or non existing.

 

Update:

 

Just for reference here are two libraries that I would recommend:

 

Phaser (JavaScrip/HTML5) - it's a game library for HTML5 games so will only work on new browsers that support Canvas or WebGL. This also has awesome compatibility and  performance on mobile.

CitrusEngine (ActionScript 3) - It is actually a bundle of libraries that help you quickly get games working in either 2D or 3D and also takes the advantage of Stage3D technology (GPU acceleration). This will do fine for desktop browsers (even older ones) that have Flash Plugin installed and you can also publish the game for mobile environment (Android, iOS etc) using the AIR technology with minimum to no modification to the code.


Edited by ram64, 28 March 2014 - 04:09 AM.


#7 Dialects   Members   -  Reputation: 140

Like
0Likes
Like

Posted 28 March 2014 - 05:07 AM

Thanks for your elaborate reply, ram64.

 

You do raise a pertinent question -- what's my target audience? Albeit not much thought has been given to this yet it is somewhat safe to assume having a platform that is compatible with computers & mobiles is the way forward. 2D/Text-Based Strategy tends to gather interest from an adult-keen audience so I'll assume this to be my target audience to begin with.

 

I would like to ask for a bit more of detailed information when it comes to code languages. What are its pros and cons? So far these have been suggested:

 

- Javascript

- Node.js (which I suppose is a derivation of Js?)

- Java

- HTML 5

- Haxe

- Action Script (I've had some introduction to AS3 in the past!)

- C# (Unity 3D)

 

 

A hands-on look at the cons and pros of these would help me greatly in understanding which may be the best pick. Take into consideration:

 

- It's a browser-based game.

- Mobile-compatible is an option but not necessary.

- It takes on several aspects of the games I've mentioned before (Rail Nation being the biggest in terms of GUI, Dynamics, Animations, Game Mechanics, etc)

- I'm new to mostly all of the above mentioned languages. I have very little knowledge of Action Script 3.0.1, Python 3 & rudimentarily, HTML5 & CSS 3.

 

 

If there's anything else you'd like to know, ask away. I might not be providing the full-extent of information you'd expect out of lack of knowledge.

 

 

Thanks in advance,

Dialects



#8 Karsten_   Members   -  Reputation: 1655

Like
1Likes
Like

Posted 28 March 2014 - 05:32 AM

There is currently a catch with the following technologies:

 

Java

C# (Unity 3D)

C# (Silverlight)

AS3 (Flash)

 

They require your users to have a plugin (of the correct version) installed. This also means that your software will only work in specific browsers on a limited number of operating systems (that supports the plugin). Tablets in particular will not load them in their web browsers.

Plugins are a legacy technology that are slowly and surely moving over to Javascript / asm.js. Unity is making good progress at porting their plugin to pure Javascript via Emscripten, Unreal engine has done the same. Adobe have also stated that they are going to be migrating their tools and language over to HTML5. Unfortunately none of these are quite ready yet.

 

So instead, since you are starting from scratch anyway, I recommend the following choices.

 

Javascript (+ Canvas) - For 2D web games

Javascript (+ WebGL) - For 3D web games (perhaps using three.js to help)

HaXe / Typescript etc. export to JS too so these kind of things might suffice if you really dislike Javascript.

 

If you or anyone else in your team is interested in getting into programming in a big way, then this opens you guys up to Emscripten (C++ -> Javascript compiler) which is becoming very popular now with larger companies and native developers but also allows you to utilize a massive back catalogue of traditional C and C++ libraries to help you develop your game (rather than reinvent the wheel).


Edited by Karsten_, 28 March 2014 - 05:37 AM.

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.


#9 ram64   Members   -  Reputation: 860

Like
2Likes
Like

Posted 28 March 2014 - 06:06 AM


I would like to ask for a bit more of detailed information when it comes to code languages. What are its pros and cons? So far these have been suggested:
 
- Javascript
- Node.js (which I suppose is a derivation of Js?)
- Java
- HTML 5
- Haxe
- Action Script (I've had some introduction to AS3 in the past!)
- C# (Unity 3D)

 

JavaScript will be available on most of the browsers (mobile and desktops) but you have to take into account the implementation of JS engines in each of those browsers (or for which browser you want to support). This would be the language of choice for a 2D/Text game if the graphical part is not that advanced.

 

Node.js is a server side environment which uses JavaScript. This would be used for the back end of a game or an application (scoring system, server logic etc) in case you want a back end to your game. 

 

Java is a powerful choice but the learning curve is quite steep. 

 

HTML5 is actually the current/next standard of HTML and is just the markup. A game written in HTML5 would still need JavaScript to function. When stating that you are using HTML5 for games you actually are saying that you are using a combination of HTML5 (markup and Canvas tag), CSS3 (styling) and JavaScript (for logic and interactivity). 

 

 

ActionScript is the programming language used in Flash. Most of the online games were and are still done in Flash but as HTML5 standard is refined more and more devs abandon Flash and AS for HTML5 and JS. But again, this really depends on your audience and on your type of game.

 

I have not used Unity before but as far as I understand it's a good solution for games (mostly 3D but recently I think they released some updates for 2D games). In my opinion this would be too powerful for a simple 2D text game.

 

As for HAXE I never used it but I think it's some kind of language that you can compile to other programming platforms (ActionScript, Java etc). Can't give you too much detail as I have no experience with it but you can read on the official site http://haxe.org/.

 

 

Also you should mention what's your overall programming experience. If you have no experience with browser games I would suggest just picking JavaScript and get on this path (as your game seems fit for it). You could also try TypeScript (which compiles to JavaScript) if you want type control and other goodies in JavaScript. 



#10 Dialects   Members   -  Reputation: 140

Like
0Likes
Like

Posted 28 March 2014 - 08:37 AM

So instead, since you are starting from scratch anyway, I recommend the following choices.

 

Javascript (+ Canvas) - For 2D web games

Javascript (+ WebGL) - For 3D web games (perhaps using three.js to help)

HaXe / Typescript etc. export to JS too so these kind of things might suffice if you really dislike Javascript.

 

This, I suppose, nails my concerns summarily.

 

It is not that I do not like Javascript. I am not familiar with either Javascript nor HaXe which is why I asked assistance in understanding what the main differences and applications between the two are. HaXe may look like an easy starting-point though given that it exports and is based on JS (correct me if I'm wrong!) I might be better off understanding the core principle of the language itself before I start using applicants and derivations thereof.

 

I currently do not have a team. It may be slightly naive of me to think I'll find one or two willing candidates. No payments are being offered as is and although the prospects may be high (at least to myself -- I've been a vivid gamer for quite some time. The idea I have for the game is enthusiastic to me. That's the ground my hypothesis is sitting on, I suppose!) I can still not guarantee that those involved will be paid during development stage.

 

I come from a Design background w/ predominance in Art Direction. If anything, it makes it easier for me to understand methodically how a concept goes from being an idea to becoming a representation of that idea. I'll possibly venture myself in running the two tasks simultaneously: Working the concept up & learning Javascript.

 

I'd like to deeply thank everyone who has commented. You've all been very helpful! To conclude it all, can you guys direct me to some Javascript tutoring/books/videos? I have seen tids and bits of information pertaining Javascript at Gamedev. I've also registered at Codecademy and have started the Javascript Learning Program. Is there more I should be doing?

 

 

Kind regards,

Dialects



#11 Karsten_   Members   -  Reputation: 1655

Like
1Likes
Like

Posted 28 March 2014 - 01:11 PM

There are many Javascript tutorials around the internet because it is quite popular (Perhaps due to the flux of web developers flooding out of universites between 2008-2011). So I am sure you can find some quite easily via google.
The only additional tips I can offer is to be weary of w3schools which traditionally has been infamous for bad habits (though it might be better now).
You will also come across many examples pushing JQuery. I would keep well away from this because it is not standard Javascript and it is not always very interoperable with other libraries.

A site that does look quite useful is Mozilla's developer site. It doesn't look browser specific either which is obviously important.
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Canvas_tutorial


Edited by Karsten_, 28 March 2014 - 02:50 PM.

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.


#12 smr   GDNet+   -  Reputation: 1681

Like
1Likes
Like

Posted 28 March 2014 - 10:03 PM

I recommend JavaScript with node for the server side. All you need is a text editor (notepad++, gedit, etc.).

As far as compatibility, you're OK. All modern browsers support canvas (2D context, not webGL) and JavaScript. The challenge is performance, screen size and input. Three of the four current versions of the popular browsers (Firefox, Chrome, Safari) perform pretty well on the desktop and mobile. Of course IE lags behind but is still OK for all but the most demanding of work, such as fluid Canvas animation.

Obviously the physical size of the screen and whether or not there is a keyboard or other physical input device attached will have a strong influence on how your game will be experienced on different platforms.

#13 smr   GDNet+   -  Reputation: 1681

Like
1Likes
Like

Posted 28 March 2014 - 10:11 PM

I also must disagree with Karsten about staying away from jQuery. Jquery is very well supported by current AND older browser versions going back to IE 8. If you want prior to IE 8 support that is available too by using the 1.9 branch of jQuery. Its API is the same as the 2.0 branch but with the cruft for crappy browsers left in. Keep in mind that using jQuery electors does incur overhead, so be sure to cache them and to profile when you suspect jQuery might be a performance issue. My experience is that in the few cases when jQuery is a bottleneck, caching selectors or direct DOM manipulation closes the gap. Use jQuery when it helps (95% of the time), and direct dom when it doesn't. Simple.

#14 papulko   Members   -  Reputation: 944

Like
1Likes
Like

Posted 29 March 2014 - 12:31 AM

I find that google's own dart is a great language for large scale web applications and games. It is similar to java / c# in OOP concepts and compiles to native javascript that can be run on any up-to-date browser without plugins. Their website is http://www.dartlang.org if you want to read more about it.



#15 Dialects   Members   -  Reputation: 140

Like
1Likes
Like

Posted 29 March 2014 - 07:59 AM

Thanks for the input everyone!

 

I'm quite lost in terms of where I should start especially given the monstrous array of possibilities. For this reason, I'll stick to learning Javascript for now while I keep myself busy with the game documentation and mechanics break-down. I reckon working the concept down will be tedious --in the good sense, I hope-- enough that it'll keep me busy and away from any programming hurdle for a while.

 

 

Best of luck in RL to all,

Dialects



#16 DareDeveloper   GDNet+   -  Reputation: 977

Like
3Likes
Like

Posted 29 March 2014 - 09:03 AM

Doing a text based game in the browser might not be the best idea.

 

Doing text based games first is usually recommended because of the simplicity of writing a console applcation.

As I see it that does not translate to the browser, though.

It is possible to write game logic that modifies the Dom tree, changed the text in a div, takes values from input fields etc.

...

but the desired simplicity is gone. Having to manage those tasks adds complexity compared to graphical games with canvas.

I recommend starting with something other than web development. That will also give you an idea of how web development is different ...

and there are just so many concepts involved in web development that it might be a good idea not to look into that until later in your programming career ...


Edited by DareDeveloper, 29 March 2014 - 09:03 AM.

Given enough eyeballs, all mysteries are shallow.

ProcGames.com


#17 Dialects   Members   -  Reputation: 140

Like
0Likes
Like

Posted 29 March 2014 - 09:55 AM


I recommend starting with something other than web development. That will also give you an idea of how web development is different ...
and there are just so many concepts involved in web development that it might be a good idea not to look into that until later in your programming career ...

 

I wholeheartedly respect and understand your point. Now that I have re-read my initial post, I might have sinned in using the reference to text-based game. 

 

I'd like to add that I do not plan on following a programmer's career, at least not at present. The necessity to learn programming (or at least the very fundaments of it) is only a mean to allow for greater assertiveness when creating and contemplating the design of a game. This is not to say I won't take programming seriously --I just see it in a different perspective than someone willing to make a career out of it would at this point in time.

 

Still, I appreciate your feedback. All of the feedback at this point is relevant and much needed!

 

 

- Dialects


Edited by Dialects, 29 March 2014 - 09:56 AM.


#18 smr   GDNet+   -  Reputation: 1681

Like
0Likes
Like

Posted 29 March 2014 - 10:27 AM

I must disagree with dare developer. A web based text game can be as simple or difficult as you want to make it. There is no reason why he cannot implement the entire text based game in a single HTML page with a single input field and button for input, and a single text area for output. The benefit is that this experience directly contributes to learning node when he wants to do more on the server side, and he's already got all the necessary tools: a browser and a text editor.

#19 DareDeveloper   GDNet+   -  Reputation: 977

Like
2Likes
Like

Posted 29 March 2014 - 12:44 PM

There is no reason why he cannot implement the entire text based game in a single HTML page with a single input field and button for input, and a single text area for output.

Yes, but still yo have to able to tell things apart, and it is extremely hard to do that.

HTML is a markup language ... what does that even mean?

JavaScript can be used for game logic ... what is JavaScript again (what type of language)? What else can be used like JavaScript (what directly, what indirectly)?

What is the difference between Java and JavaScript?

Why are people talking about Client / Server communication?

In short: yes it is scalable, but only for people who know a lot about web development.

 

The time might be better invested in just setting up development environments for different languages and not even going beyond "Hello World!" projects ... and reading up on those languages / types of languages (even/especially with Dialects' update in mind).

 

Doing a browser based game makes sense if you want to practice the skillset.

When you want to learn about game development in general ... better keep it more simple than that, because everything will be a blur until you know more about the components/technologies that are involved.

 

 

I'd like to add that I do not plan on following a programmer's career, at least not at present. The necessity to learn programming (or at least the very fundaments of it) is only a mean to allow for greater assertiveness when creating and contemplating the design of a game. This is not to say I won't take programming seriously --I just see it in a different perspective than someone willing to make a career out of it would at this point in time.

You would not be looking at the big picture if you zoom in on web development now. That big picture knowledge is something that might be really valuable for you as a game designer.

 

But sure, if you want to specialize already that is fine. I still would not start with building a skill ... better do the relevant research instead.

Then break the technologies down further and practice those with simple projects for hands on experience:

  • learn about HTML5, play with pure HTML for a while
  • add CSS files for a site, play with that for a while
  • Write simple JavaScript files ... understand the role that it plays
  • Bring everything together, maybe write a style switcher before you go for the game

Edited by DareDeveloper, 29 March 2014 - 12:44 PM.

Given enough eyeballs, all mysteries are shallow.

ProcGames.com


#20 smr   GDNet+   -  Reputation: 1681

Like
0Likes
Like

Posted 29 March 2014 - 01:21 PM

I think you're making it out to be more difficult than it really is. Many people learn to program having their first language JavaScript and their first platform be the browser. Based on my perception of Dialects' intelligence, I don't think document.write(text); document.write("<br/>"); will be a major bump on the road for him.

Besides, if he is really that averse to HTML, you can write console apps with node. There is no requirement that every script run with node be a client server application. And he'll still be practicing JavaScript.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS