Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am working on 2-player 2d sidescroller.

How should I implement the physics on the server? Use one world for every game or use a big world in which I add every 2 player that start a game?

I have looked into some source code of multiplayer games and I saw that they don't implement any kind of game loop on the server, instead they work with events. If the game has physics handled by the server shouldn't the server use a game loop to call the step method?

share|improve this question
1  
You may want to read up on this: gamedev.stackexchange.com/questions/48832/… –  Byte56 Jun 21 '13 at 17:08
    
That won't cover for my type of game. –  Romeo Jun 21 '13 at 17:09
1  
I understand you might not use Box2D, but what seems so different about that answer? There's a lot of ideas there on what sort of things you'd need to cover in that scenario. –  Katana314 Jun 21 '13 at 17:12
    
It explains that for every 2 players a game is started on the server. @Katana314 : I use Box2D but he has a world for the entire game objects while i will have multiple game instances on my server. I want to know if it's better to use one world per instance. Also i deserve a votedown for insisting of keeping the image? –  Romeo Jun 21 '13 at 17:15
    
The physics of one instance shouldn't affect any other right? That would mean one world per instance. Can you clarify the question? "How should I implement the physics on the server" is a very broad question. –  Byte56 Jun 21 '13 at 17:19

1 Answer 1

up vote 1 down vote accepted

How should I implement the physics on the server?

As per rasmuses answer to a similar question, you want to run the physics simulation on both the client and server. If the physics does not run on the client, then it will look very choppy. And if the physics does not run on the server, then clients could get out of sync.

Use one world for every game or use a big world in which I add every 2 player that start a game?

You also mention in the comments: Box2D has the ability to stop certain objects from interacting with others. I think running a single Box2D simulation on the server would cause more issues than it would solve. It would be best to run one Box2D simulation per game.

share|improve this answer
    
Should i use a Thread for every game (every 2 plyaers)? –  Romeo Jun 22 '13 at 12:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.