Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] PUN Rally

Discussion in 'Assets and Asset Store' started by perick, Dec 1, 2015.

  1. stvster

    stvster

    Joined:
    Mar 4, 2013
    Posts:
    70
    Congrats on your upcoming nuptials perick.
     
    perick likes this.
  2. chrisabranch

    chrisabranch

    Joined:
    Aug 15, 2014
    Posts:
    146
    hi, when i make my own cars the wheels don't turn in the second players view, what controls the wheel animation over thernetwork
     
  3. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    NetworkCar sends the input over the net... So the remote copies get the wheel spins and turning... But for this you have to make sure "controlable" is set to false in the CarInput on the prefabs (we turn it on procedurally).

    Most important: Remember that you also have to drag the wheels to the appropriate slots in CarController (this is a requirement of the Standard assets car controller), but I imagine you did this.

    There's nothing "magical" going on. The complete sources are there. Try to take a look at the code, read the tutorial and understand what it does (this is the best way always).
     
  4. dbordzo

    dbordzo

    Joined:
    Aug 14, 2015
    Posts:
    34
    I can't find links to part 2,3,4,5 to your tutorial :c
     
  5. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Not posted yet. Sorry about that. I'll do one today and post it before friday.
     
  6. stvster

    stvster

    Joined:
    Mar 4, 2013
    Posts:
    70
    Hi All,
    Here's a little test with desktop,laptop and android tablet.
    (no audio)
     
    NeoUnity and Andreas12345 like this.
  7. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    525
    Cool. You are running the same game on Android and PC. Nice. Would be really cool if you used AssetBundles to have TabletQuality for the Tablet and Higher Quality for the others.
     
  8. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    I try to build a pickup script for accelerate the car to double speed.
    I think trigger is a good idea.
    But the MaxSpeed is Read Only.
    What i have done so far is:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityStandardAssets.Vehicles.Car;
    4.  
    5. public class DSpeed : MonoBehaviour
    6. {
    7.  
    8.     void Awake()
    9.     {
    10.         GetComponent<Collider>().isTrigger = true;
    11.     }
    12.  
    13.  
    14.     void OnTriggerEnter(Collider other)
    15.     {
    16.  
    17.         // GetComponent<CarController>().ActivateDoubleSpeed();
    18.         GetComponent<CarController>().MaxSpeed *= 2;
    19.         // yield return new WaitForSeconds(duration);
    20.  
    21.         //   GetComponent<CarController>().DeactivateDoubleSpeed();
    22.         //   doubleSpeed = false;
    23.     }
    24.  
    25.  
    26.     void OnTriggerExit(Collider other)
    27.     {
    28.         //
    29.     }
    30.  
    31. }
    I attached a box for collide to the cars
    And my script i attach to a rotating box
    How to solve this?
    Later i like to build a pickup manager.
     
  9. stvster

    stvster

    Joined:
    Mar 4, 2013
    Posts:
    70
    Hi,
    I tried out your demo when first released but forgot to reply.Nice work!
     
    Andreas12345 likes this.
  10. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    Try it like this. Since there are multiple cars, you need to cast to each one as it hits the trigger. Instead of trying to access the Unity CarController which is always poorly written anyways, access the CarInput Accell float.

    Code (CSharp):
    1.  
    2. bool superSpeed = false; //put this in CarInput
    3.     protected CarInput input = null;
    4.  
    5.     void Start()
    6.     {
    7.  
    8.     }
    9.  
    10.     void FixedUpdate()
    11.     {
    12.         if (input.superSpeed) input.Accell = 3.5f;
    13.     }
    14.  
    15.     void OnTriggerEnter(Collider collider)
    16.     {
    17.         if (collider.tag == "Player")
    18.         {
    19.             input = collider.GetComponent<CarInput>();
    20.             StartCoroutine(DoSpeed(3f, input));
    21.         }
    22.     }
    23.  
    24.     IEnumerator DoSpeed(float speedTime, CarInput input)
    25.     {
    26.         input.superSpeed = true;
    27.         yield return new WaitForSeconds(speedTime);
    28.         input.superSpeed = false;
    29.     }
     
  11. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Hi guys... Nice work on your demos. I'm recording the 2nd and 3rd videos now. Should be up next morning...
     
  12. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    Thanks for helping, but i get in FixedUpdate:
    NullReferenceException: Object reference not set to an instance of an object

    I have a box collider to the car, and a cube with a box collider "trigger" active with the DSpeed script

     
  13. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    You should consider trashing the Standard Assets' CarController and writing your own or using one of the Vehcile Physics Packs we discussed earlier. We used the standard one just to avoid having too many scripts in a 'beginners' tutorial, but I'd never use this controller for a game I plan to release (I already mentioned that I normally use Edy's for my personal car games).
     
  14. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Last edited: Jan 16, 2016
  15. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    Add this to CarInput:
    Code (CSharp):
    1. [HideInInspector]
    2. public bool superSpeed = false;
    Change this in FixedUpdate: input is only cached when OnTriggerEnter is called
    Code (CSharp):
    1. void FixedUpdate()
    2.     {
    3.         if (input != null && input.superSpeed) input.Accell = 3.5f;
    4. //not necessary to reset Accell since it's controlled in CarController.FixedUpdate
    5.     }
    I suggest Edy's too when you're ready for more advanced functionality.
     
  16. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    The error is gone, but i a have no acceleration after collide.
    I will take a look @ Edy's

     
  17. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    I ve got Edy working, i will dive a bit in it. I see there is a nitro script :)
     
  18. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Remember that you'll have to send/receive the Nitro boolean over the network in NetworkCar as well... So the remote cars will also have a proper wheel spin, etc...
     
  19. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    Should be easy possible with "Photon observe"!?

     
  20. stvster

    stvster

    Joined:
    Mar 4, 2013
    Posts:
    70
    All the Best to you and yours on this Special Day perick(Erick).Congrats to you and the Mrs.
     
  21. stvster

    stvster

    Joined:
    Mar 4, 2013
    Posts:
    70
  22. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    you miss messages?
    Code (CSharp):
    1. Severity    Code    Description    Project    File    Line
    2. Error    CS1061    'CarGUI' does not contain a definition for 'messagesGUI' and no extension method 'messagesGUI' accepting a first argument of type 'CarGUI' could be found (are you missing a using directive or an assembly reference?)    RacerMP.CSharp    C:\Users\Andreas\Documents\RacerMP\Assets\Scripts\Race Scripts\PUNRaceManager.cs    107
    The other issue that i have is that on the networkview the car is flickering:
     
    Last edited: Jan 17, 2016
  23. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Have you checked my video on how to integrate with Edy's? I mention a couple of details you have to pay attention to.
     
  24. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    yes, i use the scripts you have attached in the post where you described it.
    i have more a problem with the flickering, not with the messages.
     
  25. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    You might be missing something, because there was no flickering (and no reason for it whatsoever) here...:/ After the wedding I'll double check that.
     
  26. michtek

    michtek

    Joined:
    Sep 11, 2012
    Posts:
    8
  27. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    I ll check with a fresh install, too.
    Happy wedding and honeymoon, to you.

     
  28. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    That would be overkill in terms of network performance. What I do is sync the INPUT, so the remote cars also have the wheel spin and steering, besides the dead reckoning.
     
  29. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    I have solved my error!
    My error was to put the prefab to the photon view instead of the script.
    It works!

     
    perick likes this.
  30. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Great. When will we have a playable demo? :)
     
  31. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    I need to make more tracks playable and more different cars.
    I work on it alone after my work and my family, so i have no fast progress.
    And i try to add some obstacles, these obstacles are released by the player like a weapon.

     
  32. michtek

    michtek

    Joined:
    Sep 11, 2012
    Posts:
    8
    ok how add this?
     
  33. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    It is included in the project. Check network car and see the input values are synced, and checking CarInput you can see how they're used in local and remote cars.

    I don't have randomnation, so I can't test it here.
     
  34. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    Here you can test a bit with my edys vehicle settings.
    I have an arcade setup with the chance to drift.
    I suggest you use CAR2(Coupe) and Track2(London)

    I am still trying to add obstacles/weapons, more tracks, more cars.
    www.quakeit.de/RacerMP.zip

    Tell me what do you think.
     

    Attached Files:

  35. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    No windows here...:( Mac.
     
  36. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Hi , hope everyone here can help . new to Multiplayer stuff .


    1 .How do I set up a post-game menu that lists the results of the race.
    Who came at what what position .

    2. And also I want to set up a restart race option after the race finishes with the same people present in the race . I want to set this option in the post-game menu screen .

    3.want the player the option to go back from a joined race back to the option of joining another race or start his own race if the player decides not to race in the current group. That is go from CarAndTrackPanel back to RacesPanel . Can this be done ?
     
  37. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    I make WegGL later today
     
  38. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526

    Attached Files:

  39. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
  40. nmcwilli

    nmcwilli

    Joined:
    Jan 22, 2016
    Posts:
    4
    Trying to add scripting to bring back to main menu after completing a race ... any suggestions? Trying to do 2 options - rematch or back to menu for car selection ?
     
  41. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    so good so far:
     
    diegoadrada and stvster like this.
  42. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Your friend (whoever he is) seems to be much better than you at racing games...:)

    Awesome work with the integration... Didn't like the center-of-gravity stuff though (unreal roll overs).
     
  43. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Hi... This will all be included in the next update. I'm back to work after my wedding, so I'll post an expected release date soon.
     
  44. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    As I mentioned in the previous post, this will be included in the next update...:)
     
  45. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Have you managed to fix the wheel rotation issue?
     
  46. chrisabranch

    chrisabranch

    Joined:
    Aug 15, 2014
    Posts:
    146
    hi,
    When the match starts, if one device loads slower then the other .
    the race starts the countdown before the slower players device loads.
    Is there a way to start the count down only when all players are in loaded and in scene?
    also, will adding a load screen mess up the game?
     
    perick likes this.
  47. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Thanks for pointing this bug. I'll fix it by having the master client start the countdown only when all computers send the OK... I'll include this in 1.0.6 (next update).

    A load screen (before the menu scene) wouldn't do any harm...
     
  48. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    News about update 1.0.6: estimated release data: Feb 1st, 2016 (next monday).

    The following features are coming in this update:

    - Back button to leave race both in the car selection or during the race (done);
    - Wait for all players to finish loading the race scene (or a timeout) before starting the countdown (done);
    - End race panel with locked position (doing);
    - Automatic nickname differentiation (in case there are players with same nickname) - (doing);
     
    gamezuv, stvster and Andreas12345 like this.
  49. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    stvster likes this.
  50. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    I d like to see first more to come here:
    Weapon System for example :)
    When finished here, the people are interested can get over to the next project.
    More then 1 project at the same time is always bad.

     
    Skyfly likes this.