Commit graph

219 commits

Author SHA1 Message Date
Erik Ogenvik
8cfe2ba0eb Altered signature to prevent ambiguity. 2016-06-26 20:13:31 +02:00
Erik Ogenvik
d5d11df11e Let "transforms" property determine pos and orient
Instead of directly setting position and orientation we've now
added a "transforms" property. This property contains zero or many
transformations. The result of these is what drives changes to an
entity's position and orientation.
By cleanly separate disrete transformations we can more easily undo
or alter them. This allows us to do things where the position or
orientation of an entity is affected by other properties, or other
entities.

The client protocol is intact. Changes to position and orientation is
still sent the same way, by specifying "pos" and "orientation". However,
these values will now not be written directly to corresponding values on
 the entity. Instead they will first be written to the "transforms" property,
with the final values being a result of combining all data in the property.
2016-06-26 19:11:15 +02:00
Erik Ogenvik
889695af07 Provide const domain accessor. 2016-06-22 17:29:27 +02:00
Erik Ogenvik
4f368a6fbc Let parent domain decide visibility and movement.
When visibility is determined, we always query the parent domain, and
never any ancestor domain.

The idea is to make the system more easy to follow.
2016-06-22 17:29:27 +02:00
Erik Ogenvik
c21a3d8c7c Store instance property data separately.
In some cases you want to store property data for each instance. Often
you'll use member data on the entities themselves for this. But in some
cases you don't want to bloat the entity class with data for seldomly
used properties.
In these cases you can instead use the PropertyInstanceState class, and
keep a static instance of this per property.
2015-04-28 20:56:15 +02:00
Erik Ogenvik
6c7001724f Fixed typos. 2015-04-28 20:54:30 +02:00
Erik Ogenvik
fbd11577fe Don't send type attributes.
This is a rather big change for the protocol, but by now there shouldn't
be any clients left that can't handle this.
Basically, since the client already has the type and knows the default
properties from that, there's no need to resend them for each entity.
This should decrease the amount of data needed to be sent from the
server.

