Open NetBeans and head over to your [GameName]Extension project. First create your package. In my last post I said it should be created as domain.domainname.gamename.entities. For our extension I create a base package called domain.domainname.gamename and this is where we will put our extension class.So:
- Right click on Source Packages and hit New -> Java Package.
- Type in the full name. Again I am using com.cjrgaming.aegisborn for my game.
- Click Finish.
- In the new package, right click and New -> Java Class...
- Give it the name of your game. For example [GameName]Extension.
- Click Finish.
Next we will create the init function:
@Override
public void init()
{
}
Thats all there is to it. Just an empty init function. We will fill this in later with our handlers and entity manager. Now is the time to make note of our package structure and extension name. We will be filling it into the Smart Fox Server information in just a bit.
First we need to right click our [GameName]Extension project and hit Build. Then we need to go to our project's folder, go into the dist folder and copy out the [GameName]Extension.jar file.
Go to [SFSInstallDir]\SFS2X\extensions and create a new directory called [GameName]Extension and place the [GameName]Extension.jar file in it.
Next log into the SmartFoxServer web management page (normally located at http://localhost:8080/admin ). Log into the server and go to Zone Configurator. Below the Zone section click the little green circle with the + and the second half of the window will appear.
- Enter [GameName] for the zone
- Click the Zone extension tab.
- In name put [GameName]Extension - this is the name of the folder containing your jar file.
- In File put domain.domainname.gamename.[GameName]Extension - i.e. com.cjrgaming.aegisborn.AegisBornExtension
- Click Submit at the bottom
- Select the zone [GameName]
- click the green button with the + sign under Rooms
- Give it a room name, i.e. General
- Leave everything else alone except the drop down for Auto-remove mode use NEVER_REMOVE.
- Click Submit
Now you need to restart the server to get the changes to take effect. Thats all for this tutorial. We now have our server ready and waiting for any connections to be made to it. Next up, Login and joining a room from unity3d.
No comments:
Post a Comment