In my previous post, I said I wanted to add more weather effects, like rain, so that’s one of the things I did! First I added the visual rain effect, since I figured if I couldn’t get something to look the way I liked I just wouldn’t include it in the game. So, using particle systems, and sub particle systems to play on particle death, I got an effect looking like this:
There’s a sort of “foreground” and “background” rain with two systems. One is fewer particles emitted, but they are slower and bigger. The other, the background, is smaller particles that move faster and at a higher emission rate. The particle subsystems are then used to create the “splash” effect of just sending two or 3 particles upward when the initial particle “dies” (RIP).
Then the actual game effects were fairly straightforward. I wanted the rain to decrease max distance and height of hits, reducing bounciness from the ground, and slow down rolling balls quicker. This was fairly straightforward. I just had to add a check in all of those functions (get hit height, get ground bounciness, etc.) to the RainManager instance to see if it was currently raining, and if so, how hard was it raining? Light rain has a smaller effect than Heavy Rain, and so on.
With rain working, I then moved on to traps! I had actually already built traps into most things already. Things like your hit, bounce checks, what club you are allowed to select, etc. all had checks for if the ground below the ball was a trap or not, and to act accordingly if so. Really all I had to do was add one to my scene, and it looks like this:
Wow. Beautiful. A lot of work went into that one, but I still had some free time left to do something else: create the “Wedge” club type. Creating the new club object in the game is easy, just create a new club prefab and set the settings I wanted for the “wedge” club type. I did have to make the sprites, too, and this is what the wedge ended up looking like:
I feel like all my club sprites have a very rough looking quality to them, but I also think there is something charming about them. Idk, probably just trying to convince myself of something that isn’t really there.
Anyway, the wedge had some special characteristics compared to the other clubs in that its rough and trap terrain distance modifiers are 1, meaning the terrain has no effect on a wedges max distance. It can hit far out from the rough and traps. So I guess that will make it useful?
Then, I added a “short putt” option for the putter club. The way I was doing it before made it so it was easy to do long putts, but really short putts were hard because the max distance was still 20 while the distance of your putt was 0.25, making it really hard to get such a short distance in the little hit slider game. Short putt makes it so the max distance is a quarter of the usual putters max distance, making it easier to hit those short putts.
So, here’s a lot of all that in action!
Rain! Traps! Wedges! A short putt! One thing that I worked on this week that isn’t shown there though were some fixes to bouncing off objects. I had realized that I never testing bouncing off an object while rolling, and when I did, I noticed a pretty significant flaw. See, part of the bounce calculation is done by dividing a value by the ball’s height. Well, when rolling, the ball’s height was 0. So, dividing by zero sent my ball into the shadow realm. I just decided to create a separate function for rolling bounces that avoids taking height into account.
Aside from fixing that “feature,” I also added the concept of a hard or soft bounce. A hard bounce causes the ball to bounce far, like if you hit a rock. A soft bounce has a shorter bounce, like if you hit something soft, like “tree leaves” (they’re soft, right?). So I just added a SoftBounce bool to the collision object. Simple, right? Well, I also wanted objects like trees to have a hard and soft bounce zone. So, get the ball’s height, if it is high (in the leaves, not the trunk), soft bounce. If it is low, and hitting the tree trunk, make it a hard bounce. It seems to work fine? As expected?
Also, the hole flag is a “soft” bounce, making it easier to bounce off the flag and down into the hole. Exciting! Copying Golf Story more!
Hmmmmm…………………..I had a crazy idea of adding lightning strikes to the game. Show a flash, delay for a bit, and then sound of the thunderclap. The difference between the flash and thunder would give the player the distance of the storm, 5 second delay = 1 mile away. Player is giving an option to take cover and lose a stroke, or play on. If you play on, you may get struck by lightning. If you are struck, you get the max penalty on the hole (10 strokes???). The likelihood of being struck is based on how far the storm is, or how short the delay between flash and thunder is. Idk. Just thinking out loud. Also had an idea about praying to the wind god through a ritual between holes through some sort of mini game, and if you fail, you have a higher chance of being smotten by the wind god (tornado launches your ball in a random direction? Super wind on just your turns? ???).
Smell ya later, nerds!