The series of ‘in development’ posts will cover individual classes at various stages of the build, and serve as a reference to the changes made during the development process.
An early sketch planning the palette class
Planning some changes to the original specification
As the user’s means of interaction with the application is through drawing, colour plays a vital role in their control over the state of the program. A two-player session will assign a unique palette of colours to each player, which they can mix on the canvas to create new colours, or use to fill the background colour of the canvas itself to change the overall ‘feel’ of the composition.
In the initial planning for the palette, it was to be responsible for drawing the colour selection controls to the screen itself. Furthermore, it was planned that the parent of the palette object register as its delegate in order to receive instruction from it. In the second image above, the palette has undergone some revisions which change its design considerably (for example, it is no longer required to draw to the screen, and has been switched from type UIView to an NSObject subclass).
For the program to work as intended, each player must have a unique palette of colours available to them. The client which chooses to launch a session creates two Palette objects, one for each user. The first of these draws five colours at random indexes from the ‘availableRangeOfColors’ array, using the ‘create’ method. The indexes of these colours is stored in the ‘colorsTaken’ int array. Once this process has been completed, the second palette is created from the remaining colours in the available range (the second palette is the return value of the ‘createOpposite’ method).
This is the ’1.0′ implementation – it works as intended, but contains log statements, and has not yet undergone any optimisation. Using this type of Palette object, the instigator of a session can transmit the palettes of both clients to the server at session start – the joiner/second party can then simply download their palette from the server, and it will be guaranteed unique.This also means that colour data need not be transmitted multiple times – a shape can simply make reference to the user, and index of the colour in their palette (for example U = 0 C = 4 for user one, colour four).














