Commit graph

61 commits

Author SHA1 Message Date
Al Riddoch
e491d6995a 2002-03-12 Al Riddoch <alriddoch@zepler.org>
* server/server.cpp, rulesets/Python_API.cpp, rulesets/Line.cpp,
	  modules/Location.cpp, client/CreatorClient.cpp:
	  Removed some obsolete comments.

	* server/WorldRouter.h, server/WorldRouter.cpp: Add member to
	  deliver operation to known entity. Make use if it to avoid
	  having to recurse in operation() when broadcasting. Ensure
	  that the container of new entities is managed from here.

	* rulesets/Thing.cpp: Tell world to create new entities at the
	  same position as the creator if no other info is provided.
	  Do not attempt to handle setting up the default containership
	  of entity once created, as this is always handled by the
	  WorldRouter from now on.

	* rulesets/Py_World.cpp: Implement getting time info from world.

	* rulesets/Py_Location.cpp: Implement handling of the orientation
	  attribute from python.

	* rulesets/MemMap.cpp: Update comments about unimplemented code.

	* rulesets/Creator.cpp: Check for string.empty() instead of "".

	* rulesets/BaseMind.cpp: Remove reference python code.
	  Cleanly handle and delete operations returned when savinf mind state.

	* client/CharacterClient.cpp: Move delete to the right place.
2002-03-12 18:08:56 +00:00
Al Riddoch
83c53f06c6 2002-03-11 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.cpp: Eliminate unnecessary call to opEnumerate()
	  and enhance debugging output.

	* server/Player.cpp: Correct the use of string.compare() in older
	  versions of libstdc++.

	* common/types.h: Added enumeration for other operations, not
	  handled by the core, but considered valid. Added new type
	  for storing mapping between operation parents and their
	  enumerated type.

	* common/op_switch.h: Separate handling of operations known to
	  be invalid from operations which are valid, but not explicitly
	  added to the core.

	* common/inheritance.h, common/inheritance.cpp, common/custom.cpp:
	  Provide global operation mapping where enumeration of operations
	  can be looked up. Install all types handled by the core, and
	  types known to be used in scripts.

	* common/BaseEntity.h, common/BaseEntity.cpp: Add object specific
	  operation mapping where operation types each object is subscribed
	  to can be enumerated, and others are rejected. Add mechanism
	  so that objects can add to the mapping, this subscribing to
	  operations. This makes enumerating operations much cheaper, and
	  eliminates the overhead of handling ops an object has no interest
	  in.

	* rulesets/Thing.h, rulesets/Thing.cpp: Add mechanism so scripts
	  can subscribe to operations.

	* rulesets/Character.h, rulesets/Character.cpp:
	  Add subscription mechanism for ops going to and from
	  the mind.

	* rulesets/BaseMind.h, rulesets/BaseMind.cpp:
	  Add subscription mechanism for sight and sound perception
	  operations sub operations, and provide an interface to it
	  for scripts.

	* server/Connection.cpp, server/Admin.cpp, server/Account.cpp,
	  rulesets/World.cpp, rulesets/World.h, rulesets/Thing.cpp,
	  rulesets/Stackable.cpp, rulesets/Plant.cpp, rulesets/Food.cpp,
	  rulesets/Character.cpp, rulesets/BaseMind.cpp:
	  Add subscriptions to operations for all core base classes.

	* rulesets/Python_API.cpp: When script is created, go through
	  methods, and subscribe to the operations which are handled by
	  them.

	* rulesets/Character.cpp: When calculating orientation of a walking
	  character, assume it is standing upright.

	* physics/Vector3D.h: Add versions of mag() and distance() which
	  omit the square root calculations, so that when their values
	  are only used for comparison, the expensive square root
	  calculations can be ommited. Add new version of collision
	  and range checking functions which provide the optimal
	  interface to the application. Add versions of methods which
	  modify this rather than creating a new operation to eliminate
	  wasted copies.

	* physics/Quaternion.cpp: Make use of faster interface provided
	  by Vector3D.

	* physics/BBox.h: Add new version of collision checking function
	  which provides optimal interface to the application.

	* modules/Location.h, modules/Location.cpp: Add new functions
	  to optimally calculate the distance between any two entities.

	* modules/Location.h: Re-write collision and range functions to
	  make much more optimal use of Vector3D, BBox and distance
	  functionality.

	* rulesets/Py_Vector3D.cpp, rulesets/Pedestrian.cpp,
	  rulesets/Movement.cpp, rulesets/Entity.cpp, rulesets/Character.cpp:
	  Eliminate implicit copies from vector arithmetic.

	* rulesets/Pedestrian.cpp, rulesets/MemMap.cpp, common/const.h:
	  Re-write code which uses magnitude of vectors to use the square
	  of the magnitude instead, as it is much cheaper to calculate.
2002-03-11 18:24:19 +00:00
Al Riddoch
49691213c9 2002-03-08 Al Riddoch <alriddoch@zepler.org>
* Changed typedef names to ones which make more sense, and are
	  clearer. There is no change in functionality in this commit.
2002-03-08 14:58:40 +00:00
Al Riddoch
70ba5263af 2002-03-08 Al Riddoch <alriddoch@zepler.org>
* common/globals.cpp, common/globals.h, rulesets/Python_API.cpp,
	  tools/cyloadrules.cpp: Make rulesets list a vector for
	  efficiency.

	* common/utility.cpp, common/utility.h: New function to create
	  an operation from a message Object.

	* rulesets/BaseMind.cpp, rulesets/MemMap.cpp, rulesets/MemMap.h,
	  rulesets/MemMap_methods.h, rulesets/Py_Map.cpp: Clean up
	  mind/memory interface, eliminating copies, unecessary allocations,
	  and passing more apropriate types around.

	* server/CommClient.cpp, rulesets/Py_Operation.cpp: Make use of
	  operation converter where it is apropriate.
