Commit graph

41 commits

Author SHA1 Message Date
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
f80c191811 * rulesets/acorn/world/objects/animals/Deer.py, acorn.vconf: Added
deer, with same basic code as pig.

	* server/server.cpp: Pass on objects which are not know by the
	  Atlas::Objects::Decoder straight to the operation handler.

	* server/Admin.*: Re-structured the way commands are handled from
	  admin client, so that apropriate operations are used instead of
	  always using Set.

	* server/Admin.cpp: Added saving world state to the database.

	* tools/cycmd.cpp: Updated to use the new admin command semantics.
	  Added save command.

	* common/persistance.*: Added interface for saving world status.

	* common/database.*: Added interface for deleting contents of database.

Al Riddoch (alriddoch@zepler.org)
2001-04-02 22:03:42 +00:00
Al Riddoch
8db1550177 * Modified database code so that entries have the correct begin
and end encodings, which is <atlas>..</atlas> in the case of
	  XML-like codec.

	* modules/Location.h: Added a flag which indicates whether the
	  bounding box of an entity is solid. If it is not solid, then
	  the entities contents much be checked for collisions rather
	  than the entity itself.

	* rulesets/Character.h: Added target_ref attribute to MovementInfo
	  as a means to track character movement between entities.

	* rulsets/Character.cpp: Modified collision code to handle
	  detecting of collisions with non-solid objects, and handling
	  movement when characters moves into a non-solid object but
	  does not collide with it.

	* rulesets/Structure.h, StructFactory.*: Added base class for
	  buildings and other structure, which are not solid, and the
	  character can move in and out of freely.

	* server/server.cpp: Made metaserver functionality optional, and
	  added a config option to the config file.

Al Riddoch (alriddoch@zepler.org)
2001-03-18 21:35:49 +00:00
Al Riddoch
4b0aeab816 * tools/cycmd.cpp: Added functionality to allow commands to be
sent to the admin account on the server.

	* server/WorldRouter.cpp: Removed mechanism for shutting down server
	  after a fixed run period.

	* server/Admin.*: Added reception of Set operation by admin account
`	  which contain commands from an admin client. Implemented shutdown
	  command, which sets a flag indicating server shutdown should start.

	* server/server.cpp: Added output indicating that shutdown is taking
	  place, to make it clear that it is not a crash.

Al Riddoch (alriddoch@zepler.org)
2001-03-16 14:27:58 +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
702e12dd78 * server/server.cpp: Increased time between pings to metaserver
to 5 minutes instead of 5 seconds.

	* common/persistance.*: Implemented de-serialisation of database
	  objects, and added the necessary code for pulling accounts out
	  of the database.

	* common/sstream.*: Added an implementation of stringstream which
	  is the preferred ANSI form of strstream, but is missing from
	  the GNU std C++ library.

	* configure.in: Added check for system sstream.h, which falls
	  back to using version included.

	* server/Connection.cpp: Check for account in database when
	  user tries to create new account.

	* tools/cypasswd.cpp: Use stringstream instead of strstream.

The account database now works fine, but only username and password
are currently stored.

Al Riddoch (alriddoch@zepler.org)
2001-03-15 20:36:14 +00:00
Al Riddoch
dcb7296a61 * common/persistance.*: Added restricted mode set by config file,
which prevents users from being able to create accounts.

	* server/ServerRouting.cpp: Added restricted flag to the
	  server Object passed to client as result of a Get operation, so
	  the client can report it to the user.

	* tools/cypasswd.cpp: Added tool to administrate password database
	  table.

	* server/server.*: Added exit flag to ensure that of exit is requested
	  database is shutdown properlly.

	* server/WorldRouter.cpp: Maintenance shutdown is now done cleanly.

	* server/Connection.cpp: Added code to handle accounts using the
	  persistance system. Accounts would now be handled by the
	  database if the persistance code was complete.

	* common/persistance.*: More work on database code.

Al
2001-03-15 11:41:34 +00:00
Al Riddoch
f4784cf895 * *: Removed use of "using namespace ..." throughout.
* modules/Location.h: Fixed error in inRange() and finally got rid
	  of the Compiler warning.

	* rulesets/Food.cpp: Fleshed out the cooking code, including how
	  food burns when it is overcooked.

	* rulesets/Stackable.cpp: Implemented divide.

	* common/persistance.*: Added the beginnings of a database backend
	  using the Berkeley db library.

	* server/Account.cpp: Modified addObject, because the attrivutes
	  added by BaseEntity::addObject are not important to accounts.

Al
2001-03-14 12:31:16 +00:00
Al Riddoch
744a201711 * server/CommServer.h, server/server.cpp: Added metaserver code
to network classes.

	* server/CommServer.h, server/WorldRouter.h, server/ServerRouting.cpp:
	  Added fields to server entity for number of players and uptime
	  in seconds.

	* Started implementation of WorldTime class for processing of calendric
          time.

Al Riddoch (alriddoch@zepler.org)
2001-02-28 12:03:02 +00:00
Al Riddoch
9ef5ef82ec * Re-wrote the way creating various types of in-game objects is
handled to allow for easier adding of more classes.

Al
2001-02-26 20:26:19 +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
c9ed4bce26 * Added handling of Get operation from client before login, to
determine game type, status and other info.

Al
2001-02-19 18:50:53 +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
4e1527c238 * all files: Re-worked the way debugging is handled to that it no
longer gives warnings.

Al
2001-01-25  Al Riddoch  <ajr@ecs.soton.ac.uk>
2001-02-04 07:08:07 +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
8fbb05647e * server/server.cpp: Modified argument processing so that installation
directory can be set as a command line argument, and then stored
	  persistantly in users config file.

Al
2001-01-20 15:12:34 +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
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
f92ff1cb46 * Massive code cleaning efforts, removing dead code, trimming reviewing
and shifting code around to optimise it.

	* Heavy use of inlining to improve code performance.

	* Added global exception handler to catch exceptions while processing
	  operations.

Al
2000-12-12 13:10:17 +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
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
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
222786df66 * Added support for decoding Sound operations in BaseMind.
* Added Talk operation throughout operation handling code.

	* Added basic WorldTime class together with python wrapper.
	  Can fill in functionality as required.

	* Put debugging back in cos I still need it.

Python mind code now gets talk ops. Some tweaking still to go.
2000-11-29 15:19:36 +00:00
Al Riddoch
e156a2b6f1 * Disabled some of the excessive debugging messages.
* Implemented getting and setting of to and from in operations
	  using map to lookup what the mind knows about the entities
	  in question. This involved adding an extra field to the
	  RootOperationObject structure to store to and from entities.

	* Sorted out base_init() python member so __init__() of all
	  classes in inheritance tree are called.

	* Started work on set_kw() replacement.

	* Added python module finding mechanism which is required to deal
	  with rulesets correctly. I am not convinced this works.

Al
2000-11-24 01:41:06 +00:00
Al Riddoch
6bb82c3197 * Added more Python/C API code. Basic framework now exists for
creating and manipulating Operations in the python code.

Al
2000-11-14 15:52:10 +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
882bb2fc2b * Added enough python interface to load a simple module, get the
class from it, instantiate that class, and call operation methods
	  from it. Still to be implented is the Atlas-C++ API for embedded
	  python.

Al
2000-11-08 01:02:02 +00:00
Al Riddoch
6e203f465a * Fixed it so that server does not exit if client negotiation fails.
* Cleaned up detection of disconnected client

	* Re-wrote thing factory so it is now a static object instance rather
	  that a static method, and added the beginnings of support for
	  python "Thing" classes.
2000-11-02 18:59:58 +00:00
Al Riddoch
6326fa76f1 Added handling of client disconnection 2000-10-24 17:44:50 +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
d6a56f6764 The basic world model now works. Operation get routed effectively between
objects in the world, mind and external minds. You can now log in, create
a character, and witness other operations in the world through receiving
sight operations.

Al
2000-08-26 15:11:24 +00:00
Al Riddoch
604d22f80d Lots more code added, and WorldRouter can now send operations around
Now adding character body and mind code so mind and body abstraction can
work and communication between client and server character entity can
work. The code is not currently in any particular state, but I have not
commited for a while, so I am doing it now for security.
Al
2000-08-25 17:54:30 +00:00
Al Riddoch
2af3db08b1 Can now connect, login or create account, and create a character, which is
then added to the world. Socket code has been tweaked so it now handles
client disconnection a little better.

Al
2000-08-21 11:31:18 +00:00
Al Riddoch
a58d5f9881 Server now allows client to create account, login, and attempt to create a
character. Early stage of operation routing seems to be working.

Al
2000-08-19 16:42:18 +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