So we need to open NetBeans and go to our [GameName]Entities project and get started. First we need to connect NetBeans with our database.
- Click the tab that says Services
- Right click on Databases and click New Connection.
- A new window will appear. Click in the drop down and select MySQL (Connector/J Driver)
- Hit Next
- leave the host as localhost
- Update the database to be your database name
- Update the user and password to the user and password you created in part 6.
- Click Next then finish.
- Right click on source packages and select New... -> Entity Classes from Database
- If Entity Classes from Database is unavailable click Other...
- Under the selection Persistence is Entity Classes from Database. select it.
- A new window will appear and will have a drop down. If it doesn't already contain your database, click it and select your database connection you created.
- The window will load all the tables in your database. For now you only need to add the classes [game_name]_account and sf_guard_user.
- click Next
- Update the Package. The standard package convention is to list it as domain.domainname.gamename.entities. So for mine i did com.cjrgaming.aegisborn.entities.
- Leave the rest of the default selections and Click finish.
This will have created 2 packages, one called META-INF and another which is your package above like mine.
Now you can right click on the [GameName]Entities project and click Build which will build a jar file. Now we can put that into our SmartFoxServer. Navigate in an explorer window to your project. In the dist folder is a jar file called [GameName]Entities.jar. Copy this file into [SFSInstallDir]\SFS2X\lib. And lastly you will want to go to your [GameName]Entities\src folder and copy the META-INF folder into [SFSInstallDir]\SFS2X.
This concludes this tutorial. We are now completely set up and ready for the messaging between the server and client.
1 comment:
Looking forward to the next instalment.
Post a Comment