Note that there might be some lingering issues with the AI code; that
has to be investigated further.
2015-04-11 22:01:14 +02:00
Erik Ogenvik
b504837cdb Properly swap properties.
When an instance property is created as a copy of a type property, the
former needs to be installed and the latter removed.
2015-04-08 23:22:23 +02:00
Erik Ogenvik
4a43d78de6 Monitor the number of active entitites per type.
This is very useful for monitoring, as it allows us to recognize
problematic patterns.
2015-04-08 19:16:54 +02:00
Erik Ogenvik
624f1d6d27 Removed unused variable. 2014-09-23 22:42:51 +02:00
Erik Ogenvik
f837532dd8 Added methods for adding and removing children.
Virtual so that they can be caught in subclasses. This is mainly meant
for the Limbo entity.
2014-09-20 22:09:00 +02:00
Erik Ogenvik
f7c43f00ed Allow multiple delegates per operation.
Previously we only allows one delegate per operation. The one that was
installed first was called; all subsequent were ignored. This doesn't
work well with how we're moving to putting more and more functionality
in properties though, so we'll have to allow for multiple delegates per
operation.
I'm not entirely happy of how this currently works. We now just call all
of the delegates, in stochastic order. If any delegate blocks the
operation it doesn't prevent other delegates from getting it too.
But perhaps that's the only way to do it without adding additional
complexity.
2014-09-18 21:45:35 +02:00
Erik Ogenvik
d02ddca0d0 Moved collision detection to the Domain.
Collision detection should fully be handled by the domain, as should
sight checking.
The plan is to let the domain keep a separate structure of all collision
geometry, optimized in something like a quad or oct tree. Since the vast
majority of geometry is static, in the sense that it very seldom moves,
the Domain should keep a flat representation of all geometry, with
precomputer meshes for fast lookup.
Similarily it should keep a separate structure, or structures, for sight
checks.
And it should of course also use Bullet for collision detection.
2014-09-18 21:45:35 +02:00
Erik Ogenvik
b171410b05 Let the domain be specified by a property.
This means that we only attach domains to entities that have the
"domain" property. The "land" entity type for example.
2014-09-15 21:11:35 +02:00
Erik Ogenvik
79d6bda7b2 Properly remove properties with delegates. 2014-08-26 21:09:02 +02:00
Erik Ogenvik
bbd73ffa13 Fixed incorrect handling of delegates.
We should only stop if the op is blocked.
2014-08-26 21:08:53 +02:00
Erik Ogenvik
9ab3a7e723 Make entities destroy themselves.
This allows for other features to preempt the destruction.
2013-11-16 13:13:49 +01:00
Erik Ogenvik
98cd97f625 Only operate on valid instances. 2013-09-13 21:07:45 +02:00
Erik Ogenvik
2c2ac52f54 Enable relayed ops for all entities.
When a relayed op is sent to an entity it's handled like any other
operation. As a relayed response a Sight of the original operation is
sent back.
2013-09-03 14:09:13 +02:00
Erik Ogenvik
cb238bd5b3 Added a relay mechanism for operations.
The relay mechanism, through the new internal Relay operation, allows
one external client to relay an operation to another external client,
and get the response back.
This can currently only be used by Creator clients. It's main use is for
mind introspection.
2013-08-16 00:03:09 +02:00
Olek Wojnar
7f9ff2246d Remove CVS $Id tags
The legacy tags are causing build issues in Debian.
2013-07-15 20:31:59 +02:00
Erik Ogenvik
835b9fadd6 Alter containered signal.
Make it not single shot. And supply the old location, as it was before
the container changed.
This is to make it more useful in general.
2013-06-15 22:53:50 +02:00
Alistair Riddoch
e9cb84388a Stop using OpNo here too 2013-02-28 15:39:59 +00:00
Alistair Riddoch
e89ae282f6 Stop using OpNo typedef 2013-02-28 15:27:54 +00:00
Alistair Riddoch
5eceba40cf Remove unused handler mechanism 2013-02-14 10:01:20 +00:00
Alistair Riddoch
3d6f39cdee Modify Property install method to take name
This change also switches DecaysProperty to using delegates as a proof of
concept.
2013-02-13 00:45:36 +00:00
Alistair Riddoch
6a052e7e83 Fix return value warnings 2013-02-12 16:29:56 +00:00
Alistair Riddoch
9748d30fb4 Add calling delegates. 2013-02-10 02:37:16 +00:00
Alistair Riddoch
4a9c7078f7 Refactor to use LocatedEntity as base class
All IG code should use the interface of LocatedEntity when dealing
with any entity, rather than sometimes requiring Entity. Add virtual
functions to the interface where required, and modify all other interfaces
to stop them using Entity. This makes the code way cleaner, and much better
de-coupled.
2013-01-17 10:17:07 +00:00
Alistair Riddoch
4e66987bad Consolidate flags into one place 2013-01-14 09:59:54 +00:00
Alistair Riddoch
c8842f7c27 Avoid hitting the PropertyManager in setAttr
In the case where the property is already in defaults, it is cheaper to
use copy to avoid the lookup overhead of PropertyManager, and it is
already necessary to check the defaults to determine whether install()
is called.
2013-01-13 23:49:20 +00:00
Alistair Riddoch
89ddc699df De-duplicate code when setting attributes 2013-01-13 23:34:51 +00:00
Alistair Riddoch
66c850cbde Re-order to make this function cleaner 2013-01-13 13:14:05 +00:00
Alistair Riddoch
b69e185b83 Make formatting a little clearer 2013-01-13 00:07:35 +00:00
Alistair Riddoch
c56b8298f4 Use copy method for instantiating a default property 2013-01-12 23:56:25 +00:00
Alistair Riddoch
8b53f5e041 Add interface for property delegates 2013-01-05 00:47:41 +00:00
Alistair Riddoch
71cbcdcfc1 Modify externalOperation to include Link
The Link reference provided is the object allowing direct communication
back to the external source of the operation. This allows us to handle
things more cleanly in some cases.
2012-12-04 20:39:35 +00:00
Alistair Riddoch
338edbcbd5 Document Router interface
We provide implementations of the pure virtual methods so they can
be documented here without cluttering the header.
2012-12-02 22:14:04 +00:00
Alistair Riddoch
5d06a0195c Add handlers for Get and Info to the core interface 2012-06-29 14:54:45 -07:00
Alistair Riddoch
f73f9f2e9c Delete entity script when destroy is called
The C++ object representing this object may persist for a while as we
need it later for broadcasting ops from it as it was destroyed. Ops
in the queue from it will also hold a reference. The Python object should
be deleted right away though, as nothing else should hold a reference, and
things with weak references should find out immediately that it is gone.
2011-10-15 02:05:51 +01:00
Alistair Riddoch
102d59ff53 Stop using noScript object for scriptless objects 2011-10-13 14:20:46 +01:00
Alistair Riddoch
a3f7327d20 Add comments explaining how decRef()ing works 2011-10-03 17:15:11 +01:00
Alistair Riddoch
a51fe0fae0 Return the property affected when setAttr is called 2011-02-27 23:56:11 +00:00
Alistair Riddoch
8b83d02a3f Fix a crash when generating Atlas representation of Entity with no type. 2009-11-17 12:33:35 +00:00
Alistair Riddoch
ea1be625e5 Modify setProperty to return a pointer to the new property 2009-11-16 03:14:08 +00:00
Alistair Riddoch
d4a4ea33c2 Add brief doc comments for all operation dispatch handlers. 2009-08-25 00:53:28 +01:00
Alistair Riddoch
379a687776 Add Use operations to those passed around by default in-game. 2009-07-24 15:43:44 +01:00
Alistair Riddoch
01f0c2d7b3 Remove unnecessary dynamic cast. 2009-05-27 22:08:00 +01:00
Alistair Riddoch
8ded02b089 Add method to get the movement domain for an Entity 2009-05-12 23:27:40 +01:00
Al Riddoch
ab54d0fea2 2009-02-02 Al Riddoch <alriddoch@googlemail.com>
* common/Identified.cpp, common/Identified.h:
	  Flatten down the base classes into one called Router.

	* client/CharacterClient.cpp, client/CreatorClient.cpp,
	  rulesets/BaseMind.cpp, rulesets/Character.cpp,
	  rulesets/Creator.cpp, rulesets/Entity.cpp,
	  rulesets/LocatedEntity.cpp, rulesets/MemEntity.cpp,
	  rulesets/Plant.cpp, rulesets/Stackable.cpp,
	  rulesets/Thing.cpp, rulesets/World.cpp,
	  server/Account.cpp, server/Admin.cpp,
	  server/Connection.cpp, server/ExternalMind.cpp,
	  server/Lobby.cpp, server/Master.cpp,
	  server/Peer.cpp, server/Player.cpp,
	  server/ServerRouting.cpp, server/SlaveClientConnection.cpp,
	  server/TrustedConnection.cpp, tests/LocatedEntitytest.cpp,
	  tests/ThingupdatePropertiestest.cpp: Update all the operation
	  routing classes to use the modified base class correctly.
2009-02-02 02:28:45 +00:00