Day 6 – but today is November 24th… this just serves to show how hard it is to combine a side project with a full-time job, a family, and other hobbies! The last two weekends I spent sailing at two all-weekend races (Northampton and Draycote), and in the evenings I am generally too busy with other things. And I don’t want to ‘pull an all-nighter’, as it’s not a sustainable way to do things. However, today I got a few things done:
The central element of my project is a ‘world simulator’, in which the characters act out their desires, follow their goals, and interact in (hopefully) interesting ways, which I will then harvest to generate a story from. The core of the simulator is a planner: you feed in the characters’ goals, and they will then find a way of doing what they need to do in order to achieve them. The planning algorithm I’m using is called Goal Oriented Action Planning (GOAP), basically a back-ward chaining algorithm: Starting from the goal, you work backwards to see which actions get you to your goal. Each action has a post-condition (which would be matched to the goal), and a pre-condition (which becomes the new goal). You select an action whose post-condition matches some of the character’s goal conditions, and then see how you get there. Each action also has a cost associated with it, which allows you to choose a more efficient path in case there are several options.
I have today managed to implement a very basic version of that in Scheme. I’m using atomic conditions, but eventually will have more complicated expressions, but it is a first step. For several toy scenarioes the planner does indeed find suitable solutions, which are paths through a network of states. Adjusting this to the final world representation should not be too much of an issue.
I have resigned myself to not finishing this system by the end of the month. But I’ve made a start, and will try to get this continued throughout the year, so that I have a novel ready by NaNoGenMo 2018… On the positive side, my Scheme programming is getting better, and I have loads of ideas about what to implement over the coming year.