borrascador / rain

Demo for upcoming rainforest game.
https://borrascador.github.io/rain/
0 stars 1 forks source link

Foraging system #312

Open borrascador opened 5 years ago

borrascador commented 5 years ago

Design will be decided on Monday 8/12 over the phone, but here are some preliminary notes:

This issue should specify the simplest initial implementation of foraging. Future issues will expand the feature.

These next points are probably not part of the simplest initial implementation. But could be desirable right away regardless.

borrascador commented 5 years ago

I will design how to semi-randomly generate foraging results. Inputs will be:

Output will be some selection of plants in varying amounts. Some will be edible, others will not, a few will be poisonous. The above inputs will help determine the specific kinds of plants and how much of each plant will be present.

I'll come up with something a little more specific and add it here. Also a space to collaborate and give feedback :artificial_satellite:

borrascador commented 4 years ago

Todo: design messaging protocol for foraging

borrascador commented 4 years ago

Protocol consists of a simple message with eventType: forage to trigger foraging on the current tile.

{
  "type": "EVENT_REQUEST",
  "payload": {
    "eventType": "forage"
  }
}

If foraging takes place on a tile where foraging was attempted in the last 30 minutes (I'm picking a number, but it can be a different number) then foraging will fail. Otherwise, there is a 70% chance of failure, a 20% chance of obtaining something inedible, and a 10% chance of obtaining food. Right now the foods we have icons for are tomato, potato, yucca, black bean, lima bean, and corn. Right now the inedible items we can forage are tomato seeds and sticks.

This is kind of getting into how to pick up items off the ground -- I'm thinking that the UI can either add the items to your inventory automatically, or it can display a treasure chest type UI, where the player sees what was found and can either drag it into their inventory or ignore it to make it disappear. If we go the automatic route, we could add a message to the chat window listing what was found -- popups are a little too intrusive for this I think. If we go the treasure chest popup route, then it will bring us closer to a looting UI on the client-side at least, but will also require an extra data structure.

So it seems that I'm pretty sure about the request message and the payouts for foraging, but I'm less sure about the response payload format. What are your thoughts on this Dan?

borrascador commented 4 years ago

Todo: define which items are in which categories: edible, inedible, poisonous and mark them as such.

amos1814 commented 4 years ago

New tiles array will look like

"tiles": [
         {
            "elevation": 0,
            "yPos": 0,
            "habitat": 0,
            "xPos": 0,
            "trees": [{
                  "yCoord": int,
                  "xCoord": int,
                  "id": int
               }
                   ...
               ]
            "loot": [{
                  "yCoord": int,
                  "xCoord": int,
                  "items": [{
                      "id": int,
                      "quantity": int}
                      ...
                   ]
                }
                ...
           ]
        }
        ...       
]