001 (ns the-great-game.agent.agent
002 "Anything in the game world with agency"
003 (:require [the-great-game.objects.game-object :refer [ProtoObject]]
004 [the-great-game.objects.container :refer [ProtoContainer]]))
005
006 ;; hierarchy of needs probably gets implemented here
007 ;; I'm probably going to want to defprotocol stuff, to define the hierarchy
008 ;; of things in the gameworld; either that or drop to Java, wich I'd rather not do.
009
010 (defprotocol ProtoAgent
011 "An object which can act in the world"
012 (act
013 [actor world circle]
014 "Allow `actor` to do something in this `world`, in the context of this
015 `circle`; return the new state of the actor if something was done, `nil`
016 if nothing was done. Circle is expected to be one of
017
018 * `:active` - actors within visual/audible range of the player
019 character;
020 * `:pending` - actors not in the active circle, but sufficiently close
021 to it that they may enter the active circle within a short period;
022 * `:background` - actors who are active in the background in order to
023 handle trade, news, et cetera;
024 * `other` - actors who are not members of any other circle, although
025 I'm not clear whether it would ever be appropriate to invoke an
026 `act` method on them.
027
028 The `act` method *must not* have side effects; it must *only* return a
029 new state. If the actor's intention is to seek to change the state of
030 something else in the game world, it must add a representation of that
031 intention to the sequence which will be returned by its
032 `pending-intentions` method.")
033 (pending-intentions
034 [actor]
035 "Returns a sequence of effects an actor intends, as a consequence of
036 acting. The encoding of these is not yet defined."))
037
038 ;; (defrecord Agent
039 ;; "A default agent."
040 ;; ProtoObject
041 ;; ProtoContainer
042 ;; ProtoAgent
043 ;; )