Commit graph

316 commits

Author SHA1 Message Date
Erik Ogenvik
36cbf54578 Remove unused code. 2018-02-20 22:26:27 +01:00
Erik Ogenvik
e7fa53214b Use nullptr instead of NULL. 2018-02-06 13:45:11 +01:00
Erik Ogenvik
7fb146eb36 Standardize installation of standard types.
This way the base types are exposed to clients.
2018-02-06 13:45:10 +01:00
Erik Ogenvik
4d530e25e4 Move domain property Entity.
And rename and fixup smaller things.
2017-07-25 23:40:39 +02:00
Erik Ogenvik
0286bcd47d Replace "parents" with "parent". 2017-07-24 15:05:18 +02:00
Erik Ogenvik
b40c613a78 Improve handling of broadcasts.
Use the domains for determining broadcasts.
2017-06-24 21:47:43 +02:00
Erik Ogenvik
b9cdbbbd1a Handle inventory domain better. 2017-06-12 18:01:52 +02:00
Erik Ogenvik
7aaa9b9ba7 Optimize includes. 2017-03-19 21:36:52 +01:00
Erik Ogenvik
0a133c75bc Handle broadcasts earlier.
Instead of handling broadcasts when the op is dispatched, handle them
when the op is first added to the world router.
This way we can better handle the case where an entity is deleted, as well
as make away with storage of perceptibles entities in the world router.
2016-12-15 18:27:42 +01:00
Erik Ogenvik
fd34c235e4 Remove "transforms" and "modespec" property.
These properties didn't work out when we moved to a physics based world.
Instead we've introduced the properties "planted-offset" and "planted-scaled-offset".
These properties takes a float and specified vertical offset for planted entities.

Likewise with "planted-rotation" which specifies a rotation applied for planted entities.
"active-rotation" keeps track of any applied rotation.
2016-12-15 18:27:42 +01:00
Erik Ogenvik
5c665ca0d4 Rename method with changed meaning. 2016-12-15 18:27:42 +01:00
Erik Ogenvik
b77bfbe013 Remove old functionality for adjusting height. 2016-12-15 18:27:42 +01:00
Erik Ogenvik
5754a5dfa1 Initial work on Bullet powered physical domains. 2016-12-15 18:27:42 +01:00
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