Pages

Tuesday, July 27, 2010

Alpha 4.1 : Advisor hints.

A nice new feature to help clueless new players who don't know the basic controls.
I also noticed that a significant number of players seems to ignore the existance of some features (using exits, pushing objects...)

ADVISOR HINTS
You can enable an Advisor (on by default).
The Advisor will monitor your situation and provide appropriate hints.
When the Advisor has a hint available, a little annoying popup appears and prompt the player to go read the hint. You can ignore it and keep playing, but because it's kinda intrusive you'll want to read it ;)
The hints are fired from the most basic ones (eg: how to move) to more complex ones (eg: how to fire a weapon), so it won't tell you the more advanced stuff until you have read all the simpler ones.

For example, as soon as you start a new game the Advisor wants to tell you how to move:

CODING
Nothing special, but it's been quite a long time I didn't show some coding stuff so let's talk about the implementation.
Thanks to the way I've done the engine (go me!) and the wonderful world of C# lambdas, it was very easy and quick to implement.
For instance, to check if it's time to trigger the "Look! You can open a door" hint I just write a line like this:
return map.HasAnyAdjacentInMap(pos, (pt) =>
{
DoorWindow door = map.GetMapObjectAt(pt) as DoorWindow;
if (door == null)
return false;
return m_Rules.IsOpenableFor(m_Player, door);
});
(thanks for messing the formatting, Mr Blogger)

Then I just maintain a table of hints that were already fired, to ignore those.
The Advisor state is stored in the Session object, so it is saved with the game.

The definition of a robo-advisor is an automated program that provides financial advice. More precisely, the program manages your investments through an automated algorithm rather than having a person monitoring your portfolio. https://www.themoneypouch.com