More then 1 world on Server

Hi, I need to create worlds (rooms) on the server. For example there are 100 players in the queue for a random battle. I want to create a server with 10 world physics with 10 players. Is it possible to implement with your engine?

Sure.

Yes, basically jme limits nearly nothing at all (that is not limited by the underlying api’s or java).

You have in the creation of a simple server is as follows:

[java]
public static void main (String [] args) {
Application app = new Main ();
app.start (JmeContext.Type.Headless);
}
[/java]
On my server players are in the menu on the game can perform various actions on the server but they are not in battle. Can be such that 100 people do not take part in any battle, and, accordingly, the server does not need a physical. When users want to play I need to create on the server fizichekoy world and remove it at the end of the battle. In your example, the world sozdaetsya at startup. I want to create worlds in separate threads. Can I have a small example of how this can be implemented?

[java]app.start (JmeContext.Type.Headless);[/java]
it mean only that Application do not use GL Window. It is terminal based.
everything needed isin tutorials.
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:networking

this what you want to achieve is possible to make.

The Best way is to split architecture into main Server that manage queue / other servers.
It’s good to have it on good port(i mean ports that are not blocked from client side).

if you dont have so many IP for server managing, then you can set pool of ports for a servers.

So user first connect to server on port (for example. 8080) and then he is redicrected to other servers on other ports.

It’s a good way to balance CPU / RAM / etc usage,by split it on many machines in future. (mostly good for MMO).

in short: just split server architecture into many separate applications.

edit: so you can just use different server for different world. Do not use DB to communicate of servers, only to save data. Servers should know each other dynamically (ip and port) from main server, so it can be possible to send messages each other.

btw, what google translate creates for you there is not very understandable.

I want to create server. On this server i want to create dynamics rooms with physics. These rooms can be not big, up to 10 players. When a player is a lot, and the rooms too, then I’ll open a new server.

for example: on my server gathered to play 10 players. 10 players want to play. My server is to create in a separate thread to the physics room. After the game, the players remain on the server, but the room with the physics should be removed from the server’s memory and their thread.
Sorry for my English.

And these rooms can be a lot. And these all on the one server.

I think everybody got that bit by now, I don’t think anyone will make that “small code example” as its quite large and not reusable and you’d have to rewrite it anyway for your game.

I need a code example, how to create

app.start (JmeContext.Type.Headless);

not in the function main, and in any other place in the code and release it.

I strongly recommend to start with something simpler, as you don’t seem to have any expirience so far with either networking nor jme nor game development, once you finsihed a simple game everything else will become much clearer.

1 Like

I need to find a solution for this problem. Jme if it can tell me how to implement it. If there is no solution to this problem it will have to seek other solutions.

There are solutions, but you have to write them yourself, JME is a framework that helps you with rendering,physics network and a few other things, but not with your own custom logic, everything in jme is generic and not specificly for a usecase, so concrete logice like the one you described has to be written by yourself.

I understand that I have to write it all myself. And I know how it is all written. I need to know how to create an independent object jme that I can use and then kill it. Can I for example do so in a place not in the main ()?

[java]
SimpleApplication app = new SimpleApplication();
app.start();
[/java]

yes you can have multiple jme applications running without any limitation.

Thank you, that’s all I wanted to hear)

Just make sure you start them headless :slight_smile:

1 Like

Of course)

1 Like