Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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?

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,567
    Thanks
    78
    Thanked 4,385 Times in 4,350 Posts
    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.

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,349
    Thanks
    11
    Thanked 589 Times in 570 Posts
    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 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,567
    Thanks
    78
    Thanked 4,385 Times in 4,350 Posts
    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
    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.

  • #5
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,349
    Thanks
    11
    Thanked 589 Times in 570 Posts
    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 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •