Unity Community |

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.
I think that instead of the first static noise sound, a quick hearthbeat sound would be better
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
-------------------------------------------------------------------------------------------------------------------------------------------
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:Code:
//- Roam whenever the player is not seen by SM, and the player is not facing SM //- Move towards the player whenever player is seen by SM (not necessarily the player seeing him back), and the player is not facing SM //- Teleport to a legal position within a maximum and minimum range when: ///--- A. SM moves outside of the maximum range //--- B. SM roams for a random amount of time without seeing the player //--- 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 #pragma strict var moveSpeed:float = 0.0; // how fast slendy moves var timer:int = 0; // a little timer for function timing. var isMoving:boolean = false; //checks if SM is moving. useful for determining whether to stay or roam. var pointer: GameObject; // the pointer object used for spotting the player. Make sure it is not too high or too low. var range:int = 0; // the range at which Slenderman can spot a player var canSee:boolean = false; // if Slenderman can see the player (not vice versa or anything) var scanInterval:int = 0; // how often to scan for player distance wayPoints = GameObject.FindGameObjectsWithTag("waypoint"); // find all the GO's and store them off the start. FindRoamPath(); // get us off pathfinding something } ////the eye of the Slenderman////////////////////////////// ///////////////////you can use your own SM vision code here. ///////////////////just make sure canSee is true for proper movement. { { canSee = true; } else { canSee = false; } } { canSee = false; } /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////a private timer. can be replaced with Time function for more accurate results. ////////////////////after a certain amount of time, search distance to player. ////////////////////the only reason this is set up as a function is because of performance reasons / teleport function timer++; if (timer > scanInterval) { searchDistanceToPlayer(); timer = 0; } //search for new waypoint once I'm close to one. { if (!canSee) //if I can't see the player. Just to make sure I'm actually roaming. { FindRoamPath(); } } if (isMoving) //this does the actual movement. movement is always the same, the target is what's different. { } // If I can see the player, execute the function that finds a path to the the player // 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) // if I can see him, then execute FindFollowPath(), which finds the nearest waypoint to the player (as if he is following him). if (canSee) { var nearpoint = FindFollowPath(); if (lastTarget != nearpoint) //if it's not the same, then keep on moving { targetWaypoint = nearpoint.gameObject; lastTarget = nearpoint.gameObject; // prevents re-moving to same position - jittery } else { isMoving = false; //you're close enough, stop moving. This works by checking if the same waypoint has been selected twice. } } } function FindRoamPath() //this doesn't do pathfinding. This just tells us the path to find. In this case, a random one. { isMoving = true; // gotta get up off our feet if (lastTarget != wayPoints[rand]) // similar to above. don't randomly pick the same spot. { targetWaypoint = wayPoints[rand]; // our target waypoint is now a random one from the list. lastTarget = wayPoints[rand]; } else { isMoving = false; } } { // loop through each tagged object, remembering nearest one found. Original "find nearest" code by Ben Pitt. //http://answers.unity3d.com/questions/16676/how-can-i-make-my-gameobject-find-the-nearest-obje.html // basically what it does is go through the list of waypoints and finds the nearest one to the -player- through distance. if (distanceSqr < nearestDistanceSqr) { nearestObj = obj.transform; nearestDistanceSqr = distanceSqr; } } return nearestObj; } function Teleport() // take me to a random waypoint! this function does not yet utilize legal (nearby) waypoints { targetWaypoint = wayPoints[rand]; } function searchDistanceToPlayer() // find distance to player. Might as well check if I'm above range to teleport, too. { var curDistance:float; { Teleport(); } }
COMPLETED//- Roam whenever the player is not seen by SM, and the player is not facing SM
DONE//- Move towards the player whenever player is seen by SM (not necessarily the player seeing him back), and the player is not facing SM
//- Teleport to a legal position within a maximum and minimum range when:** DONE///--- A. SM moves outside of the maximum range
INCOMPLETE, SIMPLE ENOUGH//--- B. SM roams for a random amount of time without seeing the player
SOME MORE WORK NEEDED HERE//--- 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
-------------------------------------------------------------------------------------------------------------------------------------------
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!
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.
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.
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.
If you want the trees to collide, you have to put a capsule collider to the tree prefab
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.
here i just made this real quick cause i got a little boreduse it all you want
Slendermanmodel.zip
Last edited by xxxDjdogxxx; 05-28-2012 at 12:03 AM.
The "World" is 3D.
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.
The "World" is 3D.
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!
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.
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.
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.
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!
Awesome idea, little pony