Today I started working on object interactions, and it inspired me to write a little post about it.
A few months ago we created a prototype to see how the game would work, to find problems in the game-play as soon as possible, and to see what kind of interactions we could expect in the game. The story and puzzles were not complete at the time, so we had to extrapolate what kind of situations the player could get into.
It was, and still is running on the Android powered Galaxy Tab, and everyone we show it to is very excited about the game. The first typical comment is “Oh, i loved Monkey Island” and as soon as we mention time travel, we hear references to Day of the Tentacle.
Anyway, we’ve shown the prototype to a lot of people, and used the feedback to tweak the prototype until we were happy. Of course, this also turned the code into a mess. Every object had its own specialized code, which quickly became unmanageable. So we ditched the prototype and started from scratch. Right now I’m working on making the interaction between objects and the player, and of course it is all scriptable and general.
I have created a matrix of interactions. Whenever an object is used with another object, I put in some commands into the corresponding cell for the engine to interpret, and the magic happens. Clicking on the green_access_card now does this:
Creating a green access card in my inventory. And when I use my inv_green_access_card with green_card_reader this happens:
Which is how you open the elevator doors. Pretty straight forward, really. The objects themselves can run an animation, if they are set up to do this. In this case, the elevator doors could open. It’s awesome when it works