2002-03-08 11:52:27 +00:00
Al Riddoch
cb99bb996f 2002-03-03 Al Riddoch <alriddoch@zepler.org>
* client/CreatorClient.cpp: Fix operation semantics for admin
	  puppetting to new convention.

	* common/Database.cpp: Add optional support for database password.

	* physics/Quaternion.h: Add extra way of setting up a Quaternion.

	* rulesets/MindFactory.cpp, server/Connection.cpp:
	  Move some output into debugging.

	* rulesets/Python_API.cpp, rulesets/Py_Quaternion.h,
	  rulesets/Py_Quaternion.h: Add support for quaternions into the
	  scripting API.

	* rulesets/mason/define_world.py: Switch to using quaternions to
	  send orientation data to the server.
2002-03-03 00:48:28 +00:00
Al Riddoch
e1669c7947 * client/ClientConnection.cpp, client/ClientConnection.h,
tools/cycmd.cpp: Switched to using skstream to completely handle
	   client socket connections.

	* client/ClientConnection.cpp, client/ClientConnection.h,
	  common/log.cpp, rulesets/EntityFactory.h, rulesets/MemMap.h,
	  server/server.cpp, tools/cycmd.cpp: Removed unused includes.

	* client/Py_CreatorClient.cpp, client/client.cpp,
	  client/define_world.cpp, rulesets/Py_Location.cpp,
	  rulesets/Py_Location.h, rulesets/Py_Map.cpp,
	  rulesets/Py_Map.h, rulesets/Py_Mind.cpp, rulesets/Py_Mind.h,
	  rulesets/Py_Object.cpp, rulesets/Py_Object.h,
	  rulesets/Py_Operation.cpp, rulesets/Py_Operation.h,
	  rulesets/Py_Oplist.cpp, rulesets/Py_Oplist.h,
	  rulesets/Py_Optime.cpp, rulesets/Py_Optime.h,
	  rulesets/Py_Thing.cpp, rulesets/Py_Thing.h,
	  rulesets/Py_Vector3D.cpp, rulesets/Py_Vector3D.h,
	  rulesets/Py_World.cpp, rulesets/Py_World.h,
	  rulesets/Py_WorldTime.cpp, rulesets/Py_WorldTime.h,
	  rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
	  rulesets/PythonThingScript.h, rulesets/Python_API.cpp,
	  rulesets/Python_API.h, server/server.cpp:
	  Reorganised python header files so that each header includes
	  all the code relevant for a particular type. Tidied up
	  the type implementations. Added prototypes to init_python_api()
	  to the Python_API.h header, and removed other dependencies from
	  it.

Al Riddoch  <alriddoch@zepler.org>
2001-10-19 11:35:07 +00:00
Al Riddoch
1aa2021f6c * rulesets/Python_API.cpp: Made variable names clearer.
* server/Connection.cpp: Fixed adding accounts to lobby on login.

	* server/server.cpp: Limited the scope of the CommServer object
	  so that it is destructed before the rest of shutdown can
	  take place.

Al Riddoch  <alriddoch@zepler.org>
2001-10-10 09:40:24 +00:00
Al Riddoch
7ec46f4fe1 * rulesets/Python_API.cpp: Fixed another leak in the python code.
Al Riddoch  <alriddoch@zepler.org>
2001-10-09 15:39:55 +00:00
Al Riddoch
8c0f0358d7 * rulesets/Python_API.cpp, rulesets/PythonMindScript.cpp,
rulesets/Py_Oplist.cpp, rulesets/Py_Operation.cpp,
	  rulesets/Py_Map.cpp: Fixed some points in the code where Python
	  objects are not decreffed, and are thus leaked.

Al Riddoch  <alriddoch@zepler.org>
2001-10-09 14:03:12 +00:00
Al Riddoch
fe4f38265e * server/server.cpp, rulesets/Python_API.cpp: Added function
to shutdown python. Ensure that all references that should be
	  decrefed during initialisation are.

	* tools/cywatchdog.cpp: Moved watchdog pidfile, so it is in
	  cyphesis specific dir.

	* tools/cyctrl.cpp: Moved in watchdog control program, which
	  makes controlling the watchdog easier.

Al Riddoch  <alriddoch@zepler.org>
2001-10-08 23:21:18 +00:00
Al Riddoch
c4baa6914e * configure.in: Switch to using improved checks for Atlas-C++ and
python.

	* common/const.h, common/const.cpp, rulesets/Python_API.cpp:
	  Removed unused consts.

	* common/globals.h, common/globals.cpp, server/server.cpp:
	  Enable running as a daemon in the background by default.
	  This improves usability by removing dependance on users
	  session. Install signal handlers so signals cause clean
	  shutdown.

	* tools/cycmd.cpp: If adminning server on localhost, get admin
	  password directly from database, instead of asking user.
	  Allows cycmd to be used in scripts. Ensure that exit
	  status accuratly reveals whether the command was sent.

	* tools/cypasswd.cpp: Switch to using common/accountbase.h.

