Questions about an always-on-screen indicator and the related scripting topics

Started by Petike, Sat 10/08/2024 18:30:42

Previous topic - Next topic

Petike

Hello everyone.

I already have some experience with making AGS rooms and all the basics that come with it, including a bit of scripting. However, I would like to ask about a certain feature in the game I'm working on, because it doesn't require just graphical work, but no doubt some extended coding to make it work. I've searched the forums as best I could, but there doesn't seem to be a specific thread covering this, so I've decided to start a new thread and ask. Apologies if there is already a topic about this. I'm still new here and feel rather intimidated about even asking any questions here on the forums.

While learning AGS on-and-off during the past year and experimenting with it, I've also learnt and tested some effects pertaining to lighting in the game, including setting it to reflect differently when a character is in a region set out to be associated with a lighting effect (e.g. a room where two animated backgrounds allow for a blinking street lamp, with the player having a slightly different shade while standing under the lamp during its lit phase). The reason I mention this is just to make it clear I do already have some basic knowledge on simple tricks and settings related to depicting lit areas within a single room.

The game I'm working on exists in a more grounded fantasy setting, and though it's primarily an adventure game in terms of genre, there are also some stealth elements to the gameplay. I plan to keep the inventory and the character commands off-screen while not in use, but I'd also like to include one HUD (heads-up-display) indicator that is always on-screen, in an upper corner. This indicator pertains to the stealth elements, providing the player with a simple indicator of how visible/detectable the player currently is (within the given region of a room's walkable area that the player is present in).

I'm not sure how to add the graphic representation of such an indicator, how to animate the indicator (e.g. showing multiple shades of light/dark, or a colour code for "quiet/loud steps", reacting to the player's position in a pre-set region), and what the possible coding procedure could be for such an indicator.

The only AGS engine game I recall using a similar stealth indicator was Croshaw's fairly old Trilby: The Art of Theft, the spinoff of his earlier adventure game series. Though that can serve as a reference point, I don't necessarily want to do it in the same manner, just fairly similar.

I'd have plenty of other questions, but one has to start somewhere and with some focus. I figured a relatively simple thing like this, covering a rather key additional game mechanic (additional to the more standard point-and-click gameplay), is a good start, to get some of the harder work out of the way sooner.

Note that, despite this pertaining to a stealthiness indicator, I'm not asking about stealth gameplay itself yet, but just the indicator as a feedback-to-the-player element. I know stealth is doable in AGS, but it's clear to me that implementing it would be rather pointless if I wouldn't figure out how to represent it to the player, giving the player a clear idea about the current situation, rather than leaving them with guess work.

I'm all ears concerning any ideas on implementing an always-on-screen indicator like that.     

eri0o

It all depends how are you designing it. I really like the first Tenchu

https://m.youtube.com/watch?v=8g0pWUmwNhY

Here you can see in the bottom left the stealth indicator has a ? (and blue) if you are undetected but close to the enemy, and there is a circle that grows to indicate some intensity - how close the enemy is. Once you are somewhat detected it turns red with a !?.

In Tenchu because of the 3D camera and geometry the stealth indicator also serves a gameplay use - it helps you detect an enemy before the enemy finds you.

Walking fast or slow changes how easily and enemy can spot you but it won't impact in the indicator, the indicator is only for helping you to visualize two things

  • State the closer enemy is: unaware, aware, looking around
  • Distance from the enemy

So you can make the first one be an enum, and the second one can be an int.

Then to make it a visual you can use either overlays or a GUI, say using two buttons, one will show state and the other will show intensity.

The state is pretty easy, just change the NormalGraphic property depending on the state.

The intensity then can be just something that gets a size set, you can use an overlay and change it's width and height or use a dynamic sprite to adjust the drawing and put the graphic as the NormalGraphic of that button.

Overall I would say it depends what you want to show to the player, what is necessary to indicate, the actual gameplay of the specific stealth mechanics you want to implement.

Crimson Wizard

There are many many ways an indicator could be done. So, whenever such question arises (any similar question really), it's important to define the desired logical behavior of a game element, point by point, "on paper". How does it look like, how does it behave, how does it connect to the game, what are the conditions that define its state, etc, etc.
When such "paper" exists, divide it on parts that you already know how to do, and those that you don't. Then find out about the latter.

