Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411512 Posts in 69376 Topics- by 58430 Members - Latest Member: Jesse Webb

April 26, 2024, 09:23:02 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsMaking a stealth game is HARD.
Pages: [1] 2 3
Print
Author Topic: Making a stealth game is HARD.  (Read 8778 times)
I_smell
Level 5
*****



View Profile
« on: October 20, 2010, 02:08:30 PM »

I've got this stealth game in my head called "Future-Robin Hood".
Now- my view on stealth games is: I do not want gadgets, I do not want a shotgun, I will not turn invisible. Stealth games, to me, are about sneaking, hiding and enemy AI. It's all about baffling guards and not being seen. I'm talkin bout MGS2.

It's gonna be a challenge cos I've never made a smart game before. I usually do like beat-em-ups, shoot-em-ups, arcade stuff. I'm tackling the basics right now, here's how my enemy AI works so far:

AWARENESS
He has a vision cone of about 60 degrees. If you're within that, then his [awareness] will go up depending on how far away you are. Also he can't see through walls. If he can't see you, then his [awareness] will drop back down. This is good, it all works fine.

FOLLOWING
If he can see you, then you'll drop a breadcrumb trail. He'll walk to each piece and collect it. This really isn't working right now. He allways gets confused on which piece he needs to go to, they get left in his memory for too long, I think I'm comin at it from completely the wrong angle.

Oh and here it is.

I'm gonna go play Xbox n come back to it. Just thought I'd write all this down incase anyone has any input. It should be pretty fun to make once I've got over the initial hurdle of gettin the enemies to work.

HERE'S THE LATEST UPDATE
« Last Edit: December 01, 2010, 02:34:59 PM by I_smell » Logged
JMickle
Level 10
*****



View Profile
« Reply #1 on: October 20, 2010, 02:19:04 PM »

seems to work, a bit confusing without being able to see his cone of vision.

i didn't find any problems like you described.
Logged

VomitOnLino
Level 0
***



View Profile WWW
« Reply #2 on: October 20, 2010, 02:19:58 PM »

I think what you need to make it work (better) is an A* (A Star) algorithm of some kind, I regularly use it in my games and it works well. Sadly my code is C so it won't be much help to you I'm afraid.

But; Basically I would just actually have 2 AI's. One which directly follows you when it sees you. You can make this smarter by adding the players speed vector to the point he follows, making him "anticipate" the players movements.

The other AI would be basically A*, him going to the last point he saw the player. (Just update player coords while seen and stop while hidden then go there.)

A* general explanation here.

A* for Actionscript 3.0 is here.
Logged
jotapeh
Level 10
*****


View Profile
« Reply #3 on: October 20, 2010, 02:49:11 PM »

Hehe, I got him stuck staring at the wall. If you sneak up behind him when he's near one, he'll slam face first into a wall. Then he sees nothing at all ever and you can run through him etc.
Logged
I_smell
Level 5
*****



View Profile
« Reply #4 on: October 20, 2010, 04:54:55 PM »

Every time I look up pathfinding, it usually boils down to "check every square" or "check 8 different directions every 5 feet".
I don't know how I'm gonna be able to make a game that does that every frame at 30fps.
If I had like 3 enemies onscreen it'd fall apart.

I'm also raytracing to check if the guy can see through walls- but I actually minized that to 1 ray so it's not a big deal. I'm just sayin. It's gonna add up.

Anyway I'm gonna try this A* idea out now. I've never made a tile-based game before so let's just do some maths n pretend there's tiles there.
I'll update in a sec.
Logged
Entar
Level 0
***



View Profile WWW
« Reply #5 on: October 20, 2010, 04:55:10 PM »

Along the lines of what VomitOnLino said: Seems to me that a pretty simple (and effective) solution would be to have the AI store where he has last seen the player, and navigate to that (using A* or whatever). If he sees the player while he's going, update that point as he goes. Then, once he gets there, he looks again. This is basically what actual people would do, and you don't have to worry about some odd bread-crumbs thing (unless you mean to have some kind of footprint in snow or something that really leaves a trail).
Logged

RCIX
Guest
« Reply #6 on: October 20, 2010, 05:15:13 PM »

The system you have seems to work really well, just when the guard's awareness is really low or when he stops have him clear his breadcrumb memory. That should work fine.
Logged
I_smell
Level 5
*****



View Profile
« Reply #7 on: October 20, 2010, 05:54:35 PM »

Ok I didn't do the A* idea, but I did somethin that was pretty close.

Now he walks directly at the last place he spotted you. He also constantly checks if there's a wall right infront of him with somethin that's kind of like raytracing around.
If there is, then he finds the next best direction, puts a node down a few feet ahead in that direction, goes there, and starts walking twoards the last place he spotted you again.
If there's still a wall there then he does it again.

Not perfect, but I think I'm gettin there.
Stand behind a wall and click the screen to get his attention, and he'll (usually) navigate around it.

When I wake up tomorrow I'm gonna tell him to do something if he gets stuck on a corner.
Logged
RCIX
Guest
« Reply #8 on: October 20, 2010, 06:55:21 PM »

The main issue i have with it is that it's near impossible to lose the guy when he gets on your tail -- which makes sense as long as it's possible to stealth my way around them Smiley
Logged
deathtotheweird
Guest
« Reply #9 on: October 20, 2010, 07:54:50 PM »

its not impossible, if you exploit the speed increase given if you run diagonally  Gentleman
Logged
I_smell
Level 5
*****



View Profile
« Reply #10 on: October 21, 2010, 11:41:53 AM »

Allright! I've got it working great now.

Click the mouse to position yourself and he'll come get you.

The only problem left is that he goes left-right-left-right-left-right if you put him behind a long wall. I'll work on that now, and then I think I might be ready to start.
Logged
Miguelito
Level 4
****


makes graphics


View Profile WWW
« Reply #11 on: October 22, 2010, 01:13:21 AM »

Yeah, but now he's an all-knowing, all-seeing god kind of enemy. Wherever you position yourself, he'll just run to that point.

I liked the first version where he had a cone of sight. The only issues I had with that were:

1.) No idle behavior: Obviously, an enemy shouldn't just be staring in one direction. But even fixed enemies should have some defined area where they're looking around in. Otherwise it looks like they're wearing blinders.

2.) Goldfish memory: Basically, the enemy will forget about you as soon as you exit his cone of vision. This leads to the amusing scenario that you can just run a very narrow circle around him and he'll instantly freeze as soon as you leave his sight.
Either there should be a default distance where he always catches on to you (sort of like a sense of "hearing" or "feel"), or he should always run to the point where he last saw you, and then re-orient himself.

Just my thoughts as a non-programmer.
Logged

   (← new art twitter)
Fauxfox
Level 0
***


Never knows best!


View Profile WWW
« Reply #12 on: October 22, 2010, 02:06:31 AM »

Yea I like the original with the crumbs + cone vision, follows you around corners but not for too long.
Logged

I_smell
Level 5
*****



View Profile
« Reply #13 on: October 22, 2010, 07:44:49 AM »

Yeah, but now he's an all-knowing, all-seeing god kind of enemy. Wherever you position yourself, he'll just run to that point.

Oh yea this is nothing like the final game, I'm just tryina nail the hardest part of the AI first. There's still a cone of vision, and in the final game he'll try to shoot you instead of following you around.
What this following thing'll MAINLY be used for is stuff like knocking on walls, or throwing distractions around.

Next time I update he'll have an idle state where he just patrols around, and hopefully I'll have a couple levels to show what the game'll actually be like.
Logged
JohanK
TIGBaby
*


View Profile
« Reply #14 on: October 22, 2010, 11:29:28 AM »

Quite well done so far, In the last example I can get him stuck quite regularly though. You might want to implement a dually linked list for each corner of each wall. That way the wall can "direct" the ai around it according to the direction the player is in.

