Unity Community


Page 5 of 7 FirstFirst ... 34567 LastLast
Results 81 to 100 of 130

  1. Posts
    261
    Ok, I recorded a quick video to show the progress so far. My test area only has two cubes as walls, a "page" (actually another cube) floating in midair, and a stretched sphere representing SM (currently stationary). Everything is FAR from complete, including my attempt at making a flashlight. What I show off here is that I can pick up the page (for some reason, the first time I click when testing the game, it unlocks the cursor, so I had to move it back), and the sound effects for the sanity level. If I'm within 10 meters when I go from not seeing SM to seeing him, it plays the dramatic sound.

    The video is a little stretched vertically, just ignore that.



    All the sounds are temporary too. I'll probably make something from scratch.

    (*EDIT* Wow, top of the next page in the thread. Perfect! ^^)
    Last edited by AgentParsec; 05-24-2012 at 01:19 AM.


  2. Location
    Spain
    Posts
    208
    I think that instead of the first static noise sound, a quick hearthbeat sound would be better


  3. Posts
    261
    Quote Originally Posted by ludiares View Post
    I think that instead of the first static noise sound, a quick hearthbeat sound would be better
    I agree. I'll switch that in when I switch out the other sounds.


  4. Posts
    1,579
    Woo! That was a pain in the ass (no it was actually really fun)

    Here you have a barebones Slenderman movement code.

    Please note, I am by no means a coder, and I'm positive everything here could be optimized or made easier to understand. My methods are far from clean, so don't take my style with a grain of salt

    BEFORE YOU GET EXCITED OR ANYTHING:

    Slenderman does NOT avoid obstacles or do any algorithmic pathfinding of any sort. He just finds a waypoint and moves towards it. I am trying to work towards a basic path system based on passable / not passable that will allow for finding and moving around obstacles, similar to A* but with much dirtier coding
    -------------------------------------------------------------------------------------------------------------------------------------------
    Code:  
    1. //- Roam whenever the player is not seen by SM, and the player is not facing SM
    2. //- Move towards the player whenever player is seen by SM (not necessarily the player seeing him back), and the player is not facing SM
    3. //- Teleport to a legal position within a maximum and minimum range when:
    4. ///--- A. SM moves outside of the maximum range
    5. //--- B. SM roams for a random amount of time without seeing the player
    6. //--- C. The player is facing him (but does not see him), a random amount of time has passed, and there is still a chance he will not teleport at all
    7.  
    8.  
    9.  
    10.  
    11.  
    12.  
    13.  
    14. #pragma strict
    15. var moveSpeed:float = 0.0;   // how fast slendy moves
    16. var maxRange:float = 0.0;   // the maximum range SM can be from the player without teleporting.
    17.  var timer:int = 0;  // a little timer for function timing.
    18. var wayPoints:GameObject[];  // an array that stores all the waypoints for pathfinding.
    19. var player: GameObject;   /// the player gameObject, used for targeting
    20.  var targetWaypoint: GameObject; // very important: the current waypoint marked for pathfinding.
    21. private var lastTarget:GameObject; // ignore this unless you really want to know what it does.
    22. var isMoving:boolean = false;    //checks if SM is moving. useful for determining whether to stay or roam.
    23.  
    24. var pointer: GameObject;  // the pointer object used for spotting the player. Make sure it is not too high or too low.
    25. var range:int = 0;  // the range at which Slenderman can spot a player
    26. var canSee:boolean = false;  // if Slenderman can see the player (not vice versa or anything)
    27. var scanInterval:int = 0;   // how often to scan for player distance
    28.  
    29. function Start () {
    30.  
    31. wayPoints = GameObject.FindGameObjectsWithTag("waypoint");    // find all the GO's and store them off the start.
    32.  
    33. FindRoamPath();   // get us off pathfinding something
    34. }
    35.  
    36. function Update () {
    37.  
    38.  
    39. ////the eye of the Slenderman//////////////////////////////
    40. ///////////////////you can use your own SM vision code here.
    41. ///////////////////just make sure canSee is true for proper movement.
    42. pointer.transform.LookAt(player.transform);
    43. if (Physics.Raycast(pointer.transform.position,pointer.transform.forward,hit,range))
    44.     {
    45.         if (hit.collider.gameObject.tag == "Player")
    46.             {
    47.     Debug.DrawRay(pointer.transform.position,pointer.transform.forward,Color.red);
    48.         print(" can see!");
    49.         canSee = true;
    50.             }
    51.         else
    52.             {
    53.             canSee = false;
    54.             }
    55.  
    56. }
    57. else if (!Physics.Raycast(pointer.transform.position,pointer.transform.forward,hit,range))
    58.     {
    59.     canSee = false;
    60.     }
    61. ///////////////////////////////////////////////////////////////////////////////////////////////
    62.  
    63. /////////////////a private timer. can be replaced with Time function for more accurate results.
    64. ////////////////////after a certain amount of time, search distance to player.
    65. ////////////////////the only reason this is set up as a function is because of performance reasons / teleport function
    66. timer++;
    67. if (timer > scanInterval)
    68.     {
    69.         searchDistanceToPlayer();
    70.        
    71.         timer = 0;
    72.     }
    73.    
    74.    
    75.     //search for new waypoint once I'm close to one.
    76. if (Vector3.Distance(transform.position,targetWaypoint.transform.position) < 1)  // this number can be changed on whatevs (depending on scale);
    77.         {
    78.             if (!canSee)  //if I can't see the player. Just to make sure I'm actually roaming.
    79.                 {
    80.             FindRoamPath();
    81.                }
    82.         }
    83.    
    84.            
    85. if (isMoving)    //this does the actual movement.  movement is always the same, the target is what's different.
    86.     {
    87. transform.position = Vector3.MoveTowards(transform.position,targetWaypoint.transform.position,moveSpeed * Time.deltaTime);
    88.     }
    89.    
    90.    
    91. // If I can see the player, execute the function that finds a path to the the player
    92. // this is called everyframe because of SM visibility. a quick conditional will allow me to see if I can see the player (no pun intended)
    93. // if I can see him, then execute FindFollowPath(), which finds the nearest waypoint to the player (as if he is following him).
    94. if (canSee)
    95.     {
    96.         var nearpoint = FindFollowPath();
    97.         if (lastTarget != nearpoint)            //if it's not the same, then keep on moving
    98.             {
    99.         targetWaypoint = nearpoint.gameObject;
    100.         lastTarget = nearpoint.gameObject; // prevents re-moving to same position - jittery
    101.             }
    102.             else
    103.             {
    104.             isMoving = false;     //you're close enough, stop moving. This works by checking if the same waypoint has been selected twice.
    105.             }
    106.     }
    107.  
    108. }
    109.  
    110. function FindRoamPath()   //this doesn't do pathfinding. This just tells us the path to find. In this case, a random one.
    111.     {
    112.         isMoving = true;   // gotta get up off our feet
    113.         var rand:int = Mathf.Floor(Random.Range(0,wayPoints.length));   // a random waypoint has been selected! 
    114.         if (lastTarget != wayPoints[rand])  // similar to above. don't randomly pick the same spot.
    115.                 {
    116.                     targetWaypoint = wayPoints[rand]; // our target waypoint is now a random one from the list.
    117.                     lastTarget = wayPoints[rand];
    118.                 }
    119.                 else
    120.                 {
    121.                 isMoving = false;
    122.                 }
    123.     }
    124.  
    125. function FindFollowPath() : Transform   //if I see the player, find a path to his position.
    126.     {
    127.     // loop through each tagged object, remembering nearest one found. Original "find nearest" code by Ben Pitt.
    128.     //http://answers.unity3d.com/questions/16676/how-can-i-make-my-gameobject-find-the-nearest-obje.html
    129.     // basically what it does is go through the list of waypoints and finds the nearest one to the -player- through distance.
    130.      var nearestDistanceSqr = Mathf.Infinity;
    131.     var nearestObj : Transform = null;
    132.    
    133.     for (var obj : GameObject in wayPoints) {
    134.  
    135.         var objectPos = obj.transform.position;
    136.         var distanceSqr = (objectPos - player.transform.position).sqrMagnitude;
    137.  
    138.         if (distanceSqr < nearestDistanceSqr) {
    139.             nearestObj = obj.transform;
    140.             nearestDistanceSqr = distanceSqr;
    141.         }
    142.     }
    143.  
    144.     return nearestObj;
    145. }
    146.    
    147.    
    148.    
    149.    
    150. function Teleport()    // take me to a random waypoint!   this function does not yet utilize legal (nearby) waypoints
    151.     {
    152.         var rand:int = Mathf.Floor(Random.Range(0,wayPoints.length));
    153.         targetWaypoint = wayPoints[rand];   
    154.         transform.position = wayPoints[rand].transform.position;
    155.     }
    156.    
    157.    
    158. function searchDistanceToPlayer()   // find distance to player. Might as well check if I'm above range to teleport, too.
    159. {
    160. var curDistance:float;
    161. curDistance = Vector3.Distance(transform.position,player.transform.position);
    162. if (curDistance > maxRange)
    163.         {
    164.             Teleport();
    165.         }
    166.  
    167. }
    I kind of got carried away, and in doing so sort of created a more general purpose AI, missing on the SM specific functionality! Never fear though, the next version of this script is coming soon. Here is the checklist:
    //- Roam whenever the player is not seen by SM, and the player is not facing SM
    COMPLETED
    //- Move towards the player whenever player is seen by SM (not necessarily the player seeing him back), and the player is not facing SM
    DONE
    //- Teleport to a legal position within a maximum and minimum range when:
    ///--- A. SM moves outside of the maximum range
    ** DONE
    //--- B. SM roams for a random amount of time without seeing the player
    INCOMPLETE, SIMPLE ENOUGH
    //--- C. The player is facing him (but does not see him), a random amount of time has passed, and there is still a chance he will not teleport at all
    SOME MORE WORK NEEDED HERE
    -------------------------------------------------------------------------------------------------------------------------------------------

    FURTHER IMPROVEMENTS FOR FUTURE PLANS:

    - Automatic waypoint generation system in the works. So easy! (if coded dirty that is!)

    - Terrain worthy (this should actually already work, if waypoints are placed via raycast from automatic generation)

    ----------------------------------------------------------------------------------------------------------------------------------
    if you have any questions please ask.

    directions for use:
    1.) assign to Slenderman object.
    2.) assign pointer object, or just Slendy himself
    3.) set move speed, make sure isMoving is checked at the beginning
    4.) make sure scanInterval is above 0, mine is set at 50.
    Last edited by TehWut; 05-24-2012 at 06:02 PM.
    Completely new to game development and Unity? don't know where to start? You don't have to be a n00b, click here and you'll be a pro in no time! The complete scripting series will bring you from zero to hero!

    Really guys, get over it. Everyone these days wants a MMO not single player. I know we should start out small but times have changed. Anymore in the game industry no matter how small or large you have to go big or go home!


  5. Posts
    261
    I've written some music to go with it now. It's a simple theme with four short loops (each loopadds an extra instrument). Nothing plays when no pages have been collected. When one page has been collected, it plays the first loop, then every two pages after that it changes to the next loop. Presumably on page 8, the game has been won, so it'll fade the music back out at that time.
    Last edited by AgentParsec; 05-24-2012 at 11:44 PM.


  6. Posts
    261
    I'm experimenting with the terrain editor. It looks fairly easy to use, although I know I did something wrong because none of the trees are solid. Thankfully I was experimenting in a separate project, which saved me from a bunch of cleanup.


  7. Posts
    261
    I'm doing some research into scresn effects. Apparently, UnityFree does not support these kinds of effects directly like UnityPro does, so a workaround is to attach a plane in front of the camera and apply the effects to the plane instead.

    I'm also looking into footstep sound effects. This should be considerably easier.


  8. Location
    Spain
    Posts
    208
    Quote Originally Posted by AgentParsec View Post
    I'm experimenting with the terrain editor. It looks fairly easy to use, although I know I did something wrong because none of the trees are solid. Thankfully I was experimenting in a separate project, which saved me from a bunch of cleanup.
    If you want the trees to collide, you have to put a capsule collider to the tree prefab


  9. Posts
    261
    Got another video. This one shows me picking up pages and the four music loops each starting. After that, I show the static effect that I apply to the screen when your sanity starts to drop.



    The static isn't really done justice by the video; it rendered it all wobbly-looking, but it actually looks more like regular static.


  10. Posts
    261
    I've made the textures for the pages now (linked due to size, they're each just over 1mb):

    Page 1
    Page 2
    Page 3
    Page 4
    Page 5
    Page 6
    Page 7
    Page 8

    Drew these myself to resemble the kind of scrawlings you find in the Slender Man mythos. I'm rather pleased with how they came out. ^^


  11. Location
    USA
    Posts
    751
    here i just made this real quick cause i got a little bored use it all you want

    Slendermanmodel.zip
    Last edited by xxxDjdogxxx; 05-28-2012 at 12:03 AM.
    The "World" is 3D.


  12. Posts
    261
    Quote Originally Posted by xxxDjdogxxx View Post
    here i just made this real quick cause i got a little bored use it all you want

    Slendermanmodel.zip
    I appreciate it, but someone has already volunteered to make a SM model, and is currently working on texturing it. Plus, I'm going with the non-tentacled version of SM for this.


  13. Location
    USA
    Posts
    751
    Quote Originally Posted by AgentParsec View Post
    I appreciate it, but someone has already volunteered to make a SM model, and is currently working on texturing it. Plus, I'm going with the non-tentacled version of SM for this.
    okk it's fine just a really cool game concept
    The "World" is 3D.


  14. Posts
    439
    Holy, this game raises hair even without proper graphics... Really nice job with the sound effects!
    Looking for helpfull hands with an action/RPG fan game -- link
    Remember to have a nice day and smile!


  15. Posts
    261
    I've run into a few minor problems. There's a clipping issue with the FPS controller if you're running in widescreen, where you can see through the wall on the far right or left side if you're pressed up against it. I think I can probably fix it by making the object a little bigger, though I'm worried about making the player too big to fit around the map comfortably. My static object also clips a little, which I can try to fix by just making it smaller and placing it nearer to the camera.

    Another thing is that the static object gets squished when crouching (since everything on the player model gets squished). I was thinking about just taking out crouching entirely, since I'm not having jumping either. Simplified controls can be good, after all, and I honestly don't see a lot of need for crouching in this game to begin with.

    I applied my page textures to the pages, and I also figured out how to make them highlight (as if under full lighting) when you are able to pick them up.

    Next I have to figure out how to do the player's footsteps, and some kind of panting when stamina is low. That, besides any ambient sounds in the woods, will pretty much wrap up all of the games' sounds.


  16. Location
    Spain
    Posts
    208
    Maybe, your problem with the camera seeing through objects can be solved by setting the camera Near Clipping Plane property to 0 instead of 0.3.


  17. Posts
    261
    Quote Originally Posted by ludiares View Post
    Maybe, your problem with the camera seeing through objects can be solved by setting the camera Near Clipping Plane property to 0 instead of 0.3.
    That did it! Thanks!

    *EDIT* Although now, suddenly it doesn't let me pick up pages anymore if I'm too close...

    *EDIT EDIT* Okay, I set it to 0.2 instead, now it picks up the pages and the rendering issue still does not occur. Don't know why it affected the pages exactly, but as long as it works...
    Last edited by AgentParsec; 05-28-2012 at 02:27 AM.


  18. Posts
    261
    Why I'm doing this instead of going to sleep, I don't know, but I have successfully put in the sound of footsteps and heavy breathing if you sprint for too long. Sounds are pretty much done at this point, though I will probably replace the dramatic sound that plays when SM is revealed within 10 meters. Okay, NOW I'm going to sleep.


  19. Posts
    1,579
    You could consider using this a screen effect for sanity meter, and I imagine it would work similar to a "blood effect" in other games.

    On the edges of the screen you would begin to see these vein like / tentacle like shapes. I always think through my ideas, and it would do a few cool things.
    1.) relate to that Eastern European SM mythos, a poem about how you will begin to see tentacles in the corners of your eyes
    2.) put the player on edge because it could look like SM is at the edges of your screen

    Of course, it would be much better drawn than this, just an idea.
    Completely new to game development and Unity? don't know where to start? You don't have to be a n00b, click here and you'll be a pro in no time! The complete scripting series will bring you from zero to hero!

    Really guys, get over it. Everyone these days wants a MMO not single player. I know we should start out small but times have changed. Anymore in the game industry no matter how small or large you have to go big or go home!


  20. Location
    Spain
    Posts
    208
    Awesome idea, little pony

Page 5 of 7 FirstFirst ... 34567 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •