Friday, 30 November 2007

Will Web 2.0 kill Web 1.0?

I have come across the opinion that Web 2.0 might eventually kill off the older Web 1.0 web sites in the long run. This is an interesting point of view, I think, that I would like to explore a little of.

  • What is Web 2.0?

In this context, I am using Web 2.0 to talk about social networking web sites that provide an API for third party expansion. For example, Facebook would fall into this category. So the question I am really trying to tackle here is the question of whether Facebook will kill off older and more established web sites.

  • Social networking vs chat

Chat programs have existed practically forever on the web. Whether in the form of IRC (Internet Relay Chat), IM (Instant Messaging) or similar, they exist for people to exchange short message quickly with friends and sometimes strangers. Chatrooms are generally full of lurking weirdos hiding behind their anonomity and net speak, but real genuine people can be found there too, so it's not always a total waste of time to drop in one. IM programs are more like SMS on mobile phones but do let you search for other members.

This is all similar to social networking sites, however, your anonimity has been removed so when you message somebody, they know it is you. This is generally a good thing. Since joining Facebook, my own communication has often occured through the site and not via email or IM with people that would have otherwise been. So while I don't think that social networking sites will kill off chat and IM (esp as IM has in-company coporate benefits), I think that they will decline.

  • Social networking vs dating sites

Dating sites let you communicate with and hopefully meet new people by seaching for them or by providing a closest match results list. This generally works and if you have a good photo, a well written profile and are friendly then the whole dating site thing can be fun and people you meet online might end up being friends (or better) in real life. However, the big downside (and this is really big) is that they often want to charge you for the service.

Contrast and compare that with social networking sites, where you can view friends of friends profiles, see people by network and interest group, or search for people by some other arbitrary measure that you decide on. You can then message those people and get your flirt on. Thats really what all the poking is about that is going on in these social networking web sites. People flirting with each other. It wouldnt surprise me if people start to meet, date and even get married because of this. So dating web sites have a lot to worry about!

  • Social networking vs marketplaces

You can buy and sell items through social networking sites. I'm not sure how big this will grow or how successful it really is at the moment, I don't think eBay (or Craigslist if you are in America) has much to worry about on this aspect but you never know...

  • Conclusion

Web 2.0 will make significant inroads at the expense of Web 1.0 sites and services, but like the television didn't kill the radio, they will continue to coexist. Some web 1.0 sites which exist by deriving revenue (such as dating sites) will have to adjust their models or die in the long run.

How popular is Facebook?

A quick example to show how popular Facebook is was what happened to a friend who administers a network in a data company. He banned Facebook and within half an hour there was such an outcry amongst the staff (one girl even complained that she couldn't network with her clients without the site!) that he had to unban it.

Thursday, 22 November 2007

The Importance of building a Data Driven Engine

During the design phase of an application, game or project very strong consideration should be given to building a data driven engine. Essentially, it is an engine where some or all of the data that it uses is external to it, perhaps in configuration files, XML files or a database.
What follows is a brief look at why developing such a thing is a really good idea.


  • No compiling...

When you make changes to the data, you do not need to compile them into the engine. The opposite of this is where data is "hard coded" into the engine, so changes to the data, even small changes, require the whole engine to be recompiled. This is extremely unefficient and time consuming and so should be avoided.

  • Flexible...

Within the framework of the engine, this will prove to be a highly flexible approach. By and large because it is much easier to change the data that the engine uses than to implement code within the engine, it helps with iterative testing, e.g. for establishing balancing rules within a game.

  • My own experience...

My own experience with hobbiest games development (generally I don't build games professionally, instead it is applications, web sites and utilities on a day to day basis) has taught me a lot about what one lone developer can achieve. Having a fantastic vision doesn't mean it can be translated into reality, but having a data driven engine will help massively. I could not have build Necrotech on my own a few years ago without this approach.

  • Vs Design patterns...

Im also relearning this very lesson with my latest project Dungeon Creep. It is an RPG based on the principles of procedural content generation and is in its early stages. It can build dungeon layouts and the player can walk around them. This is in Macromedia Flash, by the way.
I'm currently working on the inventory system which works in a similar way to Diablo and Two Worlds in that the items are also randomly generated. For example, a knife and a heavy knife share the base stats of a knife but the heavy knife weighs more, is slower and inflicts more damage when it hits.
I implemented this originally using a polymorphic design pattern which was fine. The basic idea is that items can have modifiers stacked on them (in the above example, "heavy" is such a modifier) with some rules controlling which modifiers can be stacked on what (e.g. you will not get a "Sharp" Staff). This worked very well and made it easy to add lots of modifiers and was even flexible enough for me to expand it into materials (e.g. a Steel Sword, where Steel is a special type of modifier). However, now I have about twenty of these in the item engine, it is starting to become hard to manage.

Moving this out to a data driven approach that loads them from XML files makes it much easier to get an overall view on the whole data set. I had to write some loader and conversion code to get this working but now I'm back in control of what is going on. So design patterns are extremely useful but should be used in conjunction with a data driven engine and not as a replacement.

  • It could mean life or death...

...for the project you're working on. Essentially, it can be the difference between completing a project and not, especially if it is a large or ambitious project, or the team building it is very small. Take every advantage you can to minimise the time involved in creating the project and also the stress.


  • Performance could suffer

Anything that isn't hardcoded directly into the game engine code itself will not perform as well. However, this performance disadvantage can normally be removed by simlpy reading the external data into internal data structures as part of the main engine initialisation process. So it isn't as big a deal as you might expect.

Friday, 16 November 2007

Mind AI

Artifical intelligence has been on my mind recently (I'm creating a Flash based RPG in my spare time) and I have been reading an excellent blog (Game AI For Developers) about different aspects of it that I have not come across before. Previously, my AI programming has been limited to finite state machines, pathing problems and line of sight issues. My post on recursive thinking the other day triggered an interesting discussion about how many developers struggle with the concept of recursion and how it can be represented simlpy using a ladder diagram (thanks to Zeroth for his example in the comments there, which is useful for anybody else like me who isn't familiar with the term). Building on this, I have an idea to represent a "mind " in code, using this and another technique which I will discuss below. I find it to be sufficiently plausible enough to work and I think the idea is good enough to share, in case I don't get the time to implement this in any of my own projects.

The basic idea is to simulate how babies see the world and learn from it. When each of us are born, we have a relatively clean slate* in terms of what we know. How does it gather, and represent information as concepts so that it can understand the world it is in? Let's take the example of baby's experience with a teddy bear. The baby likes the teddy bear because it feels soft when it touches it. Softness, we could say, provides pleasure through its sensory interaction with the baby. What we have in this example is a string of information here, starting at the teddy bear and eventually mapping to the feeling of pleasure, something like this...

Teddy Bear -> Soft -> Pleasure

So eventually, the conceptual mappings lead to a pleasurable experience of touchign a teddy bear because of its softness. This will then become a memory that informs the baby's decision making in future. The baby will have learned that the teddy bear is a nice thing to touch and will touch it in future to experience a form of mild pleasure or comfort. In technical terms, pleasure becomes a base node that many concepts will map to that the baby experiences. I suggest using fear as another one, because negative pleasure could be stated as pain and the survival instinct will therefore map to a fear emotion.

Mapping information in this way provides symantics, i.e. actual meaning to base data, and even (to some extent) a limited context for understanding a single piece of information. By exploring the mappings (through a recursive function, of course, as you may have to go through an unknown number of levels), the information can be put back together. It could even be how the storage mechanism should work too - when the baby encounters something new, a fuzzy logic routine probably runs to categorise what this new thing is like in order to have some understanding of it.

Such a system as this is highly efficient in terms of storage (the concept of softness can be shared by any number of other concepts) and probably closely resembles the game of association that our own brains make. You can become aware of this when a certain sound, smell or place can suddenly trigger a memory. Also, this design idea would map into an Object Oriented system quite easily.

*Relatively because we all have our preprogrammed DNA that affects how we interpret our sensory information.

Wednesday, 14 November 2007

Improving Firefox

I recently went on a bit of a quest to speed up Firefox, as I wasn't happy with its rendering times on my (admittedly dated) iBook at home and my (fairly decent dual core) PC at work. I love Firefox, it's my favourite browser whatever OS I'm on it, but compared to say Safari it does feel a little sluggish in its default configuration, so I did a bit of hunting around to find ways to improve the speed of the old fox.

So what follows are the steps I've taken that have given a very nice speed-boost to Firefox, as well as improve its already good security model.

  • Use a ramdisk

Now this will be a controversial point as many people will contend that putting your web cache on to a ramdisk won't give any real speed improvements because the biggest bottleneck to render web pages is the net connection. While it is true that the net connection itself is a huge bottle neck, followed by the cpu rendering time, once you have the data from the interweb it will be saved somewhere. Retrieving from that cache is much quicker when it resides in physical ram and not on the hard disk. I would recommend trying it. You might be surprised at the extra snappiness you will get from the browser by doing this.

Ramdisks have their negative side, however. On rebooting, your cache will not be saved, meaning your browser will re-download from the web again. This is fine by me though, as I do not want other people to root around my web cache, dislike cookies and don't have the browser save my passwords - so there are security benefits to this too. As an aside, I do have firefox also clear private data when the browser is closed, something else I would recommend.

  • Get Fasterfox

Fasterfox is a performance and networking tweak add-on for firefox that is available here. It will make a few changes to firefox and also contains a turbo mode, which will try and pre-fetch static pages for you into your cache ready for when you want to visit them. This makes quite a big difference to browsing with firefox.

  • Flashblock

This nifty little add-on will block flash by default and instead show you a little play icon. Clicking this will play the flash movie. This is very useful for preventing useless flash banner adverts from loading. It also has settings so you can "white list" websites for flash files that you really do want to see. This will speed up your browsing by not downloading ads that you do not wish to see.

  • Adblock

Similar to the above, but for traditional banner ads, this will remove them from web pages so you are not downloading them unnecessarily. Also similar to above there is a white list, but also a black list, so you can use generic filters to block ads from servers whatever ad they try and send you.

  • Final Tweaks

Lastly, follow the instructions here to further tweak the browser.

Tuesday, 13 November 2007

Recursive Thinking

I have just woken from a dream where recursion played a part in what happened. In my dream I was in my bedroom and on the phone to a friend, but with two other friends beside me. When one of the friends near me started to sing a Metallica song the other one started to do some of the drumming to the song and my friend on the phone heard this and joined in. It was quite a funny thing. Then I wake from that dream - but I am still asleep in reality, but do not know this - and I'm walking up a hill with one of the friends from my dream, explaining to him about this dream I have had and how funny it was that he could hear the craziness on the other end of the phone and had joined in.

A dream within a dream, a window to another conscious reality constructed by the brain, a dimension within a dimension - recursion. This is not the first time I have experienced a dream of this type but it is pretty unusual and provides an insight into how our minds may actually work.

I was reading recently in New Scientist that recursive awareness may be what separates man from beast. Recursion in thought explains our ability to put ourselves in the position of others (often known as empathy) and understand their point of view on another situation as well as our own. Often at the same time as our own point of view. In fact, we can simultaneously hold our own point of view and view it as others may do and this can affect how we behave. For example, we may not wish to say what we really think as others around us may be offended, even though our point of view is perfectly valid and logical. This, the argument goes, is a uniquely human proposition.

Recursion occurs in daily life too, through the use of grammar. For example, the idea that I'm looking at you, who is looking at me is a recursive statement. It could go further (indeed forever): I'm looking at you, who is looking at me, who is looking at you, who is looking at me... and yet the meaning is clear. Our brains can decipher such complex statements with ease. Another example of it occurring within language is "she said this about her mother who knows that your father is an alcoholic." We really have no problem understanding such a complex piece of information because of our ability to handle recursive concepts in our heads. Maybe it is the secret to intelligence in the brain; that if you can represent a piece of information through recursion you will have a very powerful information processing tool. I will think on this some more as it is entirely relevant to my day to day activities as a developer.

Food for thought. Food for recursive thought.

Friday, 2 November 2007

Facebook data goldmine

What will the future hold for Facebook? Will it stuff itself full of ads to milk its position as number one social networking site? It's highly likely...

There's no question Facebook is sitting on a data goldmine, with an exhaustive amount of information on people's preferences, backgrounds, and social histories--all given voluntarily by members. Facebook has profiles that include people's favorite music, television shows, books, and hobbies; their job history, education, birth date, and marital status; as well as daily activities, social networks, and interest groups. Traditional ad networks would kill for all that information in one place.

Taken from: Can Facebook feed its ad brains?

My take on this is that they probably will have a bash, get it wrong and get taken over by either Microsoft, Google or Yahoo all of which have people with the right expertise and the tech to pull this off. At which point the largest social networking website will have started haemorrhaging users to whatever alternative / new social networking site appears, or to the next "big thing". Facebook will make vast profits for a while but in five years we will be saying, are you on Facebook? No, me neither. It was the viagra ads that killed it. And the hackers. And the identity thefts.

So while I'm predicting doom and gloom in the long term for Facebook, in the short term a lot of people are going to get very, very rich.