Online Multiplayer (w/Node.js)

Sora574
Hey guys, sorry this took so long, but I've finally finished the Quest online multiplayer library.
This library utilizes Quest's ability to run JavaScript functions in order to connect to WebSocket-based servers which are run by the Node.js software.
Most of it works out-of-the-box, but there are a few steps you have to take first...

[list=1]CAUTION: You should already have a basic understanding of networking and ports/port forwarding.

[*] Install Node.js from here.[/*:m]
[*] In the Node.js command prompt, type "npm install socket.io" without the quotes.[/*:m]
[*] Once that is done, download the file attached to this post and extract it to a folder.[/*:m]
[*] Find the file called "game.js" in the extracted NodeJS folder. Open it in a text editor and find the line that says
socket = io.listen(8000);

8000 is the default port the server will be run on. Feel free to change it, just remember that your router will need to be port forwarded to whatever port you choose! (And don't forget to change the start script of the NodeJSDemo to resemble any changes)[/*:m]
[*] Navigate to the extracted "NodeJS" folder in the Node.js command prompt by using "cd path/to/NodeJS".[/*:m]
[*] Type "node game.js" into the Node.js command prompt.[/*:m]
[*] Run the NodeJSDemo game. You should connect and be able to move around and pick up objects. The Node.js command prompt will log any changes that occur.[/*:m][/list:o]

Notice how the NodeJSDemo has a function named "BeginGame" with a parameter named "empty". This is used so that after "Login" is called, the server can send back a confirmation to start the game. The parameter "empty" will always be an empty string, and is only there to act as a fake parameter to get around the JavaScript function ASLEvent limitations (You MUST specify ONE Quest function and ONE parameter).

If you have any errors or questions, post them here and I'll do my best to answer them.

onimike
oh man this is awesome I know there is a online text adventure game this is a door opener thanks.

TextStories
This is a nifty feature if it works and would make a great addition to Quest, opening up many more possibilities for it and the community in general. However, I am sure it takes more than a simple port to make a MUD type game. How would one go about making a game online for multiple users to begin with? I am not too worried about the room or monster/equipment/item balancing, but making more than one player to be able to be in the game at a time. Would it be as simple as creating "player", "player1", "player2", "player150" or what? Also are these WebSocket-based servers free to use?

HegemonKhan
here you go:

-------------

http://blog.textadventures.co.uk/2012/0 ... quest-5-3/ (best~main link to click on)
^
http://blog.textadventures.co.uk/2012/1 ... available/ (scroll down to ' Game Behavior new things -> Change-able PoV' )
^
http://docs.textadventures.co.uk/quest/ ... notes.html
^
http://docs.textadventures.co.uk/quest/

path: ^

---------------

and the code syntax for it:

http://docs.textadventures.co.uk/quest/ ... gepov.html

--------------

hope this helps you a bit! :D

TextStories
Thank you, I will have to check these out. :D

jaynabonne
Those are related to being able to switch among multiple points of view for a single character in a game. They have nothing to do with a multi-player environment.

You would need to create new objects on the fly to represent the other players, as each signs in, and you would need to do it in each player's game for the other players. I believe that is what the code in this thread does. (It's been a while!)

Edit: If you look in NodeJSLib.aslx, it does exactly that in FSCreatePlayer.

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums