MySQL Connection and Virtual World?

Hello guys!



I’m new to the forum, but I already programmed with jME3!

I have a question. I want to create something, like “virtual worlds” based in some mysql db.



i.e: The server constantly get some rows from a db, lets say… 4. I want to create a 4 different rooms based on the rows (this would be the virtual worlds). And when some user chooses to enter room number 2, he will only see objects from room number 2!



But, I have no idea how to make this virtual worlds. And my problem is: how could the jme3 deal with the values and create several different rooms with different objects without making the application slower than the normal.



I would be very grateful with someone could help me.

Thanks in advance, borba.

You just create a new scenegraph from the db data…?

Wouldn’t that overload the server? Lets say, a thousand of different rooms?

My suggestion is you want to use a technique called load on demand. This means you only query the database when you have to, when the player goes to the next room and it needs to be loaded. Lets say you have to do 1000 rooms, on the initialization of your game you go ahead and preload maybe the first 4. Then whenever you trigger moving to the next room, you query the database and save it into your custom datastructure and build the scenegraph like normen was talking about. Personally if you have to build a 1000 rooms I would also detach previous rooms from the scene so you are only always having 4 rooms active (you may increase or decrease the amount of rooms based on performance)

1 Like

Thank you scrubalub!



And what about the users? Because I would like the application to be online. So, how could I deal with it?

Just another question, how to remove the text onn the screen from the SimpleApplication?

([java]rootNode.removeControl(statsView);[/java] does not work)



Thanks in advance,

Borba.

try statsview.removefromparent for removing the node from the scene.

You will have to explain further for how the users will interact with each other. Try to keep it as detailed as possible as that might change your approach.