2017-11-09 Uncategorized 0

Last week I was adding some features for shield mushroom worm (shader to reflect health, added particle effects on landing and taking/pulling, sounds) and I modified hand displays a bit. They are now square, a bit smaller but with greater resolution to make text on them easier to read. Mind that their content will change, I am trying to get the best resolution/size ratio and font size.

I also added background noise to indicate when we are damaged. A word about health. Currently I have part regenerate, part old school health. You have two values. One is state of your current armour/shield. If it goes to zero, you’re dead. The other is backup storage, something you automatically reuse to fill your current armour/shield. If it’s that good or bad idea it should be examined when I will add upgrade system. One could invest into faster health restore or bigger backup storage etc. But that’s still just an idea I am playing with.

At the end of that week I started to work on grenades. One person told me to get more physical interactions, to have more purpose for the neutral characters I had in the game. That’s when I thought that I could turn those little spider bots into grenades (or anything else). You grab them, arm them and throw.

The way I work is to do as little as I have to do. But do it right. First I work on a hacky prototype. If that seems to be alright, I get it to “good enough” state. Not the final, but something I could live with if I didn’t have time to improve. And I try to keep things smart, modular, to reuse stuff. But having as little as I need means that some things are missing. And because there is lots of stuff I have already done (I work on it alone, but sometimes it feels like I am reading someone else’s code), I sometimes don’t know what was done or not and I just… keep my finger’s crossed when I test something.

Getting spider bot into hand was simple to add, throwing seemed the same. Until I tested it. Grabbing worked nicely but when I threw it, it just stayed in the air. “Oh, I actually do not have any throwing/free movement”. It didn’t take much time but then it turned out that just getting collisions at each frame might be not enough and items may go through walls etc. I had to do fast throwing/free movement. And then I run into another problem, hitting some invisible obstacles that turned out to be a bug related to scaling collision objects. I run into another few problems. The fun never ends.

The biggest one was making throwing work as expected by user. And that’s quite big problem with VR as there’s only location of a controller. Getting velocity does not work so well. Getting average velocity from few last frames works better. But altering that velocity a bit gives even better results. But it still seems to be a little off. Why? Well. When you throw object in real life, when you release it, you still push it a bit, the release is not that discrete. In game, to have simplier physics, you have to rely on discrete actions. Hold -> immediate release -> throw. And with throwing just a small difference in initial velocity results in totally different direction. There are still some things I want to try.

Somewhere on the way I decided to have hands adjust to the size of an object. Not wanting to go into sophisticated systems that trace shape of an object I assumed for time being that objects in hands will be cylindrical. And created few poses for various sizes and just blend between them. And it works just fine.

I needed a way to arm a spider grenade bot. I decided to put a button on top of it. And a ring around it. Using same material resulted in that button being not that much visible. I turned it red.

Well, I guess that Sigmund Freud could tell a lot about me.

By the way, in this screen shot you may see some bits of hands and legs missing. Procedural mesh generation works quite fast but in debug/dev builds switching off generation for some bits may save few seconds. And when tweaking things, testing, shaving off few seconds here and there may result in few minutes saved.

Getting back to the grenade. After I had a moment of uneasiness and laugh, I decided to keep it. It also goes quite well with one of the story layers I have on my mind.

From the functional point of view, I wanted grenade to be adjustable. It could detonate after 1 second or maybe after 5 or maybe on collision (that’s something I still have to do, it should be a quick one but still, it’s not done yet). When I armed a grenade, threw it (implemented explosion, added particle effect etc) I decided to try shooting at thrown grenade. I just killed a spider bot with a puff of black smoke. It didn’t explode. It should, right? And you could throw it and shoot it while it is still in the air, yes? Well, there you go!

shooting at grenade

Shooting it with a shotgun at close distance worked with first try, shooting it with a pistol at a distance when it won’t damage it, was a bit more demanding (the whole thing with me playing with shotgun took 5 minutes).

And then there was one more thing that is quite important to me in games. How various things work with each other. What if I hide behind a shield? The shield should take the damage and I should be alright. And (after modifying explosion code) it works just this way.

One thing to mention is as I have lots of things modular, it is fairly easy to replace explosion behaviour with anything else I will want to have. Actually I could mix mushroom with a grenade. To have a plant that could attach to anything and work as a proximity mine. I shall try doing that!

What now?

Guns coming from enemies and pockets.