Commit graph

219 commits

Author SHA1 Message Date
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
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
024b45727a * client/define_world.py: Add bounding boxes to oak trees.
* rulesets/Entity.cpp: Added support for setting bounding box.

	* rulesets/MemMap.cpp, rulesets/MemMap.h: Add looking at
	  contains attribute of entities to mind's map.

Al Riddoch  <alriddoch@zepler.org>
2001-06-11 13:08:10 +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
d74d7117e5 * server/server.cpp, server/CommClient.h, server/Account.h,
server/Account.cpp, rulesets/Entity.h, rulesets/Entity.cpp,
	  rulesets/Character.h, rulesets/Character.cpp, rulesets/BaseMind.h,
	  rulesets/BaseMind.cpp, common/types.h, common/operations.h,
	  common/op_switch.h, common/BaseEntity.h, common/BaseEntity.cpp:
	  Added support for imaginary operations used in a similar way
	  to emoting.

	* server/WorldTime.h: Added update method so underlying DataTime
	  can be updated.

	* server/ServerRouting.h, server/Lobby.h, server/Lobby.cpp
	  server/ServerRouting.cpp, server/Connection.h,
	  server/Connection.cpp, server/Account.h, server/Account.cpp: Added
	  a lobby object which handles lobby chat. Essentially it stores
	  a list of accounts and allows operations to be sent or broadcast
	  to other accounts.

	* rulesets/Py_WorldTime.cpp: Added python is_now() method because
	  using comparison does not appear to work.

	* rulesets/BaseMind.cpp: Added updating of minds WorldTime each
	  time an operation is received.

	* modules/DateTime.h: Added operator << so DateTime can be sent
	  to cout.

	* common/types.h: Added types for storing accounts in Lobby.

Al Riddoch  <alriddoch@zepler.org>
2001-05-29 11:16:09 +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
da1ae9e16d * rulesets/Entity.cpp: Added dynamic attributes to atlas entity
representation.

	* rulesets/Py_World.cpp: Added get_object() method so that python
	  scripts can actually interact with other objects.

	* rulesets/basic/mind/goals/common/misc_goal.py: Fixed hunt goal
	  so that the arrow is removed from inventory as it is fired.

	* client/define_world.py: Added archer, arrow and deer to test
	  shooting code.

	* server/server.cpp: Made CommClient more robust in the event
	  if immediate disconnection by initialising pointers to NULL;

Al Riddoch  <alriddoch@zepler.org>
2001-05-24 18:22:02 +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
1d0f77d4b5 * server/server.cpp: Added several options to the config file to
make server operation customisable. Added comments.

	* server/server.cpp, server/CommServer.h: Changed methods which
	  return int to returning bool if they are success/faul results.

	* server/WorldRouter.cpp: Removed some unused debugging code.
	  Optimised heavily used code. Changed error message on
	  sending to a non-existant entity so that it is no longer
	  reported as a critical error.

	* server/ServerRouting.h, server/Connection.h,
	  server/Connection_methods.h: inlined simple methods.

	* server/Connection.cpp: Optimised frequently used code.

	* server/CommClient.h: Simplified read method so it no
	  longer checks status redundantly.

	* common/BaseEntity.h, rulesets/Thing.h, rulesets/Entity.h: Added
	  comments explaing purpose of classes.

	* rulesets/Thing.cpp: Added detailed comments, and removed unnecessary
	  initialisation of some attributes.

	* rulesets/PythonMindScript.cpp: Removed redundant NULL check.

	* rulesets/MemMap.h: Added inlines for inlined methods.

	* rulesets/Entity.h, common/BaseEntity.h: Moved seq from BaseEntity
	  to Entity as it does not apply to Out Of Game objects.

	* rulesets/Entity.cpp: Added in stamp/seq attribute. Nade name
	  attribute optional.

	* rulesets/Character.cpp: Simplified some op handling code
	  to make it more readable and hopefully faster. Added comments
	  explaining movement, removed unused commented out code, and
	  removed some unnecessary debugging code.

	* common/operations.h: Explanatory comments.

	* common/*.h: Re-wrote extended operations to fit in
	  with Atlas-C++ 0.4.2 conventions.

	* common/log.*: Commented out unused logging code.

Al Riddoch  <alriddoch@zepler.org>

This code will no longer build against the last release of Atlas-C++ 0.4
Please use cvs Atlas-C++ stable branch.
2001-05-14 17:25:32 +00:00
Al Riddoch
279cf466e0 * Added handling of action operations to operation handling core.
Al Riddoch  <alriddoch@zepler.org>
2001-05-03 23:15:13 +00:00
Al Riddoch
3ac20e3443 * common/persistance.cpp, server/Admin.cpp: Modified database loading
of world entities so that it is done hierarchically starting
	  with the top level container.

	* rulesets/Entity.cpp, rulesets/Character.cpp: Added some needed
	  attributes to those added to Atlas Objects when converting in
	  game entities.

Al Riddoch  <alriddoch@zepler.org>
2001-04-19 11:36:11 +00:00
Al Riddoch
a303326964 * Changed many return statements to match convention.
* rulesets/Thing.cpp: Tweaked ranges code in movement to cut
	  down CPU time used.

	* common/BaseEntity.cpp: Re-ordered opEnumerate so that most
	  frequently used ops are detected soonest.

	* modules/WorldTime.h/.cpp: Moved WorldTime to modules directory.

Al Riddoch  <alriddoch@zepler.org>
2001-04-17 10:14:20 +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