My thoughts on how random numbers can be used to create an organic and believable game world, with examples from Skelattack.

Posted by DavidStanley on Aug 24th, 2017

Controlled Randomness in Skelattack

The ol’ virtual roll of the dice, gotta love it! As I’ve worked on Skelattack I’ve found ways to put it to good use to create a more organic world, and some of it is so subtle you may not notice it…but you’ll FEEL it. Let's jump right in.

Damage to Enemies

At every moment during the game, an enemy will have a hidden variable constantly updating itself with a new random number (within a set range of numbers). As your sword makes contact with an enemy, whatever the variable is equal to during the moment of impact becomes the amount of damage taken from the enemy’s health. Then the process begins all over again. I’ll never allow a zero to be rolled, as this would be unfair to the player in my opinion. As long as you’re hitting them, you’re doing some damage.

I think the straw dummy owed Skully money or something.



Why do this?

I love how the flow of battles can change due to these random rolls. If you previously killed an enemy in 3 hits, and expect that to always be the case, then get ready to get smacked when you let your guard down. Sometimes landing a critical hit when it really counts is the difference between progress and going back to your last checkpoint!

"Come closer, come closer...NOW, IMBER!"



Lighting

Skelattack uses a very simple lighting system, which helps to add mood to the levels. It’s mostly dark in there so there are a lot of torches lighting the areas. At each torch, I create a soft light source that grows or shrinks quickly, based on a random range that I’ve chosen. It's a simple but effective flicker.

Why do this?

Flame light sources in the real world jump around quite a bit. Look at what a small candle can do to the shadows in a room. Creating a randomized flickering movement adds an extra bit of credibility to my dungeon scenes.

That's some nice atmosphere.



Special Effects

Smoke objects rising from a torch will each be assigned their own random scale, rotation speed, and vertical speed. Dust falling from the ceiling will have unique scale and direction for each particle. Dirt that is kicked up from running/wallsliding will have similar values. This is something I spent a lot of time tweaking the values of, until it felt right for my project.





Why do this?

The human eye is quick to pick out patterns. By removing this, I think immersion is increased. Imagine a field of green grass. If every blade of grass were to sway in the exact same direction and speed, it would look unnatural, unless there were a storm or other reason for such force being spread equally. The beautiful thing about nature and physics is that the many different parts of a system will react in ways that are marginally different from each other.

NPCs

With some NPCs I do a unique thing: at the end of each animation cycle, I change their animation speed (within a range that doesn’t allow it to become too slow or too fast). The results are subtle but it’s some of my favorite stuff.





Why do this?

How fast do you breathe? It changes depending on your level of fatigue, mood, and the situation. Having an NPC doing its little routine at exactly the same pace every time is a little boring. They aren’t robots. They are living characters (in this game world). Here’s a challenge: go to the dungeon Library and watch the Demon Librarian. Try to determine when he’s going to turn the next page of his book. There’s no rhythm to his reading speed. Maybe he turns one page very quickly because it just had a simple illustration and he wanted to move onto the next page. This is an incredibly simple concept that can have deeper implications on your game world and should definitely be considered. For this dev, it's a wonderful rabbit hole of coming up with interesting ways to make this world seem genuine.

========================



I haven’t revealed ALL the ways I use random numbers in Skelattack, but the more you think about them, the more you’ll find clever ways to use them. Just a nice bit of controlled chaos to add a good amount of life to a project. Until next time…see you in the dungeon!





~David

As always I can be reached personally on Twitter, or you can reach us at the official Skelattack Twitter page.