Search Unity

Infinite Runner Starter Pack

Discussion in 'Assets and Asset Store' started by opsive, May 23, 2013.

  1. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    No, the override size can be whatever you want. All that property does is specify the size of the object if you want to manually override the size. The cases for this are if you don't have a renderer on your object or you have multiple renderers attached to a single scene/platform object and they all contribute to the overall size of the object.
     
  2. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    yea i tried that but if i get the size wrong for the turn scenery, everything after it will be displaced wrongly.
     
  3. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Turns are different because they are not symmetrical. A left turn will have geometry that extends further to the left then to the right. I explained how the objects are pieced together to somebody else over email, here's that text, hopefully it will help:

    When the game starts up the Infinite Object Generator asks the Infinite Object Manager for the sizes of the platforms and scenes (InfiniteObjectManager:getObjectSizes). In order to determine the size of the object the manager uses the renderer's bounds. If your objects have children objects that contribute to the size of the platform then this method isn't going to work very well. In that case what you need to do is specify a size within the overrideSize property on the scene/platform. The Infinite Object Manager will then use that size for the object.

    Once the size is retrieved the Infinite Object Generator has to actually place the objects. In order to place the objects in gets the position of the previous object and using both the previous and current object's size, it adds to the position. Before the current object is actually positioned the Infinite Object applies an offset to itself based on the transform's position (this is within InfiniteObject: orient). This works well for straight platforms/scenes but starts to cause a problem when you encounter a turn. A turn isn't necessarily symmetrical so it needs to have one more offset in order to determine the position of the objects after itself. That is what centerOffset is for. The centerOffset will be added to any object that occurs immediately after the turn object to help with alignment.

    To generalize, if you only have one object repeating that the ends don't touch along the z axis then check the size of the object and use overrideSize if you need to. If the ends touch but they aren't aligned properly then change the position on the object's transform. If you have a turn object and things aren't aligning after the turn then play with the centerOffset.
     
  4. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    thanks. that is clearly said.
     
  5. StephenAS

    StephenAS

    Joined:
    Mar 12, 2014
    Posts:
    16
    Hi opsive,

    I'm having the same issue that deiong was seeing, where the end screen buttons aren't bringing up the additional menus.

    What additional changes do I need to make to the GUIManager to get that up and running? I've already implemented your changes for the IsGameActive check.
     
  6. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    You'll also need to reference the animations again within the UI game object. Send me a PM/email with your invoice number and I'll send you a Unity package that has this done. I'll submit a small bugfix update as well just so nobody else will have this problem.
     
  7. SiMKiNG

    SiMKiNG

    Joined:
    Dec 2, 2013
    Posts:
    14
    Hi Opsive i'm having the same issues

    "NullReferenceException: Object reference not set to an instance of an object
    DistanceValueList.getIndexFromDistance (Single distance) (at Assets/Infinite Runner/Scripts/InfiniteGenerator/AppearanceProbability.cs:148)
    DistanceValueList.getValue (Single distance) (at Assets/Infinite Runner/Scripts/InfiniteGenerator/AppearanceProbability.cs:118)
    PlayerController.LateUpdate () (at Assets/Infinite Runner/Scripts/Player/PlayerController.cs:343)"

    Although i already have forward Speeds set at 15 from 0 till end.. any other reasons why this might happen??
     
  8. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Hi SiMKiNG -

    That's definitely related to the forward speeds. Can you post a screenshot of what they look like within your player controller?
     
  9. SiMKiNG

    SiMKiNG

    Joined:
    Dec 2, 2013
    Posts:
    14
  10. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    hmm, that looks correct. You have assigned that character's prefab within the static data component, correct? If you have can you send me your project so I can take a closer look at it and see what is wrong?
     
  11. StephenAS

    StephenAS

    Joined:
    Mar 12, 2014
    Posts:
    16
    Whenever I try to add a new obstacle, they fly in from the left before arriving at their correct lane. Is there anything that I need to add to the obstacles to allow them to appear in their lane properly? I think they are just not taking the "curved" position in properly when generated, because when I have the infinite objects group selected I can see that they are in the "correct" lane when created (screen 2).

    My test box, is in the obstacle layer and has the obstacle object script attached.

    $objectBend_01.PNG

    $objectBend_02.PNG
     
  12. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Yes - make sure your obstacle's material is using the diffuse curve shader -

    $curve.PNG
     
  13. StephenAS

    StephenAS

    Joined:
    Mar 12, 2014
    Posts:
    16
    Ah I hadn't adjusted the diffuse curve shader's settings (made a new diffuse curve shader that was just grey), thanks!
     
  14. pez

    pez

    Joined:
    Jul 6, 2013
    Posts:
    52
    Hi thanks for your answer to my last question.
    I have another one about the shaders that you might be able to help me with.
    The standard Diffuse Curve comes in as unlit - but still manages to receive a shadow from my character. I need the Transparent Cutout you provide to also receive shadows, but remain unlit by the light.

    I've put some screenshots up to help explain.



    EDIT: Sorry also noticed that on the Transparent Cutout shader, it is ignoring a separate texture scrolling script we applied to the model. So maybe the best solution would be to duplicate and edit the Diffuse Curve shader so that it also has a Transparent Cutout value? The Diffuse Curve works perfectly with everything apart from the lack of alpha.
     
    Last edited: Mar 14, 2014
  15. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Sorry it took me a little bit longer than normal to respond. Yes, I think in your case it will be easier to modify the diffuse curve shader to accept transparency. I will send you a PM with a link to that shader
     
  16. pez

    pez

    Joined:
    Jul 6, 2013
    Posts:
    52
    Brilliant. Thanks for your help
     
  17. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Whoa the asset store team was quick - version 1.5.2 was approved yesterday and I didn't realize it. This is a very minor bugfix that contains the following:

    - Updated the NGUI 3.0 Assets package to have proper animations when the game ends
    - Minor bugfixes

    Unless we have another 1.5.x bugfix release, this will also be the last version that supports Unity 3.5.7. Unity 4.0 will be the minimum requirement starting with the next feature release.
     
  18. frank45

    frank45

    Joined:
    Apr 23, 2012
    Posts:
    26
    Hi Opsive

    i only need my player to run in middle slot .What should i do in order to achieve this..!!
     
  19. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Hi frank45,

    The easiest way would be to disable the input that changes the slot. In InputController.cs just remove any calls playerController.changeSlots. You'll be removing some condition statements, such as:

    Code (csharp):
    1.  
    2.                         if (playerController.abovePlatform(true)) {
    3.                             playerController.turn(diff.x > 0 ? true : false, true);
    4.                         } else {
    5.                             playerController.changeSlots(diff.x > 0 ? true : false);
    6.                         }
    7.  
    to
    Code (csharp):
    1.  
    2.                         if (playerController.abovePlatform(true)) {
    3.                             playerController.turn(diff.x > 0 ? true : false, true);
    4.                         }
    5.  
    and you'll be completely removing some functions such as checkSlotPosition.
     
  20. frank45

    frank45

    Joined:
    Apr 23, 2012
    Posts:
    26
    Yup that..worked....thanks for the quick reply....!!
    I am in love with your work...!!Cheers ...!!
     
  21. StephenAS

    StephenAS

    Joined:
    Mar 12, 2014
    Posts:
    16
    Hi Opsive,

    Can you explain how the "Probability Loop" works for Section Selection? I'm trying to set this up with just the 4 base Sections but I only ever see the first section (distance 0 - 250).
     
  22. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Thank you, I appreciate it!

    Probably Loop will choose which section to show based on the section probability. For example, with your four sections you could have section 1 appear 50% of the time, section 2 appear 20%, section 3 appear 20%, and section 4 appear 10% of the time. As a test try setting the first section to a very low probability and the other ones to something higher so they will definitely appear.
     
    Last edited: Mar 19, 2014
  23. StephenAS

    StephenAS

    Joined:
    Mar 12, 2014
    Posts:
    16
    Thanks, opsive, I'll give it a try.
     
  24. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Is there a beginner's manual or tutorial? If I want to start from scratch using ur starter pack.
     
  25. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    This video will start from scratch. The video is a little bit dated (it was using version 1.2), but the general howto is the same. In general that video follows this text.
     
  26. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    What if I want to make a first-person endless runner, but with the use of Unity's terrain. Instead of platforms, I want to do open areas, that will procedurally generate.
     
    Last edited: Mar 21, 2014
  27. MinhDao

    MinhDao

    Joined:
    Oct 28, 2013
    Posts:
    155
    Hi opsive, i don't have NGUI. Can I add my own GUI instead NGUI and have any tutorial for this?
     
    Last edited: Mar 21, 2014
  28. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The starter pack requires there to be platforms within the Infinite Object Manager. It can handle not having scene objects, but it needs platforms. That said, your terrain could be a "platform" and it would handle that just fine.

    We use NGUI because it performs well on mobile, is easy to setup, and has a distribution friendly license. As soon as the new uGUI comes out in 4.6 we will start using that. If you care about performance at all you definitely do not want to use the current GUI within Unity, so you'll need to use a third party solution or create your own GUI framework. That said, I do have the start of an implementation that uses UIToolkit. I only implemented the main menu GUI as well as the in game GUI, because honestly it is a pain to use and requires programming knowledge. It will take some work to get the GUI completely on par with the NGUI version but at least it shows you how you can use a different GUI solution. You really only need to modify the GUIManager and your scene. If you want this UIToolkit implementation send me a PM/email with your invoice number and I'll send it your way.
     
  29. MinhDao

    MinhDao

    Joined:
    Oct 28, 2013
    Posts:
    155
    Thank you for quick reply! Create an infinite game is my next plan. I'll contact you when i'm ready.
     
  30. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    Can I spawn a platform Y with the condition that the previous platform is X?
     
  31. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    You can use the probability adjustment section of the probability rules to make it almost certain that object Y will always spawn after object X. It isn't a guarantee that the object will always spawn after it but if you enter a number such as 999999 then it is 999999 times more likely to occur, which basically means it will always occur. The alternative is to just group the two objects into their own prefab and assign just one platform object component to both of them.

    I have heard this request from one or two other people so I will make sure it is included in version 1.6.
     
  32. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    can i ask why do you use occur + no occur probability ?
    why not just use occur probability lol. what is the reason for your approach ?
     
  33. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    You may not want an object to appear at all. For example, if you didn't have no occur then you would have obstacles spawn in every slot available. For some games that may be OK but for others that may be too many obstacles.
     
  34. thedreamer

    thedreamer

    Joined:
    May 13, 2013
    Posts:
    226
    When Player Jump. By pressing down button I want to stop jump and Player run and When Player sliding By pressing up button I want to stop sliding
    is a simple modification it?
     
  35. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    How do I change the the default game title to my own title?
     
  36. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    @thedreamer -

    Yes, that is an easy change. In PlayerController, add the following to jump to make the character stop sliding:
    Code (csharp):
    1.  
    2. if (jumpHeight > 0  ....) {
    3.    ...
    4. } else if (isSliding) {
    5.    stopSlide(true);
    6. }
    7.  
    To make the character stop jumping, add the following to PlayerController:slide:
    Code (csharp):
    1.  
    2. if (slideDuration > 0  ...) {
    3.    ...
    4. } else if (isJumping  jumpSpeed  > 0) {
    5.    jumpSpeed = 0;
    6. }
    7.  
    This will start moving the character down when they are still jumping up. If you want to add more force for when the player moves down then just change the jumpSpeed to a negative number.

    @areszues92 -

    You can change out the logo by creating your own atlas, see this link: http://www.tasharen.com/?page_id=120
     
  37. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    I replaced the coin prefab with another prefab, had the exact same scripts attached. But, the prefab isnt moving towards the player, its moving sidewards from outside the level. How do I fix it?
     
  38. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Make sure you are using a material that has the "Diffuse Curve" shader that has all of its parameters set to the same values as the other materials.
     
  39. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Ah, I was using a normal diffuse material. Thanks.
     
  40. SiMKiNG

    SiMKiNG

    Joined:
    Dec 2, 2013
    Posts:
    14
    Hi there capsule collider not working.. not sure whats wrong i have the trigger clicked off...
     

    Attached Files:

  41. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Can you explain more of what isn't working? Where is the capsule collider attached to?
     
  42. SiMKiNG

    SiMKiNG

    Joined:
    Dec 2, 2013
    Posts:
    14
    Yep well he seems to just fall straight through the platform(floor). I have the capsule collider attached to the whole character object.
     
  43. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Does your platform have a collider (not a trigger) attached and is in the platform layer?
     
  44. SiMKiNG

    SiMKiNG

    Joined:
    Dec 2, 2013
    Posts:
    14
    Yeah its still your platform from the game. All ive done is put my character in
     
  45. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    hmm.. I think that it will be easiest if you just send me your project and I can take a quick look at it. It is probably something really small. If you don't want to do that I can tell you what lines of code to start looking at in order to debug it.
     
  46. StephenAS

    StephenAS

    Joined:
    Mar 12, 2014
    Posts:
    16
    SiMKiNG and Opsive: I actually had this same issue. Its not that the capsule collider doesn't work, if you rotate the character's model so the capsule is facing down (which I was doing because I had a car, so it made more sense than a vertical capsule), then the forward vactor is wrong, so the car goes down instead of forward.

    I wasn't able to fix this, in the playerController capsule code was looking at alot of thisTransform.forward, turned those to thisTransform.up, and -thisTransform.up became -thisTransform.forward, but the Camera code uses the playerObject's orientation,so the camera flew into the ground after getting the playerObject to no longer sink to the ground. Hope that helps!
     
  47. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Yeah, there are a lot of assumptions made in which direction the character's model is facing. What you could get away with is to parent your character's model by another game object and then add all of the components to that game object. That way it doesn't matter what the actual direction is that your character is facing because the parent object will always be facing "forward". I took a look at SiMKiNG's project and that situation was a little bit different. The model is facing the correct direction except the pivot point is in the center of the object instead of at the bottom. When the character got close to the floor the player controller would adjust y positions to being equal to the floor level. Since the y's pivot point is in the center of SiMKiNG's model, his model would adjust to being half above the floor and half below the floor. The account for that we added a new variable which will allow you to adjust the offset of the pivot.

    Code (csharp):
    1.  
    2.                     // we are not jumping so our position should be the same as the hit point
    3.                     Vector3 position = thisTransform.position;
    4.                     position.y = hit.point.y;
    5.                     thisTransform.position = position + pivotOffset;
    6.  
     
  48. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Opsive, I've changed the camera settigns to make it first-person. But how do I make the camera follow the model's animation? Like FPS, the camera moves around when you run.
     
  49. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    There are different degrees to the implementation level of a FPS camera. The most basic would be to just parent the camera with the character's head, that way the camera moves wherever the character's head moves. The most complicated would be to integrate UFPS but it would give the most realistic camera. I say complicated because I have never tried integrating the two assets, for all I know it will be as easy as dropping in the camera.. but nothing is ever as easy as you want it to be.
     
  50. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    How do I set the camera to be child of the head when the game starts? Currently it's the child of the character.
     
    Last edited: Mar 30, 2014