Dallinger / Griduniverse

Welcome to the Griduniverse.
7 stars 3 forks source link

Experimenters can define autonomous transitions: 5 points #271

Open nataliavelez opened 1 year ago

nataliavelez commented 1 year ago

As an experimenter, I can define transitions that occur autonomously (without player input) after a given delay (in seconds). This feature would replace existing food_maturation functionality in the game.

Example: Given the following transition structure:

transitions:
  - actor_start: bread_dough
    actor_end: null
    target_start: oven
    target_end: oven_baking_bread

  - actor_start: null
    actor_end: null
    target_start: oven_baking_bread
    target_end: oven_with_bread
    autonomous: true
    delay: 5 

   - actor_start: null
    actor_end: bread
    target_start: oven_with_bread
    target_end: oven

Players should be able to place bread dough in an oven, wait 5s for it to bake, and then take baked bread out of the oven.

nataliavelez commented 1 year ago

Just to follow up on a question @alecpm had during the planning meeting: If possible, I think it would be nice if players could interact with objects before an autonomous transition completes. In the oven example above, players wouldn't be able to interact with oven_baking_bread until it's transformed to oven_with_bread because there are simply no other transitions involving oven_baking_bread. But since this functionality is pretty general, it would be nice if the same feature could also be used to support, e.g., picking plants at different stages of maturity.

For example, the transition structure below defines a game where sunflowers pass through life stages (budding, blooming, dried) in 5s intervals. When sunflowers are blooming (sunflower_bloom), players can interact with them to get flowers. Conversely, when sunflowers are dried out (sunflower_dried), players can interact with them to harvest seeds.

transitions:
  - actor_start: null
    actor_end: null
    target_start: sunflower_sprout
    target_end: sunflower_bud
    autonomous: true
    delay: 5 

  - actor_start: null
    actor_end: null
    target_start: sunflower_bud
    target_end: sunflower_bloom
    autonomous: true
    delay: 5 

  - actor_start: null
    actor_end: null
    target_start: sunflower_bloom
    target_end: sunflower_dried
    autonomous: true
    delay: 5 

  - actor_start: null
    actor_end: sunflower
    target_start: sunflower_bloom
    target_end: null

  - actor_start: null
    actor_end: sunflower_seeds
    target_start: sunflower_dried
    target_end: null

Would something like this be feasible?

alecpm commented 1 year ago

I think this sounds very workable and only the timer part is a significant deviation from the current setup. However, I think we may want something like autonomous_transition: $id as a property of the item to avoid needing to search for autonomous transitions for every object on the grid, and also avoid the ambiguity that would result from multiple autonomous transitions with the same target_start. We'll also need to make sure to skip any autonomous transitions when looking up the transitions available for a user action.

nataliavelez commented 1 year ago

That makes sense - I'm happy to make it an item property instead!

silviot commented 1 year ago

@nataliavelez This work is now merged and testable