Stealth games provide an interesting challenge, It would be ideal to implement a stealth mode (walk) and a run mode for the player, the ai would have a radial distance for hearing your movements as well as a cone of vision. If you are running he can pick up your sounds within that distance vs sneaking, as an example. It also provides the player with the ability to restealth by playing on distance, visibility and stealth mode. I think MGS had something like this.

Logged
I_smell
Level 5
*****



View Profile
« Reply #15 on: October 27, 2010, 05:10:31 PM »

The walk-run idea's great, thanks.

I haven't updated at all because a couple other people told me to use Astar pathfinding. So I researched it, understood it completely, and spent like the last 3 days throwing myself at a .fla and failing. I CANNOT get this to work at all. I give up, it's fucking impossible.

So anyway here's some example levels with my own shitty pathfinding that I can't fix.
Someone suggested I do the art isometric. It sucks to draw everything top-down, but I don't wanna be another Metal Gear ripoff, so I dunno if I should or not.

By the way I might aswell spit the story of this game at y'all- it's needlessly complex:
It's a few hundred years in a future and the earth's population is super big. People have spread out to colonise the sea n deserts n such. The game opens in the north pole where there's a few huge pyramids dotted about. Inside each one is a paradise city with digitally synthetic vacation skyline, simulated wheather effects, no crime, no homeless, it's great.
UNFORTUNATELY, underneath each city is a bigger underground colony of people who can't afford to live on the surface, and the aforementioned gypsies, tramps and thieves. They work the mines n run the generators that power the world up-top. It's all very heated n there's a load of slavery all that shite.
So this one miner digs up something top secret left behind from some old future-war: It's an Iron-Man stealth suit. He gets himself some attention and tries to start a revolution against the imperial surface. It fails and he gets thrown in jail. You have to break out and make your way up the imperial tower; basically be a guerrilla terrorist and fuck up the power for the better-privelaged long enough to kick-start some kind of revolution.


Long-story short, you have to get to the stairs every level.
Logged
Greg Game Man
Level 5
*****


i have to return some videotapes


View Profile WWW
« Reply #16 on: October 28, 2010, 03:43:25 AM »

3 days......fucking impossible

wat

Ai is shaping up, i hope you do something more original than knocking on  walls, throwing pebbles, and armed guards in the final game!

Be cool to play as a serial killer or a giant spider, sneak upon my prey
Logged

I_smell
Level 5
*****



View Profile
« Reply #17 on: October 31, 2010, 06:33:19 PM »

UPDATE

I now HAVE REAL PATHFINDING, which I'm really happy about. Someone at FlashGameLicense helped me out with it, it's still the hardest thing in the world. But yeah now I'm a lot more confident in this.

There's a couple more levels, but I've not really kicked it up to Go Time yet. Like this still feels like a prototype and I'm not sure when it'll start feeling like a game.

is draw all the characters n stuff first, but what can I even do with art here? This is really different than the Metal Slug, Streets of Rage-type stuff I usually make.

People are still suggesting I change it to be isometric. HERE'S A TEST OF THAT- Ignore how janky it is, it's just a test.
It looks slightly better, BUT it means I'd have to draw and animate everything at like 5 seperate angles, which would make the whole game take longer than I want it to.
And that's a really awkward angle to draw things in.

+I was afraid it'd seem like a Metal Gear ripoff if I did that, but it doesn't look like one so I think I'm safe on that.

Maybe I should draw it the same way I drew No Time To Explain, I dunno:
« Last Edit: November 07, 2010, 04:03:04 PM by I_smell » Logged
RCIX
Guest
« Reply #18 on: October 31, 2010, 06:58:48 PM »

Durr, your isometric test link goes to a road trip rampage video :S
Logged
I_smell
Level 5
*****



View Profile
« Reply #19 on: October 31, 2010, 07:04:13 PM »

Durrrr sorry, fixed.
Logged
Pages: [1] 2 3
Print
Jump to:  

Theme orange-lt created by panic