Commit graph

2764 commits

Author SHA1 Message Date
Erik Ogenvik
423b0dfcf0 For now set velocity directly, preparing for Bullet. 2016-06-26 21:50:10 +02:00
Erik Ogenvik
2f55d5d82b Fixed various compile issues after rebase. 2016-06-26 21:50:10 +02:00
Erik Ogenvik
1320c836d0 Added a Propel property, describing propel force.
This is mainly the force used to propel characters forward. I.e.
walking, running and so on.
For now it's not activated, since we rely on proper physics to be
implemented first.
2016-06-26 20:17:18 +02:00
Erik Ogenvik
cb493811b3 Added "forces" property.
This property describes all external forces affecting the entity.
2016-06-26 20:17:18 +02:00
Erik Ogenvik
9cf67cb412 Added tests for Mode and ModeSpec properties. 2016-06-26 20:17:18 +02:00
Erik Ogenvik
3d57e884cd Offset transforms when updating from Move.
The pos and orientation sent is after transformations have
been apply, so in order to set the correct entity transformation
we need to remove any external transformations from these values
first.
2016-06-26 20:17:18 +02:00
Erik Ogenvik
84923d0c39 Rotate in local space. 2016-06-26 20:17:18 +02:00
Erik Ogenvik
12a38b3d0f Added a mode specification property.
This property tells how the entity should behave when put into
different modes. Currently we only allow for specific transformations
to occur.

The mode specifications are registed in properties where "mode-" forms
a prefix, and the mode a suffix. For example, "mode-planted".
This also does away with the "plantable" property.
2016-06-26 20:17:18 +02:00
Erik Ogenvik
923f037b13 Introduce a separate Transforms class.
Used to hold transformation data, and serializing to Atlas.
2016-06-26 20:16:48 +02:00
Erik Ogenvik
668c6edd0c Allow properties to alter other properties.
In order for this to work, we must always issue an Update
op after a Set op, so that we can handle any updated properties too.
We also have to add a new Entity flag to handle when the location
has been dirtied, since this isn't handled by normal properties.
2016-06-26 20:16:48 +02:00
Erik Ogenvik
55d6107efc Allow Set operations from the Creator.
We should really disable random Set operations from
Characters though...
2016-06-26 20:13:31 +02:00
Erik Ogenvik
4d4cdbef23 Fixed tests after transforms property. 2016-06-26 20:13:31 +02: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
de4c3b9347 Allow properties to specify keys.
In almost all instances most properties will only be used
for a specific key. To make things easier and less error prone
we've introduced the trait "property_name", which when available
allows us to refer to a property only by class, and not having
to specify the key it's bound to.
2016-06-26 19:08:54 +02:00
Erik Ogenvik
600d8d0a8b Any cultivated plant should be planted. 2016-06-26 19:08:54 +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
219d847bfd Added a "plantable" property.
This describes how entities should behave when they are put in the "planted"
specifically how they should be oriented and adjusted in vertical position.
2016-06-26 19:03:19 +02:00
Erik Ogenvik
d160211ee5 Let plants only feed if they're planted.
This introduces the new "mode" of "planted", which is
meant to be used for plants and other things that are planted in
the ground.
2016-06-26 19:02:36 +02:00
Erik Ogenvik
731383150c Improved logging and removed dead code. 2016-06-26 14:27:24 +02:00
Erik Ogenvik
c9ebbfd6c6 Added method for determining visibility.
And then use that to determine if parent locations should be shown.
2016-06-26 14:18:37 +02:00
Erik Ogenvik
4f4a204935 Turn off debug logging. 2016-06-26 14:18:18 +02:00
Erik Ogenvik
5ab3e5e61f Made logic for distance checks more sound. 2016-06-26 13:17:32 +02:00
Erik Ogenvik
889695af07 Provide const domain accessor. 2016-06-22 17:29:27 +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
72fc2d7923 Added an InventoryDomain for characters.
The Inventory domain is meant for all characters, i.e. those than can have
an "inventory".

It's a non physical domain, which means that entities contained in it won't
be affected by any physical constraints, or have physics applied to them.
Visibility for outside entities are by default forbidden unless an entity is
outfitted or wielded.
The idea is that other playes shouldn't see what's in the inventory of another
player, unless things are outfitted or wielded.
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
0a81e9897f Added a concept of goal "validity".
Calling "is_valid" checks whether the goal actually can be fulfilled.
If it can't be, False is returned.
By default all Goals return True unless a "validity" function is supplied
in the constructor.

For now we only use it for checking whether movement goals can be reached.
2016-06-08 22:03:59 +02:00
Erik Ogenvik
ec857b57e5 Handle movement goals not being reachable.
Though perhaps we should have a more general mechanism for querying
goals about their validity?
2016-06-08 21:46:37 +02:00
Erik Ogenvik
eed786758e Better log output with entity's name. 2016-06-08 21:46:37 +02:00
Erik Ogenvik
326c2f6667 Handle subgoals being None. 2016-06-08 21:46:37 +02:00
Erik Ogenvik
9ed8e75894 Swallow empty Operations being returned.
As these indicates that the mind code don't want any operations to be performed
for the tick.
2016-06-08 21:46:37 +02:00
Erik Ogenvik
2d644311cc Describe entities better in log messages. 2016-06-08 21:46:37 +02:00
Erik Ogenvik
be83ec6496 Don't remove entities.
Since they can be references from elsewhere. We need to implement
a better system of keeping references to them.
2016-05-15 23:40:45 +02:00
Erik Ogenvik
374a691735 Allow destination to be set to another entity.
This only works for entities that share the same domain.
It also allows for entities to follow other entities.
2016-04-03 21:25:39 +02:00
Erik Ogenvik
7f71d23c41 Enable terrain. 2016-03-31 21:08:12 +02:00
Erik Ogenvik
924ba32982 Added extra goals to some goals.
These are goals that can be injected to run when the parent goal
is fulfilled.
2016-03-30 22:34:44 +02:00
Erik Ogenvik
b5e7861669 Added linger and iterate goals. 2016-03-23 22:23:15 +01:00
Erik Ogenvik
4f8a76810c Spread out entities more. 2016-03-23 22:21:34 +01:00
Erik Ogenvik
48839bc8e7 Send range on to move_me goal. 2016-03-21 21:50:56 +01:00
Erik Ogenvik
9570196ffb Don't send Looks for Unseen operations.
Since we'll then enter into infinite loops.
2016-03-20 22:48:28 +01:00
Erik Ogenvik
58f3cabb73 Set both location and radius when setting destination. 2016-03-20 22:48:03 +01:00
Erik Ogenvik
68aa6d3ddc Scale desired tile amount with observer count. 2016-03-20 20:19:35 +01:00
Erik Ogenvik
988cd2f4f0 Don't send move ticks on to the mind. 2016-03-19 23:05:13 +01:00
Erik Ogenvik
372ae67743 Added some test methods for testing out steering. 2016-03-19 23:05:13 +01:00
Erik Ogenvik
d56d026ce1 Clean up awareness when entity is deleted. 2016-03-19 23:05:13 +01:00
Erik Ogenvik
fa4eb7bb0b Limit too long distances.
If the character wants to travel too far, we shouldn't try to map the whole
path straight away. Instead we'll cut down on the lenght, and increase the
acceptable radius.
This works since the AI will issue a new destination on its next Tick.
2016-03-19 23:05:13 +01:00
Erik Ogenvik
e76e0fc7ad Skip movement goals that are unreachable.
A goal is considered to be unreachable when all tiles in the awareness area
have been mapped, and no path still could be found.
2016-03-19 23:05:13 +01:00
Erik Ogenvik
16f394bf6c Better log output. 2016-03-19 23:05:13 +01:00