Petike

#3
Quote from: eri0o on Sat 10/08/2024 19:30:48It all depends how are you designing it. I really like the first Tenchu

Here you can see in the bottom left the stealth indicator has a ? (and blue) if you are undetected but close to the enemy, and there is a circle that grows to indicate some intensity - how close the enemy is. Once you are somewhat detected it turns red with a !?.

In Tenchu because of the 3D camera and geometry the stealth indicator also serves a gameplay use - it helps you detect an enemy before the enemy finds you.

Walking fast or slow changes how easily and enemy can spot you but it won't impact in the indicator, the indicator is only for helping you to visualize two things

Tenchu's approach is interesting, including the HUD used, but I was thinking more along the lines of the Thief trilogy (1998-2004) or The Dark Mod (2013-) homage made by Thief fans, and unrelated stealth games that have used similar systems.

Ergo, in Thief you have a relatively simple system, where there's a 'light gem' and it has various 'levels' of illumination, from darkest to brightest, depending on the depth of shadows or intensity of light around the player character. The whole 'light gem' conceit was very simple and elegantly minimalist, it only showed the amount of light or dark, no other information. (About the most complex thing about it were the various shades of light/dark it goes through, depending on the surrounding environment.)

In addition, in Thief, you also had the audio/aural side of stealth, where you had no on-screen indicator whatsoever, and the player simply learnt to associate certain types of surfaces with certain levels of loudness. Logically, metal grate surfaces or tiles in echo-y halls were depicted as louder, capable of giving away one's location more easily, than walking on carpets, quieter floorboards or low grass.

It's not necessarily wholly realistic, same as with the hiding in shadows mechanics and such, but there is a bit of real world verisimilitude in it that players can learn and understand quickly and easily.

One other game with an interesting idea about sound-based stealth is Betrayer (2014). The player character could utilise the sound of the trees rustling in the surrounding forests, triggered by strong gusts of wind in the outdoor, wilderness environments the game was set in. The rustling of the trees allows the player to do things such as a quick sprint to another location, under the cover of the loud rustling sounds, without being heard. Regular walking around, without a gust of wind, instead makes a player more audible to potential enemies nearby, necessitating the usual crouched stealth walking instead. I felt that the "louder sounds as cover" stealth idea was fairly unique. Though admittedly, you could think of it as a variation on Thief's idea about walking on carpets guaranteeing more muffled footstep sounds, i.e. you could walk on carpets upright without much fear, not needing to crouch down while moving atop a carpet. 


All of the above brings me to some potential experimentation with the stealth mechanics in my project:

----

1.) the light/dark aspect of stealth would follow Thief's example, as it's simple and elegant. You can use it as a certain design pattern for each AGS room, separating the walkable areas of a room into regions that cause different stealth conditions.

For example, let's say I set one region of a room to have a certain value represeting a certain degree of light or darkness, and the light/dark indicator reacts by displaying a "current light level" that corresponds with the value set for that region. If, e.g. I made the indicator have 5 light levels, and decided "0" means "not visible to the naked eye", "100" means "completely visible", and "25", "50", "75" are the gradual values in-between, a player character present in a "0"/"complete shadows" location (a region set to the "0" value) will have the indicator reacting to that "0" value with the corresponding dim graphic. If at a "50"/"half-shadow" location (region set to "50"), you'll get an in-between shade of light on the indicator.

The graphical depiction of the 'light levels' on the indicator would, in basic spirit, follow the context-sensitive light levels of Thief's light gem. In this case, the thing driving it underneath the smoke-and-mirrors of the in-game world, would be the regions of an AGS room, associated with certain light levels.

Though I'm not absolutely sure, I think this should be doable even with animated backgrounds affecting the depiction of light sources. I.e. if a player character stands underneath a strongly blinking street lamp, their light level could potentially vary based on the background cycling of a dim street lamp and a lit street lamp. You'd have to work with the same region and likely set two different associated light effect values for the two backgrounds, but you'd likely be able to get the desired effect (both with the player in the environment, and the reaction of the indicator).

----

2.) the sound aspects of stealth would also be similar to the existing titles I mentioned above. Not in a literal manner, because AGS is obviously a very different engine, after all, but you'd once again have the use of AGS regions, within a specific AGS room, to signify different audio outcomes affecting stealth.

