Thursday, 31 December 2009

Database

One of the biggest challenges for me while working on this game has been developing a working database that is able to communicate with the game and vice versa.

The database we are using is mySQL driven and as such cannot interact with flash directly, however it has been possible to transfer information between the database and the game via php scripts.

The first thing we do in this process is to send the information, we want the database to recieve, from flash to the php script. In this example I will use the coin system, so flash will be sending the users unique id and the amount of money earned to the php.

The code we use is as follows:

_root.addCoin = function() {
coinbag = new LoadVars();
coinbag.user_id = userID;
coinbag.amount = coinIncrease;


replyCoinbag = new LoadVars();
replyCoinbag.onLoad = openCoinbag;

coinbag.sendAndLoad("http://www.academy.artdesignhull.ac.uk/coinIncrease.php",replyCoinbag,"post");
};
function openCoinbag(success) {
if (success) {
_root.currencyFigure.text = "$"+this.currencyFigure;
}
}

This script creates the function "addCoin" which can be called at any point in time, this exact script will also work for the shop to reduce the coin as a negative number can be used with no errors.

Now the two figures sent to the php come into play:

coinbag.user_id = userID;
coinbag.amount = coinIncrease;
:
The PHP script that controls how these figures are used is:

< ? php
include('db-connect.php');
$result = mysql_query("UPDATE `users` SET `currency`=`currency`+".$_POST['amount']." WHERE `user_id`=".$_POST['user_id'], $conn);
echo mysql_error($conn);
if ($result) {
$a = mysql_query("SELECT * FROM `users` WHERE `user_id`=".$_POST['user_id'], $conn);
if ($a) {
$details = mysql_fetch_array($a, MYSQL_ASSOC);
echo("result=");
$id = $details['user_id'];
$userLoggedIn = $details['displayname'];
$currencyFigure = number_format($details['currency'], 0, '.', ',');
echo("ok&user_id=$id&user_name=$userLoggedIn¤cyFigure=$currencyFigure");
} else {
echo mysql_error($conn);
}

} else {
mysql_error($conn);
}
?>"

This script adds both figures to the database and then checks the users info in the database before sending back all the figures to flash. Before sending the currency figure back it converts it from a regular number such as 28574 to 28,574.

Once it has been sent the final lines of the flash function come into play:

function openCoinbag(success) {
if (success) {
_root.currencyFigure.text = "$"+this.currencyFigure;
}
}

This takes the new currency figure and adding a $ to the start of it, applies it to the currency text box.

This is one of the more simple functions of the database and while there is a leveling / stat system almost complete there are still some bugs with it.

Sunday, 27 December 2009

Help me!




As the game has become quite advanced and detailed, I have added a help button and explanation of what's going on for every screen. I think it makes a real difference, without cluttering up the screen or affecting performance. We have also added a character of lady gaga to the help screens and many other parts of the game to emphasize her role in the academy and root the project in the criteria of the brief.
Character design was originally going to be handled by Matt with help from a friend to develop a style and his drawing skills. However they had let us down and left one of the most important parts of the project empty and so John stepped in to create a Lady Gaga char. I then added a cartoony outline in flash and altered the alpha levels to match the game's visual style, while keeping it slightly more detailed so she stands out. We also redeveloped the customisable character for the same reasons.
John has also been busy creating detailed environments for many areas of the game such as the arcade and classrooms which massively improve the visual range of the game and I think make it feel much bigger.
Calum has converted the music to MP3 so Matt can use it with the banner media player and has started on a new track.

Tuesday, 15 December 2009

New Banner


While I was happy with the information on the banner, when put next to the other vibrant and varied content it looks quite plain. I have therefore redesigned it, making it slightly taller as we can fit in more detail and as the user will have had to scroll anyway, I don't think it will change their experience.
I took the visuals from the Career screen which I think are some of our strongest imagery and shrunk them into place, converting the clock icon into the sun. The banknote is now a bit prettier and there is a simple title of the game as well as a space for the user ID. I have completely redone the XP bar and I think its much more streamlined and suits the rest of the interface.
All of the info is arranged along a horizontal line and are cushioned to the pixel so that each text box can fill and the page will look balanced.
The moving icons have stayed as I think they still work really well and I've added the spinning gothic flower from some of the game buttons, some randomly generating sparkles and a fade/wipe glow on the title.

Its really just a case of tidying things up for three weeks now, with a list of loose ends for me and John, database work and 2 minigames to polish for Matt and sound effects and music on the way from Calum.

GO TEAM

Tuesday, 8 December 2009

Linx

I have uploaded the latest versions of everything for the meeting tomorrow; the last meeting before the Christmas break. Having this extra web space is great as I'm not having to worry about running out of space.
I have added links from the campus and career screens to open the 4 minigames we have so far in new tabs. When completed, there is a 'finish' button on the score screen which will close the tab and could add code to upload the score variable to the player's stats. This tab system means that the player will return to their last location within the complex menu structure we are developing, which would otherwise be quite fiddly to implement.
Apart from the cursor, which we think can be added by php over the two swfs, we have completed everything agreed with Jay in the last tutorial and I think we're getting there! All of the bits and pieces left to do on the current content are small finishing features and we really just need more games and the media player.
Character design Matt is working on will also help to theme the game more significantly around Lady Gaga, while her music and visual style recurs throughout the interface and fashion.

Mall Development


I have edited the 40 items I created earlier in Flash into two sizes and added them to the mall shopping screens. Through a fiddly bit of keyframe spamming, the user can now navigate through pages of items and select any from the smaller slots to view at a larger size. They will also see the items cost and statistics, which I have balanced to make each set varied and fair.

Character Customisation



Two days hard work and we now have a character customisation screen within the Pad swf. We decided upon 5 main areas to alter in this demo as competitors such as Vampire Wars have a similar range. Details such as individual watches and earrings might be unnecessary and impractical with this type of game and could instead be incorporated into entire purchasable outfits.
As it is, the user can access the customisation menu in the bedroom of the pad, choosing from 5 boxes of icons for skin tone, hair, top, pants (Americanism), and shoes. A total of 40 options grants a wide range of possibilities even at this early stage and should make the character and gaming experience feel more unique. John coloured and edited the images for me and created the great bedroom background.
I have also refined the wallpaper and carpet menus to make them far more effective and tie in with the theme of the interface, as well as enhance the other visuals of the pad.
All the latest has been uploaded to our specific Uni domain and the website structure and style has been developed slightly.

Sunday, 6 December 2009

MOAR TWEENZZ!!!11!



After a tutorial with Jay we identified areas to refine in the interface and games so far. I have worked backwards into the many save files I've made for the main campus and created smooth tweens between the different buildings and refined the interface throughout with help from John for the visuals.
The boat and car games both now have a tutorial screen and have been developed to be more challenging and look better. Damage is now active on the car and upon collision with other traffic, the damage stat will drop from 100, changing a visual on the car every 20%.
With the pace of the progress on all of the games, we may not have as many as we had hoped, but unlike our last group project, 100% of what we make will be visible for the user.