Ocean Village - A dev blog

Morning bite - Complexity

November 15, 2019 - Friday morning

So turns out the recycler stuff didn't take all that long. It was mostly just dealing with NavMeshAgent and getting the correct order of positioning commands.

There's a little more to be done here, but I'm going to start on the meat of the game early. The simulation builds on top of a few fundamental actions residents can take. So far, these are:

  • WalkTo (a building)
  • FindA (building type matching a condition)
  • Rest
  • Work
  • AssignHome
  • AssignWork

These basic actions are organized into Tasks which determine which action to execute after the last one finishes. I'll probably write more about how Activities are structured later - but in short each resident's behaviors are contained in an Activity and it's just a big nested state machine.

Actions I'll need to add next:

  • BuyA (resource amount)
  • CarryA (resource amount)
  • DeliverA (resource pallet)
  • CheckShoppingList (resource amount)*

*I'm not sold on the name, but the idea is this would be a shopping list attached to a House.

I'll also need to add ticking buildings. Currently when residents work at a building, they add to the work done at the building but this doesn't do anything. Once the work done reaches a certain amount for a building, during its tick that work will be converted to a resource.


I thought about how I'd like to structure building discovery (as in, which building a resident ends up with when they FindA). Right now - it's just whichever one Map.tryPick ends up with.

One approach could be to have buildings know about each other, and residents only ask buildings where other buildings are rather than each resident trying to check against every known building each time they try to FindA something. This in effect turns every building into a local cache of buildings.

The process would be something like:

  1. Resident wants to find a restaurant while they're at work
  2. They ask the work building which restaurants it knows about
    • If empty
      • do their own search and report the results to their current occupied building
    • If a result doesn't exist anymore
      • notify the building to remove it from the list
      • repeat step
  3. Go eat

I'll also need to add a new building - Store. Right now, the simulation just has House and Industry. This store needs to be able to produce Tasks, which can be assigned to and progressed by any Resident that works there.


It looks like the work for me this weekend:

  • The new actions (4)
  • Building ticks (work done -> resources)
  • Building tasks (assignable to and progressed by Residents working there)

I forgot that I'm traveling next week, so whatever I get through this weekend is going to be it for the week!


Say hi! Enable JS to see my email (or send to this domain)