Commit graph

33 commits

Author SHA1 Message Date
Erik Ogenvik
72e7a5e0c2 Move resting entities along.
I.e. when an entity is moved, and there are other entities resting on
top of it, move them along too.
2018-03-09 14:37:11 +01:00
Erik Ogenvik
ca2abb94b5 Refactor how movement is handled and sent.
We've introduced the properties "speed-ground", "speed-water" and
"speed-flight" which specifies the top speed in m/s for each medium.

The "propel" attribute is now normalized, since it's multiplied with the
applicable top speed (depending on the medium, although currently we
only use the ground speed, TODO).
2018-02-11 23:22:20 +01:00
Erik Ogenvik
6e6fe3b9b6 Handle (dis)appear ops when moving between locs. 2017-06-27 21:06:07 +02:00
Erik Ogenvik
b9cdbbbd1a Handle inventory domain better. 2017-06-12 18:01:52 +02:00
Erik Ogenvik
df489ae244 Clalify interface. 2017-01-31 22:12:50 +01:00
Erik Ogenvik
6b4302dc5f Let property handle tick rate.
And other smaller fixes to the physical domain.
2017-01-27 20:39:00 +01:00
Erik Ogenvik
900dd544ea Cleaned up some smaller issues. 2016-12-15 18:27:42 +01:00
Erik Ogenvik
bd42f89527 Removed unused method. 2016-12-15 18:27:42 +01:00
Erik Ogenvik
8bea81fa21 Toggle perception in domain when it changes.
Though for now we'll never remove it once an entity becomes perceptive.
2016-12-15 18:27:42 +01:00
Erik Ogenvik
fe709529fe Synchronize visibility methods in Domain.
So that they behave the same way.
2016-12-15 18:27:42 +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
7b19e67cb8 Make sure domain updates when terrain updates. 2016-12-15 18:27:42 +01:00
Erik Ogenvik
aa88be1ea7 Make sight checks more efficient. 2016-12-15 18:27:42 +01:00
Erik Ogenvik
5d98e768c7 Refactored visibility handling.
To allow for better performance when scaling to larger worlds we can't keep
iterating though all entities when checking visibility.
Instead we now have the PhysicalDomain keep track of all entities that are
either observering something, or being observed.
Since Bullet already contains efficient structures for doing space partioning and
collision detections we'll resuse that for visibility checks.
Each entity now has a sphere of "visibility" with which each perceptive entity does
checks against.
2016-12-15 18:27:42 +01:00
Erik Ogenvik
07853ce6c2 Removed obsolete collision code. 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
b2a96d31f7 Further work on Bullet integration. 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
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
760f92f707 Alter how visibility is determined.
When checking visibility, we now use the Domains more extensively.
The base rules are:
* If an entity is a child of a domain-less entity, visiblity for the
  child is the same as for the parent.
* If an entity is a child of a domain-holding entity, visibility is
  determined by the Domain.
* Entities cannot observe things above a Domain.
* Entities can observe things below a Domain, if the Domain allows it.

These rules are not yet set in stone. We need some more time figuring out
exactly how we want visibility implemented. We're striving for a balance
between a powerful but not too complex system, with good performance.
2016-06-22 17:29:27 +02:00
Erik Ogenvik
3b1a2cb566 Make Domain an interface and provide two versions.
The "physical" world behaves like a standard world. The "void" world
however doesn't allow for neither movement nor sights.
2014-09-24 22:00:54 +02:00
Erik Ogenvik
99ce6b900c Expanded comments. 2014-09-22 20:18:04 +02:00
Erik Ogenvik
bb7d004e64 Send Disappear when moving out of domain.
It would be better to use a Broadcast of the Disappear op though, but
that would require a change so that the location is encoded in the op
which will be broadcasted. Otherwise the WorldRouter will just use the
location of the entity as it is when the op is processed, which will be
wrong for this case.
2014-09-22 20:14:41 +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
23b2b71986 Moved visibility change calculations to the domain.
Currently it just iterates over all child entities, but this should of
course be done more efficient, with spacial trees.
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
2f3ab1da18 Let the Domain handle sights.
As any world can contain multiple domains, we let the domain handle the
sights calculations.
This is a change from how this previously was done, as previously
sight checks were only done for the top level World entity. This has
changes however, so that sights checks now are done for all entities.

When determining whether an entity can be seen, the system first checks
the size of the entity against the distance from the observer. If this
check fails, the system makes exceptions if the entity in case is
outfitted or wielded.
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
Olek Wojnar
7f9ff2246d Remove CVS $Id tags
The legacy tags are causing build issues in Debian.
2013-07-15 20:31:59 +02:00
Alistair Riddoch
035f25e5dd Start work on a test movement domain class for handling collisions with bullet. 2010-08-10 00:54:25 +01:00
Alistair Riddoch
f7b062219a Make Domain a singleton, and add method to constrain height 2009-05-12 23:26:42 +01:00
Alistair Riddoch
e35a9d6873 Fill out the basics of the class 2009-05-08 15:48:19 +01:00
Alistair Riddoch
0cca7eae11 Start work on interface for movement domain code 2009-05-08 15:26:19 +01:00