Sunday, October 2, 2011

SmartFoxServer: Multiplayer Flash Games!

Have you ever wanted to create Flash games that you can play online with your friends, but you have only a small amount of knowledge when programming AS2 or AS3? Then SmartFoxServer is the answer for you!

SmartFoxServer (SFS) is a simple program/application that you run on your computer that handles all of the connections and complicated material automatically for you. What is nice about SFS, is that it comes with an Examples folder in the installation path. This allows you to open up AS2 or AS3 example flash documents to view the coding and the structure of how to build chats, games, etc.

So today I will show you how to install SFS and use the "SimpleChat" example in Flash AS2.

First, download it: SmartFoxServer Pro. This is free, but you can only have 20 maximum connections at a time. If you want more people to be able to play at the same time, you have to buy a license for more connections.
Select which OS you are using and open up the installer.

Accept the terms of agreement














Instead of installing to your Program Files, put it on your hard drive or in My Documents. For me, I'm putting it straight onto my hard drive.














After SFS is installed, we need to Port Foward our router so people can connect to our server.
So open up Command Prompt by hitting the start button and searching for "cmd" or "command prompt".
In Command Prompt, type: ipconfig







Find your Default Gateway and IPv4 Address by scrolling to the top and take note of them.







Now, in your browser, type your Default Gateway (mine is 192.168.1.1)
Log in to your router (Some routers default user/pass is: user: admin pass: admin) Once logged in, select the option for Port Forwarding. On a Linksys router, just select "Applications and Gaming".
Use the following options when adding a port:






Notice that for the IP Address, I put the last number from my IPv4 Address.
Now save your options and close your browser.

Last thing we'll look at is the SimpleChat example that is given to you when you install SFS Pro.
Go to the installation path of SFS and find the "Examples" folder. In that folder, choose either "AS2" or "AS3" as your programming language. I'm using AS2. Now choose the "SimpleChat" folder and open up the SimpleChat.fla file in Flash.

You can see that everything is done and ready for you. All you need to do is turn on the server. To do this, go to your SFS folder, and choose "server.bat". This is the program that you run to turn on your server. 































Once its loaded, you can test the chat. Congrats! You're done! If you wish to furthermore change options and functions of the chat or other example just take a look at the forums of the SmartFoxServer.com website and there are plenty of tutorials for you to check out! Thanks for viewing this tutorial!

1 comment:

  1. Can you give an example about implementation smartfox to the game?
    i mean when the room master start the button, then every user in same room will start the game too..

    thx..

    ReplyDelete