Sunday 2 October 2016

Time Warp's AI, Story and Additional Content

I know I said that I'd write an update on Friday after I uploaded the sketchfab post, but that didn't happen. Not that it matters, as now I have a better update to share: progress on project Time Warp's AI! I've also had some story concepts, but I'm not 100% sure on weather to share them yet, because they are just concepts and might not come to fruition. I'd live them too though, they allow for quite a bit of creative freedom and allow for a story line that's engaging but simple, not overstepping our boundaries. Because, lets face it, writing a heavy backstory into a relatively simplistic game is just a recipe for disaster. I was going to talk about the AI now, but I think I'll detail a bit more on the story for a bit. Because it's my dev blog, after all.

Anyway, so as I said I'm not sharing much on the story yet because that would be dumb, because as a lot of the game is still in development things will change often and most things aren't set in stone. Except that sniper rifle model. That kicks ass. So, as previously stated, the story will be kept relatively simple, and will be largely told through text and other visual means, because I'm an awful voice actor and we've got a budget of £0 to make this game with. That's not the main reason, however, I fell that it's less likely to cause issues with the main mechanic of the game, as voice clips would have some...unexpected issues while playing. The main mechanic is almost done, so you'll see what I mean soon.

But anyway, my story plan is this keep it simple on the surface, but plant of seeds of a larger story (or even just tell one) for those who explore the levels and look for secrets. I love exploring levels, and also love it when my exploration is rewarded; finding those extra ammo crates, or that little Easter egg, or maybe even a hidden power weapon to help complete the level. However, the main case in point of this is in Halo 3, where Forerunner Terminals were present on forerunner stuff, telling an underlying story that adds deeper layers to the relatively simple story that you play through. I loved finding these, it gave more backstory to the locations you were in, introduced lore characters that led to the events that brought you here, and even unveiled present character's hidden motives, including little details that hint towards their ultimate roll either as ally or enemy.

Screenshot from a video by Youtube user HaloSpartanGamer: https://www.youtube.com/watch?v=1TFhJki2goA

So, I plan to tell some underlying elements of my story through a similar means. I'll probably plan out a story far in advance of this one, maybe just to give me some hints about where things could go from here, etc. However, one thing that I do like to do it keep a sense of similarity through all my games: each one references another, and they're all intertwined, one way or another. My first ever game, Defender: Last Stand has links to Fighter Prime, a game that'll be put on steam in the near future, which has ties to Galactic Combat, another space-related title of mine. This has links to Gravity, which has ties to The First Strike, which then links into The Dead Planet and so on and so fourth. By the way, most of those will never see the light of day, but here's to hoping that I get round to finishing them as some point. It would be nice. But what I'm saying is that most of them have similar looks in one way or another, in both a story half of linking everything together and the developer half of re-using assets. Anyway, stories in layers. Like onions. Onions have layers.

Also, I said in the last post that I would be unveiling something about weapons in the next major post, but that won't happen so deflate your hype balloons. It's a perfect example of what I was just talking about: adding new weapons offsets the balance and pacing of the game, leading to all sorts of variables player-side that I can't account for. Some of the planned weapons included a pistol, an SMG and a shotgun as a secondary choice of firearm. However, after fiddling with a number of variables and trying out different combinations, a problem arose: what was the point?

If you have a long range point-accurate sniper rifle, then why do you need an SMG? and if you have a reasonably accurate semi-auto pistol, then why have a sniper rifle that does the same, but fires slower? why have a shotgun, when you can just 360 trick-shot ricochet no-scope a dude while he's right in front of you? Point is, those weapons all offset the balance of everything, and therefore were removed. They might be added back if i find a way, but for now, bye bye to the SMG model I made. It didn't look col enough anyway.

Hey, it's finally time to talk about the AI! who'd have thought I could delay it for 6 paragraphs?! That probably holds some kind of record for dodging topics. Anyway, the AI is...erm, yeah. It wasn't looking good until a few hours ago. As a a matter of fact, it still isn't looking great. But it's a start. I'm pretty proud of some things, they work well, some others though, maybe the less said about them the better. Let's start off by looking at how far we've come. Not a great deal of in-progress screenshots and stuff unfortunately as most of it was problem solving, but I have some lovely professional GIFs to show you, such as this one:


