Tuesday, June 8, 2010

GameSalad: Merging Levels and Quirky Nuances to Remember

Well, things are moving smoothly enough in the final stage of building "Bucky's Challenge", our multi-level sports game and first-time app building experience. Our journey began nearly six months ago, taking twists and turns along the way. Ultimately, we are nearing the end using GameSalad to reach our goal.

In the last blog entry I shared the team's surprise and frustration at learning that GameSalad doesn't encourage merging projects because of the original Actor IDs generated specifically for each project that cannot be transferred over into a new project. This is an important fact because it means that each level built in a different project was rebuilt from scratch inside the new Merged Project Folder.

In the process of merging we have encountered some other issues worth mentioning here. First and foremost, we have chosen NOT to update GameSalad to the newest released version. We have found in the past that attributes lose their settings in the process of updating and we must go into the settings and reset them, by first finding those that reset. One example comes to mind, Image settings seem to get dropped. Gravity or density seem to be affected. We can not say that such things are happening with the latest version because we aren't updating to find out. I believe that as a general rule it's wise not to update during a project build, unless the new version positively addresses a major function of your game.

We have discovered as well that the random spawner rule isn't all that random. For instance the game chooses a number at random initially when the game or level starts, but it sticks with that number consistently so that the spawned object has the same time and space between each spawned object.

However, the most challenging issue we have dealt with has been starting over a level when a person loses and wants to replay that level. The player would lose the level and be redirected back to the game menu. All well and good so far.
The problem was encountered when the player tried to restart their level and the game would take them straight to a win or lose screen. We discovered this happened because scores and lives weren't being reset when the level would start over. HINT: A saving level rule becomes very important here.

As a solution, we created a global (game) attribute integer called "level" set at 0. In addition, we inserted within each level's game controller actor a:
  • Change Attribute Rule that changed the integer level to whatever number that level was. Example: Bucky Basketball Level 3 - we would change that integer to 3.
    • Right underneath that rule we have a Timer Rule that saves the game.level attribute after 0.1 seconds from the start of the level.
To add to the solution, we created a "Continue" button at the menu scene, which is at the very beginning of the game. Within the "Continue" button we added the following:

  • Added a Touch Rule to the "Continue" button
  • When button is touched and game.level = 1
    • Then change scene to level 1
    • and, reset the scores and lives for that level accordingly.
This solved the problem of the game throwing us to a "win" or "lose" screen. NOTE: This was done for each of our five levels.

As a last note, don't forget to address your sound. We enabled "Run to Completion" for each of our levels for the "win" and "lose" screens. However, this option caused the sound to bleed over into the other scenes when scene changed. Simple solution: uncheck that option.