Super Snow Fight in Winter Wonderland

Some people are really good at everything. They can code, they can design, make textures, models, sounds and music, just everything you need for a game. Well, not me. I think I can write some code. Maybe I am also able to put some images together in Gimp and change the color. But that’s it. So what do you do, when you have an idea for a game, but you don’t have the people to make the game pretty? You browse the Unity AssetStore like you browse Steam or Amazon for your next games! It’s amazing what people sell in the AssetStore. In particular because the assets are not too expensive for and indie game developer and they will give your development process a real push. Just imagine how long it would take to make all the models and sprites by yourself or how much money you would need to pay designers for this stuff. Of course, sometimes you need custom assets you won’t find in the stores. But even in this case there are uploaders who will make assets for you on request for a little fee. If you need assets for your prototype or you see a style that just fits into your game, I recommend the Unity AssetStore or any asset store you can find on the web. It will make you happy. ;)

Thanks a lot to the Hedgehog Team who made the Toon Level Kit possible. Super Snow Fight looks amazing thanks to your assets! :)



Enemy spotted!

Moving the character and throwing some snowballs works so far. But since Super Snow Fight is about snowball fights, we need someone we can fight with. Throwing snowballs in your own face is not that much fun in the long run, I guess.



That’s why you can see two cubes with cylinders now in the YouTube clip. The green one is the player character, the red one is the greatly feared enemy. It won’t be a real fight if your enemy ist just standing there doing nothing. So we need a little artificial intelligence. The AI to this date is quite simple. My goal was to keep the enemy moving and throwing snowballs at you, but not in a predictable pattern. This means we need some random juice.

With this method the enemy character will move in any random direction. What’s left is the time the character should change its direction. Counting the time in the Update()-method and calling ChangeMoveDirection() if a certain time is reached will do the deal.

Now what about throwing snowballs? In Super Snow Fight you are able to charge your shot or throw. Holding the left mouse button will increase the power behind your snowball, which then will make more damage. Well, your opponents do not really hold the mouse button. Instead I gave them a random power and a random time they wait until they throw their snowballs. In some situations it’s not really fair, e.g. if an opponent spawns right next to you and shoots you down with full power. But in my opinion the game is still easy enough to be fun and getting bashed all of a sudden may create some laughter.

Last but not least, enemies focus on the closest player. You can try this out when you play the game and walk up to a guy fighting against another AI character. If your distance is the smallest, he will turn around and tries to beat you up!

And that’s the code. GetClosestPlayer() determines – you guessed it – the closest character. LookAtPlayer() then uses this character to rotate the model. Calling LookAtPlayer() in FixedUpdate() will keep your opponent up-to-date.