Load Mutiple Map on the server?

All things HTML5 or text based engines, or really any web based engines.
Post Reply
zaquanishak
Posts: 53
Joined: Mon Aug 26, 2013 1:54 am

Load Mutiple Map on the server?

Post by zaquanishak »

Hi,
I would like to ask how can i create multiple map on the server and load different map on different client? Is it possible?

Regards,
Zachz
zachz
Programmer
compass-interactive
User avatar
coolbloke1324
Posts: 181
Joined: Mon Jan 23, 2012 5:20 pm

Re: Load Mutiple Map on the server?

Post by coolbloke1324 »

The best way for scaling and concurrency is to only put one multiplayer map on each server instance. When a user moves from one map to another the client can connect to a new server.

The benefit of this is large because each instance can then easily deal with only the clients connected to a particular map, only run physics on a limited number of objects, and also only handle multiplayer data for the map they own, and not flood a single instance with ALL your players.

You CAN use a single instance and have multiple maps on it but it would be a mistake to code that way if you plan to support lots of users.

Is your game going to support lots of users?
CEO & Lead Developer
Irrelon Software Limited
http://www.isogenicengine.com
User avatar
coolbloke1324
Posts: 181
Joined: Mon Jan 23, 2012 5:20 pm

Re: Load Mutiple Map on the server?

Post by coolbloke1324 »

Also, for reference, this is the way large games like World of Warcraft work as well, haivng individual server instances handle different maps.
CEO & Lead Developer
Irrelon Software Limited
http://www.isogenicengine.com
zaquanishak
Posts: 53
Joined: Mon Aug 26, 2013 1:54 am

Re: Load Mutiple Map on the server?

Post by zaquanishak »

Yes it will support alot of users. But instead of creating multiple server i would like to create multiple map on one server only. The physics will be the same i think. What i was thinking is i will spawn my character to another location of the grid but with different map. That mean I dont have to create a large map for multiple places in the grid. Instead, whenever a character is walk through a door it will spawn to another location of the grid with different map(like a room which they dont interact which other characters which not belong to that particular room). So can u please show me how to do that? I know how to load multiple map on the client but how do i destroy the map that have been previously load and load in a new map just for that particular client upon moving to a tile? From the example, map is load on client which it will run once during the client connect to the server. So i do i initiate the cilent again to run a different map?

Thanks in advance,

Regards,
Zachz
zachz
Programmer
compass-interactive
zaquanishak
Posts: 53
Joined: Mon Aug 26, 2013 1:54 am

Re: Load Mutiple Map on the server?

Post by zaquanishak »

hi,
so how do i move the client to another server? I already define the connection port during client connect to the server such as
ige.network.start('http://localhost:3000', function () { } , so how do i do that when i already define it in the client? Should i place the ige.network.start() in the character class? coz from what i see the client.js is not looping so once i define it i cant change it unless i refresh the client. is it correct? Please advise.

Regards,
Zachz
zachz
Programmer
compass-interactive
robaldred
Posts: 64
Joined: Tue Aug 27, 2013 5:54 pm

Re: Load Mutiple Map on the server?

Post by robaldred »

I'm building a game which is two player realtime multiplayer, but I want many groups of two to be able to player, to enable this, I'm created a game server instance for each "room"
I've created a small node app which acts like a server browser, which spins up and manages game instances.

A player visits my game, the first thing they hit is the server browser, they create or join a game, the server browser app issues their browser with a redirect taking them to the main game index.html with and argument eg. index.html?port=23456

You could have a little transparent node app in a similar way that keeps track of the the game server instances and which map they're running.

In the game client all I do is take this port argument and pass in into the ige setup code.
It isn't the most secure method, as it's easy for a user to change the port argument manually, you could hide it in a cookie or local storage if you're concerned, about the average user meddling.

You'll need to grab the query params in javascript with a little function like this:

Code: Select all

queryParamByName = function(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}

var port = queryParamByName("port")
ige.network.start('http://localhost:'+port, function () {
zaquanishak
Posts: 53
Joined: Mon Aug 26, 2013 1:54 am

Re: Load Mutiple Map on the server?

Post by zaquanishak »

Hi,

What i mean is when u already connect to a server instance how do u change the connection to another server instances? What i want is similar like the casinoRpg game. As u can see when the player hit the door, the player will spawn to another location/room. So i want to know how they do it? Are they using one server instance for a room or they just spawn the player to another location within the server world? If they really spawn the character into another server instance, how do you change the connection of a client to another server when the client is already connect to a server. I dont see how to change the client.js to have option on connect to multiple server instance because the client.js does not have loop. From my research, the only class that have loop is the IgeEntity which u can extend the _update function. So how can i create a loop inside the client.js so i can change the connection from one server to another server?

Please Advise.
Regards,
Zachz
zachz
Programmer
compass-interactive
robaldred
Posts: 64
Joined: Tue Aug 27, 2013 5:54 pm

Re: Load Mutiple Map on the server?

Post by robaldred »

Ahh OK, I haven't played CasinoRPG a great deal, however it looks great, a fine example of what can be achieved with IGE.

From what I can tell...
They're checking when a player moves near a door/elevator then using the mouseUp event to trigger the room changed.
They've also made their own classes which extend IgeTileMap, one for each different room (so probably quite a few)
* city
* condo
* one for each layout of casino floors.

Basically, they're masking the room transitions with a UI over the top of the main scene which fades to black
When it's blacked out, they're doing a few things...

1. Removing the current room
* Cleaning the current room of it's objects
* Unmounting the tilemap, texture map & other entities from the scene.

2. adding the room the player's moving in to.
* Loading room layout
* Adding all it's objects
* Mounting tilemap & texture map & other entities to the scene

3. Finally they fade back from black, revealing player in the new room.
User avatar
coolbloke1324
Posts: 181
Joined: Mon Jan 23, 2012 5:20 pm

Re: Load Mutiple Map on the server?

Post by coolbloke1324 »

robaldred wrote:Ahh OK, I haven't played CasinoRPG a great deal, however it looks great, a fine example of what can be achieved with IGE.

From what I can tell...
They're checking when a player moves near a door/elevator then using the mouseUp event to trigger the room changed.
They've also made their own classes which extend IgeTileMap, one for each different room (so probably quite a few)
* city
* condo
* one for each layout of casino floors.

Basically, they're masking the room transitions with a UI over the top of the main scene which fades to black
When it's blacked out, they're doing a few things...

1. Removing the current room
* Cleaning the current room of it's objects
* Unmounting the tilemap, texture map & other entities from the scene.

2. adding the room the player's moving in to.
* Loading room layout
* Adding all it's objects
* Mounting tilemap & texture map & other entities to the scene

3. Finally they fade back from black, revealing player in the new room.
It would be awesome if @goldfire could weigh in on how they handled server-side multiplayer with multiple rooms.
CEO & Lead Developer
Irrelon Software Limited
http://www.isogenicengine.com
robaldred
Posts: 64
Joined: Tue Aug 27, 2013 5:54 pm

Re: Load Mutiple Map on the server?

Post by robaldred »

Indeed, I wonder if they're just keeping a big list of all players and only showing those that are in the same room as the current player?
Post Reply

Return to “HTML5/Web Engines”