DB Rooms

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

UrbaLoca
Posts: 86
Joined: 29 Nov 2006, 16:44

DB Rooms

Postby UrbaLoca » 01 Aug 2008, 04:44

Hello.
Im making a MMO. The rooms are persistents but when I disconnect the server, the rooms are cleaned. I want to store these rooms in a DB and then, load the rooms from the DB.

How I can do this?

Thanks! :wink:
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 01 Aug 2008, 07:18

You make a server side extension :)
In the init() method you load the properties of each room (name, type, maxusers etc...) and create them dynamically.

When the application runs you can also store new data in the DB, if necessary and on the next restart you will have all rooms back again.

If you need help in configuring the DB and see how to work with it, check the examples and the documentation coming with SFS PRO.

Kind regards,

p.s. = since SFS 1.6.0 we embedded a powerful database engine, so you don't even have to setup your own.
The database is called H2, more details here -> http://www.h2database.com/
Lapo
--
gotoAndPlay()
...addicted to flash games
UrbaLoca
Posts: 86
Joined: 29 Nov 2006, 16:44

Postby UrbaLoca » 01 Aug 2008, 13:54

Thanks Lapo!
Can you put an example of the extension and How to load it to show rooms?
Im not good at extensions...

Thanks.
Menser
Posts: 111
Joined: 13 Nov 2007, 18:32

Postby Menser » 01 Aug 2008, 14:26

Heya-

If you go an look in the feature wish list section. There is a post called Persistent dynamic rooms or some such that was written by me.

It includes all code needed to have Persistent dynamically created rooms over server reboots, as well as being fairly well documented (perhaps over documented lol).

One thing, it currently does not use a DB to write and load files, it writes and loads from a text file. The code was written with 1.5 which did not have the built in DB engine so i waned to make it as useable by as many people as possible. Though it should be easy enough to edit to do the saving and loading from the DBs.


Hope that helps..

_-Menser-_

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 73 guests