Page 1 of 1
HTML5 multiplayer tutorial question
Posted: Sun Jun 02, 2013 10:54 pm
by legoson
I was just following these tutorials about creating a HTML5 multiplayer game
http://www.youtube.com/watch?v=2_e5NaDX2rs
How would I be able to access the server on a website for testing?
Locally I'd have to run the server.bat manually then access the index.html and it would work, but how would I do it off my website? I'm not sure how the server.bat can be executed when others access the webpage.
Maybe I need to possibly keep the server running on my machine, then when other people access the game webpage it would communicate with the server on my pc? If so then how can I do that?
Thanks, I'm new to socket and web programming

Re: HTML5 multiplayer tutorial question
Posted: Sun Jun 02, 2013 11:39 pm
by Jackolantern
The server must constantly be running. It isn't like PHP where it runs for each personal request. You can either run it from your personal machine (if you have a static IP address or use an IP routing service), or you can get a VPS (Virtual Private Service), where someone essentially rents you a portion of a server and it runs like nothing else is on the machine. A standard web host can't run node apps because you can't run true applications on a web host. On a web host you can only upload files to be used by the web server. There are also specific node hosts, although those can be a bit more expensive, or even a lot more expensive but some of the setup is done for you and a few even have node-specific features.
Re: HTML5 multiplayer tutorial question
Posted: Mon Jun 03, 2013 12:16 am
by legoson
Oh
my hosting service (Dreamhost) seems to offer a VPS but costs $15 per month for 300mb, but I just want to test this out so I think I'd rather simply keep the server running on my machine, but you mentioned that I need a static IP address or an IP routing service, is there any specific programs that I could use to accomplish this? I'm not too sure how to get started with it since I've never hosted any servers before.
Re: HTML5 multiplayer tutorial question
Posted: Mon Jun 03, 2013 1:22 am
by Xaos
I know you can use a Raspsberry Pi to create a server. Theres some tuts on how to do this. Not sure if it'd be good enough for what you're trying to do, but worth a try. Jack knows alot more about the Pi than I do, but i'm pretty sure you could make it work.
Re: HTML5 multiplayer tutorial question
Posted: Mon Jun 03, 2013 3:47 am
by Jackolantern
I don't know much of anything about the Pi lol. I think you are thinking of someone else (perhaps Vitinho?).
As far as hosting a server with a static IP, check out
NoIP.com. They are pretty much the leader in IP forwarding. I have never used it, but I think you run an application on your computer/server 24/7 that monitors when your IP changes, sends the changed IP back to no-ip's servers where they route any requests to your virtual domain name to your actual IP address. At least...that is the only way I can see it being possible for it to work, but I know it does, so...they do something. And it works lol.
As far as running a node server, your home computer would probably be fine. Node is single-threaded, and thus, can't use all the resources on your computer without some special development techniques, so even if your server is running at capacity, it will only be using 1 processor and it is pretty good on memory as it isn't threaded.
Re: HTML5 multiplayer tutorial question
Posted: Mon Jun 03, 2013 4:08 am
by Xaos
Oh haha, sorry Jack. Thought you said you had been messing around with it.
Here's one tut
http://www.wikihow.com/Make-a-Raspberry-Pi-Web-Server
Re: HTML5 multiplayer tutorial question
Posted: Mon Jun 03, 2013 5:10 am
by Jackolantern
Did you say you had a Raspberry Pi mini-computer, Legoson? Because node should run fine on a desktop. I do believe the Pi would make a nice little node server, but I don't want to give the impression that you need a Pi to serve node content.
Re: HTML5 multiplayer tutorial question
Posted: Mon Jun 03, 2013 9:03 am
by a_bertrand
Personally I develop all my game on my own PC, with node.js installed on windows, with a node module called nodemon which will restart the node server each time I modify the node code.
Then I simply connect on my local pc with an url like:
http://localhost:8081/ and the thing is running. Works fine to test even with multiple browsers open at the same time to test the multi-user interaction.
Beside that, if you want to a server to host players, you will need to rent something on internet. Even a static IP will hardly cut it as the usual bandwidth you have at home is bigger for download than upload where for a server you would need more for upload than download. So once you have your game ready to be beta tested you will need to take a VPS or a dedicated server. In both cases, you will need quiet some Linux administration knowledge, even just to install the needed packages, without talking about security issues.
Is that all too complex for you? Then... time to learn
To learn Linux adminisitration, the best bet is either to build a 2nd pc to install it there, or you can install VirtualBox on your windows machine and then create a virtual machine running linux on it.
Re: HTML5 multiplayer tutorial question
Posted: Mon Jun 03, 2013 1:01 pm
by legoson
@Jackolantern: no I don't have a Raspberry Pi mini-computer but I think I'll check out NoIP.com
@Xaos: Hmm I'll take a look at Raspberry Pi
@a_bertrand Yeah I didn't think dealing with multiplayer with Node JS was going to be an easy task, but I'm always up for learning something new
Thanks for the reply guys! I'm going to try to get started today with the methods mentioned above.
Re: HTML5 multiplayer tutorial question
Posted: Mon Jun 03, 2013 1:03 pm
by a_bertrand
BTW I doubt Raspberry Pi is the way to go for such things...