Al Riddoch  <alriddoch@zepler.org>
2001-10-06 16:52:02 +00:00
Al Riddoch
dee412c0a0 * client/CharacterClient.cpp: Removed commented out code.
* client/CreatorClient.cpp: Fixed processing the response
	  to a create operation, and cleaned up debugging output.

	* client/ObjserverClient.cpp, client/ObserverClient.h,
	  client/client.cpp: Added setup method, which which handles
	  connecting, negotiation, logging in and creating character.

	* client/Py_CreatorClient.cpp: Added check if make() failed.

	* rulesets/Python_API.cpp: Fixed setting the import hooks
	  list properlly to include the ruleset list in use, instead
	  of hardcoding it.

	* rulesets/acorn/define_world.py: Copied define_world.py script
	  from client directory for Acorn.

	* rulesets/basic/editor.py: Modified to be used from C++ core.

	* rulesets/basic/mind/goals/__init__.py,
	  rulesets/basic/mind/goals/humanoid/werewolf.py:
	  Added in goals file to contain goals related to werewolf.

	* rulesets/basic/mind/panlingua/interlinguish.py:
	  Added in vote and execute verbs for werewolf.

	* rulesets/werewolf: Added in new ruleset for werewolf.

Al Riddoch  <alriddoch@zepler.org>
2001-08-19 18:37:38 +00:00
Al Riddoch
2fd239e63c * tools/cycmd.cpp: Ensure that login op is flushed after it is sent.
* server/Player.cpp: Arg order of std::string.compare() is
	  incompatable between recent libstdc++ versions. Switch
	  back to old version, still in most common use.

	* rulesets/Thing.cpp: Set refno on ops handled in game.

	* rulesets/Python_API.cpp: Modify Entity() python constructor
	  so that commonly used attributes from old atlas are translated
	  to their modern equivalents.

	* rulesets/Py_Thing.cpp, rulesets/Py_Mind.cpp: Differentiate
	  between previously identical error messages in several places.

	* rulesets/Py_Object.cpp: Rework conversion of python dict to
	  Atlas map to be more efficient and clean.

	* rulesets/Py_Location.cpp: Rework setting of vector parts of
	  location so that it can accept vectors from python in more
	  formats, including lists and tuples.

	* rulesets/Creator.h, rulesets/Character.h, common/BaseEntity.h:
	  Re-order virtual methods declarations to fit a convention.

	* common/stringstream.h: Hardcode use of local stringstream class,
	  as the version provided with older libstdc++ seems to be broken.

	* common/database.cpp: Use the common header to pick the right
	  stringstream implementation.

	* common/BaseWorld.cpp, server/Persistance.cpp: Removed unused
	  stringstream include.

	* rulesets/Creator.cpp: Added extra debug output.

	* client/define_world.h, client/define_world.cpp, client/CommClient.h:
	  Use CreatorClient to store Creators mind, instead of BaseMind.

	* client/client.cpp,
	  client/ObserverClient.h, client/ObserverClient.cpp,
	  client/CreatorClient.h, client/CommClient.h, client/CommClient.cpp:
	  Modify method names to fit capitalisation conventions.

	* client/CreatorClient.cpp: Implement creation of in-game entities,
	  using creator entity.

	* client/CommClient.cpp: Added correct client side monitoring of
	  creator entity.

	* client/ClientConnection.h, client/ClientConnection.cpp: Added
	  pending method to establish if ops are in the queue. Switched send()
	  method so we only send ops. Add setting of serialno of sent
	  ops, starting with an offset of 512.

	* client/CharacterClient.h: Removed unused member, opFound.

	* client/CharacterClient.cpp: Debugged sendAndWait() method.

Al Riddoch  <alriddoch@zepler.org>
2001-08-16 17:39:42 +00:00
Al Riddoch
dcc3dfa85a * server/server.cpp, server/CommClient.h, client/ClientConnection.h,
tools/cycmd.cpp: Switched to using skstream library for socket
	  comms instead of hand rolled fstream based version.

	* ALL FILES: Fixed use of std namespace throughout all code.

This server is now ISO C++ compliand and builds with gcc 3.0.

Al Riddoch  <alriddoch@zepler.org>
2001-08-14 17:52:50 +00:00
Al Riddoch
73b210279c * client/client.cpp,
client/ObserverClient.cpp, client/ObserverClient.h,
	  client/ClientConnection.cpp, client/ClientConnection.h,
	  client/define_world.cpp, client define_world.h:
	  Started re-coding of python client code in C++.

	* common/accountbase.h:
	  Database class used for simply accessing accounts.

	* common/OOGThing.cpp, common/OOGThing.h, server/Account.h,
	  server/Routing.h:
	  Moved OOGThing class into common as it is not server specific.

	* common/BaseWorld.cpp, common/BaseWorld.h,
	  server/WorldRouter.cpp, server/WorldRouter.h,
	  rulesets/Entity.h, rulesets/Py_World.cpp,
	  rulesets/PythonThingScript.cpp, rulesets/Python_API.h,
	  rulesets/Thing.cpp, rulesets/Thing.h:
	  Added base class for WorldRouter so that code that previously
	  used WorldRouter now used the interface defined by this
	  new class. This means that the code in rulesets no longer
	  has dependencies on code in server, so can be used in the client.

	* server/ExternalMind.cpp, server/ExternalMind.h,
	  rulesets/Character.h, rulesets/Creator.cpp,
	  server/Account.cpp:
	  Moved ExternalMind class into server as it is server specific,
	  so that there is no dependancy on server in rulesets.

	* server/Persistance.cpp. server/Persistance.h,
	  server/Admin.cpp, server/ServerRouting.cpp, server/server.cpp:
	  Moved high level server specific persistance class into
	  server, so there is no dependency on server in common.

	* common/database.cpp, common/database.h, server/Admin.cpp,
	  tools/cydbload.cpp, tools/cyisoload.cpp, tools/cypasswd.cpp:
	  Increases efficiency of some interfaces by passing Object::MapType
	  instead of MapType, when the value must be a map.

	* modules/WorldTime.cpp, modules/WorldTime.h,
	  rulesets/Py_WorldTime.cpp, rulesets/Python_API.cpp:
	  Brought the version of WorldTime in modules up to date, as this is
	  the version now used.

	* rulesets/Character.cpp, server/WorldRouter.cpp, rulesets/Thing.cpp,
	  server/Admin.cpp:
	  Made world objects dictionary private.

	* rulesets/EntityFactory.cpp, rulesets/EntityFactory.h:
	  Change newThing parameters so entity factory does not need to
	  know about WorldRouter.

	* server/Lobby.cpp: Added support for people and rooms attributes
	  of OOG room class.

Al Riddoch  <alriddoch@zepler.org>
2001-08-13 17:22:27 +00:00
Al Riddoch
3969bffbfe * common/inheritance.cpp, common/inheritance.h: Added code to store
atlas object inheritance tree.

	* server/Connection.cpp: Added code to allow client to query
	  atlas object inheritance using get ops.

	* example/client/InheritanceClient.*: Added example client which
	  queries the inheritance tree of the server.

	* rulesets/MemMap.h, rulesets/Py_Map.cpp: Made hooks lists private,
	  and added methods to access them.

	* server/Account.cpp, server/Lobby.h: Added correct handling of OOG
	  look ops when looking at own characters, other accounts, or the
	  lobby.

	* server/ServerRouting.h: Added function to generate serial numbers
	  for operations.

	* server/WorldRouter.cpp: Assign genuine serial number to all
	  in game operations as they are pulled off the queue.

	* Cleaned up header file multiple inclusion checks for uniqueness,
	  and made sure of ISO compliant use of std::string.

Al Riddoch  <alriddoch@zepler.org>
2001-08-02 14:27:06 +00:00
Al Riddoch
1930946950 * server/server.cpp, server/ServerRouting.h, server/ServerRouting.cpp,
server/CommServer.h: Added support for server "name" which
	  defaults to the hostname of the server machine, but is
	  customisable in the config. This can be used in preference to
	  IP address when doing lookups with the metaserver.

	* server/Lobby.h, server/ServerRouting.h, server/Account.h,
	  server/Account.cpp, rulesets/Stackable.h, rulesets/Stackable.cpp,
	  rulesets/Python_API.cpp, rulesets/Py_Object.cpp, rulesets/Plant.cpp,
	  rulesets/Pedestrian.cpp, rulesets/Entity.h, rulesets/Entity.cpp,
	  rulesets/Character.h, rulesets/Character.cpp, common/BaseEntity.h,
	  common/BaseEntity.cpp: Modied asObect() and addToObject()
	  methods to make them more efficient.

	* modules/Location.h, modules/Location.cpp: Removed old obsolete
	  Message::Object based addToObject() method.

	* rulesets/Thing.cpp: Optimised apperance/disappearance code.

Al Riddoch  <alriddoch@zepler.org>
2001-07-16 17:52:23 +00:00
Al Riddoch
9f0e733adb * server/server.cpp: Handle cleaning up after database load.
* server/WorldRouter.cpp: Switch to using stringstream to
	  generate ids.

	* rulesets/Thing.cpp: Re-write SetupOperation so Sight
	  operation is not lost and leaked.

	* rulesets/Python_API.h, rulesets/Python_API.cpp,
	  rulesets/Py_WorldTime.cpp, rulesets/Py_World.cpp,
	  rulesets/Py_Thing.cpp, rulesets/Py_Operation.cpp,
	  rulesets/Py_Object.cpp: Sort out correct handling of
	  python references, and ensure C++ objects are
	  deleted as required.

Al Riddoch  <alriddoch@zepler.org>
2001-06-22 22:03:59 +00:00
Al Riddoch
8bea85cdfc * Fixed up build files to install in a conformant way.
* acorn.vconf: Added in new building classes which set up
	  wall objects for collision purposes. Building now seem to
	  work.

	* common/database.cpp, common/database.h, common/globals.cpp,
	  common/globals.h, rulesets/Python_API.cpp, server/server.cpp,
	  watchdog/control.c, watchdog/watchdog.c: Implemented
	  correct way of getting installation directories from
	  autoconf.

	* rulesets/Movement.h, rulesets/Movement.cpp, rulesets/Pedestrian.h,
	  rulesets/Pedestrian.cpp: Fixed collisions with the solid
	  wall of a structure.

	* rulesets/Thing.cpp: Modified setup operation so that a sight
	  of create operation is always generated even if setup is
	  overloaded.

	* Many fixes from Anders Petersson to get the build working under
	  debian.

Al Riddoch  <alriddoch@zepler.org>
2001-06-16 14:19:00 +00:00
Al Riddoch
2c4a2036d3 * tools/cydbload.cpp: Added parameter handling so any file can
be loaded into the database.

	* tools/cycmd.cpp: Cleaned up usage and help functions.

	* tools/cyisoload.cpp: Cleaned up usage(), and made sure build
	  completes okay if libraries are missing, and missing
	  functionality is reported to the user.

	* server/server.cpp: Added config options that specifies that
	  the contents of the db should loaded on server startup. Cleaned
	  up some debug code.

	* server/WorldTime.cpp, server/WorldRouter.cpp,
	  server/Connection.cpp, rulesets/Structure.h,
	  rulesets/Python_API.cpp, rulesets/Py_WorldTime.cpp,
	  rulesets/Movement.cpp, rulesets/Entity.cpp,
	  physics/Vector3D.h, common/persistance.cpp,
	  common/database.h, common/database.cpp: Removed output either
	  to debug mode, or removed altogether.

	* common/BaseEntity.h, common/BaseEntity.cpp: Removed redundant header
	  includes.

	* server/ServerRouting.cpp, common/persistance.h,
	  common/persistance.cpp: Modified admin account function names it
	  fit convention.

	* module/Location.h: Fixed collision detection so that entities
	  with velocity set to 0 still get checked.

	* rulesets/Entity.cpp, rulesets/Thing.cpp, rulesets/Character.cpp,
	  rulesets/BaseMind.cpp, rulesets/Creator.cpp,
	  rulesets/ExternalMind.cpp, rulesets/Food.cpp, rulesets/MemMap.cpp,
	  rulesets/Movement.cpp, rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
	  rulesets/Py_Location.cpp, rulesets/Py_*.cpp, rulesets/World.cpp:
	  Removed unnecessary #includes.

Al Riddoch  <alriddoch@zepler.org>
2001-06-04 11:22:27 +00:00
Al Riddoch
0572ab631b * Renamed Operataion method names throughout so they no longer
all have the name Operation but are now called MoveOperation,
	  according to the type of operation they handle.

	* modules/DateTime.cpp, modules/DataTime.h: Filled in functionality,
	  allowing initialisation and updating from a time values in seconds.

	* modules/Location.h: Modified collision detection code so no
	  checking is done between two moving objects.

	* rulesets/BaseMind.h, rulesets/BaseMind.cpp, rulesets/Entity.h,
	  rulesets/Entity.cpp: Removed virtual getMap() method and replaced
	  with a fixed method in BaseMind only. Added time member veriable
	  to BaseMind so each mind keeps track of time by itself.

	* rulesets/Python_API.h, rulesets/Py_Mind.cpp, rulesets/Py_Mind.h:
	  Added specific python interface for mind objects, because if
	  increasing differences in the way this must be handled.

	* rulesets/Character.h, rulesets/Character.cpp: Added isAlive flag
	  which is cleared if the character is dead. If this flag is cleared,
	  operations are no longer sent to the mind.

	* rulesets/Movement.h, rulesets/Movement.cpp, rulesets/Pedestrian.h,
	  rulesets/Pedestrian.cpp: Cleaned up the code, made members more
	  distinctive, and make interface more general.

	* rulesets/Py_Thing.cpp: Removed features used to support mind.

	* rulesets/Py_WorldTime.cpp: Added support for comparison of
	  time with strings, to establish whether it matches descriptions
	  of time.

	* rulesets/Python_API.cpp: Modified creating of scripts so mind
	  scripts use a slightly different interface from entity scripts,
	  to support the fact that a mind handles its own timekeeping,
	  has a memory map, and has no access to the world.

	* server/WorldTime.cpp, server/WorldTime.h: Brought WorldTime into
	  the build. Used to track details of the time. Added support for
	  checking time descriptions such as "midday", "summer" against
	  DateTime.

Al Riddoch  <alriddoch@zepler.org>
2001-05-28 14:58:24 +00:00
Al Riddoch
b6a7e1302a 2001-05-22 Al Riddoch <alriddoch@zepler.org>
* client/define_world.py: Added archers who can hunt deer.

	* rulesets/basic/mind/goals/common/misc_goal.py:
	  Added the hunting goal.

	* rulesets/basic/mind/goals/common/move.py: Modified hunt_for()
	  goal so it has variable attack proximity.

	* common/op_switch.h, common/operations.h, common/Generic.h,
	  rulesets/Character.cpp, rulesets/Entity.h, rulesets/Entity.cpp,
	  rulesets/Python_API.cpp: Added handling of operation types not
	  directly supported by C++ classes in the scripting engine. In
	  order for these to be used they must be created in a script, and
	  received in a script.

	* rulesets/Character.cpp: Avoid using RootOperation pointers unless
	  that is really what we mean.

	* rulesets/Character.cpp: Added code to delete operations from
	  internal mind when external mind is active.

	* rulesets/Entity.cpp: Handled leaking of null script objects,
	  and python script objects.

	* rulesets/Connection.cpp: Delete characters external mind when
	  connection goes down.

Al Riddoch  <alriddoch@zepler.org>
2001-05-22 17:59:43 +00:00
Al Riddoch
d339cbe5e4 * rulesets/BaseMind.h/cpp: Added isAwake flag to indicate whether the
mind is active or not. Defaults to true.

	* rulesets/Py_Object.cpp: Reverted to storing complex attributes
	  in a python dict.

	* rulesets/Python_API.cpp: Get complex attributes from operation
	  arguments.

	* rulesets/Thing.cpp: Added in broadcast of sight(create) operation
	  to setup when object is created. See Thing::Opertion(Create) for
	  details.

	* rulesets/basic/mind/goals/common/misc_goal.py: Cleaned up comments.

Al Riddoch  <alriddoch@zepler.org>
2001-05-20 19:02:41 +00:00
Al Riddoch
e091bfd8f8 * server/Admin.cpp: Modified database loading code so it picks up
the object parent correctly instead of looking for a type attribute.

	* server/server.cpp: Made metaserver address a config file option.

	* common/database.h: Put in compiler error if code is built without
	  database support.

	* common/BaseEntity.cpp: Switched over to using stamp instead of seq
	  as the attribute used to check whether entity needs to be
	  updated.

	* Used action operation throughout python code to denote performing
	  an action, as differentiated from setting mode.

	* rulesets/skills: Added the beginnings of a skill system.

	* example/client: Fixed Atlas-C++ 0.5 example client so it
	  compiles again.

	* README: Wrote a README file

Al Riddoch  <alriddoch@zepler.org>
2001-05-06 23:51:37 +00:00
Al Riddoch
a481668f13 * rulesets/Py_Object.cpp: Added support for complex attributes
for Entities used as argument for operations.

Al Riddoch  <alriddoch@zepler.org>
2001-05-03 22:04:43 +00:00
Al Riddoch
617252bb7d * common/database.*, common/persistance.*: Added new database tables
for mind data, and server data.

	* common/persistance.*, server/Admin.cpp: Implemented saving and
	  loading of mind state to mind table. Initially only saving the
	  contents of the memory map is supported.

	* rulesets/MemMap.h: Added asObject() method to convert contents
	  into Atlas representation.

	* rulesets/BaseMind.*: Added handling of load and save operations
	  which in conjunction with the Python mind component build an
	  Atlas representation of the mind state.

Al Riddoch  <alriddoch@zepler.org>
2001-04-20 16:23:34 +00:00
Al Riddoch
2ccfaadef3 2001-04-14 Al Riddoch <alriddoch@zepler.org>
* Substantial re-work of object model. Moved many attributes out
	  of BaseEntity class. Changed WoldRouter so it now handles
	  objects in terms of Entity, rather than BaseEntity.

	* Code cleanups, including removing reduntant includes, and
	  getting rid of C style comments.

	* Fixed the way attributes are handled in Set operations and
	  when merging from an Atlas::Message::Object. This fixed
	  problem with setting gender of characters.

	* rulesets/Pedestrian.*, rulesets/Movement.*: Re-named
	  Movement variables to make them clearer. Added in
	  separate handling for collisions from moving to
	  target position. Modified collision handling so
	  objects can slide next to each other.

	* rulesets/Thing.cpp, rulesets/Character.cpp: Cleaned up and
	  rationalised movement code. Much shorter, faster and
	  more compact than before.

	* Made better use of iterators throughout, eliminating unnecessary
	  lookups, and copying of data.

	* Moved all virtual functions out of header files, making
	  less work for the linker.

	* Made more use of const references to avoid the need to copy
	  data before being able to inspect it.

Al Riddoch <alriddoch@zepler.org>
2001-04-16 16:26:44 +00:00
Al Riddoch
77a6d063dd * common/BaseEntity.*: Changed addToObject to take reference
instead of pointer.

	* physics/Vector3D.h: Re-ordered functions to allow correct inlining.
	  Changed member names to correct convention.

	* rulesets/MemMap.cpp,rulesets/MemMap_methods.h: Re-ordered function
	  to allow inlining, and moved non-inlinable functions into .cpp file.

	* Changed new operation initialisation to be done at construction
	  time instead of imediatly after construction for performance
	  reasons.

	* server/WorldTime.*: Modified member names for convention, and
	  moved non-inlineable function to .cpp file.

Al Riddoch  <alriddoch@zepler.org>
2001-04-12 11:13:06 +00:00
Al Riddoch
43211cf9d1 * Re-wrote class headers files so that all class members now
begin with a lower case letter and do not contain _.

	* Fixed retrieval of Account from database so that the Account
	  is now correctly referenced in the server object.

	* common/types.h: Changed type name to make them clearer.

	* rulesets/Character.h: Moved MovementInfo into its own class
	  file, and made it a base class, with a Pedestrian super class.
	  This allows different types of movement handling classes
	  to be used to handle things that move differently.

Al Riddoch  <alriddoch@zepler.org>
2001-04-11 14:34:15 +00:00
Al Riddoch
488f35b52f * Complete re-write of python script interface to allow other
script types to be cleanly dropped in.

	* Re-work on server and communication related classes to use
	  references where they are apropriate. Code is now much more
	  robust.

	* Huge cleanup of header files removing redundant includes.

	* server/WorldRouter.h: Removed is_object_deleted because it
	  is broken and not used.

	* server/Connection.h: Removed unused disconnect() methods.

	* rulesets/Entity.*: Added new in game base class from which
	  all mind and object classes are derived. This removes
	  clutter of Thing class from mind classes.

	* aiclient/*: Progress with creating AI client for mind handling.

	* common/globals.*: Moved some globals out of server specific files.

	* rulesets/Makefile.am: Separated rulesets code into 3 almost stand
	  alone packages; entities, mind and python interface code.


Acorn may well not work now, but I would apreciate it if people could
test the code on their setups. Lots of code has changed, and almost
everything is now cleaner.

Al Riddoch  <alriddoch@zepler.org>
2001-04-10 19:05:14 +00:00
Al Riddoch
291621d9e8 * watchdog/*.c: Corrected C++ style comments in c code.
* */*: Fixed mistake in copyright statement.

	* tools/cypasswd.cpp: Fixed usage message.

	* tools/cycmd.cpp: Added tools for sending administrative commands
	  to server.

	* server/server.cpp: Send terminate instruction to metaserver on
	  server shutdown.

Al Riddoch (alriddoch@zepler.org)
2001-03-16 11:38:14 +00:00
Al Riddoch
3a5e4e56c0 * Changed oplist to use std::vector. Recoded and re-optimised use
of oplist to take advantage of vector's best performance.

	* Modified OP_SWITCH macros to improve speed, and made it inlinable.

	* Cleaned up python interface code to improve compile and link time.

	* Moved custom operation definitions in one header file per class
	  to improve modularity and compile time.

	* Modified boundingbox handling so it now uses size and median.

	* Added collision check and inbox member function to Vector3D class.

	* Added collision prediction and checking to Location and Vector3D
	  classes.

	* Added collision prediction into MovementInfo class.

	* Modified Thing::operator[] so that static attributes can be handled
	  and added Thing::set() which must be used to modify attributes.

	* Added collision resolution so characters can no longer walk through
	  each other.

	* Moved weight attribute to being static attribute of Thing, so it
	  can be much more easily handled in movement code.

Al
2001-02-26 14:41:10 +00:00
Al Riddoch
35d78b27a2 * Implemented beginnings of ranges code:
* modules/Location.h: Added inRange() method which can be used
	  to check whether location, including bounding box, is within
	  given range of a given location. Changed parent member
	  variable to ref to fit with Atlas spec. Changed all code
	  related to using the term ref instead of parent so
	  that there is no confusion between ref for coordinates
          and parent in the Atlas hierarchy.

        * rulesets/Thing.cpp: Added code to move operation to check
          what entities come into and out of range when entity moves.
          Appearance and Disappearance operations are sent to the
          moving entity with a list of the relevant entities as their
          argument.

        * server/WorldRouter.h/cpp: Added overloaded Look operation
          handler which applies range constraints to the contains
          attribute before returning.

        * common/BaseEntity.h, rulesets/Thing.h, rulesets/Character.h:
          Added handling of Appearance and Disappearance operations.

        * server/WorldRouter.cpp: Added primitive check to broadcast
          operations to avoid delivering broadcast operation to
          entities out of range.

        * Removed world.get_object() use from server python code, as
          its use is not required.

        * server/WorldRouter.h: Implemented fetching of floating point time
          from the OS so movement is much smoother.

Al
2001-02-19 06:13:31 +00:00
Al Riddoch
e7eb28366c * all file: Added copyright statement
Al
2001-01-26 16:38:23 +00:00
Al Riddoch
f9e8d1c832 * Fixed inheritance bug in BaseMind::operation()
* Tweaked the way Look operations are handled when sent from mind, so
	  an argument is not required if to is set.

	* Made some performance enhancements.

	* Implemented nourish operation.

	* Modifed move_me() goal so it sets face direction.

	* Fixed memory leak in MemMap.

	* Implemented fully deleting of entities.

	* Cleaned up and tweaked python scripts so eating acorns now works.

	* Implemented hooks in MemMap for python scripts.


This is the work I got done over the Christmas break. Acorn now works
with a couple of minor glitches.

Al
2000-12-30 23:16:57 +00:00
Al Riddoch
57c737a756 * Fixed error in Thing::operator[] which meant attributes could not
be accessed, and certain move operations caused an abort.

	* Removed attributes from python object which don't have attributes.

	* Added Py*_Check() macros, and used them for easier code reading.

	* Added snow attribute to weather.

	* Commented out code which makes server exit(0) after a certain time.


Al
2000-12-16 20:28:06 +00:00
Al Riddoch
2aae7249ea *** empty log message *** 2000-12-15 19:25:19 +00:00
Al Riddoch
5ce54bf665 * Modifed python interface Operation() function so that it accepts
strings for to and from as well as entities.

	* Adapt python Operation() function so operations can be given as
	  arguments.

	* Add Eat, Chop, Cut and Fire operations into the main operation
	  handling functions.

	* Added code so that intelligent entities can use python mind classes
	  other than NPCMind, and added config section for specifying which.

	* Tweaked python mind code for Pig, Wolf and Skeleton so they work.

Al
2000-12-14 12:03:05 +00:00
Al Riddoch
defe46b91e * Set up rulesets processing so that everything is handled dynamically
from config files. Global ruleset should indicate top level ruleset
	  which can depend on a list of other rulesets.

	* Sorted out installation directories. Cyphesis will now need to be
	  installed before it can be run.

	* Cleaned up a load more python scripts for more Acorn stuff.

	* Added getting x y and z from Vector3D.

	* Made acorn the default ruleset.

Al
2000-12-13 12:10:48 +00:00
Al Riddoch
4343c8d383 * Removed lots of extraneous debugging output, and turned the rest
off using debug flags.

	* Added halt_time, which is number of seconds server should run before
	  it exits.

	* Cleaned a bunch if the remaining memory leaks.

	* Cleaned up the way time is handled.

	* More tweaks to Python code and API to get Acorn working.

	* Inlined some methods into the class definitions, for performance.

	* Updated movement code to sort out setting mode properlly, and
	  deal with stuttering NPC movement.

This is quite a big commit, and most of Acorn now works. Performance seems
to be good too.
2000-12-11 13:06:12 +00:00
Al Riddoch
b1a1db69d3 * Major attack on the more fiddly memory leaks. The only noticable
leak now is copied Location objects in the python interface code.

	* Added hook into the time code so the server can be set to exit
	  after a given number of seconds. This is required for LeakTracer
	  to generate its report.

Al
2000-12-08 11:40:32 +00:00
Al Riddoch
d1f2e912a0 * Added handling for removing connections.
* Removed some unused code.

	* Tweaked some python scripts so they import correctly.

	* Added in_game flag to BaseEntity so it is possible to tell
	  if an object is in game.

	* Increased the number of operations handled by Message()

	* Added handling for initialisation of location.parent using me
	  in mind code.

	* Added is_object_delete() functionality to python interface to world
	  object.

	* Added handling for converting Tuple into Message::Object, and then
	  ensured that non-basic python types don't get stored as attributes
	  of a Message::Object.

Many more improvements to goal behavoir. Guard now patrols correctly,
and butcher tries to by a cleaver, because he fails to notice he already
has one.

Al
2000-12-07 12:14:35 +00:00
Al Riddoch
1826587f9d * Fixes to worlds object list so it now contains world.
* More python code tweaks to work with modifications to interface.

	* Modified code which gets Thing attributes from Message::Object
	  so it can use any object dictionary to look up parent object.

	* Fixed handling of Thing's static type attribute.

	* Modified creation of operations from python to eliminate
	  some strange segfaults.

	* Re-wrote and fixed Entity creation from python.

	* Implemented dictlist.remove_value for removing things from inventory.

	* Implemented Vector3D arithmetic and methods from python.

	* Implemented as_entity() and get_xyz() methods for Thing from
	  python.

	* Commented out deletion of operations from python OperationObject
	  dealloc() function as it was causing segfaults. There is a problem
	  somewhere with ownership not being cleared, but I can't find it.

	* Implemented conversion of Python Operation and Oplist objects
	  to Message::Object.

	* Fixed MemMap so that attributes of Things are accuratly updated.

	* Fixed it so that look ops from mind are broadcast rather than sent
	  to world. This may have to be reverted.

	* Tweaked autoconf to make it cleaner and work better. Still needs
	  alot of work.

A simple test of some goals now works! The lych goals worked to some
extent and no-longer gives python errors. Only a few more things are
required before Acorn can run, at which point I will release 0.1
for testing.

Al
2000-12-06 18:21:35 +00:00
Al Riddoch
e6d6f7ef0d * Added new common namespace to prevent collision with math function
log.

	* Added in lots of deletes to sort memory leaks.

	* More python tweaks.

	* Implemented status attributes of thing.

	* Re-wrote some code which needlessly creates objects in the
	  free store.

Very nearly all works now.

TODO:
Tidy some of the rest of the leak handling, including all of the stuff
to deal with connections going down.

Sort out how mind gets its attributes set and updated.

Sort out iritating python error in init of Vector3D

delete oplists in OplistObjects. The pointers are never passed back.

Al
2000-12-05 14:26:04 +00:00
Al Riddoch
21b18875f6 * Started working on sorting out memory leaks.
* Implemented python function to deal with not being able to check
	  type of python objects implemented in C.

	* Added method to thing for extracting location data from a
	  Message::Object

	* More work on python references to improve leakage.

	* Added flag so that python Operation object can own
	  the operation they point to, and thus delete it in dealloc().

	* Implemented find_by_location() and find_by_type() as required in
	  MemMap, and corresponding python interface.

	* Put in temporary work around to deal with the fact that a mind
	  does not know its name. Currently the mind is not able to
	  discover any of its bodies attributes, and I am not sure how
	  to solve this.

	* Fixed Location and Vector3D so they use operator bool() to detect
	  whether they are set.

	* Fixed bugs in getting parent from Location in python which caused
	  segfaults.

	* Imported all the basic ruleset entity python scripts.


Goals now work to some extent, though nothing moves around still. The main
priority is to work out how minds inherit the attributes of their
bodies, and keep them up to date. aloril?

Al
2000-12-04 20:08:21 +00:00
Al Riddoch
61009ef844 * Corrected broadcasting of non-perception operations to
non-perceptive entities.

	* Sorted out removing spaces from id strings.

	* Implemented Entity arguments to Operaiton creation in python.

My TODO list is now empty, but it still does not quite work.

Al
2000-12-03 23:17:52 +00:00
Al Riddoch
4b0b328c92 * Debugged set_kw() and confirmed that it does work.
* Added python API support for self.world.

Al
2000-12-03 16:56:10 +00:00
Al Riddoch
fbdb46ddc8 * Added support for varconf config files.
* Used config file to list enitity types and their python class files.

	* Cleaned up reference counting in Python API related C++ code.
	  References should all now be handled correctly.

	* Added support for adding None to Operation and Oplist.

Reference count changes have solved some segfaults I was getting. New
config files allows easy specification of rulesets, and has allowed
me to test the complete range of python entity classes used in Acorn.

Import hook code does not appear to work for classes imported directly using
python API calls.

Al
2000-12-03 14:23:26 +00:00
Al Riddoch
fda1182f78 * Added dictfunc functionality to Python interface.
* Added creation of Entities for use in Operation arguments.

	* Added initialisation of Vector3D through constructor
	  arguments in python.

	* Added append() method to python interface for Oplist.

	* Added support for coercion of operation into addable form.

Al
2000-12-01 00:13:39 +00:00
Al Riddoch
907455c4c8 * Added more required functionality to base python Thing class
so that operation manipulations can now work.

	* Implemented getting of object name to python/C API, and added
	  methods for differentiating between op and object.

	* Implemented on-the-fly de-coding of operations, from operation
	  arguuments in python/C API. This will be obsolete once Atlas-C++
	  does full decode later.

	* Implemented get and setattr for Message Object from
	  python. Attributes are stored both in Object, and in supplementary
	  python dictionary for non Atlas compatable attributes.

	* Implemented copy() method for Python/C Location class.

Al
2000-11-30 12:51:59 +00:00