Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411592 Posts in 69386 Topics- by 58444 Members - Latest Member: FightingFoxGame

May 07, 2024, 06:56:35 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsProcedurally Generated Stealth Game - First Playable Release
Pages: [1]
Print
Author Topic: Procedurally Generated Stealth Game - First Playable Release  (Read 5653 times)
Draco18s
Level 0
**



View Profile
« on: March 06, 2014, 12:35:29 PM »

Uncreative title is uncreative.  That and the project has no name otherwise.

Anyway, it was recommended to me that I come on over to TIG and devlog my progress (and considering that where I was doing it is on another developer's forum and my thread is like 10% of his forum activity at this point, I might as well--I'd only originally shown up to ask him for advice doing Delaunay Triangulation and getting this paper in return).

Man.  I've come so far in the last two weeks!

First screenshot of a successful triangulation (10 days ago) through Minimal Spanning Trees (8 days ago) and placing objects and basic textures to defining locations (2 days ago) to starting to script various objects (today).

It doesn't seem like much for how long since I started working, but I am doing this on and off around work and leisure time.

My goal for this project is to create a stand-in that a GM for Shadowrun can drop in front of the hacker player and say "go" instead of trying to run two separate, and parallel, scenes.  In that regard, the following ideals have formed the core game design document:
  • Procedurally generated
  • Flexible parameters (size of the dungeon, difficulty, etc)
  • Gradients of success (just because you're there to disable a lock doesn't mean you can't find some paydata)
  • Gradients of failure (getting spotted once should not result in an instantaneous loss as every guard heads towards your position)
  • Multiple avenues available to bypass any given obstacle
  • Ideally it should take 10 minutes or less to complete

So my plans are to make it so that laser grids are "soft barriers" which the player can pass through and a check will be made against one skill or another (e.g. Stealth: does it see me at all? Spoof: I'm just a normal agent *innocent whistle*) with failure adding a point to the global awareness counter and getting the nearest patrolling unit to come investigate.  Cameras would have a similar check (though harder to fool), but with a delay (so you'd have to be within its cone of vision for a couple of seconds).  Roaming patrol units would be somewhere in the middle, but would move between waypoints (as well as being susceptible to misdirection).

It would take several "alertness points" before the system wide alarms go off.  At this point getting spotted would call several nearby units to come investigate as well as raising alertness further.  At even higher levels, getting spotted will additionally spawn more patrolling units, further increasing the risk of being caught.

Patrolling units, if successfully IDing the player as an intruder will attempt to engage in combat (the player can either run or fight), either dealing damage or other possible effects (such as stunning to slow the player's retreat or outright evicting the player from the system at high alertness levels).

This means that the player's success is more tied to the skills the character (which would be entered along with the system's skill scores prior to level generation) has than to the player's ability to remain behind walls, as there would be no "oops, I got seen, reload from save!" ability.  You only get one shot so the game should be balanced around success, but by slim margins.
« Last Edit: March 28, 2014, 10:48:29 AM by Draco18s » Logged

I code for me.
Draco18s
Level 0
**



View Profile
« Reply #1 on: March 07, 2014, 01:18:23 PM »

Got the first pass on hard barriers done (locked doors and where their key/password is).



I've highlighted which door is opened by which password-storage-unit.  Still need to write the code so the player can actually acquire the passwords, but once acquired, doors will open automatically.

Passwords attempt to be placed inside a data storage area, but in some cases it isn't possible (due to being strictly limited to areas closer to where the player starts).  This one had a small bug (in yellow) in that the while same-distance locations should be valid, it picked the same room that the door was adjacent to, which has a 50-50 odds of being on the wrong side.  It did, however, produce a nice back-and-forth that was pretty cool.

Fixing the bug didn't result in as intricate a map.



At some point passwords/keys placed in non-data storage rooms will be as a different object type.  So rather than oddly placed filing cabinets, it'll be things like "carried by a patrolling guard" or "dropped item."  There will be abilities to unlock doors without locating the password, of course, and the remaining space in the data storage areas will also be filled with other filing cabinets including the occasional bit of paydata that has monetary value.

I've also got some basic functionality for laser grids and cameras to detect the player and raise the system's alertness level, though the result isn't shown to the player yet, nor does it actually effect anything (as there are no guards) but the framework is there.
Logged

I code for me.
Draco18s
Level 0
**



View Profile
« Reply #2 on: March 08, 2014, 07:34:29 PM »



Minimap: check
Feedback to the player about the system's awareness of them: check
Feedback to the player about getting passwords: check
A dohicky that is the goal: check
Feedback on that (mission waypoints): TODO

Minimap camera does its best to orient and scale to show the full dungeon based on the boundaries determined by the generation algorithm, though I still get the rare clipped room (no more than two tiles worth).

I did a runthrough a little while ago to see how functional things were and I managed to get to the hacking target in about 3 minutes, although the system's awareness was pretty high (about 18, and the little meter there goes to 20--the two red lines are the two points of increased security).

I guess I'm at the point where I can't push off navigation of AI units any farther.  Not much else I can do at the moment until that happens other than fill up the datacenters with filing cabinets that do nothing (you gotta work for them passwords!).
« Last Edit: March 09, 2014, 12:11:22 PM by Draco18s » Logged

I code for me.
hogge
Level 0
***


View Profile WWW
« Reply #3 on: March 09, 2014, 10:33:52 AM »

This looks really cool.
Perhaps you could make the levels less linear, giving rooms multiple openings and stuff?
Logged

Draco18s
Level 0
**



View Profile
« Reply #4 on: March 09, 2014, 12:08:19 PM »

This looks really cool.
Perhaps you could make the levels less linear, giving rooms multiple openings and stuff?

There's already some of that.  The ones depicted are small and some of those multiple openings get obscured by adjacency.

I've also got some programmatic controls over how much it happens, as for smaller levels too many connections tend to make them map rather crowded with few dead ends for things like the admin room (which should be secure with as few entrances as possible).

Here's a larger level, about 30 rooms.



You can see how it gets a little odd down in the lower left.

Sometimes it also depends on the RNG.  The way extra paths are done is that the algorithm attempts to add additional rooms into the "blank areas" of the map after the other rooms are spread out.  If they're clustered close enough together, it can't find a place to put them (as it avoids areas beyond the min/max boundaries), and those rooms are the only ones that generate connections above the minimum required to make sure every room is connected.

I'm not too concerned about it, as I'm planning for multiple ways of passing undetected rather than the usual "hide behind a box, so there's gotta be lots of boxes to hide behind" kind of player-skill based stealth.  Sure, hiding behind stuff / finding another route should be a valid option, but to some degree it's not as important if the algorithm fails to generate those routes.
Logged

I code for me.
Draco18s
Level 0
**



View Profile
« Reply #5 on: March 10, 2014, 04:10:34 PM »

A* Pathting is programmed, just need to retrofit it for Jump Point Search (JPS) so its more efficient.  One test that I ran--start and goal were near opposite sides of the map--required 900 tile checks before a path was found, which slowed down Unity quite a bit (it ran once and took maybe a second).

Even if JPS doesn't speed things up much I still have the room connectivity map, so I could easily A* that to locate a partial path destination and let the tile-level A* run more frequently, but in shorter jumps (which would reduce the overall footprint).  Should probably do this anyway.

This was the first time I've actually written the A* algorithm for myself.  Wasn't too bad, once I was converting from world coordinates to grid coordinates properly (they line up 1:1, but 0,0 isn't necessarily the same in both spaces).
Logged

I code for me.
Draco18s
Level 0
**



View Profile
« Reply #6 on: March 11, 2014, 08:03:47 PM »

JPS implemented.  Its not perfect, it's a little greedier than JPS is supposed to be, but it's orders of magnitude better than pure A*



This path took only about 35 nodes examined, compared to over 400 in A*

Pathfinding will ignore the 1-block high passages that are the various backdoors.  I will also need to code it to avoid the file cabinets, but there's no flag for those yet (well there is, but it is overloaded).

I can now start coding AI units and getting them to spawn.
« Last Edit: March 11, 2014, 08:12:35 PM by Draco18s » Logged

I code for me.
Draco18s
Level 0
**



View Profile
« Reply #7 on: March 12, 2014, 07:10:47 PM »

Not much work got done today.  On anything.  Mostly because for half of the work day my computer was re-purposed to record a demo reel video.

I did, however, find a bug in the camera trigger volume.  If the player was crouched, the camera would think that they left the trigger area.


(image shows the player clearly inside the trigger, but the camera isn't reacting)

I replaced the physics based method with distance and angle checks (with a final raycast for blocking objects).  Which also made it easier to extend its sight distance.

I also got the merge-children script into the project, the level now has all of its geometry combined into collective meshes (one mesh per unique material).  Still some work to do there, when I altered the color of a material at runtime (for the floor colors of the special rooms) that generated unique materials per each cube.  So no savings in draw counts there!  But all of the walls are now a single mesh, which is a lot faster to render (mesh size is less important to Unity than number of individual mesh objects).
Logged

I code for me.
starsrift
Level 10
*****


Apparently I am a ruiner of worlds. Ooops.


View Profile WWW
« Reply #8 on: March 12, 2014, 11:15:17 PM »

My goal for this project is to create a stand-in that a GM for Shadowrun can drop in front of the hacker player and say "go" instead of trying to run two separate, and parallel, scenes.

This is super-exciting to me. Before we threw all our weight behind Pong and put the emphasis on video games, early computers were used to assist, and then attempt to replace, tabletop gaming. It's awesome to see things sort of come full circle in this way.

I can't help thinking that some GM's will want to design their own cybermaze, though. Have you thought about a level editor / allowing for that possibility?
Logged

"Vigorous writing is concise." - William Strunk, Jr.
As is coding.

I take life with a grain of salt.
And a slice of lime, plus a shot of tequila.
Draco18s
Level 0
**



View Profile
« Reply #9 on: March 13, 2014, 04:47:31 AM »

I can't help thinking that some GM's will want to design their own cybermaze, though. Have you thought about a level editor / allowing for that possibility?

That's actually where I started, conceptually.  I ended up nixing the idea due to setup times.  Originally I was thinking the GM would drag and drop some predefined rooms (there would still be proceedurally generation that added details), linked them up, specified a goal...

And I decided that was way too much work for the GM if the player decided to hack something the GM hadn't planned on.  It didn't fit the concept of "on the fly aid" enough.
Logged

I code for me.
Draco18s
Level 0
**



View Profile
« Reply #10 on: March 13, 2014, 03:54:29 PM »

I have a guard that patrols!

Sort of.  I still have to manually add it to the map and give it places to go, but that's only until I solve a bug that occurs when it spots the player and tries to give chase (it throws an index out of bounds error).

I ended up having convert a number of JavaScript files over to C#, which is where most of my time went.  I prefer working in JS, but a few plugins that I need to reference are in C#, which makes things dicey, as JS is compiled before C#, meaning you can only reference from C# to JS and not the other way around, unless the C# is over in standard assets, then you can reference from the JS (NOT in Standard Assets) to the C#, but not in reverse.

The Agent coded needed to go both ways.  Oops.  Now the code is 100% C# and will have to stay that way.  Javascript's more flexible in some ways, but C# is more optimized.

Also tweaked the pathfinder a little so that Agents will take hard corners without jigging through solid walls.  Makes changes in direction in open rooms a little odd, but I'm ok with this; this is an AI we're dealing with, not a person.
Logged

I code for me.
starsrift
Level 10
*****


Apparently I am a ruiner of worlds. Ooops.


View Profile WWW
« Reply #11 on: March 13, 2014, 11:14:15 PM »

I can't help thinking that some GM's will want to design their own cybermaze, though. Have you thought about a level editor / allowing for that possibility?

That's actually where I started, conceptually.  I ended up nixing the idea due to setup times.  Originally I was thinking the GM would drag and drop some predefined rooms (there would still be proceedurally generation that added details), linked them up, specified a goal...

Not sure what you mean by setup times?
Logged

"Vigorous writing is concise." - William Strunk, Jr.
As is coding.

I take life with a grain of salt.
And a slice of lime, plus a shot of tequila.
Draco18s
Level 0
**



View Profile
« Reply #12 on: March 14, 2014, 04:54:37 AM »

Not sure what you mean by setup times?

The amount of time spent by the GM building the maze.
Logged

I code for me.
Draco18s
Level 0
**



View Profile
« Reply #13 on: March 15, 2014, 08:26:28 AM »

Found some more bugs in my A* and was working on those.  One was just an edge-case where it wasn't adding a given node to the OPEN list.  The other is harder to solve; in a handful of situations, the goal node is removed from the final path list due to the code I wrote to prune the list so that muliple adjacent nodes didn't need to be present.

Eg.

Code:
.........
........7
.......6.
..4...5..
.3#######
.2#......
.1#......

In this, we can prune node 2, as it is directly adjacent to 1.  But we can't prune 3 or 4 (and in fact, should add a node to make the corner around the wall).  But we can prune 6.  Ideally we can prune 5, but it's harder to check for.

I recalled an old old Pathfinding article that addressed that issue as well.  So my next plans are to redo my pruning so that it only adds the additional corners (between 3 and 4) and then do a second pass to make for a smoother result (pruning 2, 4, 5, and 6).

E.g.
Code:
.........
........3
.........
.2.......
..#######
..#......
.1#......

That article also addressed smooth corners and turning radius, but that gets complicated quickly.  As these agents aren't slow-turning tanks, it's not significant.
« Last Edit: March 15, 2014, 08:38:17 AM by Draco18s » Logged

I code for me.
Draco18s
Level 0
**



View Profile
« Reply #14 on: March 16, 2014, 02:55:41 PM »

Notes before I forget, from a conversation with a friend:

Backdoor routes that are not on the mini-map
 - Entrances should be obscured, potentially near-invisible except though Perception
 - should be easy to add
Room-level independent awareness mechanic
 - should be easy to add on top of the existing room system
Rooms alert other rooms on a separate adjacency map
 - maximal spanning tree?
 - minimal spanning tree after removing routes from first MST?
 - would be moderate to add on top of existing system
Way for a GM to interfere with the player beyond ProcGen - will require networking code
 - would be difficult, but VERY nice to have
Activated perception ability?
Way for the system to notice/disable disguises?  +Cooldown on use
 - "These are not the droids you are looking for" already planned, this is specifically referring to the system forcing the ability off.
Data bomb mechanics (see perception)?
 - any kind of passive check should only happen once-per at limited range
 - should not reveal itself as anything specific
 - - implies other kinds of modifications that would need to be scanned (see perception)
Read over the matrix rules for SR2 and SR3
 - will need to acquire the books
Logged

I code for me.
Draco18s
Level 0
**



View Profile
« Reply #15 on: March 18, 2014, 09:54:55 AM »

Started work on some of the items in the previous list.

I'm leaning towards a mix between passive and active Perception, towards that route I've been creating various kinds of plugin modules that various security Features would be able to utilize for different kinds of bonuses.

Here's what I've got so far:
  • Analyze - Adds its rating to the check made to notice the player.
  • Data Bomb - When the player accesses the Feature, it explodes (unless disarmed).  This is regardless of whether the feature made the spot check.
  • Alarm - Increases the alertness level of the system (above the base) when the spot check succeeds (unless disarmed).
  • Encryption - Not mechanics built yet, but for things like the file cabinets it would slow down the player's access of the data.  For things like the laser grids it might hide the grid from view (unless the Perception check succeeds).
Not all plugins make sense for all security Features, but having several options to choose from makes things more interesting and gives a reason for the player to want to analyze everything.
Logged

I code for me.
Draco18s
Level 0
**



View Profile
« Reply #16 on: March 18, 2014, 06:33:23 PM »

Notes.  A few more plugin ideas.

  • Logout - Kicks the player back to spawn, having forced them to logout (then the player logs in again, handled automatically).
  • Corruption - One password the player has is reset.
  • Reinforce - Summons a new IC agent to the grid, which immediately investigates the location.
  • Trace - System begins a trace one the player.  When it completes, the system immediatelymoves to the highest alert level and always knows where the player is.
Ideas for IC agent behavior
  • Stationary and performs rotational scans of the room
  • Trap like - shots in a single file, doesn't move, hidden, explodes on successful scan
  • Combat oriented, low/no scan ability, strong attack and armor
« Last Edit: March 19, 2014, 06:59:35 AM by Draco18s » Logged

I code for me.
Draco18s
Level 0
**



View Profile
« Reply #17 on: March 21, 2014, 07:30:41 AM »

All modules are programmed so far (except Encryption, due to it needing to function outside the existing framework).

The "mine" IC (Intrusion Countermeasures) type is created.  The mine itself has a massive Analyze bonus compared to other ICs, but can't move, has an extremely limited scan area, and is pretty much a one-shot: It blows up like the Data Bomb module (and as such it cannot accept the Data Bomb module) as well as alerting nearby IC agents and increasing the system alertness.  It's currently always-visible like other (non-module) stuff, but that will change as I start programming the Encryption stuff.

Encryption will be one of the asymmetrical parts of the game.  For the player the system is attempting to beat their Stealth Attribute (or for some activateable powers, Spoof) and is rolling Analyze + System.  On the other side, the system is able to hide things using Encryption which the player needs to beat using Disarm (would be Decrypt, but seeing as there's no other use for Decrypt, I'm merging it with Disarm) which will also be used to disable Data Bombs and other modules as well as the mines.  Roaming IC agents won't be susceptible to it, but you will be able to Spoof commands to them or beat them up with Cybercombat (note: Combat should be a last-resort option, as an agent hit by an attack will immediately know that there is a hostile intruder).

Modules can be applied to IC as well as other Features (cameras and laser grids, eventually other things) and active and passive Perception is working.  Right now it's pretty much a given that if a Feature or IC has a module you'll spot it, although not always identify what kind it is (the thresholds are pretty low, based off the source material mechanics--almost makes me consider letting modules have modules, just so I can apply Encryption to them!  But no, it would get hairy fast).

Screenshots are a little old (the placement of the icon was tweaked) but this gives an idea of what things will look like.  The first one is a module of an unknown type, the second shows a highlight selection for the Analyze ability.  And the third is an identified Analyze Module (grants its Rating as a bonus to the Feature's scan attempt).  All the icons used are pretty obvious, the entire sprite sheet is fourth (and has room for another 4 module types).
http://s28.postimg.org/71dv2hup9/unknown.png
http://s7.postimg.org/km2mrndkb/highlight.png
http://s30.postimg.org/etdf39z0h/analyze.png
http://s9.postimg.org/gmklwr5a7/module_icons.png
The Analyze module icon got changed to red instead of black, so it was more apparent that it's not-good from the player's point of view.  The only one I'm not truly happy with is Reinforce (the solider).  The Corrupt one is a little strange, but "data corruption" doesn't really have a universally known iconography, versus "search" "bomb" "warning" or "logout."  the highlight also isn't great, but it's what I can get without paying $30 for a really nice system.

Individual rooms also have their own alert level, although that feature is incomplete so far.  There needs to be a way to indicate to the player that a given room is on high alert even if the system as a whole is not generally aware of the player.  Both of the alert levels (system and room) grant a bonus to scans (and the higher used to determine what action to perform), and per-room alert levels rise more quickly, but slowly reduce back to their minimum (Entry is always reduced to 0, no matter how high it was, Admin reduces to 8, and Security (the yellow room) reduces to 4).  Rooms also put neighboring rooms on alert (including using a different connection path than what the player sees--not yet constructed).

Also found some more pathing bugs.  All minor except one, which I still haven't fixed.  Somehow it's finding a path through a solid wall and I've only got one test case for it.  The more-frequent one was that obstacles weren't being avoided when spawning agents, so they'd get pushed outside it, then try and path back into it later.  A second one, which made it worse, was that pruning was still a little too aggressive.
Logged

I code for me.
Draco18s
Level 0
**



View Profile
« Reply #18 on: March 25, 2014, 05:25:57 PM »

Lots of stuff going on!

 * Fairly basic setup screens are now in, which include the ability to regenerate if you (the GM) are not happy with the layout or wish to change a setting.
 * Second IC type which scans in two directions and rotates (but does not move).
 * Security Connections between rooms (for room-level alerts).  These only match up to hallways on occasion.  Will probably continue to tweak how these are mapped, but its in a fairly satisfactory place right now (the red lines):

These connections are visible to the GM during their review, but not to the player later.
 * Optimizations made to the roaming AI script.  There was a lot of garbage collection going on that was eating big chunks of CPU time (now the only problem area is physics, which is fine, as even with the occasional spike it stays above 60 fps on my machine).
 * Game over state!  Once the player loses all their health, something actually happens!
 * Fancy shaders to use fewer objects and fewer textures!

The one on the right (actually the alpha-reverse) allows me to use a single texture for the health bar.  I had been using two of the middle-type shader, one for the white area (clipping max health, which is variable) and one for current health (actually filling in as you took damage).  (Texture shown above is the one I was using for max-health.  What alpha cutoff does is make any alpha value below the threshold 0 and the rest 1.  My new shader made it so that anything below the lower threshold was clipped AND anything above an upper threshold was also clipped.  The inverse clips the alpha values between the two thresholds.)
It also lets me use a single texture for the data search results of the file cabinets (which now pack data centers).

Still need to add in the higher level alert states for the roaming guys (attacking and such) of course.
« Last Edit: March 25, 2014, 05:31:34 PM by Draco18s » Logged

I code for me.
Draco18s
Level 0
**



View Profile
« Reply #19 on: March 28, 2014, 10:47:32 AM »

Actually kind of reasonably playable version available.

Still lacking a lot of generally stealthy kinds of tactics (hiding behind stuff) but that's due to a lack of ambient feature objects.  But still, staying out of sight = good, getting spotted = not instant death.

http://www.pages.drexel.edu/~mmj29/temp/hacking.html

The first two screens are the setup (for the GM).  Roughly speaking the larger the values for the System, the harder it will be.  Higher numbers for the hacker, the easier it will be. (It is not linear: all 3s will not be equivalent to all 6s, although in general the larger the gap the easier/harder time the player will have--easier if the player's numbers are higher, harder if the System's are).

While it will accept values up to 32, its probably not advisable to go above about 9.  I haven't done any tests above that either, so it might be fine, it might not be (the System attribute contributing to the number of roaming agents, so setting that to max will impact performance for sure, same thing with the size of the dungeon, which at some point will go over ~120,000 verts and the Combine Children script will not display over half of the level geometry).
Logged

I code for me.
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic