Gaming Your Way

May contain nuts.

Bye bye Swarm, hello side quests

We have been thinking what we could do with Swarm mode in Outpost 2. I really like the mode, it's just a nice switch off your brain bit of shooting fun, and I think it holds up well on it's own ( Outpost:Swarm turned out much better than I could have hoped ). But, I don't think we integrated it well enough in Outpost:Haven, the idea was to add a little extra to go back to after finishing the story, to give the whole game more value. It does, but it's a little bit disconnected ( To the point that it actually works as a stand alone game with very little story context attached ).

Our thinking with Swarm in O2 was to make them optional "Side quests", kinda. The plan is that even during the game itself you'll be able to select a side quest from the mission select screen and go and have a bit of fun there before coming back to the story mode. Going down that path meant what do we reward the player with for doing a side quest ? They'll get extra XP which of course helps with unlocking items, but is that enough ? We want to encourage people to play the mode, there's no point adding value if only a small percentage of players are taking advantage of it, so we're going to add unlockable perks as your reward which should make a very real difference to the story mode.

So that's the current plan, anything to make this game even more complicated and hellish to code.


PS. Should we release Swarm:Facebook this week ? I can't see why not, so we'll do a soft launch some time this week I guess.

Outpost:Swarm postmortem

It may seem a little strange doing a postmortem for Swarm without yet doing the Haven one, but it's up on Kong now so it felt right to give it a pimp shot in the arm, plus it should be a lot shorter for me to write as I'm just going to cover the specifics in this game rather than the whole thing.

What went right:

1) The huge advantage we had over Haven was the insane amount of feedback we had banked when making this one. Filtering out the noise with feedback is always tricky, but with so much and so many detailed ideas it was a lot easier. Because of that Swarm is a lot tighter in many respects than Haven. The movement is better, the indicator showing the direction of damage, just so many little almost unnoticeable things got tweaked that even though we finished this only a couple of months after Haven, it makes a lot of things in the first game feel dated to me.

2) The AI co-op is the most obvious stand out feature. I'm not sure how this came about, I mean it's an obvious thing to do, but I remember Lux and I talking at the start of the project and agreeing that we had to make the game stand up on it's on, it wasn't meant to be Haven lite, but a good game in of itself.
From memory I just spent a day seeing how it would play out, if it worked and worked as well as we would have liked then sweet, if not then we'd just drop it and write that day off. More by luck than judgement it did play so much better that it set the mood for the rest of the game. I'd say having Jameson as your wing man in this game makes it what it is as much as the aliens.
One last thing to tie a bow on this one, having the different colour schemes for the main sprites made a huge difference, something we really should have done in Haven. 

3) The new tilesets / locations worked so well. We managed to re-use a fair few assets without hopefully feeling like we'd just lifted them wholesale ( I think we only added one new visual effect though, the smoke flares on the planet side levels. In our defence, we did make a lot of one shot visuals effects for Haven ).
From that basis Lux really came up with some beautiful stuff, the sewer level is great ( Unfortunately a bit of a CPU hog ) and the planet side levels used the terrain splatting which we developed for Knight's Quest at last. The out doors levels are just stunning, we're going back to visit that planet again in O2.

4) The game flow, from pressing Play to actually playing the first level, was tweaked a lot thanks to feedback from Miniclip. Normally amends just 'cause a groan in all coders ( And these did too to be honest ) but they removed a lot of clicks and helped you get into the game much quicker. Amends which actually improve a game ? Anyone who does just adver-games will think that impossible. It did have one downside though, but lets save that for the next section.

5) I really like the "pop-ups". Popcap nailed giving awards to players, and I've always been a fan of that, and the COD titles have just taken it and put it in an arcade / shooting context, which I really like, so we embraced that a lot more this game, and I'm really pleased with it. We're always flashing up some update ( The mode in the recent Halo games whose name escapes me right now also inspired me with this a lot ).
It helps ground the game I think, shows we're not playing a survival horror, but a shoot'em up with terror aspects. 

What went wrong:

1) Time. We just ran out of time and budget to do all the things we wanted. We had hoped to add a new baddie type ( A flying bug type thing. I had a vision of them being like a swarm of gnats ) and I wanted to add the sentry weapon ( Which is something I think everyone wants ). I think the AI just ate into the time to do those things and it was a worth while trade off, as it brought more to the game than anything else we could have added.
I can't remember how much we over-ran the deadline by, 16 days or so, not a great deal, but there are always lose edges which need tidying up and adding major things like a new baddie would just have blown the deadline completely. As soon as you're past that deadline you're working for free and you can only do that for so long no matter how much you love the project.

2) After the whole Owlmen story running throughout Haven there was a lack of context in this. We did have a briefing in there, which we removed to improve the flow, but we had no story at all, no reason for this to be happening. I assume people who played the first game got it, but that's not really valid as it's meant to be a title which can stand up on it's own. I was toying with having info-cards really hidden in levels which would progress the story, but they would only have been relevant to players of Haven as we didn't have enough scope to explain the whole thing.
I regret that we didn't explain Swarm mode more. In my head it was always like a TV show being shown back on earth, Lee and Jameson are basically dead men walking at this point, there's no escape, so they'd go out fighting and all the money they earned from the bug hunt would go back to their families on earth ( These aren't stupidly brave men, they're just two guys caught up in a shit storm which they have to tackle head on ). Even at one stage I thought of having crowd cheers if you did something really cool, like you were watching this in a bar back on earth on a TV, but without any sort of context it would just have been mental.

