Commit graph

303 commits

Author SHA1 Message Date
Erik Ogenvik
8cfe2ba0eb Altered signature to prevent ambiguity. 2016-06-26 20:13:31 +02:00
Erik Ogenvik
ca3588041a Affect position directly.
No need to use an external transform for this kind of
ajustment.
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
d7bf27d180 Take plantable adjustment into account.
When an entity which is "planted" is adjusted, we also look
for if there's any offset specified for the height adjustment.
2016-06-26 19:08:54 +02:00
Erik Ogenvik
e9513169e6 Start visibility test from observer for broadcasts. 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
dd352ec759 Refactor ai client to use op dispatch. 2015-05-24 11:25:08 +02:00
Erik Ogenvik
b4572d67e6 Moved operation dispatch to separate class.
So it can better be reused.
2015-05-24 11:25:08 +02:00
Erik Ogenvik
766f4e361b Apply time multiplicator when calculating time. 2015-04-09 13:44:46 +02:00
Erik Ogenvik
ec9cad7eab Update monitors after ops have been handled. 2015-04-09 10:57:45 +02:00
Erik Ogenvik
4e9419c564 Make sure to always process any immediate ops first.
We need to check for immediate ops in each iteration, since these might
have been added as a result of the last op.
2015-04-08 23:25:11 +02:00
Erik Ogenvik
d2d4d4ba2f Use for each iteration. 2015-04-08 19:16:54 +02:00
Erik Ogenvik
49e4e26bd6 Update monitors at more correct time. 2015-04-08 19:16:54 +02:00
Erik Ogenvik
e05c35dea6 Fixed issue with queue altered while iterating.
If the operation results in more operations being pushed onto the
queue, this can in some cases invalidate the reference, leading to
segfaults.
2015-04-08 19:16:53 +02:00
Erik Ogenvik
65a1cff8f2 Print queue ops in debug mode. 2015-04-06 00:57:13 +02:00
Erik Ogenvik
a93bd55199 Add metrics for operations queue size. 2015-04-05 22:04:30 +02:00
Erik Ogenvik
23e9eb8ff8 Fixed issue with not checking domain. 2014-09-15 21:11:36 +02:00
Erik Ogenvik
dbf1a9e345 Let the Domain determine broadcast visibility. 2014-09-15 21:11:36 +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
3b295ca0a1 Added concept of a default entity.
Instead of the root entity always being the default one (for new
entities being created etc.) we now can specify another entity which is
the default one.
2014-08-27 22:17:09 +02:00
Erik Ogenvik
d0d7690cfb Removed obsolete method. 2014-02-04 12:25:49 +01:00
Erik Ogenvik
f7b242fe8a Make the main loop more efficient.
Whenever there's no work to be done we should wait on IO. This makes the
process responsive while keeping the amount of CPU used down.
2014-02-01 21:15:53 +01:00
Erik Ogenvik
79c7a6f057 Fix issue with stale time values.
Don't keep the time in field, updated only at poll requests. Instead
calculate it when it's needed.
This fixes an old bug where all client movements were slightly
incorrect. The time was only recalculated at WorldRouter::poll calls. However,
when polling for IO the process waited up to 100 milliseconds. That
meant that any client received operation would get an on average 50
milliseconds offset in it's registered time. The result of this was that
most Move operations would be slightly incorrect, resulting in jerky
movement.
2014-02-01 20:24:45 +01:00
Erik Ogenvik
64deae5519 Fix slightly incorrect op counting.
The op count was increased even if there was no ops to dispatch.
2014-01-31 23:22:18 +01:00
Erik Ogenvik
18d5bccf14 Use std::queue instances for the op queues.
Since they are queues after all.
2014-01-31 23:20:22 +01:00
Erik Ogenvik
226c3f601b Removed some minor redundancy. 2014-01-31 23:12:27 +01:00
Erik Ogenvik
312a7efedd Use a priority queue for operations.
Since they are sorted by seconds anyway a priority queue is more
suitable.
2014-01-31 23:04:33 +01:00
Erik Ogenvik
6bcfcb2c11 Moved spawn filtering to Account. 2014-01-24 12:29:25 +01:00
Erik Ogenvik
10364de724 Only send spawn points with character_types.
I.e. those spawn points which allows for characters to be created.
2014-01-24 08:54:36 +01:00
Erik Ogenvik
9307b0dfc6 Fixed issue with invalid spawn points.
Since the queues weren't queues until after the destructor had run,
there was a risk of a spawn entity being deleted later on, leading to it
referencing invalid spawns since m_spawns weren't cleared.
2014-01-21 21:05:49 +01:00
Erik Ogenvik
88000ef7cc Fixed memory leak. 2014-01-20 18:38:36 +01:00
Erik Ogenvik
ce25a1d231 Added method for removing spawn points. 2013-11-24 15:01:38 +01:00
Erik Ogenvik
4778aa70b3 Fixed issue with relayed deletion ops and segfault. 2013-11-20 15:09:09 +01:00
Erik Ogenvik
328ba969fe Make spawns use entities and archetypes.
There's no reason to use the hacked in "contains" feature for creating
inventory. Instead we can rely on the Archtype features. Any entity
declaration for which we also want inventory created should use an
archetype.
The change is that the "contains" and "character_types" attributes are
removed. Instead there's a "entities" attribute, which is a map. The
keys are the names of the entities as seen to the client, and the values
are the entity specifications.
2013-11-16 22:55:47 +01:00
Erik Ogenvik
edc5fd604b Added property for respawning entity.
The "respawning" property makes an entity respawn instead of being
deleted. It intercepts the Delete op and instead of deleting the entity
it moves it to the specified spawn point.
A typical use case of this is to place the property on any user
controlled entity, thus making sure that it's never deleted and istead
respawned when killed or defeated.
2013-11-16 21:05:45 +01: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
b054382f2a Add "archetype" as new type.
An archetype is used for creating new entities. It contains one or many
definitions for entities, along with relationship between them. It also
contains any extra data needed for a world simultion, such as thoughts
and knowledge.
Archetypes should be seen as blueprints for entity types, as they
describe how new one should be composed. They are created just as
regular entities, using the existing Create op functionality.
As an example, there should be one "human" entity type, with archetypes
such as "settler", "merchant", "soldier" etc. This differs from the
current setup where each of these are separate entity types.
2013-11-15 21:39:35 +01:00
Erik Ogenvik
8e9fe41fcf Provide better error logging. 2013-09-08 23:25:40 +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 Hjortsberg
6da14d3f62 Added a suspend world feature.
While in suspended state all "Tick" ops will be placed in a special queue
and not delivered until the world is resumed.

This is of most use for world authors who want to edit the world and
not worry about entities being altered.
2013-03-31 20:41:19 +02: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
7fd84c549d Fix a memory leak 2012-12-28 13:38:50 +00:00
Alistair Riddoch
a46a97a702 Check for errors setting up spawn 2012-12-27 23:06:16 +00:00
Alistair Riddoch
d67e092a0e Separate spawn setup code from the constructor 2012-12-27 23:02:04 +00:00
Alistair Riddoch
55c877dbf8 Fix incorrect map iterator usage 2012-12-24 10:50:44 +00:00
Alistair Riddoch
82054eb5ec Fix unsafe missuse of reference 2012-12-22 13:14:10 +00:00
Alistair Riddoch
68bd0c6e25 Refactor TaskFactory for more flexible activation matching
We can now match the target based on different critea by configuring the
factory to do different checks
2011-12-06 10:07:25 +00:00
Alistair Riddoch
eb9c58c153 Refactor the task setup interface to use LocatedEntity 2011-12-02 23:42:24 +00:00
Alistair Riddoch
e949f36c6c Use the new class for time updates 2011-10-31 11:19:33 +01:00
Alistair Riddoch
ac37383d8a Convery all the property get functions 2011-09-29 17:36:26 +01:00