Jump to content

Pong Multiplayer/Sync Feasibility + Vector2D


Recommended Posts

A few days ago I decided to try to re-create Pong within MTA to further get used with DX interaction and some of the Vector2D functions.

After roughly 3 hours I had a basic working prototype done, and seeing as how it worked pretty well within MTA I came up with some ideas what to do with it, however, I don't think it would do much good without multiplayer. Which means 2 players.

The problems I have run into are;

1. Synchronization

With one of my other projects requiring synchronization between players, I found that using Element Data seemed to be the fastest(probably not the most efficient, obviously).

Simply triggering events between 2 players and the server won't be fast enough. Are there any other methods I might have missed which could be used as well?

I thought about creating a new element, which would act as a sort of a room between those 2 players. This element would then store all the game-specific stuff such as the Ball X/Y Position, Ball Velocity/Speed/Direction, Player Paddle Locations and etc.

2. Pong Multiplayer Feasibility in General

Is this even a feasible thing to try to achieve at all? Pong is a pretty precision-based game, and I fear that a 60-150ms latency might become a rather big obstacle to overcome.

3. Vector2D Confusion

I've never worked with Vectors before, and I'm not particularly good with math either. But I have studied some tutorials over at Khan Academy(I highly recommend their videos!) so I know the basics of Vectors.

Basically I thought I'd use these functions to take care of the ball, however I can't figure out whether I'm using it wrongly or if I've just mistaken the use of vectors. I can normalize my vector and get the X and Y magnitudes just fine, however, I can only set X and Y with absolute pixel values. Where as I assumed I'd have to enter magnitude values such as -1 to +1.

The Wiki doesn't have any information regarding these whatsoever, which is why I'm afraid I'm using them entirely wrong. So if someone has some experience with this, I'd appreciate some advice! Basically this is what I wanted to be achieve;


Link to comment
I think you should make a sync serverside and just interpolate for others clientside. Half a second should be enough. You can even trigger events with that instead of element data, it will reduce bandwidth usage with many players.

Interesting, I'll experiment a little with this and see what I can come up with.

Link to comment

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...