3) Some of the levels aren't great, level 2 is too hard as it's so small and restrictive. Also we had to re-use a [ Tweaked ] level from the swarm mode in Haven as again we'd run out of time. Level design doesn't come easy to me, it's something you need to iterate over to get just right, and with that clock ticking I didn't really have the time.
Plus making an interesting level which is basically just a loop is tricky, with no clear objective, no going from point A>B, it's hard to make it interesting, and I failed on a couple of levels, with the medical lab being the stand out mis-step ( And it really doesn't help that it's only the 2nd level ).

4) We'd reduced the difficulty of the challenges due to the feedback in Haven, but like in the first game we struggled to come up with the unlockable awards. They're ok-ish, but we didn't do ourselves any favours by having such a limited pool to draw from, and they were very last minute and of course with that the panic of "Shit, we haven't got enough stuff".
Not a major failing, but something we need to think about more for the next game. 

I'm sure more things went wrong, but they escape me now, but those things annoy me enough for 5 issues.


When it went on Kong the other day I thought I should really give it a go ( After voting 5 for it, it felt like the right thing to do ) and I'd forgotten I'd used the "They're here" sample on the intro which made me jump. Then I gave the first level a play, kinda half hearted as I have played it once or twice before, and I really loved it. There's a bit in Aliens after the sentry guns have run out and they're all in a room as the aliens are closing in, and then they all fall through the ceiling and it really kicks off. It felt like that. Fucking felt great to be honest.

So I think that's this about done. Not many regrets, lots of things to be pleased with. I wish in a way we could have done this one first before Haven, but things like that are impossible to second guess.
As always it was a pleasure working with Lux, and Rob and Theresa at Miniclip were a joy too.

We can't wait for the Owlmen to return, and it's going to be soon...


So how does the NPC AI in Outpost:Swarm work ?

Now Outpost:Swarm is live I thought it may be an idea to explain how I did your in-game partners AI.

If you've ever read up on Boids you'll know they have 3 simple rules,




And all the examples you'll see are bird like objects flying around, maybe towards your mouse pointer, maybe avoiding obstacles. All seems simple enough. Adding them to a real game however quite a bit trickier.

For separation we have to ensure the NPC is avoiding both the player and all the baddies. Firstly we find the distance to the players sprite using a simple

distance=dx*dx + dy*dy;

Like you would in your usual circle to circle tests. If we're too close then we need to repel the NPC from the player, via:



Where tmpPoint1 is just a new Point(0,0);

That's part 1 of the test done, the second is checking against all the baddies, and there can be a load at any one time. What I did was use a flip flop, every even frame we get a list of all the possible neighbours ( Baddies which are close enough to care about, if they're on the other side of the screen then we can skip them ), every odd frame we do exactly the same distance check as we did above.

Finally we divide our Point value,



( private var speedDivisor:Number=20; )


This keeps the values within a respectable range so we don't move too fast.


The next rule is alignment. Lucky for us we don't care about that in this case, we're not creating a flock of birds or swarm of insects, we just want one guy to look fairly smart and follow his friend around.

Cohesion in this case means following. We do another distance check to the player, but this time with a greater radius ( We want them close and for the NPC not to lose sight of the player, but we don't want them virtually kissing. That's planned for the sequel, Outpost:Date&Fuck ).

var dx:Number=bodyXPos-targetX;

var dy:Number=bodyYPos-targetY;

var distance:Number=dx*dx + dy*dy;



  return tmpPoint2;





Note the use of targetX/Y, rather than PlayerX/Y, we'll come back to that at the end of my presentation. As you can see, it's pretty much the same thing as before, and something I'm sure most of you have done with your circle to circle checks.

Right, we've got two Points after running our rules, time to calculate the NPC's velocity.



Then we do a quick test to make sure the velocity in both directions isn't greater than the max speed we've set for the NPC, we don't want him outrunning the player ( Or actually, not to outrun the player enough that people will notice ).

The next part was the tricky one, we can move him around fine, but what about the walls ? It turned out to be surprisingly simple. We use good ol' tile based checks. If there's a wall on the horizontal of the NPC we set velocity.x=0; and then the same with the y. 

We're finally there, we just finish off with



Cool, and that's how you can use Boids in real life ( The same principle handles the baddie movement ).
Let's test that out in game. Excellent it works, and if I manage to lose the NPC behind a wall then... oh tits, he'll just sit there. That's not a great look for a hard as nails space guy with a big ass gun.
Check this level map out,  

AI path

Within each level we lay down a path for the AI. Every couple of frames we look to see if the NPC can "see" the player using a line of sight. If he can't it means we've ditched him behind a wall.
When that happens we fire out 4 rays from the NPC until it hits one of those path tiles ( Remember at the heart of the game is a tile engine running alongside the purely physics based one ). Once we've done that we can easily find out which is the nearest part of the path, we change the TargetX/Y ( From above ) to our tile and the same code that moves him towards the player moves him towards the path.
All the time we're moving towards the path we're doing our line of sight checks to the player, if we spot him again we break off from the path and go back to following the player.
It's not fool proof, if he gets lost then he's only going to make his way to the path and then not do anything really clever, but because the levels are small enough you should soon bump into him again to get him following the player. Also, he doesn't really need to be that smart when he's off on his own, we just want to create the illusion that he's not a dumb arse, he doesn't need to be Stephen Hawking ( Perhaps not the best example when talking about movement ). Finally, we're still using Flash, we don't have all the CPU time in the world to do something really fantastic.
And that's how we move the NPC.
PS. Wow, looks like I've got about 40 fonts / sizes in this, nasty, but it took enough time to write this up, I'm going to swallow it looking slightly ugly.

Nearly there

We're pretty close to Outpost:Swarm being gold, we've just finished working through the amends, so it's just a couple of little bits and pieces dealing with the portal's API to finish off, and we're done.

Should we celebrate with a screen grab of level 2 ? Yeah why not,

I'm sure there will be a couple more screen grabs before it's actually live. Ah pimping, it's what makes the web go around.