Multi Game Server

All things HTML5 or text based engines, or really any web based engines.
Post Reply
robaldred
Posts: 64
Joined: Tue Aug 27, 2013 5:54 pm

Multi Game Server

Post by robaldred »

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
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Multi Game Server

Post by hallsofvallhalla »

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.
robaldred
Posts: 64
Joined: Tue Aug 27, 2013 5:54 pm

Re: Multi Game Server

Post by robaldred »

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.
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Multi Game Server

Post by hallsofvallhalla »

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.
User avatar
coolbloke1324
Posts: 181
Joined: Mon Jan 23, 2012 5:20 pm

Re: Multi Game Server

Post by coolbloke1324 »

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! :)
CEO & Lead Developer
Irrelon Software Limited
http://www.isogenicengine.com
robaldred
Posts: 64
Joined: Tue Aug 27, 2013 5:54 pm

Re: Multi Game Server

Post by robaldred »

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.
User avatar
coolbloke1324
Posts: 181
Joined: Mon Jan 23, 2012 5:20 pm

Re: Multi Game Server

Post by coolbloke1324 »

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.
Awesomo!
CEO & Lead Developer
Irrelon Software Limited
http://www.isogenicengine.com
Post Reply

Return to “HTML5/Web Engines”