Let's say most of a room has surfaces (sorted into regions) that create muffled or fairly quiet sounds. The player has to be a bit careful about some of these surfaces, but not too much. However, the player might come across one region of the room placed over surface graphics indicating e.g. a metal floor. Once the player walks in this region of the AGS room, a corresponding sound effect is played (if it's possible to wary or swap the player's walking sounds depending on the region they're walking in). The loudness of the footsteps

I haven't thought in detail whether the player character would ever outright run, but let's say a certain key combination could allow the player character switching between an upright/crouched stance. The crouched stance would make walking on regions representing louder surfaces somewhat quieter (and ultimately slower as well, since you can't both be crouched and run at the same time).

The audio side of things could also extend to the "background ambience as sound cover for the player" mechanic. If the player is in a machine room, indoors, or is on some countryside road, lined with trees and groves during windy conditions, these could provide an audio "cover" for the player's footsteps. Either statically (e.g. a turbine loudly humming in the background of that particular machine room) or slightly more dynamically (e.g. depending on the time of day and weather, the outdoor location could be windy or still). 

----

I imagine the overall indicator in my game - the base frame of the entire graphic, at least - to have a central, dimming/lighting-up area akin to the light gem (light/dark stealth), and the outside part of the frame have several little "control light" objects in the manner of a colour semaphor, a particular colour indicating a level of loudness, in terms of risk, danger (sound stealth).

If a player character in my game walks into a well-lit area, the light/dark part of the indicator lights up accordingly. If the player character walks over a quiet surface, there might be no control light or a green little light, but if the player keeps walking with loud footsteps on a "loud type" of floor, the sound control light might light up orange, or outright red.

----

I don't envision the indicator showing any distance towards guards or other NPCs, nor their (potential) nearby location, or any other information of that sort. Instead, those NPCs that might object to your player character being there (not all NPCs object to a player's presence and some NPCs even ignore it) will have separate ways to show they've noticed someone they're suspicious of, etc. Maybe a tiny icon popping up above the NPCs' heads, maybe a unique animation (a "startled reaction", or something), a soundbite in the vein of "Anyone there ?" / "Did I just see...", or if the player is seen clearly, "What ! What are you doing here ?!", etc., etc.

In short, some sort of indication on how the more player-hostile NPCs are reacting to the player's stealthiness, or lack thereof, but without making it part of the player's indicator. The indicator is just the player's readout, but everything beyond that is ambiguity, and the player character has to pay some attention to the NPCs that could prove hostile if the player was caught by them.

----

