Tuesday 31 July 2012

Integrating Game Engine and Graphics

After receiving some of the initial graphics for the game I integrated them into the game engine, the result is shown below. Personally I think it's looking really good, just a few small scaling issues.


Monday 30 July 2012

Designing the Game Engine

When approaching the programming of this application I decided to use the libgdx framework. Libgdx is a cross-platform development library based on OpenGL. I decided to do this as not only does it allow the game to be run both as a windows application and an android application, but also preforms much better on mobile devices than the standard android sdk.

At the moment the game simulates a shoal of fish swimming around a tank, With one fish being user controlled.  The user is shown an area, the size of their screen, of the game map which they can explore with their shoal.

The Flocking Algorithm - The Technical Bit:
The game uses the flocking algorithm to control the movement of fish within the game. Programmatically each fish has a 3 distances defined from it's centre, effectively making the three rings representing the repulsion, orientation and attraction zones.
The fish also has a cone of angles, defined as it's viewing zone, the fish can only react to other fish within this cone.
 When changing the position of a fish, its position is checked against the position of all other fish, if another fish is within one the fishes zone it's position vector is added to the total for that zone.
When a fish has analysed all other fish and their positions it can execute, changing it's position, based on the other fish.
According to the algorithm the fish's repulsion zone takes priority, this means that if another fish is within the repulsion zone the fish will move itself away, regardless of how many fish are within the orientation and attraction zone, this is reflected in the algorithm.
If their are no other fish in the repulsion zone then the fish can react to the others in their orientation and attraction zone.

In this game the user plays as one of the fish, the leader of the pack, obviously in order for the player to be controlling and moving a fish within the shoal the algorithm cannot be perfectly implemented, however I think I managed to get around this (relatively) elegantly by making the user controlled fish appear to all other fish as multiple fish i.e. the other fish are weighted towards the player, for example if the weighting was 10 the fish  would act as if there were 10 fish moving in the same direction and from the same position as the player.



Although this can't really be shown in a screenshot, I have tried my best in the above. The larger green fish represents the player and the blue fish represent the rest of the shoal. Something to bear in mind- the graphics on this screenshot are very much programmer art.


Obstacles and Walls:


I have added walls to the game at the perimeter of the background to prevent the fish from escaping, and obstacles within the game that the fish can't pass through. The interaction between a fish and an obstacle/wall is similar to a bounce, where the relative component of the fish's velocity is inverted. For example on the diagram below the Y-Component of the fish's velocity would be inverted upon hitting the wall whilst the X-Component can remain the same. Once the fish is no-longer touching the wall it returns to executing the flocking algorithm.








Thursday 26 July 2012

Designing the Logo

The first graphics job was to design the logo for Complex City Apps. 

This started out with some quick sketches for ideas. There was already a plan for the direction we wanted to go: something simple, eye-catching and scalable, as the logo will need to appear on anything from documents to mobile screens.
 
After a bit of design work, a few alternatives were printed and offered to some YCSSA staff for feedback. It always helps to get different opinions on a design, as personal tastes can vary.
 
Designs for feedback - small changes make a big difference!

Feedback suggested that we might make the logo more specific to York to strengthen the connection to the University of York. A few alterations to the skyline brought the logo to its current state. Is the York detail too fiddly and distracting, or good branding? Let us know your opinions in the comments.

York themed logo

Monday 9 July 2012

Flocking Algorithm

The flocking algorithm that we are using for our first app is by Couzin et al. Using this method of flocking, each of the individuals has three zones around it. The outer zone represents a region of attraction, the individual will be attracted to others if they are within this zone. In the next zone the individual will try to orientate itself to try to fly in the same direction as other individuals. If another individual gets too close and enters the central zone then they will be repelled. Behind each of the individuals is a blind spot in which they cannot see. The research paper by Couzin et al gives much more detail.

Monday 2 July 2012

First Application: Flocking

A large flock of birds
Awklet Flock by D. Dibenski source Wikimedia Commons.

Our first application will be a game based on flocking.

Flocking is a well known area of research. Boids is an example of a computer simulation of a flock. In a flock each individual has certain rules of behaviour and the combination of these individual behaviours determines the overall flock behaviour.

The properties of the rules control different aspects of the flock behaviour, such a how closely the individuals crowd together.