Hi All,
I've built a prototype of my game which is a multiplayer box2d turn by turn shooter.
It has a simple lobby system which just keeps track of player state, all the physics is run client side. Obviously this is not ideal.
I wanted to try and reimplement it using IGE, so I can benefit from all it's features.
I need the server to run more than one game.
I could be completely wrong but it seems I can only instantiate one IgeBox2dComponent because it's added to the ige global.
Wondered if you have any suggestions for an elegant solution.
Thanks for your time.
Rob
Multi Game Server
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Multi Game Server
Could you have all of your instances as one game but separate them by an array that list the games then only send data to whatever room the instanced object is a part of?
Much like Nodejs's room ability. It ties all clientIDs to a room id.
Much like Nodejs's room ability. It ties all clientIDs to a room id.
Re: Multi Game Server
yeh, socket.io provides rooms which is exactly how i'm doing it in my current prototype, but that's fine as i'm doing client side physics.
However, to full implement IGE, the physics needs to run server side with a physics instance per game, completely separate, regardless of the network transport.
If I ran all the games physics in one world, there'd be tons of objects flying around colliding with objects from other games.
There may be a way we can extend the rooms functionality somehow to give me what I want here.
However, to full implement IGE, the physics needs to run server side with a physics instance per game, completely separate, regardless of the network transport.
If I ran all the games physics in one world, there'd be tons of objects flying around colliding with objects from other games.
There may be a way we can extend the rooms functionality somehow to give me what I want here.
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Multi Game Server
I see. I was suggesting server side checks to make sure the objects can only collide with other objects with the same room id, but maybe I have not looked into how the collision works enough as I am not sure a check could be put on time of collision to see if they are in the same room.
- coolbloke1324
- Posts: 181
- Joined: Mon Jan 23, 2012 5:20 pm
Re: Multi Game Server
Hey ya,
Sorry about the delay in getting back to you after you posted, I've had lots on my plate.
The simplest way to handle this would be to fire up new ige server instances on separate ports and direct traffic accordingly.
Doing it this way would also mean that you can scale easily. What I would do is have your client-side code make a request to your main control server and ask for an IP/port to connect to. That way you can monitor connection counts and make sure clients are sent to least utilised "rooms". Once you have the IP and port it is trivial to connect the same way as you are already doing.
I would not recommend running two or more physics simulations on the same thread anyway (as each Node.js instance is single threaded) since you will run into bottle necks.
Hope that all makes sense, let me know if you need any more clarification!
Sorry about the delay in getting back to you after you posted, I've had lots on my plate.
The simplest way to handle this would be to fire up new ige server instances on separate ports and direct traffic accordingly.
Doing it this way would also mean that you can scale easily. What I would do is have your client-side code make a request to your main control server and ask for an IP/port to connect to. That way you can monitor connection counts and make sure clients are sent to least utilised "rooms". Once you have the IP and port it is trivial to connect the same way as you are already doing.
I would not recommend running two or more physics simulations on the same thread anyway (as each Node.js instance is single threaded) since you will run into bottle necks.
Hope that all makes sense, let me know if you need any more clarification!

Re: Multi Game Server
Hey Rob, No worries, appreciate your time.
Perfect, that's pretty much the approach I thought I would have to take.
I need to essentially build a server browser
I'll build another little node app to route players to individual game servers.
Perfect, that's pretty much the approach I thought I would have to take.
I need to essentially build a server browser
I'll build another little node app to route players to individual game servers.
- coolbloke1324
- Posts: 181
- Joined: Mon Jan 23, 2012 5:20 pm
Re: Multi Game Server
Awesomo!robaldred wrote:Hey Rob, No worries, appreciate your time.
Perfect, that's pretty much the approach I thought I would have to take.
I need to essentially build a server browser
I'll build another little node app to route players to individual game servers.