Framework for building games and interactive stories