See? Are you proud? Isn't it looking great? What? You think it looks weird and unnatural and want to have your dreams unscathed by it's presence because you can't deal with the nightmares anymore? Well great, me too, but we don't all get what we want. In this case, I wanted some way to have a ragdoll correctly react to being shot, so I attempted to simply incorporate AI code into the rag doll. "Simply" maybe isn't the word for it. Maybe unreasonably difficult. I've never done it before, so maybe it's easy to those who have, but to me it was awkward. I didn't want to enable and disable the physics on each bone or anything because surely there's a more efficient way of doing it.

Turns out if you don't, it just flops around like a man-shaped fish. So my solution? Pin his head in place. Of course. Why didn't I think of it sooner? It'll hold him up and i can maybe animate the arms and legs individually and call them as needed. But that's dumb apparently, because this is the result. I suppose I could make a game with no ramps, edges, stairs, ledges, walls or objects, but I think that might compromise gameplay. Dumb solution to a dumb problem.

I basically wanted to avoid what I've come to call "Source Syndrome", which is a condition that seems to affect a lot of Source games (sorry Gabe). Basically, when an enemy is killed, for a frame or two, sometimes you can see their t-positioned ragdoll spawn before it's corrected to the right positions Sometimes, they don't even correct at all and just leave it t-posed! It's especially evident in G-Mod, which I know isn't the best example of a polished game but it's the best place to see it. Anyway, the use of ragdolls already in position came from this, and also I could get accurate hitboxes and reduce what's been come to be called by me as "Payday Syndrome", where leg and arm shots don't count because they don't fit into the (I assume cylindrical?) collider that they seem to use. Especially given the game, these physics need to be on point. Absolutely on point.

So, after some tweaking I decided to give in and disable each bone in their prefabs, and then enable them again when they're killed. turns out that's actually the best way to do it, and it allowed me to get some actually kind of cool physics results. Basically, Using the particle effects and their hit positions, I can apply force to specific parts of the ragdoll as it's enabled,m ending in a seamless transition from living to dead, but also giving a better effect of being shot. For instance, shoot a guy in the head? His head'll whip back as his low-poly brains are catapulted allover a nearby wall. Bop a guy in the shoulder? He'll spin in that direction from the force of the impact before collapsing on the floor. Popping a sniper in the foot? His appropriate leg will give way, and he'll collapse leg-first into the ground, or off a wall if he's standing on one. Take a look at some examples:

Leg shooting

Head shot!

You spin me right round baby right round

Chest bop

His buddy wanted to see what was wrong with him

Possibly my favourite, leg-hitting enemies on walls and watching them tumble

So, as you can see from this increasingly GIF-heavy post, things are going...alright. The AI is still missing the whole second part of that whole "Artificial Intelligence" thing, as currently all they do is seek out locations marked as cover and stand there, randomly selecting a new one at random intervals. I've missed around with them shooting the player and it all works, I just haven't got the whole player death stuff down yet. It's nearly finished, just needs a little tweaking. Also, I added a little blood effect when they're shot which comes out of where they were shot, but I'm not sure about it; I don't think it fits with the whole aesthetic. However, none of that matters because you can Sparta-shot them off of a ledge and they go tumbling, and it's my favourite thing in the game so far.

Bonus GIF: firing Extermination shots into a crowd in a small room, with the impact force ten times as strong as intended. Additionally, shots bounce off of enemies when they hit them

However, once we get this AI business down and tweak the main mechanic to get it perfect, we'll be pretty much set to start creating levels. Oh, and we'll get a story down of course, but I don't really know where to go with that at the moment. My current plan involves sneaking aboard a form of transport to sabotage it, but we'll see. Stealth mechanics aren't really something I'd like to implement in this as it doesn't really fit with the gameplay as a whole, so we'll see. Maybe a rethinking of that concept is in order. Either way, I'm looking forward to making the levels. Some concepts so far involve allow for quite a bit of creative freedom in their design given the aesthetics; Plans for cityscapes, intense sky combat and thrilling train rides are so far on the table. but for now, that's your update. Maybe you'll get the main mechanic next time, who knows.

No comments:

Post a Comment