Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Player Survivor System | Player Script for Open-World games etc!

Discussion in 'Works In Progress - Archive' started by Sykoo, Sep 25, 2014.

  1. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    Hi everyone!

    While developing my game and taking a bit breaks time to time, I thought of making a nice little script which I'll sell for the cheapest price you can find for such a high-quality Player Script!

    Player Survivor System, also known as PSS is a few scripts for your game! It includes high-quality written codes which are easy to understand and also comes with JS (JavaScript) and CS (C#) version! It is including all the stuff named below, in the "features" part!

    Features:
    + Works with Unity FREE and PRO!
    + Custom movement which supports jumping and sprinting!
    + Custom mouse movement script!
    + All scripts written in both Javascript and C#!
    + Works with all sorts of 3D models and supports animations!
    + Easy to set up, where you use just a couple scripts and put both on same object!
    + Highly in-depth comments which will also teach you what's going on!
    + Hunger and Energy attributes, which also affects each other!
    + Built-in resting system where you just put a little line of code to enable!
    + Tutorial and chat-help to customers who gets stuck!
    + Using Rigidbody, so you're not stuck with CharacterController!

    Features I consider on further updates:
    + Parkour system in the same script!
    + Better and more comments about how it works!
    + Much more in-depth tutorial to help you out in the best way possible!
    + More attributes which will fit to your game!
    + Help you to add your own attributes and modifications easier with in-depth-comments!
    + Add some other stuff that you guys suggest me to include!

    The system is considered being 5$, where you pay only once and get all the updates and extensions for free!
    This Thread will be used as devblog for this asset! Be sure to check out the thread for my own game that I'm also working on, by clicking here! :)

    Here are some early-pictures of the asset!

     
  2. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    Let me know any sort of feedback if you've got! :)
     
  3. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    It's planned to be released next week or the week after!
     
  4. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    Bump :)
     
  5. TemplarGFX

    TemplarGFX

    Joined:
    Aug 21, 2014
    Posts:
    103
    Hi Sykoo.

    Can you give some more information on the systems survival aspect? Especially the ratio and conditions that control the different variables and their effect on each other?

    I am creating a survival game with complex survival mechanics and so how this works under-the-hood would be something I need to know before I would buy.


    Does your script have inputs to take things like temperature or weather into account when calculating the survival mechanics?
     
  6. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    Hi! First of all, thank you very much for your suggestion and comment in common!

    For example, the hunger will effect your health. It will make your health decrease over time and if you do not eat for a while, it will starve you to death. If you're hungry, you'll obviously also get lower energy. Resting will not help as much as it would if you were not hungry. And eating same food type for long time will make you sick, causing poisonous effects on the player and decreasing energy of the player dramatically, even so much at some points that the player won't be able to move fast enough.

    I am planning on adding (and probably will) a script for the inputs of the temperature and register how cold the player is feeling. The problem is that it'd be super-complicated for customers to use it as it is not confirmed that anyone who buys my package will use any type of weather system. But I will think about that later on! Maybe I can make a day-and-night system together with a weather system soon as an extension to this package! :)
     
  7. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    something wrong with you jumping code ? if i spam it i would fly. you should check for being grounded or add a cooldown.
    you should add an IsDead condition to avoid killing the player everyframe when health drop below 0.
    you can create a variable for inputs like : public KeyCode jumpKey; it would allow you to remap easily
     
  8. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    Hi! Thank you first of all for your comment :)

    Yes, it's true! It's currently a little bugged but it will be fixed!
    Latest thing I work on right now is the grounded part of the code.

    Thank yuo for the tip about varaible, I actually did not know about that! Thanks alot! :)
     
  9. DexRobinson

    DexRobinson

    Joined:
    Jul 26, 2011
    Posts:
    594
    Why are you checking if health is equal to 0 and if it is less than or equal to 0. Just use the less than or equal check. Also, I wouldn't hard code your variables for idle and running to 1 and 2. Make it a variable so it can be changed because you may then have a swimming ability and then you could have a variable for that too or you could just use the running variable. Also I wouldn't track what state they are in because eventually you will have a lot of states I would use something more along the lines of a variable that interacts with a speed parameter this way you don't have to write out a bunch of if/else statements.

    Code (csharp):
    1. void Update()
    2. {
    3.      Hunger += (speed * HungerMovementLossRate + BaseHungerRate) * Time.deltaTime;
    4. }
     
  10. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    Hi! Thank you very much for your comment :)

    I forgot that >= and <= means "less or equal", and therefore I did twice as many checks. Thank you for reminding me there :)

    Thanks for the tips, I will consider about making changes and improve as much as possible after your reply, thank you! :)
     
  11. inko

    inko

    Joined:
    Nov 29, 2013
    Posts:
    143
    Noooo! You mad man! You don't know what you are doing!
    As if there weren't enough of these games already clogging up the interwebs.
    Your infamy will lead to humanities doom! Soon all games will merge into a blur of non-descriptive zombie survival games! The end is near!

    ;)

    On a more serious note:

    Your code seems very basic and straight forward in your little example. Are you sure you have enough experience to make make a modular system that is good enough to be sold for money?

    Not trying to sound like an ass here( I was earlier, but not now), but even the stuff you do show could use some improvement.
    No control over the jumping curve, handling inputs in the same class as the output, using rigidbodies...
    I'd feel ripped off after buying something like that.

    Maybe I'm misjudging you, either way I'm wishing you best of luck,
    take it easy and keep it up!
     
  12. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    Hhahaha, I will soon take over the world. Come, and join my side with Survival Gamers :D

    Hey, thank you so much for your comment!
    I know, I wanted to make the code as simple as possible on purpose, to be able to comment on it easier and make people understand it. Honestly, there was no other ways of coding it more 'complex', as it's not really much of a thing at this moment. But this is a great starting script for your Survival projects I'd say! I know that you're not trying to be mean, and I appreciate your kind feedback. But the code is in my honest opinion, really good. It's functioning well and it's ready to be sold for 2$ each copy.

    I am fixing the control over jumping curve. If you gave a example or more brief description with what you mean about "handling inputs in the same class as the output" and "using rigidbodies" I'd super-appreciate it! I mean, is it bad that I use rigidbody? And also, I am pretty new with C# and I was using JS until now, but I will make a JS version of that script so I think it will be much better looking than what it is now :)

    Thank you once again for your constructive feedback, I really apprecaite it and thats how I improve! :)
     
  13. inko

    inko

    Joined:
    Nov 29, 2013
    Posts:
    143
    Thehe, glad you took it well. As for your questions:
    Usually you want to collect all inputs comming from the player in one single container class. That way if you later decide to store the input as an outside file or something you don't need a whole bunch of ifs all over your scripts but instead you can white a single inport/export pipeline.

    So something like:
    Code (CSharp):
    1. class InputHandler {
    2. static InputHandler instance;
    3. public static Instance {
    4. get {
    5. if(!instance) instance=new InputHandler("... applicationPath.txt");
    6. return instance;
    7. }
    8. }
    9. public static InputHandler (string s) {
    10. //load file from string
    11. //set variables based on file
    12. ...
    13. jumpKey = tempJumpValue;
    14. }
    15. string jumpKey = "Space";
    16. bool Jump {
    17. get{
    18. Input.GetKey(jumpKey);
    19. }
    20. }
    21. //other input code goes here...
    22. }
    23.  

    Then you would access it like this:

    Code (CSharp):
    1. if( InputHandler.Instance.Jump) {
    2. //jump logic here
    3. }
    4.  
    If you wanna go real fancy you collect all the input in a playerclass and then send that to the entity

    Code (CSharp):
    1. class player : MonoBehavoiur {
    2. void Update() {
    3. myEntity.Jump (InputHandler.Instance.Jump);
    4. ...move input goes here;
    5. ...shoot input goes here;
    6. etc etc
    7. }
    8. }
    9.  
    The advantage here is that you are channeling all the input through a single pipeline for all entities. So zombies and the player could both share the same actual movmenet code. That means less duplicated code and an easier time adding new features later.

    This is all a very rough implementation with lots of room for improvement I'm sure, but it should give you an idea of what I'm talking about.
    I also didn't try to compile it so it's probably full with types ;)

    As for rigidbodies. I don't like them because you don't really have a way to manipulate them directly. There is always a lot of stuff going on in the background that you don't really have controll over. Rigidbodies are good for simple shapes, but the more percice you want their behaviour to be, the more they became a pain. That's my experience at least.

    Hope this helps.
     
  14. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    I cannot find words to tell you how much I appreciate your kind feedback and as well your amazingly in-depth help! I finally now have a way to skip using so many if statements! I was literally sick of using if's. Thank you so much! I will check out much more about how to use that sort of thing you told me :)
     
  15. calmcarrots

    calmcarrots

    Joined:
    Mar 7, 2014
    Posts:
    654
    The code honestly looks too simple to do on my own. Make something more complicated that's worth my money.
     
  16. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    I'd appreciate alot if you gave an example of what to change and how to change :)