imitation and memory

What i want to make is a ai system that moves how the player moves and records those movments.And then the person that is playing the game can type in a name for those movements after he presses enter.And then the npc can do those movements when the correct name is typed in.In fact the npc will remember by doing.How would i do that?

This is definitely possible, I just have no clue how to do it xD you ask hard things

Thisis very similar from what I want to do.
In my case, every action is declared, so when a target is selected, the actions properties are read. By recording these actions in order/sequence, etc, you generate a small file/database record for later use, as long as the entire action (task) is named!

It depends how you define the action in the first place. You’re probably using animations, so if you use a linked armature for thé ai, it can share the animations that the player has defined. Then it is matter of typing in the animation name (or a key that maps to the blender animation name), unless you’re combining actions at the same time, in which case you apply the same principle with layers. This isn’t so touch, you have two parts, the interpretation that tells the ai what to do, and the data which tells the ai how to do it.

Sent from my Nexus 7 using Tapatalk 4

i anything sure to understand .

if you want just copy pos/rot/scale and reuse this data after a bit of time , is pretty easy.(ie basically, the NPC follow the player)

but what type the player ?_?

ie : the thing above require really one line (thanks to m4x4) :


if not "storedMovement" in own:
    own["storedMovement"] = []
own["storedMovement"].append( own.worldTransform.copy())

Well, actions, shouldn’t be directly connected to animations. More like a property. If the player is making an action, a property is active for a specific time. This action and the tie it remains active is recorded. When the action is collected from the DB, the NPC, just has to make the action property get the value to activate the action and run a counter for the animation.
EX:
Your actions/animations are: 0: iddle, 1: walk, 2: sit
Then when the player is executing them you record them: [(1,5),(0,3),(2,10),(1,50)]
When the data is collected from the DB:

you run a for loop:


for a in range(len(actList)):
    actº= actList[a][0]
    time = actList[a][1]
    while time>0:
        npc["action"]= actº
        time-=0.1