Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add object actions #287

Open
jwaa opened this issue May 14, 2021 · 2 comments
Open

Add object actions #287

jwaa opened this issue May 14, 2021 · 2 comments
Assignees
Labels
core Work related to the core functionality feature Work for a new feature

Comments

@jwaa
Copy link
Member

jwaa commented May 14, 2021

Is your feature request related to a problem? Please describe.
Currently atleast two MATRX worlds needed to add new objects to the world while the world is running. Currently the workaround is a custom action, though since the increasing commonality I propose to add it to MATRX.

Describe the solution you would like
An AddObject action, such as the one proposed in #286.

It use could be something like (inside the AgentBrain.decide_on_action method):

def decide_on_action(self, state):
    ...
    action = AddObject.__name__
    obj_to_add = EnvObject(location=(), name="New object", class_callable=EnvObject)
    action_args = {object: obj_to_add, add_range: 5, duration_in_ticks: 1}
    return action, action_args

Where the action arguments behave as follows:

  • obj_to_add: An object inheriting from EnvObject, including any custom object.
  • add_range: The range in which this agent can add objects (in the above example 5 means that the agent can only add objects that are within a Euclidean distance of 5 its location). Results in a failed action when the location of the object is out of range. This follows a similar behaviour as the other object actions such as GrabObject and RemoveObject.
  • duration_in_ticks: Similar as always. It is the number of ticks the agent will be busy with doing this action. In the above example the value of 1 means that it will be busy adding this object for this and next tick.

Describe alternatives you have considered
A common solution now is to create your own action. Another option is to build in the (long planned) Event System that could handle this. However the former is not applicable anymore as more people need it and the latter should not be misused for this (and works with Action anyway).

Additional context
A response to issue #286

@jwaa jwaa added the request A request for a new feature label May 14, 2021
@jwaa
Copy link
Member Author

jwaa commented May 14, 2021

@thaije Agree with the usage example here? If so let's try to incorporate it in v2.1

@jwaa jwaa added this to the Release v2.1.0 milestone May 14, 2021
@thaije
Copy link
Collaborator

thaije commented May 15, 2021

Yes the example for adding object looks fine. Within that action we should also do the checks for valid placement etc. Also, I would make the add_range optional and have it set to infinity by default.
I would suggest also giving the user the ability to add an agent on the fly if possible. This requires some extra or other checks, so a different action named AddAgent maybe?

@jwaa jwaa self-assigned this May 16, 2021
@jwaa jwaa added feature Work for a new feature core Work related to the core functionality and removed request A request for a new feature labels May 16, 2021
@thaije thaije removed this from the Release v2.1.0 milestone May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Work related to the core functionality feature Work for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants