Lerp, or linear interpolation, is a super useful function we all love. However, I often see devs use it in some weird way. I feel like they never bothered to read the documentation. Well, these devs probably didn’t. Here is an example of how not to use Lerp right.
Goodie Assembly is a relaxed puzzle game. Slices appear randomly from 8 directions and move toward the center. Player gets coins and points for completing delicious food.
The game is done within 1 month from prototyping to polishing. This is the first game I personally published on a store. To me it’s more about learning how to make a game than making any money. In fact, I learned a great deal about the game industry as I did lots of research on the way. Making games, especially good ones, is slow and demanding, and surviving as an indie dev is even more difficult. That said, I’m really enjoying the craft and not planning to stop anytime soon. Just have to stick to what we love, right?
Anyway, hope you like the game and Merry Christmas!
Comparing tags is a thing we all do in every game project at some point but not everyone seems to know about the existence of CompareTag. Unity could really have done a better job documenting this useful method.
In short, use obj.CompareTag("someTag") instead of string comparisions such as obj.tag=="someTag". CompareTag is much faster and will log an error if a tag is not defined, which is a very good thing.
In case of comparing against a list, use list.FirstOrDefault(t=>obj.CompareTag(t))!=null rather than something like list.Contains(obj.tag) for the same reasons.
I use a fair number of singletons in my game projects. And I think I have written something similar the code block below for too many times now. So have you, probably.
if (instance == null)
instance = this;
else if (instance != this)
Getting tired of copy&pasting that code snippet over and over, I want to archive the same thing in just one line of code. When someone looks at my code, I want them to recognize the singleton pattern in less than half a second – “Oh hell, singleton again!”
I learned finite state machine (FSM) in model of computation class at a university. I’ve loved it ever since. It turns out to be one of the most commonly used patterns in game development. State design pattern is not only easy to understand and implement but also very flexible. I think every game programmer should know about it, and ideally how to employ it.
I believe the best way to learn programming patterns is to apply them. In a recent game project, I learn faster by doing than reading or watching even though I enjoy good reads and tutorials from time to time. In a recent project, I had a chance to look closely at and evaluate (many of) the design choices that make FSM either very efficient or extremely painful to debug and maintain.