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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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,099
    Power ups need to first be purchased from the store before they will appear.
     
  2. ipk77

    ipk77

    Joined:
    Oct 17, 2013
    Posts:
    6
    I sent you the email Opsive. Thank you.
     
  3. ipk77

    ipk77

    Joined:
    Oct 17, 2013
    Posts:
    6
    Hi again Opsive,

    Is there a way to solve coin re-activation problem when you make them a child of a scenery? Because, whenever the player collects the coins, they don't get re-generated when the scenery is re-created.
     
  4. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    When an InfiniteObject is spawned the method InfiniteObject.activate() is called. If you take a look at it you can see that it recursively activates all of the children. When a CoinObject is collected, it is parented to the player so the coins will move with the player. It doesn't sound like the coin is returning to the parent object (the scene) so it can be activated again. If you added the coin to the InfiniteObjectManager the parent would be set correctly, but since you are adding it to the scene object it isn't going to be set.

    That said, you should be able to manually set it within SceneObject.cs:
    Code (csharp):
    1.  
    2.     public override void Awake()
    3.     {
    4.         base.Awake();
    5.  
    6.         InfiniteObject[] infiniteObjectChildren = GetComponentsInChildren<InfiniteObject>();
    7.         for (int i = 0; i < infiniteObjectChildren.Length; ++i) {
    8.             infiniteObjectChildren[i].setStartParent(getTransform());
    9.         }
    10.     }
    11.  
     
  5. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    Hey that would be the basic step, I purchased all the power ups, but nothing appears at all
     
  6. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    There really shouldn't be much more to it. You'll obviously need to list the power up in the Infinite Object Manager and have valid appearance probabilities, but that is the same as any other object. If you still can't get them to appear I'd love to see some reproduction steps. Grab a fresh copy of the starter pack from the asset store and list the steps to reproduce, or send me your project.
     
  7. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    Hi Opsive the problem was solved. I reimported the scripts and it worked. It was my mistake:). Thanks

    Can you tell me how to make the characters have the Idle animation in the store? Right now the characters were in T-pose.
     
  8. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    Sure, at the end of GUIManager.refreshStoreItem, add the following:

    Code (csharp):
    1.  
    2.         if (!storeSelectingPowerUp) {
    3.             storeItemPreview.animation.enabled = true;
    4.             storeItemPreview.animation.Play("Idle");
    5.         }
    6.  
     
  9. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    Thanks for the solution!!

    I found an issue in the coins spawning, the coins were reappear immediately after colliding with the player. The problem is when i got the coin magnet, the coins which is reappearing behind the player is getting attracted. How to increase the time delay for the coin appearance after passing the player.
     
  10. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    I'll take a closer look at the coins activating when you get the coin magnet power up.
    Edit: I have been playing around with the coin magnet and the coins but I haven't been able to reproduce anything. Do you have specific steps to reproduce?

    For the increase coin appearance question, let's say that you have two groups of coins that have spawned. You then collect a few coins from the first group and the next group is 50 meters away. Do you want coins after that second group to spawn later? Currently that isn't possible with appearance rules/probabilities. They have to be setup ahead of time and they aren't too dynamic in that regard. I had another request to increase the coin distance as the player moves faster, and your request is similar to that. I will add it to the feature request list.
     
    Last edited: Oct 24, 2013
  11. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    Please check your PM. I tried reducing the coins collection speed from 0.75 to 0.1 and it worked but the coins were collecting very slowly. Please help. Thats why I asked to reappear the coins outside the coin magnet trigger area.

    $coinsIssue.jpg
    Hope this image helps
     
  12. frak

    frak

    Joined:
    Feb 8, 2013
    Posts:
    45
    I have noticed that the latest version (running 'vanilla' ie untouch before playing with it) the character is going through the stairs a lot again.
     
  13. Chris_E

    Chris_E

    Joined:
    Jul 10, 2012
    Posts:
    32
    I'm looking around the documentation and I can't find detailed instructions on adding a turn.

    I marked it as a turn, but I don't know what to do next? How do I let the system know where the turn is and where to spawn the next piece? Auto turn does not work, he just keeps running straight.

    It seems like it's spawning off in space instead of right next to the turn.

    EDIT: Found Turn Length Offset, but it's still floating off to the left side (It's a right hand turn) and I can't figure out how to get it closer. Also, he still doesn't auto-turn.
     
    Last edited: Oct 24, 2013
  14. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    @Dharma_raj - Thanks for sending me this. This was caused by a deeper issue within the infinite object generator. I've sent you a fix and in addition to the coins working properly, there will also be a small performance gain from it.

    @frak - This is caused by the physics engine not keeping up with the game. Are you saying that in one of the previous versions it worked fine without the player going through the stairs? I'm surprised that you've seen a difference, I haven't really changed anything that would cause the performance to increase or decrease in the past few releases. Regardless, do you know what version you were previously using so I can compare? You may want to try playing with the fixed timestep to see if that makes any difference.

    @Chris_E - The spawned location of a platform depends on two things: the transform position and the turn length offset. If you take a look at the demo included in the starter pack, you'll notice that the left turn has an x position of -3.25. This is to align the turn correctly with the rest of the platforms. The turn length offset is hard to explain but it is the the difference between the center and the amount that is exnteded out for the turn. Basically it is the offset that is caused by the turn piece. My suggestion would be to first get the turn placed correctly, then play with the offset. The offset is used by the next platforms. It doesn't have any effect on the positioning of the actual turn platform.

    In terms of the auto turn variable, again take a look at the left turn platform. You'll notice that it has a child object that is a turn trigger. This is how auto turn knows when to turn. If the turn doesn't have that trigger then auto turn won't do anything.
     
  15. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    I am getting these errors

    Assets/Infinite Runner/Scripts/InfiniteGenerator/InfiniteObjectGenerator.cs(366,115): error CS1061: Type `PlatformObject' does not contain a definition for `getRandomSlot' and no extension method `getRandomSlot' of type `PlatformObject' could be found (are you missing a using directive or an assembly reference?)

    Assets/Infinite Runner/Scripts/InfiniteGenerator/InfiniteObjectGenerator.cs(366,32): error CS1502: The best overloaded method match for `InfiniteObject.orient(PlatformObject, UnityEngine.Vector3, UnityEngine.Quaternion)' has some invalid arguments

    Assets/Infinite Runner/Scripts/InfiniteGenerator/InfiniteObjectGenerator.cs(366,32): error CS1503: Argument `#2' cannot convert `object' expression to type `UnityEngine.Vector3'

    Edit: Also please look into the diffuse curve shader to make it as a optimised cutout shader. My draw calls were increasing heavily while adding "Tags { "RenderType" = "Transparent" "Queue" = "Transparent" }
    Blend SrcAlpha OneMinusSrcAlpha". Without the shader the drawcalls were below 30, on using it the drawcalls crosses 110. Please help
     
    Last edited: Oct 25, 2013
  16. frak

    frak

    Joined:
    Feb 8, 2013
    Posts:
    45
    Not sure what version - would have been a week ago (had to step away from this project fo a week).

    Previously it would go through the stairs rarely - you said you ran in got mode for quite a while to see it (and I thought you had fixed it). The next version the problem did go away completely.

    Now it happens say every 5th set of stairs ie a lot.

    Not sure what settings you mean (I have a long background in development but Unity3d is still quite new to me).

    thanks,
    Mathew
     
  17. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    @Dharma_raj -

    I forgot that I sent you some files from the new version and the file that I sent you works with the released version. Regardless, download the file again from the link that I sent you.

    @frak -

    Maybe we were just getting lucky the times before? The latest update is from October 8 and that just contained a fix for iOS/Android. As far as timestep goes, take a look at this: http://docs.unity3d.com/Documentation/Components/class-TimeManager.html. Decreasing the timestep will increase the amount of physics calculations.

    Here are some other things that you could try:
    1. Increase the width of the collision box on the stair platform collider
    2. Change the collision detection of the stair platform collider's rigidbody from discrete to continuous dynamic or continuous
     
  18. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    Also please look into the diffuse curve shader to make it as a optimised cutout shader. My draw calls were increasing heavily while adding "Tags { "RenderType" = "Transparent" "Queue" = "Transparent" }
    Blend SrcAlpha OneMinusSrcAlpha". Without the shader the drawcalls were below 30, on using it the drawcalls crosses 110. Please help
     
  19. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    Without seeing your scene it is hard to say why your drawcalls multiplied almost 4 times. Ensure that you are using as little materials as possible. Just adding the shader to the transparent queue doesn't increase draw call count. As a test, I took the scene included in the starter pack and hit play. The game had 31 draw calls. I then added the shader to the transparent queue and set the blend type. The game ended up having less draw calls (27) because the shadow wasn't rendering.
     
  20. Sinhabros

    Sinhabros

    Joined:
    Aug 3, 2013
    Posts:
    15
    How do you prevent floating up the stairs?
     
  21. Hala

    Hala

    Joined:
    May 13, 2013
    Posts:
    31
    How can I know the amount of distance that player spent runnning?
     
  22. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    @Sinhabros -

    Do you mean aligning to the angle of the stairs? If so, you can do that by adding the following to the top of PlayerController.cs:
    Code (csharp):
    1.  
    2. public float alignSpeed;
    3.  
    Then at the start of Update():
    Code (csharp):
    1.  
    2.         // Align with the slope of the platform
    3.         RaycastHit hit;
    4.         if (Physics.Raycast(thisTransform.position + Vector3.up, -thisTransform.up, out hit, 10f, 1 << platformLayer)) {
    5.             Quaternion hitRotation = Quaternion.FromToRotation(Vector3.up, hit.normal);
    6.             Vector3 eulerAngles = targetRotation.eulerAngles;
    7.             eulerAngles.x = Mathf.MoveTowards(eulerAngles.x, hitRotation.eulerAngles.x, alignSpeed);
    8.             targetRotation.eulerAngles = eulerAngles;
    9.         }
    10.  
    @Hala -
    Take a look at this post on the update that will be in the next version and from that the distance traveled is just the score, which you can get by DataManager.getScore()
     
  23. aupktm

    aupktm

    Joined:
    Oct 28, 2013
    Posts:
    1
    Hello, I'm very interested in this proyect, and I want to know if is possible to add or integrate some ads like Admob or similar.
    Special thanks.
     
  24. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    Hi aupktm,

    Thanks for your interest. Yes, it is definitely possible to integrate an ad solution to this project. Generally the Prime31 plugins are easy to integrate (though I personally have never used the Admob plugin).
     
  25. frak

    frak

    Joined:
    Feb 8, 2013
    Posts:
    45
    I am at the stage of generating startup objects.

    I want a emple area to be hehind the player, but do not see how to do that. Generations is always only in front of the player.

    I have tried manually placing the scene behind the startup position - however that appears to move with the player of course.

    What do I need to do to the object to get it into the cue so it will move backwards and get deleted?

    thanks
     
  26. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    Similar to the demo scene that has the stairs behind the player?

    Create the startup objects like you normally would and save it out. Then stop the game and drag in the startup object into the scene view. From there, drill down as far as you can through the scene/platform group of objects. From there you can add your different scenes or platforms. In the picture below, I manually added left turn and the stairs down platform. The added objects don't even need to have an infinite object component attached, the infinite object generator will know to remove them once they get out of view.

    $startup.PNG
     
  27. frak

    frak

    Joined:
    Feb 8, 2013
    Posts:
    45
    That is strange, as that is exactly what I tried. I will do that again and see what happens.
     
  28. frak

    frak

    Joined:
    Feb 8, 2013
    Posts:
    45
    Lol.

    No I must have messed that up. Only what I THOUGHT I did.

    Thanks for the patience!

    :-D
     
  29. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    Good to hear!
     
  30. frak

    frak

    Joined:
    Feb 8, 2013
    Posts:
    45
    Okay this is a question HOW or a feature request:

    I would like to setup jumps where the hieght also drops. Is it possible to do that?

    Also: regarding stairs up and stairs down, am I right that the system looks at all obejects in the platform object, and gets the lowest boundry on an object? Reason I ask is a jump down could be created by a downslope transparent object with no collision object.

    Also when a player falls off the platforms (eg misses a jump) does the current code support the player then dying?

    thanks
     
  31. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    It's funny that you mention that scenario because we are creating a new section for the curve update that will have a jump in it to show how to use it (I feel like I've been talking about this update forever.. the art is modeled and just needs to be textured).

    In the Platforms directory there is an example of how you would use the jump. You can also mark the jump as a slope down. In the override size field make sure you specify the size of the length and the height difference. You don't even need to create a transparent object, the only thing required is a platform object, appearance rules, and appearance probabilities. Specifying the override size is key. Don't worry about specifying a jump length because override size will overrule the jump length. When the player falls, the player will fall but they won't die. I will be playing with this code in a couple of days so I make sure I test the scenario.
     
  32. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    Just a quick status on the next version. The major new feature of this next version will be curves, and I created a short preview of them in action at http://www.youtube.com/watch?v=ev-XCxj-zkA. In this video we only show curved turns but you will be able to create a variety of curved platforms, such as s-bends. This release will not allow branching or non-90 degree turns, but I've started to structure the code to make those features easier to support in a future release.

    Edit: some more details:

    The curve uses a quadratic bezier curve. To add the curve to a platform, all you do is drag the different handles to the desired position. As seen in the image below, this turn platform has three different handles. You can have any number of handles (a minimum of 3 is required to form the curve though)
    $curve.png

    Edit2: This post has even more details.
     
    Last edited: Nov 6, 2013
  33. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    This is awesome!! You did what I really wanted to add in this kit. When are you releasing this version?

    Can u help me out in changing the offset value of the curve shader dynamically. I could not use gameObject.renderer.material.SetVector because it affects only that particular object. Is there any way to change globally so that it could affect all the objects in the scene which are using the curve shader.

    Also I want to add light to the shader
     
    Last edited: Oct 30, 2013
  34. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    We are just finishing up with the art so I hope to be able to submit this weekend. Currently there is no way to change the value globally, just loop through all of the different materials when you want to change the value.

    I'll PM you a shader that has light.
     
  35. frak

    frak

    Joined:
    Feb 8, 2013
    Posts:
    45
    AWESOME I really wanted this feature.

    Is there any chance of getting this release early? (ie direct instead of via the asset store?)

    A related question: I have a section were I just want a bridge in space (it just the running platform) and nothing else. Presumably with the distance overrides I can now do thi without a dummy scenery?

    thanks
     
  36. gharinanda

    gharinanda

    Joined:
    Oct 23, 2013
    Posts:
    2
    can you show ths project deploy on mobile on iphone or android? :)
     
  37. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
  38. RetronamicGames

    RetronamicGames

    Joined:
    Feb 9, 2013
    Posts:
    84
  39. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    The vertext transformation included in the starter pack is based on an exponential equation. That package provides some alternate equations which results in the verticies transforming differently. It wouldn't be hard to modify the current shader to support whatever type of transformation you want. If you tell me the effect that you are looking for I should be able to come up with an equation.
     
  40. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    The curve update is ready to submit!

    I had a few people express interest in getting the update early so I will send it to them first and then if everything goes well I will submit within the next day or two. If you missed it this post gives some more detail on how the curves work. Also, the web player has been updated to show the latest update.

    In addition to curves, we added an example of the jump platform which you can see in the screenshots below. If you would like to test this version out early send me a PM or email with your invoice number and I'll send you the link.

    $flames.PNG

    $curveFlames.PNG
     
  41. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    We are having a little sale before our next update goes live. You can currently get the Infinite Runner Starter Pack for 30% off. This sale is going to last until Unity approves the curve update.
     
  42. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    Hi Opsive, How can I add shininess to the curve shader. I want the coins to be shiny. Thanks
     
  43. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    I sent you a PM with the link. Modifying the curve shader has been a popular topic. To reduce my (future) workload I created a curved shader that can do all of the basics:

    $curve shader.PNG

    Send me an email/PM with your invoice number if you want this shader.
     
  44. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    This is great!! Thanks:)

    Hi, The shader shows following error $error.jpg
     
    Last edited: Nov 7, 2013
  45. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    I should have sent you both versions. The specular shader will work with any version of Unity, however the other shader that I sent you only works with Unity 3. I will send you the version that works with Unity 4.
     
  46. isacan

    isacan

    Joined:
    Jul 18, 2013
    Posts:
    37
    Hi opsive,

    can i use for animation character unity mecanim system.

    Thanks
     
  47. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    Thanks for the shader!!! How could I add coins to the moving obstacles and other static obstacles. When I tried making it as a child of a moving obstacle, its not there in the game. I did a test in which I created an empty scene, added a platform and a moving obstacle with a coin. Soon after I hit run the coins moved in z direction and gets disappears. Please guide me on adding coins in obstacles.

    And also the coin array spawning overlaps an obstacle, it should be like if there is a situation when a coin and an obstacles spawn in same position, the coin should shift its y position higher than the obstacles position. Any ideas? thanks
     
  48. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    @isacan -

    I just had somebody else ask me about mecanim a couple days ago as well. Personally I've never really looked into it so I can't say what the right approach would be, but since the idea is starting to be more popular I'll take a look at it and try to get it in the next feature release or two. All I know right now is that it will take some modification of PlayerAnimation.cs.

    @Dharma_raj -
    You should be able to just add the coins as a child of the obstacle. I just tried adding the coins to the moving obstacle and it didn't have a problem:
    $moving obstacle.PNG
    The group of coins moved with the cannonball just like you would expect. This is in version 1.4 so it may have something to do with that. I'll PM a link where you can download this version.

    Right now there isn't any logic within the coins to detect if they are over any obstacles. What you could do is a add a raycast within Awake() and if it is over an obstacle then it will position itself slightly higher. However, you should also be able to adjust the collidable positions on the platform object to ensure there is always enough space between collidable objects.
     
  49. warren-miller-maltd

    warren-miller-maltd

    Joined:
    Jul 26, 2012
    Posts:
    53
  50. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,099
    Hi Warren,

    That does look bad, thanks for letting me know about it (it has been awhile since I tested the accelerometer). I have it fixed and will send you a PM with the fixed files.