Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-16-2012, 03:41 AM   PM User | #1
Jncocontrtol
New to the CF scene

 
Join Date: Jul 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Jncocontrtol is an unknown quantity at this point
I need some advice

Hey everyone.

I'm wanting to take up Javascript, Cause here is what i would like to accomplish with it.

I wanna make a text based broswer RPG game, To my understanding there various "branches" of Javascript, True or not?
If not true, Where would be the best place to learn Javscript, Would you also recommend any books to help accomplish this?
Jncocontrtol is offline   Reply With Quote
Old 11-16-2012, 05:12 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,248
Thanks: 59
Thanked 3,999 Times in 3,968 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Is it to be a multi-player game? If so, you won't do it with HTML and JS alone. You will need some sort of server-side support.

If a single-player game, you can do it all in JS. Just don't offer any big prizes, etc. for doing well, because hackers would simply download all your code (no protection against that, though you can obfuscate the code) and figure out how to beat the game.

As for "flavors" of JS: I can't think of any you would care about if your game is truly text-based. MSIE versions 8 and below (and especially 7 and below) have some peculiarities. You are unlikely to run into them with a text based game, bui if you do, just ask for help. It won't be a big issue.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Old 11-17-2012, 12:35 AM   PM User | #3
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,469
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
Quote:
Originally Posted by Old Pedant View Post
Is it to be a multi-player game? If so, you won't do it with HTML and JS alone. You will need some sort of server-side support.
that may have been arguably true last week, but not anymore, and it's going to be really untrue within 6 months.

look into webRTC if you have not done so already, it's already/almost here...
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Old 11-17-2012, 01:40 AM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,248
Thanks: 59
Thanked 3,999 Times in 3,968 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Okay...looked at their FAQ. Not saying it couldn't be used for this, but it sure seems focussed on video and feels like overkill for a text-based game.

In fact, I don't see anything in the API description that looks like an easy way to do text-based game.

It looks like this would be the relevant section of the API:
http://dev.w3.org/2011/webrtc/editor...-peer-data-api
But then this section
http://www.webrtc.org/faq-recent-topics
says
Quote:
The Data Channel API is not implemented and its implementation is being discussed in the standards committee.
So I think your 6 months estimate is WILDLY optimistic. If they don't even have it working in Chrome, yet, how long do you REALLY think it will be before it becomes any kind of standard???

I like your enthusiasm for new toys, but I think you overestimate the browser maker's sharing of that enthusiasm.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Old 11-17-2012, 05:55 AM   PM User | #5
Jncocontrtol
New to the CF scene

 
Join Date: Jul 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Jncocontrtol is an unknown quantity at this point
Quote:
Originally Posted by Old Pedant View Post
Is it to be a multi-player game? If so, you won't do it with HTML and JS alone. You will need some sort of server-side support.

If a single-player game, you can do it all in JS. Just don't offer any big prizes, etc. for doing well, because hackers would simply download all your code (no protection against that, though you can obfuscate the code) and figure out how to beat the game.

As for "flavors" of JS: I can't think of any you would care about if your game is truly text-based. MSIE versions 8 and below (and especially 7 and below) have some peculiarities. You are unlikely to run into them with a text based game, bui if you do, just ask for help. It won't be a big issue.
At 1st it's gonna be just a Single player, but only for testing purposes, After I feel ready I'm gonna be doing multiplayer.
I did a little research and found that i'm gonna have to learn mysql to save all the information on it. But way I figure it, That's a little ways down the line.

But, you guys wouldn't know any good books that would be of use to me?

Last edited by Jncocontrtol; 11-17-2012 at 05:58 AM..
Jncocontrtol is offline   Reply With Quote
Old 11-17-2012, 02:37 PM   PM User | #6
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,469
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
Quote:
Originally Posted by Old Pedant View Post
Okay...looked at their FAQ. Not saying it couldn't be used for this, but it sure seems focussed on video and feels like overkill for a text-based game.

So I think your 6 months estimate is WILDLY optimistic. If they don't even have it working in Chrome, yet, how long do you REALLY think it will be before it becomes any kind of standard???
yeah, the docs leave a bit to be desired at this point. someone should write a book and make a fortune.
"rtc" in 2013 will be like "ajax" in 2006.

it's due in firefox 18, scheduled for early next year.
microsoft is onboard, but arguing over video and audio codecs.
frankly, i care a lot more about raw signaling than A/V.

now is the time to learn real time.
even if only in the shape of EventSource or WebSockets, real-time-communication is going to be big part of the web in the next few years, starting in the next few months.

i'm waiting for the APIs to solidify before i get into AV next year, but plain text events add a lot to basic apps. i've been playing with EventSource a lot these past few months, and while i know it's just the tip of the iceberg, i really love it. so far i've built a many-device synced music player, a notepad that's always the same on every tab/device that has it open, and a secure chat app.

at the risk of straying off topic (too late?),
networking can be much simpler than what you see on most of the examples out there. i have a public event server that handles all the back-end stuff so you can just write JS that talks to other JS. i am starting to look for devs to help me test this out for free for now. PM me and i'll be happy to provide the connection details and links to the documentation.


here is an example of a dead-simple app that changes the color of the screen and all the screens looking at the page.you could tuck an unused laptop on top of a book shelf, load this page, and "set the mood" with this app from your phone . or something like that; it's less code than a chat demo:

Code:
<input id="color" type="color" 
   onchange="net.broadcast('color', escape(this.value) )"   />

<script src="network.js"></script>
  
<script type='text/javascript'>
net = new Network("http://x.x.x.x:xxxx/colordemo/"); //connect to server

 //change color when event arrives
net.on("color",  function showColor( e ) { 
   document.body.style.backgroundColor= e.data ;
}); 
</script>
i'm not trying to push my particular script here, this code is virtually the same as EventSource(). My point is simply that it's ajax-simple to use "comet" these days, and it's widely supported right now.

looking forward, you can play with the webRTC API now using node.js emulator packages, and there are some client polyfills.
here's one example: http://code.google.com/p/webrtc4all/
and another https://github.com/kdomagal/Web-RTC

one last note,
i checked my chrome:
Code:
new webkitRTCPeerConnection(null)  ;
// console dump from chrome:
RTCPeerConnection
__proto__: RTCPeerConnection
addEventListener: function addEventListener() { [native code] } addIceCandidate: function addIceCandidate() { [native code] } addStream: function addStream() { [native code] } close: function close() { [native code] } constructor: function RTCPeerConnection() { [native code] } createAnswer: function createAnswer() { [native code] } createDataChannel: function createDataChannel() { [native code] } createOffer: function createOffer() { [native code] } dispatchEvent: function dispatchEvent() { [native code] } getStats: function getStats() { [native code] } removeEventListener: function removeEventListener() { [native code] } removeStream: function removeStream() { [native code] } setLocalDescription: function setLocalDescription() { [native code] } setRemoteDescription: function setRemoteDescription() { [native code] } updateIce: function updateIce() { [native code] }
so it IS in chrome.
even if we had to use audio for some reason, the webaudio api would make writing a mo/dem pretty easy and fun.

consider turning a 1000hz sine wave on and off; simply sample for 2ms and Math.round(amplitude at 1k). if it's not the same as before, raise() the change event.

while that's only a 250bps scheme, less than an old 300 baud modem, the important thing to me is just getting a message waiting clients as soon as possible, and one bit is enough. you can ajax for specifics at the moment data becomes available if need be...
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:19 PM.


Advertisement
Log in to turn off these ads.