The Facebook Platform has created a whole new market for online games and start ups such as the Social Games Network (SGN) and Zynga. I wrote about developing Facebook Applications a while ago as a overview of my experiences. Some of my apps are games and some are not – I’m a game developer so I prefer making games.
While going through my blog traffic data, I saw search terms specifically about developing games on Facebook. That leads me to believe that someone is looking for information about that. I have some of that knowledge to share!
I generally make games for Facebook using Flash and ActionScript. There really isn’t a good way to make really interactive games using web languages and Flash is fairly powerful for 2D casual game experiences. You can find a list of the Facebook games that I’ve made or had a hand in from my developing Facebook Applications article.
There are basically three real games on that list: FlipCup Challenge, Sam’s Solitaire, and Sheep Tycoon. Sheep Tycoon is by far the prettiest because there was a real artist on that project – the other two I just slapped some art together to get the game out quickly. I’m not really an artist.
Using Facebook API From Flash
Figuring out how to best make calls to the Facebook API from Flash was one of the first things we had to deal with. In Sheep Tycoon, the high score table shows up in the Flash part of the game opposed to FlipCup or Sam’s Solitaire where I just did it in PHP. There are a whole bunch of Flash Facebook API’s – I didn’t like any of them.
The solution we came up with is to make a 0×0 iframe – basically invisible – on the canvas page and load a PHP script that would do all the Facebook API calls. So, if we needed to add a new high score to our database, we would load the script in the invisible iframe. This works for sending notifications or doing any sort of Facebook API call.
Getting the Friends
Although I didn’t find doing this all that complicated, I did see a search term for it in my traffic data. The easiest way to accomplish this is to just get the user’s friend ID’s in PHP and then passing it into the game using flashvars. I don’t see many cases where the user’s friend list will change while the game is being played. Once you have the friend ID’s in the game you can do whatever you want with it. We used it to show the list of your friend’s high scores in Sheep Tycoon.
The game takes the friend ID’s from flashvars. When we need to get the high scores, we pass the same ID’s to our PHP script that does all the database work and then returns the data in XML form for Flash to read.
Dealing with High Scores
You can display the high scores inside the game or you can display as a PHP page. I will generally opt to do the latter because there are less steps involved. PHP will get the data and display the data while Flash has to call a PHP script to get the data and then display it. However, displaying the high scores as part of the game itself is a better experience.
The semi-tricky aspects with high scores is how to record them and assign global ranks to each player. I’ve used time as a tie-breaker for scores that are identical. If you got the score first, you will stay above the person who got the score second. MySQL has been our database of choice and you can use ORDER BY with more than one field so it would be: ORDER BY score, time.
In FlipCup Challenge, each user has a global rank that is determined by their high score. This rank changes as players get new high scores. Updating everyone’s global rank every time someone managed to get a new high score didn’t seem like a good idea.
Firstly, to calculate the global rank, I figured out the number of rows that had a score higher than the score we are looking to get a new rank for. With that information, we’ll know that the rank will be something lower than the row count. We then find all the scores that are the same as the score we are using and then determine where it fits in there. With those two pieces of information we can calculate the right rank.
In order to make sure the scores are correct when anyone goes to look at the Scoreboard in FlipCup, we also update the ranks of all your friends when your rank changes. Global ranks are also recalculated every time you view the Scoreboard page. This will ensure that all the global ranks will be correct when someone is viewing it.
I’m sure there are better ways for determining global ranks than this but, for FlipCup’s purposes, it works fine. The main objective was to make sure the pages loaded fast so the code had to do the work quickly.
Experiment
Game development on Facebook is still in infancy. I’m not aware of many sites dedicated to providing information about games and Facebook. The games themselves are still rather primitive as most don’t really tap into the potential of social networks. I believe social networks are a powerful tool that can help spread new games and game ideas.
I have not looked much into development on the “new” Facebook even though I have switched to it and my links above point to the new Facebook. My apps are still working fine so I am not too concerned. The marketing and growth of apps are going to be affected. The chance of a Zombies-esque app proliferating is very unlikely in this new environment.
I will continue to create games for Facebook and other social networks. There are some ideas I have floating around – some of which I am working on. Experimenting with different ideas is the best any of us can do as this is a new road to travel.
Tips For Developing Facebook Games
Free Gardening Tips
Gardening Tip #1: If you want to save on time, start jotting down your gardening plan on a piece of paper. Keep the plan in front and call a friend to discuss the whole matter. A second opinion helps. You have to ensure its appearance and calculate the distance of the hose from it. Also if there are any sprinklers needed. This is over and above other points you may think of.
Gardening Tip #2: The way you have prepared your soil can decide whether you succeed in your gardening efforts. Remember that different plants need different types of soil. If your garden is planned to be vegetarian or herbal, make sure to use only organic fertilizers if you want the natural flavor of the food to remain. Try to replace ordinary fertilizers with good compost or even wooden chip mulch.
You might think that having a backyard compost heap something of an impossibility but it will be worth its weight in gold once it starts providing you with the goods. While fresh home brew compost is full of nutrients for the herb and vegetable garden, sometimes it proves to be slightly unrealistic. Though mulch is a good alternative to home compost mixture, ensure that you use redwood or pine as it breaks faster. Whether you use mulch, compost or fertilizer, you must mix them well.
Gardening Tip #3: Once the soil is ready, instead of planting the plants, simply lay them on the top of the soil, to have a final look at what your garden would look like, in case you want to make any last minute changes. I firmly believe it is wise to plant plants together that have similar characteristics. For instance, all plants which have similar radius should be planted close to each other. All tall plants at the back and shorter plants in the front make a lot of sense.
Gardening Tip #4: You must water your garden regularly. Keeping a well-maintained garden is hard labor, especially if your house is very big. An automatic watering system is best since it works on its own. Your automatic watering system can start from a huge sprinkling system to a small timer which is attached to the hose. Gardening is a rewarding hobby, which not only provides shade, beauty and sometimes food also! Find more interesting tips in [http://free-gardening-tips.blogspot.com].
Free Web Traffic – Google Blog Search To Increase Web Traffic
Sure, you can get your blog listed and exposed at Technorati, Sphere or DMOZ, to name a few. But your blog doesn’t get the maximum exposure. You must get at least 21,000 people to find your blog at once for free! Here’s how.
As of December 28, 2006, Google Blog Search is used by 0.0025% of US Internet users, and this number keeps rising (weblogs.hitwise.com/leeann-prescott/2006/12/google_blog_search_surpasses_t.html). It surpasses Technorati which is used by 0.0023% of US Internet users. The population of US Internet users itself is 232,057,067 as of January 11, 2007 (www.internetworldstats.com/stats2.htm). Translated into number, Google Blog Search is used by 5,801 US Internet users.
While this statistic only counts US Internet usage, if we can assume that it holds true for the world Internet usage which is 861,472,625 users (www.internetworldstats.com/stats2.htm), Google Blog Search is used by 21,537 Internet users! Imagine how many people can find your blog using Google Blog Search.
This is very good news for bloggers and small business market that blogs are in the rage now. Aggregators are getting more powerful and more usable, and the number of people bookmarking their favorite sites and topics via readers is growing. The growth of blog-specific search sites like Technorati and Sphere shows that people not only want to read blogs, they quite often want to look for specific topics on them. Google’s introduction of a blog search engine will help triggering the other engines to offer similar features and will help boosting the growth of blog readership.
As Google puts it, “Blog Search is Google search technology focused on blogs. Google is a strong believer in the self-publishing phenomenon represented by blogging, and we hope Blog Search will help our users to explore the blogging universe more effectively, and perhaps inspire many to join the revolution themselves. Whether you’re looking for Harry Potter reviews, political commentary, summer salad recipes or anything else, Blog Search enables you to find out what people are saying on any subject of your choice.”
How to find Google Blog Search:
blogsearch.google.com, search.blogger.com, The Blogger Dashboard, Or from the navigation bar on any Blogspot blog
How to get your blog listed:
If your blog publishes a site feed and automatically pings an updating service, it will be found and listed by Google Blog Search. You can manually ping Google Blog Search at blogsearch.google.com/ping. However this is a one time notification service so every time your blog changes you must submit your blog again.
So get your blog listed in Google Blog Search to get free web traffic!