I've found and read an interesting older stealth-related discussion here on the forums, where it was suggested the "cones of vision" for guard-style NPCs could be placed in front of guard NPCs, set as separate NPCs, and made transparent, but influencing the main NPCs. I haven't thought about it much, but as far as setting up any "seeking"/"searching"/"guarding" archetype NPCs is concerned, some of those AGS design ideas might have some merit. (As for more regular NPCs, many wouldn't need stealth-related reactions to a player, unless there was a good in-story reason for it.)

Quote from: eri0o on Sat 10/08/2024 19:30:48
  • State the closer enemy is: unaware, aware, looking around
  • Distance from the enemy

So you can make the first one be an enum, and the second one can be an int.

Then to make it a visual you can use either overlays or a GUI, say using two buttons, one will show state and the other will show intensity.

The state is pretty easy, just change the NormalGraphic property depending on the state.

The intensity then can be just something that gets a size set, you can use an overlay and change it's width and height or use a dynamic sprite to adjust the drawing and put the graphic as the NormalGraphic of that button.

Thank you, this will be very helpful as I delve more deeply into constructing more complex scripts. I'll gradually look into it as I get better at scripting, I'll do a few test implementations, and see how it goes. The game, as it is now, is just a very humble prototype so far. I want to work mainly on the mechanics first, and once I'll be more satisfied in how it all gels together, I'll focus on expanding the storyline draft I have for the story of the game, and my ideas for the environments and locations in the game.

----

Now, concerning the things I want to show the player, and how it fits into the overall gameplay, I'll break it down a bit, into individual answers:

Quote from: eri0o on Sat 10/08/2024 19:30:48Overall I would say it depends what you want to show to the player
The indicator's function is that of an early warning device (in a figurative and literal sense) for the player character, an easy way to show the player their current status within an environment, with regards to the visual and aural aspects of stealth. I.e. whether they are easily visible or audible at that given moment, in the exact spot they're in.

I'll note that the indicator is not meant to be a direct alarm. It's not going to flash or make sounds that tell the player "Watch out, you could be spotted when you don't want to right now.". It's meant to be just an indicator, and the rest is up to the player's concentration and skill within a given room (i.e. environment, whether indoor or outdoor). 

Quote from: eri0o on Sat 10/08/2024 19:30:48what is necessary to indicate
By and large, it's only light/dark stealth and the audio stealth. To keep things personal (and arguably more immersive) for the player, the player character only knows their own current stealthiness status with any certainty. Whereas the reactions of NPCs hostile to the player character are kept ambiguous/unclear at a distance, and it's only when the player gets closer that he does get feedback on the NPCs (the sight direction of guarding NPCs, their patrol routes, etc.) and could be potentially spotted/heard (a guarding NPC 'noticing' the player in a better-lit area nearby, or hearing a suspicious sound nearby, etc.).

Quote from: eri0o on Sat 10/08/2024 19:30:48the actual gameplay of the specific stealth mechanics you want to implement.
I've largelly covered the 'hard' in-game stealth mechanics in the preceding parts of this post. I want to keep them fairly simple and intuitive.

The game is going to have some RPG elements that will slightly affect a player character's stealth, but aren't going to provide an easy victory or easy defeat in that area of the gameplay.

I have also pondered that maybe the player character could occassionally come to a section in the storyline where they'd get a disguise and the stealth would be social. However, rather than a completely separate mechanic, like with light/dark and sound stealth, the disguise/'social' stealth idea is more about the stealth being implied, rather than a 'hard' gameplay mechanic, like the preceding two. I.e. let's say the player character wears a disguise in a particular part of the game's story, gathering intel, but when talking with some local NPCs, going through a dialogue tree, the player might pick an answer that will make the local NPCs suspicious. To prevent this from devolving into a trial-and-error thing (especially for a first time player of the game), the player would be encouraged to explore the location before and during dialogue, to find any notes or hints about the local situation, to avoid potential local social faux pas, and so on. Essentially, the exploration, gathering clues and intel can give the player indirect hints at what answer to choose in conversations with locals, with strangers, etc., and avoid blowing the player's cover.

Quote from: Crimson Wizard on Sat 10/08/2024 19:54:18There are many many ways an indicator could be done. So, whenever such question arises (any similar question really), it's important to define the desired logical behavior of a game element, point by point, "on paper". How does it look like, how does it behave, how does it connect to the game, what are the conditions that define its state, etc, etc.
When such "paper" exists, divide it on parts that you already know how to do, and those that you don't. Then find out about the latter.
Indeed.

I have a clear idea about the elements and their interactions, it's just that I need to look into each of these elements from the perspective of presenting them convincingly through AGS.

If some of the stealth-related mechanics in my project would be highly limited by some limitations of the AGS engine, I'd obviously have to either omit them or scale them down or rework them in some other way. Generally, I'm pretty confident that many of the mechanics can be depicted quite well through AGS, even if it'll take a bit of scripting (including more advanced scripting) to eventually get there.

Snarky

Is there a tl;dr version of this? There's too much to dig through to figure out what you actually want to show.

In general, to display a visual indicator, you could either:

1. Draw and import all the different possible indicator states as separate sprites, and display the appropriate one depending on the state (e.g. if you were using a traffic light indicator, or for an old-school Doom-style face indicator)
2. Draw it dynamically (for example changing the size, orientation or color) depending on the state, using functions like DrawRectangle, DrawCircle and DrawLine (easy to do health bars, compass needles, radar pings etc. in this way)
3. Use a particular sprite and use rotation, scaling, tinting or some other adjustment to change its appearance
4. Layer multiple sprites on top of each other, optionally using transparency to control the appearance
5. Some clever combination of the above
6. Probably other ways

Of course, you can also do animation (for example a heart rate monitor) by constantly updating the display.

Typically you would display the final sprite on a (non-clickable) button on a GUI, or you could use an overlay.

Any reasonable visual display should be perfectly doable in AGS.

SMF spam blocked by CleanTalk