Sign in to follow this  
Mythics

[web] P2P Browser Based MOG

Recommended Posts

I'm very fluent in VB6, heavy into learning C# and VB.Net, and now I'm wanting to move into more browser based programming. I've done a lot of network programming and database manipulation, report generation, etc.. but never done anything for a web browser. I'm mostly looking for opinions on how I could accomplish a peer to peer browser based multiplayer online game. My real difficulty is in figuring out the best way for me to accomplish the bare basics of this potentially large task. I've got an artist working on some graphics that will most likely take a year or more before completion, so I have time, but the game designer is wanting to know what our capabilities should be after that amount of time. Should login/profile information be PHP based to a MySQL database? javascript for image manipulation / collision detection client side? Can javascript handle TCP/IP even? If so, what are the best encryption methods out there to prevent players from cheating if everything is client side? Maybe there are other languages out there to do everything I'm looking for, or perhaps some way to use VS.Net to generate OCX files that could be embedded into any and all web browsers regardless of OS? If anyone has any suggestions outside of using flash, please PM me or reply.

Share this post


Link to post
Share on other sites
Ajaxey techniques? From a quick search, it doesn't look like the best way to do what I'm going for here.. but perhaps one that could still work nonetheless.

I'm guessing from a few quick Google searches, javascript doesn't actually handle sockets? If that's the case, is there something more like a TCP/IP connection vs the Ajax method?

Can javascript handle database manipulation?

Where would the server-side script fit into the equation?

This is totally new territory for me, as the most I've done in the past is a little HTML.

Edit:
HTML/PHP sounds like my best bet for most everything I'm going to do outside of the game itself. While I could do the game in javascript most likely, I'm really needing to not only have graphics manipulation and database access, but I'm also going to need a socket connection from one user to several others (bypassing the server altogether if possible) just for referencing chat data and character positions.

[Edited by - Mythics on May 7, 2008 3:39:48 PM]

Share this post


Link to post
Share on other sites
Quote:
I'm guessing from a few quick Google searches, javascript doesn't actually handle sockets? If that's the case, is there something more like a TCP/IP connection vs the Ajax method?

You should take a look at comet.

Quote:
Can javascript handle database manipulation?

Where would the server-side script fit into the equation?

javascript can't do any database stuff. And that's were the server side script comes into play. The javascript should send an request to the server-side script which handles the database stuff.

Quote:
...but I'm also going to need a socket connection from one user to several others (bypassing the server altogether if possible) just for referencing chat data and character positions.

javascript doesn't know sockets and there is no way to have javascript clients communicate directly with each other. Actually the security model of the javascript running in browsers even disallows todo ajax requests to webservers with a different domain then the one delivering the webpage.


I should mention that whenever i wrote "javascript" I meant "javascript running in a browser".



Share this post


Link to post
Share on other sites
I'm thinking pure Java will be the route I'll want to go. The syntax is pretty similar to C/C++ for the most part, and it's something that would be pretty useful for me to know anyhow.

It supports everything I can think of at the moment, handles security pretty well, networking is doable, database manipulation is doable, and there are quite a few books out there pretty cheap that I can use well.


Anyone have any opinions on my taking this route? Disagreements with Java for browser based games/sites? Potential flaws with Java that would be nice to inform a programmer ahead of time, lol?

Share this post


Link to post
Share on other sites
I'm sorry to have to be the one to inform you, but what you want to do is impossible. No web browser that I know of gives you access to sockets. The best you'll get is the XMLHttpRequest object, which is what enables all of this AJ[AX] technology to work. The problem is that you're still limited to posting HTTP requests to a web server. In no way will that enable a peer browser to post a request to another peer browser. And if that wasn't enough, you'd be crippled by latency. You're just going to have to stick to using a client-server model.

Besides, client-server is arguably easier and it's definitely more secure. Even with binary MOG clients such as World of Warcraft there are anti-hacking software installed on your computer to ensure no changes to the client are made. Can you imagine trying to prevent users from cheating by changing the javascript running in their browsers? You need a server in the middle that can be trusted to verify the validity of every action being performed by the players.

Share this post


Link to post
Share on other sites
Quote:
Original post by smrI'm sorry to have to be the one to inform you, but what you want to do is impossible. No web browser that I know of gives you access to sockets.


I thought Java could allow for this? Would that mean that Java can't allow for sockets through a simple web applet?

Quote:
Original post by smrAnd if that wasn't enough, you'd be crippled by latency.

Assuming I'm correct in my current evaluation of Java, why would latency be an issue? I could understand some latency, but the number of users in any instance will be limited to 10 or so.. meaning each user will only send coordinates and chat messages to 9 other users.

From my experiences in the past, I would think the latency issue wouldn't come up as that big of a problem as long as I know users may overlap one another (one says they're moving to X/Y position, and another does the same before receiving the first client's instructions). Another example would be if a chest is opened by a user, item acquired and all, but another user does the same thing before being informed of the first client doing the same action. It would then simply be a 'who opened the chest first' scenario, but the game we're intending to make will allow all clients to always acquire their own copy of every item (so it's not a problem).

Afaik, the only advantage to a client/server structure (in my situation) would be lower latency due to sending instructions to a server that is then queried from the other users as needed.

Share this post


Link to post
Share on other sites
Quote:
Original post by smr
If you use Java, then you will likely have access to sockets for outgoing connections to the originating host. Your java applet will not be able to connect to another peer.

Ah... Thanks for the info and link, very appreciated.

Well, this stinks.. lol.

Quote:
Original post by smr
As far as latency is concerned, I was talking about http.


Ah, understood.

Share this post


Link to post
Share on other sites
Quote:
Original post by Mythics
Ah... Thanks for the info and link, very appreciated.


No problem! Don't be discouraged though. Client-server is really the way to go. Your users aren't going to appreciate the fact that the game they play is P2P instead of client-server. They just won't give a hoot. Client-server is easier to develop (arguably) and it's more secure (definitely). Sure, you'll need to host the server somewhere, but dedicated hosting has become very affordable with gigabytes of bandwidth usage per month. And you will need gigabytes of it.

And if you really want player-hosted games, you could distribute your server application as a separate download.

Share this post


Link to post
Share on other sites
Quote:
Original post by smr
And if you really want player-hosted games, you could distribute your server application as a separate download.


Everything you said up to to this point made perfect sense.

Server Application?

I've done many network based programs using client-server logic, but I was under the impression that a browser based game that used client-server would be populating a table or some other static data rather than connecting to an actual application. Then other clients would read from that data to see what's going on.

How did I go from just obtaining web space for a site to obtaining a server for hosting applications? lol

Share this post


Link to post
Share on other sites
It's not the client that populates the database or static data, it's the server. Many server applications for smaller games (eg. all the PHP web games) are essentially scripts or extensions running as part of a web server. Others are standalone applications, as with 'proper' MMOs. Either way, it's still essentially a server application.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this