Answer the question
In order to leave comments, you need to log in
How would you implement program decision making in a pick'n'point game?
Take, for example, Machinarium or any similar pick'n'point game
. How would you organize your program's decision-making logic? Let's say I'm standing in position A, I press a certain button. How the program decides to drive to position B and play the animation
Several options come to my mind:
1) Each position / button on the level is a class that checks the conditions on the level (where the hero is, what tasks have already been completed) and issues commands.
2) Either there is a single handler class for each level that makes decisions.
Again, checking conditions and making decisions is a bunch of if else for each level, or it’s better to get confused with some protocol like 'if click pos A or C then go B play mov1 ' and parser
It's about 30 levels. All different. There are a lot of job/position dependencies everywhere. I would like to standardize. Any thoughts?
Answer the question
In order to leave comments, you need to log in
Classes decide everything - this is a throw of yourself through your thigh ... You will kill yourself, in general.
Read Champandara , you need a Behavior Tree and Goal Planning section.
Any player action is a trigger. Accumulating, or each by itself, triggers affect the internal memory of the machine. The automaton simply performs the action that corresponds to its current internal memory.
The description of the automaton is best done in a scripting language (LUA/Python embedded).
Each level is just a description of the machine in the script.
The actions themselves. Where to go, etc... It already depends on how your scene is made. This can be done both with a rigid animation with a name (which the automaton will launch), and with the help of the AI subsystem (to which the same automaton will give instructions).
With such an organization, you will save yourself a mountain of time and nerves.
class click
{
click back; //link to the previous action, I understand the actions are linear and follow the chain
click front1; //action #1
click front2; //action #2
private bool click (...)
{
if (f1)
then....
else
...
}
}
I don't know if I got the point across. I am writing in a very sleepy state.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question