Skip to content

Commit

Permalink
rewrite for version 3
Browse files Browse the repository at this point in the history
  • Loading branch information
bitcraft committed Jan 20, 2012
1 parent cd7afe1 commit e3ae35e
Show file tree
Hide file tree
Showing 36 changed files with 2,597 additions and 1,255 deletions.
Binary file added 16x16-overworld.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 55 additions & 32 deletions README
Original file line number Diff line number Diff line change
@@ -1,32 +1,55 @@
pyGOAP v.2

My implimentation of GOAP AI.

The main concept of GOAP is that AI is not a static table
or set of states. Rather, GOAP uses a A* like search to
find solutions to goals at runtime. This frees the
designer of setting up complex behavior trees. This
python implementation uses a simple text file and a python
script to define actions for a GOAP agent. You can have
a look in the npc folder and pirate.py.

There is a test called pirate.py. It more-or-less test/demos
the GOAP library.

You should be able to run the pirate demo and watch how he
satisfies his two goals: getting drunk and laid. =)
You'll notice that he dances a lot. Thats because the dance
action gives him 25 money, and he needs 100 to woo a lady.

The source has a ton of comments, but most of them are just
notes that I take so I don't forget stuff, since I don't
always have time to work on this, and forget some of the
details and ideas that I have for the future. That said,
some of the comments are not truen, and you shouldn't trust
them. =)

pygoap is under a rather large rewrite as I prepare it for
usage in large environments. This includes an environment
modeler and pathfinding, among other things.

Hope you have fun.
for goap 3

planner

planner sould be able to reasonably predict the cost of repeating actions

agents:
in an rpg game, the player can expect to talk to NPC'sr and and to gather
information about quests, items, other npc's, etc.

i think that goap can become an engine of sorts, dictating every action in the
game. basic play elements can be emulated through goap and would not have to
be explicitly coded into the game. take simple "hello" meet/greet actions with
an npc:
npc will have a insatable desire to talk to a player
they will have a different thing to say depending on mood/state of player

a side effect of this will that npc's could possibly become more lifelike as
they can move around the game world to satisfy goals. to moderate and conrol
the npc's and to make the game more enjoyable, npc's can have goals that are
only relevant at certain times of day or days of the week.

in the harvest moon series for example, the nps do have certain schedules that
they will loosely follow. this makes the game play predictable once their
simple schedule is learned. imo, giving the npc's too much freedom to act wiil
make the game world seem more random, and potentially frusterating to play.

tying the speech system to goap agents could make the gameplay more immersive
by allowing the player to ask unscripted questions. while developing a system
that perfectly synthesizes english is not a viable option, giving the player
the option to ask canned questions, unrealted to the quet or story, with the
ability to choose specfic parts of the question is a definate cool thing.

for example, the player might ask an npc "have you seen gary?". the goap
agent can then search it's memories of gary and give a response to the player.
because this would be based on the agent's memory, and not some canned
response, it will simotaniously make the make more immersive and releave the
game designers and writters the burden to creating dialog.

a frusterating aspect of some games is dealing with faction alliances. for
example, in some games, killing or doing some negative action against a member
of a faction will cause all members of that faction to instantly become hostile
toward the player. this is unrealistic in situations where the information
that our your hostility could not have reached the other party.

simulating the spread of information could also be simulated in goap by
creating goals that one agent wants to tell other agents things that he saw the
player do. for example, they may be nuetral npc's that will gossip with other
npc's in distant towns. or, members of one faction may use radio, phones,
letters, messengers, etc to tell other faction members about the player.

this too could be emulated with goap, and would not have to be explicitly
programmed.


2 changes: 0 additions & 2 deletions TODO

This file was deleted.

16 changes: 16 additions & 0 deletions formosa.tmx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="15" height="15" tilewidth="16" tileheight="16">
<tileset firstgid="1" name="16x16-overworld" tilewidth="16" tileheight="16">
<image source="16x16-overworld.png" width="256" height="336"/>
</tileset>
<layer name="Grass" width="15" height="15">
<data encoding="base64" compression="zlib">
eJwTYmBgEBrFwxJnU6CPHL3ZZOrNJlMvur6higEQaSSv
</data>
</layer>
<layer name="Tile Layer 1" width="15" height="15">
<data encoding="base64" compression="zlib">
eJxjYCANfAbiL0D8FUnsOxD/AOKfBPQyMzIwsAAxKyNCjB3I5gBiTkb85ggD5UWAWBRJrziQLQHEkoyo5pAKkM0ZTsCJAn3KQ1SfEB4MUq8ExdjsU8KDyXEfsQAAzu0N1Q==
</data>
</layer>
</map>
Binary file added npc/pirate/.actions.py.swp
Binary file not shown.
15 changes: 0 additions & 15 deletions npc/pirate/actions.csv

This file was deleted.

Loading

0 comments on commit e3ae35e

Please sign in to comment.