• Advertisement
Sign in to follow this  

Developing games in Javascript?

This topic is 3029 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I've been working with web programming for about 2 years (PHP, MySQL. And also HTML and CSS for about 3,5 years). I also know some javascript (Good enough, at least). Recetly I got an idea for yet another classic strategy game where you start at 0 and need to build your city and all that. However, I do not know C++, VB6 or Java which, as far as I understand it, is the only languages I can use to make games (Well, games NOT ran in a web browser, like with javascript). My question is, would it be possible to make "exe games", I mean games played outside of the browser but still online, with javascript, or is my only way out to learn C++ or one of the others? :( If possible, would it also be possible to use AJAX to communicate with PHP scripts on my server to save stuff to a MySQL database? Or are there any other langauges to use except those mentioned? Thanks

Share this post


Link to post
Share on other sites
Advertisement
It's possible, if you package it with something that can run javascript (i.e. a web browser or XULRunner (which according to Wikipedia has been the platform for at least one commercially released game)).

Alternatively, you might want to take a look at Flash. ActionScript, the scripting language Flash uses, is based on the same standard language as javascript (ECMA Script) and is therefor very similar.

Share this post


Link to post
Share on other sites
In theory, you might be able to find some javascript implementation that produces executables (there might exist .NET or Java compilers for javascript).

If so, then you might have a chance, as then you'd have .NET/Java libraries available to you.

Share this post


Link to post
Share on other sites
From Java1.6 there's the scripting API which you can use, it comes included with the Rhino javascript Engine. With scripting you have full access to the Java API. You can distribute your game as a JAR or WebStart.

Share this post


Link to post
Share on other sites
Quote:
Original post by kirsis
In theory, you might be able to find some javascript implementation that produces executables (there might exist .NET or Java compilers for javascript).


Like v8?

Quote:
If possible, would it also be possible to use AJAX to communicate with PHP scripts on my server to save stuff to a MySQL database?


AJAX is browser technology - so it needs a browser. If you are not using one, plain old HTTP requests would do, or just custom sockets.

Share this post


Link to post
Share on other sites
Quote:
Original post by NasInTheOven
I also know some javascript (Good enough, at least).

You could probably use a reintroduction, like the rest of us. ;)

Also, now that you've been put onto the Mozilla Developer Center, stick around - bookmark it, go on Wiki walks through it, add "MDC" to your javascript searches, etc. It's probably the best javascript resource on the web. :)

Quote:
Original post by NasInTheOven
Recetly I got an idea for yet another classic strategy game where you start at 0 and need to build your city and all that.
However, I do not know C++, VB6 or Java which, as far as I understand it, is the only languages I can use to make games

...

Or are there any other langauges to use except those mentioned?

Any Turing-complete programming language capable of receiving data from an input device and feeding output to some sort of display device (or rendering system) can be used to make a game - there are more than three such languages. ;)

Quote:
Original post by NasInTheOven
My question is, would it be possible to make "exe games", I mean games played outside of the browser but still online, with javascript, or is my only way out to learn C++ or one of the others? :(

There are a few application development environments for javascript around, as well as game engines with javascript embedded to specify rules and respond to events. A lot of them have been mentioned in this thread already.

Quote:
Original post by NasInTheOven
If possible, would it also be possible to use AJAX to communicate with PHP scripts on my server to save stuff to a MySQL database?

Oh, you still want browser webpage javascript? There are a few technologies, mostly up-and-coming and geared towards allowing a user to pull a website they frequent out of the browser and onto the desktop (as opposed to allowing you to package your website as an exe), that'll facilitate this sort of thing. Mozilla Labs "Prizm" is one; Adobe Integrated Runtime (AIR) is another, somewhat different one; and I think Google built a facility for this into their Chrome browser.

Share this post


Link to post
Share on other sites
Thanks for you great replies, everyone! I'm really thankful. :D
I tried the methods you linked, and a whole lot of others I found on the web, and Prism really caught my mind.
Looks like it's almost exactly what I need - It allows me to still run my game with javascript and Ajax yet outside of the browser, maknig it much cooler IMO. Also, it seems to run faster and save memory.
However, a few things popped up when looknig at Prism.
To play the game, you'd have to download Prism manually and then add a shortcut to my URL = Not as user friendly as I want it.
Would it be possible, and legal, to include Prism with my game, along with any other files I might need later on, and have a Prism shortcut (Leading to my webpage of course) automatically generated?
I have a slight idea of how I could do it, but would it be allowed or would it break any Mozilla licenses?

Thanks again, all of you. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement