Commit graph

82 commits

Author SHA1 Message Date
Al Riddoch
096b4d898d 2003-03-21 Al Riddoch <alriddoch@zepler.org>
* modules/Location.h, modules/Location.cpp: Change location
	  member names to fit the Atlas attributes they map to, and
	  make it clear they are members.
2003-03-21 10:48:17 +00:00
Al Riddoch
15ef748518 2003-03-07 Al Riddoch <alriddoch@zepler.org>
* Use " instead of < when including application headers.

	* Re-work the interface between server and worldrouter objects
	  so that the are less tied together, and more flexible.
2003-03-07 00:22:12 +00:00
Al Riddoch
4dcfac66b5 2002-05-10 Al Riddoch <alriddoch@zepler.org>
* modules/Location.cpp, modules/Location.h, physics/BBox.h,
	  physics/Vector3D.h, rulesets/Character.cpp, rulesets/Entity.cpp,
	  rulesets/MemMap.cpp, rulesets/Movement.cpp, rulesets/Pedestrian.cpp,
	  rulesets/Py_BBox.cpp, rulesets/Py_Location.cpp,
	  server/Account.cpp, server/WorldRouter.cpp:
	  Get rid of operator bool() in vector and related classes,
	  so that errors are less likely to emerge in code. Make use
	  of Vector3D::isZero() where apropriate.
2002-05-10 21:20:14 +00:00
Al Riddoch
ebf8fac14c 2002-05-10 Al Riddoch <alriddoch@zepler.org>
* physics/Quaternion.h: Added required comparison operators, and
	  get rid of operator bool, to ensure that no implicit conversion
	  happens where it shouldn't. Add operator required for debugging
	  Quaternion.

	* modules/Location.cpp: Use new isValid() method instead of
	  relying on operator bool.

	* rulesets/Movement.h, rulesets/Pedestrian.cpp, rulesets/Pedestrian.h:
	  Fix up interface for genFaceOperation() so it works the right
	  way round, and orientation is not actually set until the Move
	  op is genuinly dispatched.

	* rulesets/Character.cpp: Add clearer debugging output.
	  Fix up handling orientation in move ops from mind, and generate
	  the move ops for simple change in orientation correctly.
2002-05-10 18:52:08 +00:00
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
30bd136e35 * common/database.h: Add function to query database path for
error reporting.

	* server/server.cpp: Added check to database initialisation so
	  that an error opening the databases is reported with explanation,
	  or logged as apropriate, and startup is aborted.

	* phyics/Quaternion.h: Added quaternion class for represening rotation.

	* modules/Location.cpp, modules/Location.h: Removed face attribute and
	  replaced with orientation which is a quaternion.

	* rulesets/Character.cpp: Modified code which handles the direction
	  of movement, and how this affects the character rotation so it
	  now uses orientation.

	* rulesets/Entity.cpp: Switch attribute checks from face to
	  orientation.

	* rulesets/Movement.h, rulesets/Pedestrian.cpp: Modify movement
	  code so that orientation used instead of face.

	* rulesets/Py_Location.cpp: Removed support for obsolete and
	  unused rotation attriute from python code.

	* rulesets/Thing.cpp: Modified attriute handling to use orientation
	  instead of face.

Al Riddoch  <alriddoch@zepler.org>
2001-12-14 16:40:38 +00:00
Al Riddoch
90ec47ab1e * physics/BBox.h, rulesets/Py_BBox.h, rulesets/Py_BBox.cpp:
Added direct support for new format bounding boxes.

	* modules/Location.cpp, modules/Location.h, physics/Vector3D.h,
	  rulesets/Character.cpp, rulesets/Creator.cpp, rulesets/Entity.cpp,
	  rulesets/Movement.cpp, rulesets/Plant.cpp, rulesets/Py_Location.cpp:
	  Switched over to using new format bounding boxes, and re-wrote
	  collision code for this format, making it clearer and more
	  efficient at the same time.

Al Riddoch  <alriddoch@zepler.org>
2001-11-30 14:35:59 +00:00
Al Riddoch
4de50bb822 * Cleaned up auto* build files. Added more updated info to README.
* modules/Location.cpp: Removed redundant includes.

	* rulesets/mason/define_world.py: Drop in copy of Acorn world.

	* server/WorldRouter.cpp: Removed double delete of gameWorld.

	* server/server.cpp: Modified comments about segfault in Python
	  shutdown, as this has now been eliminated.

Al Riddoch  <alriddoch@zepler.org>
2001-11-10 15:20:58 +00:00
Al Riddoch
a44ee6f86d * BUGS: Note that C++ version of client currently does not work.
* TODO: Update on important issues which allow easy DOS attacks.

	* client/ClientConnection.cpp, client/ClientConnection.h:
	  Cleaned up unused code from ClientConnection class.

	* client/client.cpp: Removed monitoring section of client
	  so it simply exits once the world is initialised.

	* rulesets/basic/mind/goals/humanoid/werewolf.py:
	  Started work on dynamic goals for playing werewolf.

	* rulesets/werewolf/define_world.py: Added in the mayor, who runs
	  werewolf games.

	* common/BaseEntity.h: Made id of entity private, and implemented
	  accessors.

