Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Views for online multiplayer  (Read 1892 times)

0 Members and 1 Guest are viewing this topic.

Sixoul

  • Newbie
  • *
  • Posts: 17
    • View Profile
Views for online multiplayer
« on: May 05, 2014, 08:33:02 pm »
I was looking at the tutorial for handling views. I tried thinking of how views would work in some games.

In a fighting game online would one player have an advantage if their resolution is larger than their opponent? Say the view is made to be the edge, the player entities can't move outside the view. The view will stay centered between the two player entities unless they move to the edge of the level. The view zooms out slightly as the player entities get further apart but to a certain distance.

Would this cause one player to move off the screen of the player with a smaller resolution or aspect ratio or some other issue?

What are some common issues in dealing with varying view sizes and aspect ratios?

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Views for online multiplayer
« Reply #1 on: May 05, 2014, 08:45:37 pm »
If you make views of both players the same size, they will show the same part of your world whether one has a different resolution or different aspect ratio.
However, having a different aspect ratio will make the view stretched and deformed. So you probably want to keep the aspect ratio of the viewport of both views the same. (I'm not sure if my words are in the right order...)

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Views for online multiplayer
« Reply #2 on: May 05, 2014, 08:47:41 pm »
In this case, the view size is a simple function of the two player positions.  Given the positions, computing the view every frame on the client is trivial.  This computation will have to take aspect ratio into account, but as far as I know there are really only two aspect ratios in common use (4:3 and 16:9) so if your code can handle those two correctly, you're probably set.

Synchronizing the player's positions, stances and moves is the real concern.  http://gafferongames.com/networking-for-game-programmers/what-every-programmer-needs-to-know-about-game-networking/ is as good a place as any to learn the basic concepts of how multiplayer games synchronize these things.

Also note that the SFNUL extension library has a synchronized object class which may save you some of the hassle of implementing all this yourself.

Sixoul

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Views for online multiplayer
« Reply #3 on: May 07, 2014, 03:39:08 am »
From that article it made it sound like the most effective online setup is having the client-server setup except the client predicts the game state, it kind of sounded like it only predicts what the client player is doing so it's predicting itself. Is that what causes rubber banding effects?

How does something like GGPO work?

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Views for online multiplayer
« Reply #4 on: May 07, 2014, 08:08:08 am »
Rubber banding is what happens whenever the client and server disagree, and the client's correction of its local simulation is noticable to the human using the client.  I believe it's correct to say that this particular problem wouldn't happen if you weren't using client-side prediction.

Based on GGPO's home page, it sounds like it also uses client-side prediction and such, but it relies on a peer-to-peer architecture rather than a client-server one.  Presumably sending inputs directly to the other player is faster than everyone sending to a server and then waiting on the server to respond.  Of course, peer-to-peer only really makes sense with very few players (which is typical in fighting games) and when you aren't worried about cheating (which is why commercial games can't really get away with it).

Disclaimer: I've never made a multiplayer game so most of this is educated guessing.