Friday, 7 October 2011

MVC Architecture and Single Page Interfaces

It seems I always come back to this blog after taking a break. I’m going to try keep this up to date as I begin in finalising my design, the coding of the system and then the implementation into the real-world environment.

The Problem
The project I’ve taken work of is the web game system. It runs similar to a board game but all from a single interface. This interface makes calls through Javascript (JQuery in this case) to backend PHP files which do the work and connect to the database.

This sounds fine, however over time the code has expanded with no organisation, comments or any kind of documentation. Things are half implemented with variables cluttering up the code all over the place.

Coming from a Java background I like things to be in neat ordered classes which can be extended when required. One of the problems with this is that websites and the programming of websites don’t work like this.

When a class is instantiated in java it is created in the virtual memory and so long as it stays in scope it exists. Web programming to my current knowledge is different, especially with PHP, as the class is instantiated on the server to do a purpose and then goes out of scope.

The Solution
My plan is to strip out everything from the game to and create a framework that all future code can be built off.

Normal MVC however would not work with this due to the fact the game is a single page interface whereas normally each normally indicates a new page. In my variation I am planning to make it so that views are called via AJAX calls from the main interface to do any processing required.

Very little actually is done through the interface except the viewing the of current state of the board (in this case a map) and then requests being sent to the database which update values, such as moving a unit or requesting an alliance with a player.

In a more visual method the MVC architecture looks like the following as standard:

Note: The solid lines represent a direct association and the dashed lines represent an indirect association through an observer pattern for example.

This is how my interpretation of the system will work. It's a little different but not much so. It's different enough so that I'm not using a pre built MVC architecture and instead I'm going to use the ideas of it instead since the bootstrap is going to effectively be my interface. This is how my MVC-SPI should look:

The interfaces will be updated directly from the views however all calls will go through the game interface (the core index) which will route them and update the correct sub-section. This should allow for extensible code while still allowing for the game to run as it currently does.

Monday, 11 July 2011

World Shattering

Okay so it’s been a long time since I’ve written a blog mainly due to the fact I’ve not had much to write about. Regardless of this while writing up some game design ideas I had I’ve found a topic to write about!
This topic as the world so subtlety suggests is to do with the shattering of worlds or in the case of this blog, the seemingly primal urge of most gamers to try break the world of the game they’re playing, sandbox or not.
It seems to me that anytime myself or almost every gamer I know gets in contact with a new game, the first thing we do are test the limits of its reality. Is this a case of us wanting to re-assure ourselves that it is really a game for the time that games and reality are impossible to determine?
Unlikely, but I think the real cause is that the majority gamers judge the quality of a game based on the quality of its graphics and its reality. Give the majority of modern gamers; referring here to those who grew up in the late PlayStation 2 or early Xbox 360 era, a game from the 90s or even some modern indie games and they’ll look at you as though you’re crazy, as the visual fidelity does not match what they consider the sign of a good game.
Another reason I think the reality of a game is key is due to the fact many gamers want to see the cause and effect of their actions to give weight to a choice they have chosen or an action they have performed.
An example of this for me would be the changing world of a Grand Theft Auto game to either show the passing of time in years, or the opening of new areas much like the mansion in Vice City.
This example being a sandbox game however is also reflected in games that are not in essence sandbox games, games such as Resident Evil. The formula of Resident Evil is probably farthest you could get from the sandbox of GTA; however the quality of the gameplay is hindered by the non-obvious obstructions in the original incarnations of these games.
The modern Resident Evil’s while keeping a similar formula show this cause and effect allowing the player to “know” and comprehend the reason for not being able to go backwards whether that be a security door locking due to the zombie infestation rather than an invisible barrier to stop inquisitive players.
Anyways to get to the point I think that the quality of a games reality relates to the fact players want to break the world to see if it reacts to their actions. It’s similar to a child poking a cat because it’s not doing anything, it’s not because they want it to break, it’s because they want it to respond.

Saturday, 22 January 2011

The Problem With Loss in Games and the Death of Fear

