I'm working on a farming system for a Harvest Moon clone and I was hoping for some guidance on a few mechanics!

Right now I have a crop system set up with Tagged Machine components, and when a day passes, it triggers an event and the crops grow. Neat! But when I place the crops, right now they're just set to spawn on top of the player, so it doesn't line up neatly, like in a farm game.

There's a few things I want to do that would involve selecting a tile in front of me -- planting crops on a grid, watering tiles, tilling the soil, etc. I figured I can make a bunch of game objects that take the place of each tile, and when they are interacted with by items (like seeds) and equipment (like a watering can).

I'm having trouble making this a reality though. I tried a few selected data-y things, like using a Select Game Objects node to find a "plot" game object, then Spawn Prefab to spawn the plant on that position -- but it's just spawning the prefab on 0,0,0 each time. I figure the data is not actually be transferred to where the plant should be spawned, but I'm not sure why.

I also know the battle grid system can handle a lot of this stuff, but since it's a farm game it doesn't make much since to use a battle grid here, since as far as I can tell you have to be in a battle to utilize those tools. Is there any way to use ORK's grid mechanics out of battle? I'd love to have the little grid selector cursor out, be able to select the tile in front of me, and water it/till it/plant a plant on it/etc.

Any advice?

  • Well, you could make the farming a battle and handle this via battle actions (abilities, items) targeting cells ...

    Otherwise, you can do something like this:
    - each 'plot' is a game object, e.g. with Object Variables component to handle it's state stuff, also needs a collider to be able to 'detect it'
    - your farming mechanics use a Raycast node to get the plot in front of the player (or wherever you want to handle it)
    - afterwards, just do stuff on the plot you found via the raycast

    With a good layer setup, e.g. plots being on their own layer and only raycasting on that layer, it shouldn't be too difficult to handle.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.