Version 3 (modified by dave, 10 years ago) (diff) |
---|
Overview of structure and layers/programming languages involved.
Code can be found here: http://svn.lirec.org/scenarios/GerminationX/
Server (Oak)
FAtiMA layer
Running agents defined using XML, standard Lirec codebase, no changes. Each agent runs as a Java process, sending and receiving messages from the world server program.
World server layer
Another Java process, programmed in Clojure. Listens to messages from agents, and dispatches them to the others. Contains the FAtiMA world state, agents and objects,
Webserver layer
Running in the same process as the world server, but in another thread, the webserver responds to requests with information based on the world state. Programmed in Clojure, and based on the Compojure web server.
Client (Fungi)
Multiple clients, running in web browsers, programmed in Haxe, for flash or HTML5 canvas. Responsible for displaying the world state, and allowing players to interact with it. Objects created here are passed up to the world server layer, so characters respond to changes the player makes.
FAtiMA server API
The FAtiMA server receives http requests and returns all data in JSON format.
/agent-info
Returns all the information for all the agents in the world.
This is in the form of:
[agent1, agent2, agent3]
Where each agent consists of:
General information:
- name - name of the agent
- fatactions - a list of the actions recently performed
- fatemotions - the raw output from the FAtiMA emotional state, converted to JSON
Game specific data:
- tile - current world tile location
- pos - position in the tile
- emotions - the current accumulated emotional values
- emotionalloc - the location of the object causing the most significant emotional response
This is a real example from the game:
[ { "tile": {"x":1,"y":0}, "pos": {"x":7,"y":8}, "name": "CoverSpirit", "emotions": {"Pitty":0,"Gratification":31.025406,"Admiration":5.0656595,"Shame":0,"Gloating":0, "Anger":0,"Pride":23.023403,"Resentment":0,"Hate":0,"Satisfaction":0,"Reproach":0, "Gratitude":11.897399,"Remorse":0,"Fear":0,"Disappointment":0,"Relief":0, "Love":71.686676,"Joy":91.661285,"Fears-Confirmed":0,"Distress":0,"Happy-For":34.498783, "Hope":0}, "emotionalloc":{"x":12.0,"y":0.0}, "fatactions": [ {"time":232021, "msg":"look-at cover-fruit-b#102#"}, {"time":232021,"msg":"look-at vertical-fruit-c#147#"}, {"time":232019,"msg":"look-at cover-fruit-a#146#"}, {"time":232018,"msg":"look-at cover-fruit-a#183#"}, {"time":232018,"msg":"flower cover-fruit-c#22#"} ], "fatemotions":{"tag":"EmotionalState","attrs":null,"content":[{"tag":"Mood","attrs":null,"content":["10.0"]},...]} } ...]
/perceive
Causes all agents to perceive the world - for debugging purposes.
/agent-sprites
This command returns a list of all the sprite textures making up the agent's body. This makes it possible to change them in game.