Search Unity

Games Welcome to Beacon Pines!

Discussion in 'Works In Progress' started by hidingspot, Sep 10, 2019.

  1. hidingspot

    hidingspot

    Joined:
    Apr 27, 2011
    Posts:
    64
    weep_wood_1.png

    twitter: https://twitter.com/hidingspotgames
    webpage: https://hidingspotgames.com/wbp.html

    Overview
    Welcome to Beacon Pines! is an interactive fiction deck building game.
    You play as Luka: a sweet, sassy, and strange little deer-boy. But just how sweet, sassy, and strange he gets is up to you. Explore and interact with the world to collect cards. Each card has an adjective written on it.
    multiple.png
    Unlike most adventure games, it's not a matter of choosing between lines of pre-written dialog. Instead, you’re often prompted to play a card from your deck to fill in a missing word in the story. Your choice will affect Luka's personality, which will in turn affect how he treats those around him.

    Tech
    There's some fun tech written for the game that I'll share in following posts. Here's a sneak peak at the procedural wind blowing around a big tree in the game

     
    Last edited: Sep 10, 2019
    owlhowell likes this.
  2. hidingspot

    hidingspot

    Joined:
    Apr 27, 2011
    Posts:
    64
    As promised, here's a quick rundown of how the procedural wind above is implemented. While this sort of effect might also be achieved in a shader, I chose to utilize the new Unity 2d animation/rigging packages for ease of designing wind around different types of trees. This way, it's super easy to rig up bones in a tree and just plug in those references to the "BoneWind" script. The rest is taken care of by the code:
    wind_bones.PNG
    Here's a debug view of somewhat exaggerated wind to better show the effect


    The operative code is simple: just loop through the transforms of the bones you want affected by wind, and apply some good-old-fashioned perlin noise:
    Code (CSharp):
    1.     void Rotate(Bone bone)
    2.     {
    3.         var t = bone.transform;
    4.         var windPos = t.position * windDensity + Vector2.one * Time.time * windSpeed;
    5.         var wind = Mathf.PerlinNoise(windPos.x, windPos.y) * 2f - 1f;
    6.         var angleOffset = wind * windStrength;
    7.         Debug.DrawLine(t.position, t.position + Vector3.right * angleOffset);
    8.         Vector3 angles = t.localEulerAngles;
    9.         angles.z = bone.baseAngle + angleOffset;
    10.         t.localEulerAngles = angles;
    11.     }
    12.  
    13.     struct Bone
    14.     {
    15.         public Transform transform;
    16.         public float baseAngle;
    17.     }
    The windStrength (float), windSpeed (float), and windDensity (Vec2) are all exposed to the editor for easy tweaking. One nice-to-have addition which for now doesn't quite warrant the extra time is additional layers/octaves of noise.