Most games do not try to cause the player to experience loss or overwhelming odds (although they create the effect of this). There are of course exceptions to this rule such as EVE-Online but the majority of game designers seem to believe that their player base would not be interested in such an experience.
                I agree that a game where you are killed continually and cannot progress is not a particularly interesting one but the effect that the fear of loss causes is food for thought. Fear in games is fascinating because players don't tend to experience it very often. It's very hard to be bored into a game if you're so close to failure yet the general consensus is that gamers will quit if they find it too hard and get frustrated.

                There are of course cases of games that use this successfully and one of these I have mentioned already is EVE-Online. This game uses real loss to reinforce its ethic of "life's not fair so why should Eve be any different".
                For those of you that have not played Eve it is a MMORPG set in space where the player has free-reign to create whatever legacy they find engaging, it has a full player-driven market system and a huge ever changing political landscape. Eve does of course have its downsides. Most of which come from its steep learning curve and unforgiving game design.
                EVE-Online takes the stance that it's players should be playing the game to engage in something more than mindless grind. Players do not advance by levelling or killing they grow by learning new skills and there are no restrictions on what a player can do apart from time. The other bonus of this is your character can train skills while you are offline making the game largely un-rewarding for people who just wish to progress their character. People that wish to progress their fortunes, stature or reputation will find Eve most rewarding since this is what the game excels at.

                Back to my original point, EVE-Online uses its game design mechanics to drive its economy and social landscape. This extends to the point that almost everything is created by players. Ships, modules (items), ammo, rigs (ship customisations) and implants (attribute or skill upgrades) are all created or pieced together by players.
                The key point that drives all this is that if your ship is destroyed and you are killed then everything that you had on your ships is gone. You are resurrected due to newfangled cloning technology and may lose skills if it's not up to date (a service that you pay for) yet the ship you had and the modules you had equipped are destroyed forever. Items in your cargo can be stolen by your enemies and your ship can be salvaged for parts (used to create rigs: See above).
                This causes the effect I mentioned earlier that you continually fear for your loss and hence will not risk an expensive ship for a cause you do not seem worth it. If you spend 6 weeks generating the money through mission running, trading and other in game methods to buy an expensive Battleship, then you will not go and throw it away at some random stranger (even though you can if you wish).
                If you lose a ship then you can indeed just go buy another ship of the same type and fit it exactly the same way but it is not the same ship. You still lost something physical that took you time to get. As you go up the triangle of value (from frigates up until titans) the fear of loss gets greater yet this is all relative to cost you paid which is varied by the economy that is driven by supply and demand.
                The other-end of the spectrum is something such as World of Warcraft or other similar play systems.  The game babies the gamer so they don't experience any real loss. When a player dies in World of Warcraft they have a run back to their corpse and the only other thing they have to deal with is a slight reduction in the quality of their gear. This is a small cost for the death yet only at a high level can this cause a slight hassle when raiding and death is likely.
                This causes more annoyance than loss and as a player you know that you will not lose any of your gear. This means that player fear is almost null, the only thing that most players will actually fear is their guild mates or friends looking down on them for their dying. This is not a game mechanic and is an effect of peer pressure from other players.
                It's quite strange how this has come about since World of Warcraft's predecessor is Dungeons and Dragons (as are most RPG dice-roll based games) and original DnD was notoriously difficult to survive a dungeon crawl. As the revisions went on it eventually got easier but still rather difficult at a base level.
                So why I hear you shout, did Blizzard decide to forgo this difficulty curve in World of Warcraft? It's quite simple from my point of view (as a gamer). The reason is that they wanted the game to be accessible to casual gamers and people that may not have been interested in a "true" role-playing experience.
                This would explain Blizzard's monstrous 11 Million player base but as their rate of adoption is so high then I'm sure their subscription losses are also high.
                Earlier I commented on fear being able to be used to drive the game play forward in a title. This has been seen in modern titles such as Left 4 Dead which uses fear to drive the players towards the conclusion of the chapter. Left 4 Dead also uses loss as a minor mechanic since when a player dies they are gone until the other players get to such a point where they can revive them.
                I think that modern games should use mechanics such as fear, loss and frustration to drive game play forwards and create a more engaging experience for the player. These mechanics must be twinned with intelligent and interactive game design so a player must not get so annoyed at the game or so disheartened that they quit.
                Games that use these mechanics well are games like Ninja Gaiden which uses a steep difficulty curve to drive the player onwards. Trackmania also uses frustration to drive game play. Players will spend hour’s shavings milliseconds off of a time just to drop it at the last corner the reason is they will always feel like they're progressing within the game.

                I should probably mention here that I'm a long time player of both games and I enjoy them both for different reasons but I personally think that the design ethic and design decisions of Eve-Online outstrips World of Warcraft on a variety of level. The reason that this article has a heavy focus upon Eve is that many gamers have not played or heard of it and i believed that it deserved a description to get my point across. Also the heavy focus is that way because almost all pc gamers have at sometime experienced World of Warcraft and its mechanics in one way or another.
                In conclusion I believe that more gamers should see the benefits in apparent "un-fun" aspects of game play such as fear, loss and frustration within the mechanics. Modern thinking would disagree with me due to the marketing and success of casual games that show no hint of these such as World of Warcraft and Counter Strike.
                So does that mean the game play mechanic of loss is a dud and not marketable? Possibly But let me leave you with this. The loss mechanic may not all be lost since EVE-Online has been growing at a rapid rate of adoption since its release and is still growing. Maybe the future for games that create fear, make the player feel loss and maybe even frustrates the player to the point of them becoming determined is not so dull.