Jump to content

How to make multiplayer online games?


Paul-Andre
 Share

Recommended Posts

Http definitely. Mainly because static files should be handed by static file server (apache, nginx).

Actually the image is not static. I am making a painting program. When a person connects, I need to send him the picture at the current state. Then I will continue by sending him messages when changes happen. Currently what I have working is that the client requests the image through http, but I have a problem.

I wish to keep the site server and the painting servers as seperate programs, so that in the future I could have more than one painting. Currently I'm experimenting with one.

 

What I had first:

Site url: http : // localhost:8000

Websocket url: ws : // localhost:9000

Url of image: "http : // localhost:9000/image.png"

 

This didn't work because it caused the cross-origine error where you can't read pixels from a canvas.

 

So now what I have, and what is obviously not good:

 

Site url: http : // localhost:8000

Websocket url: ws : // localhost:9000

Url of image: http : // localhost:8000/image1/image.png

 

If I pipe my image through WS, I would keep it so that 1painting=1ws=1url, but I'm not sure if that is a good way to do things. If there is something wrong, please tell me. And is opening more than one port bad?

 

 

Whatever suits you. But if you know Python, then don't go with node.js. Python Twisted is a better option. I'm using it, it works great and you have much cleaner and easy to maintan code.

 

No, I don't really know python that well, I'm just trying to see what options I have. php seems to be a standard with webdev. hmmm

Link to comment
Share on other sites

  • 2 weeks later...

Regarding your type of  game, ping pong might sound an easy game but it can be difficult to implement. The reason is on internet there is always some latency and ping pong is a fast paced game. Suppose your ball goes from one side of screen to other side in 200ms, then latency should be less than 200ms, if the latency is more than that, it will not work properly. On different networks, there will be different amount of latency sometimes even 300-600ms. So, it's very important that other than doing the communication thing, you need to think hard on how to handle latency and make game appear smooth on both sides.

You can try cloud based solutions. There are several Backend As A Server providers. They allow you to make multiplayer games without writing server side code and hosting them. The core logic lies at client side only.

As I am an engineer at Shephertz, I would recommend you trying our own Multiplayer solution, named AppWarp. It's a BaaS cloud solution for making real time multiplayer games. It consists of rooms and lobbies. So it will allow you to run simultaneously several ping pong games. http://www.shephertz.com/index.php 

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...