The pace is definitely picking up now. I have a bit more free time away from teaching and other duties as the semester draws to a close (though I must correct 30 game essays and a number of game group projects, nearly 40 Spring framework assignments and a number of group Spring web / database projects by early January!).
Today I made some progress on the clues / deductions drag and drop user interface. You can now walk around and right-click on objects and those that are clues will add an image to a free clue slot in the UI. Right now I have a maximum of 10 clue slots – maybe I ensure that some deductions are made and clues cleared before moving on to the next section and 10 will be enough. These clues can now be dragged around within the clue slots, dropped into a free slot or swapped with an existing clue image. This might be useful if the player wants to group what he/she thinks might be related clues. The solution involves scripting the drag and drop behaviour of the clue slots in the UI, while maintaining a parallel array of clues; all very old fashioned programming / scripting in some parts. Here is what I have so far:
It’s a bit rough yet, but with some prettifying it will look just fine. In the background, I have scripted the beginnings of the deduction data structure and the management of it. I have decided that in each level, I will create an array of object references (i.e. reference the actual 3D object that was dropped into the level, which will have embedded clue metadata – clue text, clue image, etc.). This is a 2D structure with an array of deductions, each of which has an array of associated clue object references.
To allow for flexibility as to what a clue object is, I created a ClueInterface, which each type of interactive clue object will implement (it simply has a get method that returns clue text and clue image). This means that my base interactive object, and by extension any more specific objects that inherit from it (e.g. newspaper articles, notes, etc.), as well as any other objects like non-player characters or anything else, can be a clue – it just implements the interface and the get method, returning clue text and clue image property values. This avoids the bad cast-fail-cast pattern because you never need to cast to a specific type of object, you just cast to the generic one-size-fits-all ClueInterface type.
Next step is the drag and drop to the deduction slots below, plus being able to select which deduction you are working on.