Growl Patrol - Software Development

From EQUIS Lab Wiki

Jump to: navigation, search

Contents

Game

A first version of the game has been implemented.

  • There are 3 types of animals : cats, dogs and birds. Tigers and cages are also present.
  • There are 3 different ways to control the player :
    • by GPS, gyroscope and compass to get the heading,
    • with the arrows
    • or using the arrows and the compass combined
  • The player can catch the animals, bring them to their cages, earn money, buy tools...

Global architecture

UML5global.png

GPS and positioning features

This part was done by using the classes Jason did with his tourist application.

Sound

Features

  • Animals (cats, dogs and birds) :
    • There are 3 or 4 different sounds for each type of animal so that they can be differentiated. The sounds are long enough and not repetitive so the user can hear them in a loop.
    • The animals emit a sound when they are caught by the user or eaten by a tiger.
    • When an animal is left at a cage, the user can hear coins falling.
  • Tigers:
    • The animal emits a different sound when he is walking, attacking or eating.
  • Cages:
    • The cages emit a knock sound continuously.
    • When the user presses the joystick button of the PC (or the ‘tab’ key of the keyboard), and if a cage is close enough, then the cage will emit a sound like a knock on metallic bars followed by the sound of the animals it can take.
  • Speech interface:
    • The user can know whenever he wants different numbers, by pressing the ‘C’ button of the ultra-PC.
    • The information given is : ‘You have X coins. You carry X animals: X cats, X dogs and X birds.’

Architecture

All the game entities that are related to sound inherit from a class called Entity. Then the entities are divided in 2 groups : emitters and listeners.

UML5Entities.png

Entity

The entity class gives a location and a bearing, along with a form (user, animal, tiger or cage) and a texture. The entity also has a method allowing it to react to the different interactions with other entities. This method is virtual and does nothing, it has to be implemented for each entity regarding its behavior.

The class also possess its own Draw method to be called whenever needed.

Emitters

All the entities that produce a sound inherit form the EmitterEntity class.

This class (which inherits from Entity) provides everything needed to produce sound, but in a way that it is simpler to use (the interactions with the audio stuff of XNA are hidden). The class provides protected methods to create the emitter :

  • add/remove a sound to the list of sounds available for the emitter,
  • initialize the audio which takes care of all the initializations needed by XNA along with the retrieval of the sounds in the XACT library,
  • a method to apply whatever sound (that has already been added) to a listener,
  • a method to apply a bip sound to a listener (when the listener gets closer, the paste gets higher) not used in the game.
Listener

The only listener is the user. The UserEntity class possess the AudioListener used for the sound. As for the 3D sound, the listener is considered to be all the time at the position (0, 0, 0). The emitters are positioned according to their distance (in meters) to the listener for each axis.

Game behavior

Map

  • I created a class called MapTexture that allows to control several features concerning the map :
    • In order to prevent the animals from running through buildings, we determined areas where the animals can’t go. To do that, we turned the map we are using in black and white (no nuances of grey). The white parts are the ones the animals can go, the black parts are the forbidden areas.
    • The size of the play area and the place of the play area can be modified ( as long as it stays inside the map)

maps(605x173).png

Entities Behavior

  • User : before starting the game, one can choose the way to control the user : all GPS, all manual (with the arrows), or half manual (arrows to go forward or backward, but using the compass to precise the heading).
  • Animal : each animal has an AI that dictates its behavior. For the moment the AI is very simple : the animal looks if it can go straight for X more updates, if not it turns by 10 degrees and try again. If none way allows to go straight for X more updates, it takes the way that allows to go the furthest.
  • Tiger : each tiger has 2 AI. When it is walking, it has the same AI than the animals, but when it is hunting, it follows its prey.
  • Cage : each cage is fixed.

Communication between entities

All the interactions that can happen between entities are treated by the class EntitiesInteractionHandler. This class checks any possible interaction between the entities, and then sends a message to the entities concerned. To do so, it creates an EntityInteractionEvent that it sends to the entities thanks to the method InteractionEvent of each entity.

UML5Interactions.png

Visual interfaces

There are 2 visual interfaces : the map, and the information interface.

  • Map: the user is in the center, the animals that can be caught by the user are visible, the tigers and the cages are visible.
  • Switch button : a touch button is displayed at the bottom right corner of the screen to switch of interface.
  • Information interface: it is divided in 3 parts.
    • The global numbers concerning the game : how many entities of each kind are remaining in the game.
    • The numbers concerning the user : how much money does he have, what are the kind of animals he can catch, what animals is he carrying.
    • The tools he can buy, displayed as touch buttons that he can only interact with when it is allowed (ie he has enough money, he doesn’t already have the tool and he is at a cage).

UML5Buttons.png