Al Riddoch  <alriddoch@zepler.org>
2001-09-13 15:21:16 +00:00
Al Riddoch
d64f5712a7 * server/Account.cpp: Fixed setting name of characters startup coin
objects.

	* modules/Location.cpp: Added bounding median to attributes sent
	  using Atlas.

	* common/BaseEntity.cpp: Always set the id on an entity.

Al Riddoch  <alriddoch@zepler.org>
2001-07-23 10:43:56 +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
72740adfb9 * server/server.cpp: Cleaned up loading of config files, so that
an invalid installation is reported more clearly, and more
	  usefully.

	* rulesets/acorn/world/objects/animals/Pig.py: Fixed creating ham in
	  the right place.

	* rulesets/Movement.cpp: Fixed leaving containers so that if the		  initial collision with parnet bounding box is missed, character
	  does not get stuck.

	* rulesets/EntityFactory.h: Cleanup code is now cleaner.

	* rulesets/EntityFactory.cpp: Removed unecessary varconf dependancy
	  in rulesets code.

	* rulesets/Character.cpp: Allow move ops from mind with no loc set.

	* physics/Vector3D.h: Included check for inTime so that if entering
	  time is in the future, this is detected.

	* modules/Location.cpp, modules/Location.h: Provided method
	  to add location to a map.

Al Riddoch  <alriddoch@zepler.org>
2001-07-12 16:10:41 +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
60b256e670 * physics/Vector3D.h: Detect leaving time of bounding box, even if
entity is not yet in it.

	* modules/Location.h, modules/Location.cpp: Added get_xyz() to
	  find absolute coordinates.

	* modules/Location.h: Added true location based range checking.

	* servers/WorldRouter.cpp: Implemented new location based range
	  checking so that operations that take place inside buildings are
	  range checked properly.

	* servers/WorldRouter.cpp: Re-wrote id generation code to be a bit
	  more robust.

Al Riddoch (alriddoch@zepler.org)
2001-03-20 13:42:13 +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
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
959ba0128d 2001-01-24 Al Riddoch <ajr@ecs.soton.ac.uk>
* Throughout entire code base:
	  Removed all obsolete code and commented out code relating to porting
	  from python. Removed interim data types bad_type and None. Added
	  const throughout where apropriate. Change various flags to bool
	  type. Removed unused members.

	* Added TODO list.

Al
2001-01-24 15:45:58 +00:00
Al Riddoch
7605800f01 * Fixed pig behavoir bug so location coordinates are now not added
to object if they have not been set.

	* Added code to example client so it now reads characters list
	  when it logs in.

	* Removed support for obsolete old-atlas locations.

	* Changed behavoir on unexpected error from client socket, so
	  it no longer causes an abort.
2001-01-04 19:00:11 +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
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
fc4ab2b5fe * Removed two conflicting "WorldRouter * world" members from
class hierarchy.

	* Added setting of refno to operations, so client can tell
	  what they apply to.

	* Sorted out initialisation of python path.

	* Added loading of admin account, allowing admin client to communicate.

	* Made sure all attributes of created objects are set, so that
	  character gender works.

	* Added face attribute to Thing, to indicate what direction it faces!

	* Modified error operation so it complies with traditional format

Al
2000-11-10 00:57:34 +00:00
Al Riddoch
550beb9cc8 * Modified legacy location code so it is now activated by a single
#define

Al
2000-11-03 14:44:05 +00:00
Al Riddoch
3ba5e76833 * Added temporary support for old Atlas style location object
in entity to move operations. This allows uclient to work for
	  now until it moves over to the latest Atlas spec.
2000-11-02 23:47:19 +00:00
Al Riddoch
6b7b2c18d6 * Fixed some attributes of in-game object
* Added temporary support for old style Atlas location so we still
	  work with uclient.
2000-11-02 20:38:18 +00:00
Al Riddoch
bd9aecbcfa Modified all internal operation handling functions so they now return a list
of Operations instead of just one. Debugged movement, which now works, but
does not yet stop when it reaches the destination.

Al
2000-08-31 21:48:46 +00:00
Al Riddoch
0d372a6da0 Got MovementInfo to compile, and cleaned up the code a bit more. Removed
botched attempt to add support for optimised non-string object ids.
Modified the idle routine so it now delivers all the waiting operations
rather than only one per cycle.

Al
2000-08-27 18:00:38 +00:00
Al Riddoch
7129bb8b8c Initial check of work in progress converting cyphesis python code over to
C++. Don't do anything to this code until I have finished moving the rest
of the code into place.

Al
2000-08-13 20:36:18 +00:00