Stealth...

Discussion in 'Scripting' started by Alec, Aug 20, 2008.

1. Alec

Joined:
Mar 11, 2008
Posts:
1,330
Eventually I have to come round to working on the stealth system in Delta Maverick but I have no idea on how to execute. Heres some points on what I want.

-stealth system in a day and night cycle world
-Shrub/foliage stealth

^
thats the most optimal outcome however if we had too I guess we'll have to find a way to use viewcones.

Hope I get some help

2. zumwalt

Joined:
Apr 18, 2007
Posts:
2,287
Take light intensity into consideration, give your characters a variable for detection level based on light level, then the player code checks the nearest light sources and there intensity and helps to determine his / her hidden factor.

Say you have 10 light sources in your scene, light source intensity for the lights are each a 2 for instance, distance from nearest light is about 10 meters and with an intensity of 2, that goes out say 4 meters, so he has a bonus factor of 6.

Direction of light from player and objects between player and light source to determine shadow location. If the player has a barrel between himself and the light source, then the source is casting some shadow reducing the lights effectiveness by half, so based on what I mentioned above, light source intenisty of 2, distance of light range is 4 meters, range from source is 10 meters, bonus from light source is 6, barrel in the way casting shadow, crouching bonus sitting still is half his currenb bonus so that is 3, if he is standing if the barrel is shorter than he is the bonus is nullified otherwise it is still 3, so a total bonus of 9.

Add in player stealth ability points where necessary, now a guard passes buy, he has a percent chance of detecting the player based on his senses skill (if you have that), so say he has an awareness skill of 10/20, the player has a stealth skill of 14/20, then add in his bonus of 9, making him 23/20, frankly the guard stands no chanse to detect him, otherwise if it was under 20 then you would do some math between the differences and do a check to see if he is detected.

If detection fails, don't bother another check unless the player moves. The guard needs an awareness range, (or sight range) which is pentalized during the night and bonus during the day.

A ton of work.

3. Alec

Joined:
Mar 11, 2008
Posts:
1,330
Seems like a dam lot of work, how do you think I should start?

4. zumwalt

Joined:
Apr 18, 2007
Posts:
2,287
Start simple, write a code block that lets your character know how close it is to the nearest light source. Find the light intensity, have a value for day or night, and just print out to the console the resulting factor. You have to have a character class that you will be expanding on. Its all dynamic once you get it in place.

Attach that script to the player prefab, move it around, maybe have the information on an on screen gui, be generic at first, have it show seen or unseen as the message and play around with it some.

Do you own visio?

5. Alec

Joined:
Mar 11, 2008
Posts:
1,330
No idea what viseo is

6. Alec

Joined:
Mar 11, 2008
Posts:
1,330
I'm having a hard time with this, not sure which components to use.

7. Alec

Joined:
Mar 11, 2008
Posts:
1,330
Don't worry now, CHarlesHinshaw is helpin me

8. zumwalt

Joined:
Apr 18, 2007
Posts:
2,287
Sorry I haven't had the time to get back to this thread, been in the middle of a move. Visio is a microsoft software that allows you to create diagrams. If you have a diagram of your character layout, it helps to visualize the code.

Actually, any sort of visualization / diagram modeling software would help any developer. If you can see how things are to be built, understand how they are to react, and have some sort of blueprint on how you are to handle things, you are way better off.