...

View Full Version : I need some advice



Jncocontrtol
11-16-2012, 03:41 AM
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?

Old Pedant
11-16-2012, 05:12 AM
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.

rnd me
11-17-2012, 12:35 AM
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...

Old Pedant
11-17-2012, 01:40 AM
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/webrtc.html#peer-to-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.

Jncocontrtol
11-17-2012, 05:55 AM
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?

rnd me
11-17-2012, 02:37 PM
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:


<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:


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...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum