Search Unity

[RELEASED] PUN Rally

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

  1. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Hi, the new update is really good. Two things ...
    1 . Right now you can only race with people randomly . Can we create a game lobby where only friends can join ?
    2. Can we create a 5 race tournament ? So every race awards points on finishing and after 5 races the player with most points wins . Is this possible ?
     
  2. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Both things are possible (and not actually difficult), but you'll have to program yourself:
    - For the five race tournament, add a static variable for the players to store their victories (or points based on final position), and have a "new race" button to load the next race scene (only in the master client, and after all cars have finished the race) - in the end of all races/scenes, just order the players by their points/victories;

    - for a private room in Photon, I recommend reading similar questions in this forum, many of which were answered by the guys from Photon. I suggest reading Tobias' answers in this thread here:
    http://forum.unity3d.com/threads/how-to-create-private-rooms-with-photon-cloud.163714/

    Please, focus on reading TOBIAS's answers... There is a lot of silly suggestions by other users. Tobias is the lead programmer for PUN at Exit Games.
     
  3. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Thanks will try it out . So the "new race" button will work even with the single races that we have right now? I mean after finishing a race I have to go back to the lobby and try and match again . If I place a new race button and just start the scene again ..will it work ?
     
  4. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Yo
    No, you'd have to write code to load the specific scenes in order...

    I might think about implementing this tournament idea for next update. It's neat...:)

    BTW, redhead robot, the developer of funcar kit (another car physics pack) gave us access to their code, so I'll develop a new custom integration and video (just as I did for Ed's car physics and realistic car controller).
     
    Last edited: Feb 14, 2016
  5. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Cool Tournament will be really fun . Look at mario kart 8 for inspiration . I meant for starting the non-tournament races . Can you just start the single race again by restarting the scene . This way I would not have matchmake again for a race ? Can you also make a integration video for Randomation Vehicle Physics 2.0 . I want to buy it but will buy it only if integration is possible.
    https://www.assetstore.unity3d.com/en/#!/content/29883
     
  6. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Restarting the race might work... Just create a button and link it to a method that does exactly as the one that loads the race from the car-selection scene (take a look at the code and reuse/copy it).

    Regarding Randomtion: I can only make integrations for packs I have... The guys who make funcar kit gave me a key, so I can do it. And I have Edy's physics for a long time, so I did that first.

    The thing is: integration is ALWAYS possible, and very easy normally. The guy who asked me about funcar kit did it right in less than one day (he exchanged a couple of personal messages with me for clarification, but he did it himself and is happy with the results. Now that I have access to this pack, I'll only review what he did and post here an "official" custom NetworkCar class for it).
     
  7. dbordzo

    dbordzo

    Joined:
    Aug 14, 2015
    Posts:
    34
    From me I think that every Vehicle Physics can be integrated to this Multiplayer.
    But you will need to look at their scripts, I thought also about Randomation Vehicle Physics 2.0 because it looks really nice : )
    When you will do your integration tell as how it works for you : )
     
  8. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    I can do one at a time, as long as I get access to the physics pack code (the developers of funcar gave me a key after I asked them).

    Which one you guys think should be next? Choose the one you want most to be integrated and I'll send them an email asking for access to the pack (they normally are fine with it, because it's good for them).
     
  9. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Randomation Vehicle is more versatile and like me I guess most will be interested in it .
     
  10. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Running into a few small bugs :

    1. If 1 is master UV1 in this case and uv1 finishes 1st and uv2 finshes second the timer of uv2 keeps running even after
      uv 2 finishes. This is a big problem because I want to implement a few things after every one finishes race.
    2. The player positions are not correct / flipped on each screen .
    3. The end game menu positions are also not correct .
    4. If I have a 1 lap race the lap counter goes to 2/1 after I finish .
    Hope you can fix this soon because my game is almost done.
     

    Attached Files:

  11. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Will fix today. Thanks for noticing. The 2/1 lap thing I knew (just haven't locked the laps), but the others I'll check...

    The positions at the END should indeed be the same (will check the bug), but during the race they can differ slightly depending on the latency, because the car positions will not be perfectly synchronised. At the end I use the positions as computed in the "server" machine, so they should be the same.

    I'll check this, the clock of the second car and also lock the laps and then do a bug-fix update.
     
  12. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Hi... Just finished fixing the bugs you mentioned... There were a couple of lines that I needed to change to do this... Here's a screenshot showing everything working:
    - laps are corrected at the end (no more 3/2);
    - both cars are not counting anymore;
    - positions are not flipped;

    I did exectly as you said (made the car who created the race win):

    Screen Shot 2016-02-17 at 21.00.30.png

    I'll ask Tobias to up this as 1.0.6b tomorrow.
     
    stvster likes this.
  13. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    I have forgotten to put the formatted time (00:00:000) at the end race panel... Now it looks like this (formatted time):

    Screen Shot 2016-02-17 at 21.08.07.png

    BTW: After this update, lets post our best times for each Track (no cheating, such as messing with laptimes in code, please - no prizes at play here...:))
     
    stvster likes this.
  14. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    cool. Thanks a lot. Haha will post my time. I will be using edys coope
     
  15. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Hi, found another bug. As shown in the image , if you follow the steps ... 1 . start a new race , 2 . Go back , 3. Start a new race again , the name on the other player's screen changes to a number . I did not know what it was so I blacked out half of it . RaceNameError.jpg
     
  16. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Also can tobiass or you guide me on this . I have set a private room successfully . Now if my player 2 wants to join player 1 but has typed a invalid name or the room is full I get a debug message in the editor. But I need to tell player 2 that the name is not valid or the room is full . So I have text that will pop up to do it. But I don't know where to call the text from . Right now the debug is coming from networkingPeer.cs which is not visible in the scene .
     
  17. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    When a player tries to join a room and it fails, for whatever reason, the following callback is executed:
    virtual void OnPhotonJoinRoomFailed (object[] codeAndMsg);

    Take a look in the official API documentation for this method.

    To correct the bug you mentioned, take a look at the CreateGame method inside PunMenu.cs, and replace line 90 (in my version here) for this:
    PhotonNetwork.CreateRoom(PhotonNetwork.player.name, options, TypedLobby.Default);

    I'm using the player name as room name. Before it was wrongly using the string in the nickname editBox, which is empty in case the level (menu) was reloaded with the back button. This new code will make it work just fine...

    I'll include the fix in update 1.0.6b (which is ready btw).
     
  18. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Okay I was able take care of not-joined feedback . I also did PhotonNetwork.player.name ...But now there is another problem . If player 1 creates a room , player 2 joins , player 1 leaves and player 2 stays ...the room with player one name still exists and player 2 is in it so now player 1 cant make another room and I get this error "A game with the specified id already exist."
     
  19. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    so as far as I can understand you cannot have duplicate player and Room Names ? If that is true this is a big problem for a multiplayer game .
     
  20. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Also right now in the same situation where player 1 creates a race , p2 joins and then p1 leaves ... p2 does not have the option to start the race ...p2 should become the master if p1 leaves the room right ? so if p1 leaves his own room and p2 stays ...p1 gets a join option in the create-join screen to join his previous room . So if he joins that both p1 and p2 are without start buttons . So the only option for both is to go back.
     
  21. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    You might take a look at the code in PunMenu and enable the start button for the new master-client (photon elects a new one when the original leaves the room). Do this on the OnPlayerDisconneced (or something like this - take a lood at the documentation I reffered before).

    As for two rooms not having the same NAME (I name the rooms as the player name), you'd have to ask tobiass... I'm pretty sure it is possible to do this somehow.

    I might take a look at these options for you in a couple of days.
     
  22. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Okay . I will look it up too . Thanks .
     
  23. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    BTW: PUN Rally will be updated to version 1.0.6b tomorrow, with the fixes for the aforementioned issues.
     
    Andreas12345 and stvster like this.
  24. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    So i have done heavy changes so far, can you drop the changes you have made?
    per PN or Forum, i do not like to start again. :)
     
  25. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Hi Andreas, it's minor stuff only. I'll take a look at the git history and post the changes later. 1.0.6b is up... You might take a look at CarRaceControl.
     
  26. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Relevant changes are in CarRaceControl (2 lines changed), CarPaneGUI (1 line) and PunMenu (1 line).

    Download the pack in a new project and copy these 3 files to your current project (if you haven't changed these 3 scripts - if you have, you'll need to modify by hand anyway).
     
    Andreas12345 likes this.
  27. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Related to "
    - If player creates a race and then uses the back button, the next race it created would
    be labeled with a random/garbage string. Fixed for keep on using the player nickname;"

    Hi, just imported the update in an empty scene . Having the same issue after the bug fix .
    - Operation failed: OperationResponse 227: ReturnCode: 32766 (A game with the specified id already exist.). Parameters: {} Server: MasterServer .

    Please let me know if I am doing something wrong .
     
  28. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    I'll check it here. I haven't had this issue. It'll probably be a quick fix, so I won't change version numbers.
     
  29. stvster

    stvster

    Joined:
    Mar 4, 2013
    Posts:
    70
    Thanx for version 106b!!
     
  30. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Hi so I have created a room with random name but I want master player's name on the roomlists . Is this possible ?
    right now it is button.RoomName = game.name; I want it to be
    button.RoomName = game's master name . Is this possible ?
     
  31. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Us
    Use PhotonNetwork.player.name (this is where I store the name the player types into the input field.
     
  32. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    That is giving me the current player's name . I want the master's name to be displayed on the 'join race' name .
     
  33. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    I'm sorry I didn't detailed my answer...
    Use that value on the create race/room method (that's what I use in my original code), so the room is created with the name of the player who created it.

    Do you have my original code? This is exactly what I did originally.
     
  34. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Here's the original code for CretaeGame (that's called when you press Create, becoming the master of that race):

    Code (CSharp):
    1.  
    2. // Called from UI
    3.     public void CreateGame () {
    4.         RoomOptions options = new RoomOptions();
    5.         options.maxPlayers = 4;
    6.         PhotonNetwork.CreateRoom(PhotonNetwork.player.name, options, TypedLobby.Default);
    7.         foreach (Transform tb in trackButtons) {
    8.             tb.gameObject.SetActive(true);
    9.         }
    10.     }
    This will create the room naming it with the name of the creator (because player.name was set with the nickname typed in the input earlier - in another callback).
     
  35. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Okay thanks. The problem was that this method does not work well if two players have the same nick-name . So if there is a room named 'rob' and another 'rob' wants to create a room he cant . In the end I came up with my own solution .
     
  36. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Sorry I delayed the repeated name solution for the next update. Good you got to solve it yourself. It'll be included in 1.0.7 anyway.
     
  37. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    No problems mate. Hope you can add in the tournament mode in the next update too . It will save me so much time .
     
  38. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    The only issue is that this update is planned for after GDC only, but I have some good news regarding this (for everyone).

    One of our developers designed and implemented a custom, very robust (and very complete/versatile) weapon and power-ups system for one of the buyers.
    - power-up spawns;
    - diversified power-ups (<timed> speed increased/decreased, weapon/ammo collect, surprise bombs, etc);
    - Several weapon/projectile behaviors (rocket, drop bomb, etc);
    - Clean code design, so it's easy to understand and extend;

    The good news: We plan to include this complete system in our next update (maybe with a new car model also, but that is not so useful). For those who have the pack, this will come in 1.1.0 (which will be the next, because of this addition).

    For new users, We're thinking on rising the price just a bit (~5 or 8 bucks) because of this complete system and everything that we'll add (tournament, integration with multiple physics packs, etc). But even with this, we'll do sales from time to time as well.

    Any comments are welcome.
     
    Andreas12345 likes this.
  39. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    That is super news ! Can we see a demo video right now ? just to plan the game ahead of time ? Can you also implement a loot system and a glide system like mario cart 8? Also a small request ...In the next versions it will be great if photon rally has a separate folder . Its getting hard to manage the project with a lot of plugins with all the folders outside .
     
  40. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Photon Rally is a complete project..:/ So it's not intended to be used as an add-on (that can be packed in a separate folder), but there are some things we can do:
    • Put everything (except for what's inside Resources) in a Photon Rally folder;
    • Use a separate namespace for classes and scripts;

    What can't change because it is a complete project/tutorial that shoud work out of the box:
    • The Resources folder needs to host Prefabs which are instantiated over the network (they might go inside a sub-folder there, however);
    • Your project settings also are overwritten when you download Photon Rally (not sure if this happens in an update, but I'm afraid it does).
    About your suggestions:
    No, there are no videos yet (the system is all code as of now, 3d models and particles are being included).
    Yes, a loot mechanism can be easily done with the new power-up system;
    No, we do not intend to implement every physics behaviour needed by each user (that's up to you to implement or buy a physics pack that includes it). This is why we're planning to integrate with other physics packs. Photon Rally takes care of how the network part works (a power-up system needs to be networked, but a gliding mechanism does not - because it is already covered by the syncing).

    Which reminds me of something else:
    - I've been exchanging emails with a clever user and we've been discussing a much better/smoother/efficient dead-reckoning algorithm. It's not gonna be complex, maybe replacing the 1-line-of-code current to a 5-loc one, and this will also be part of 1.1.0.
     
  41. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Does Photon need a specific API Level - Android ? or can I put minimum gingerbread 2.3.1 ?
     
  42. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Well, I can't answer on behalf of Photon (you should ask in their forum or contact form), but given PUN is written in C# on top of Unity's basic network API, I believe it works wherever Unity (and it's low level network) works.
     
  43. CoMMoN86

    CoMMoN86

    Joined:
    Jul 19, 2013
    Posts:
    21
    I did not understand how to do that you can shoot in the game,
    My question is how to do that when the Android edish to make a smooth and even through the Schur sharply
     
  44. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    I'm sorry but I didn't understand your question...:(
     
  45. CoMMoN86

    CoMMoN86

    Joined:
    Jul 19, 2013
    Posts:
    21
    1й вопрос, как сделать чтобы можно было стрелять в игре.
    2й вопрос как снизить резкость поворотов в игре т.к Г сенсор очень резкий.
    1st question is how to do that you can shoot in the game.
    2nd question is how to reduce the sharpness of the turns in the game because it is very sharp D sensor.
     
  46. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Ok...

    1 - If you're asking how to shoot in the mobile version, we didn't put a button for it yet (it works on the desktop version). Update 1.1.0 will include these mobile buttons for shooting...

    2 - Not sure if I understood the second, but here are some guessed answers:
    - If you're talking about the TRACK turns, you can replace the track for whatever 3d modeled track you want;
    - if you're saying that the "wrong way" sensor is showing even when not in the wrong direction, you might put more Waypoints/Checkpoints along that turn;
    - If you're saying that the input sensibility is too sharp, try to play with the Car prefabs parameters such as: turn-helper in or the max turn angle (both in the standard car controller script). This controls how sharply the car responds to turn inputs.

    If anybody else reads/writes Russian, any help is welcome...:)
     
  47. CoMMoN86

    CoMMoN86

    Joined:
    Jul 19, 2013
    Posts:
    21
    Спасибо за ответы, Ваши ответы я выделил жирным шрифтом, буду ожидать версии 1,1,0
    Thank you for your answers, your answers I have highlighted in bold will be expected version 1,1,0
     
    perick likes this.
  48. perick

    perick

    Joined:
    Jun 20, 2008
    Posts:
    235
    Guys,

    This is Racers: Dirt, a game by 21c.Ducks studio (David Lee) from Korea. He's using PUN Rally as the basis for the multiplayer bits in his game and we've been discussing improvements in the dead reckoning implementation (most of it will be part of update 1.1.). I'd like to share the video for the game as I enjoyed it a lot:



    If you guys want to share your games here, I plan to put a section on our website showcasing games based on our pack.
     
  49. stvster

    stvster

    Joined:
    Mar 4, 2013
    Posts:
    70
    Racers Dirt looks like a very cool game...I kept looking for a $$ slot on my pc so I could play )
     
  50. diegoadrada

    diegoadrada

    Joined:
    Nov 27, 2014
    Posts:
    59
    Hi perick, I'm following the tutorial and I have a doubt in the section corresponding to get the available rooms, you do this:
    Code (CSharp):
    1.     void OnGUI () {
    2.         if (!racesPanel.gameObject.GetActive ()){
    3.             Debug.Log ("No es momento!");
    4.             return;
    5.         }
    6.          
    7.         foreach (RoomJoiner bt in roomButtons) {
    8.             bt.gameObject.SetActive(false);
    9.         }
    10.         int index = 0;
    11.         foreach (RoomInfo game in PhotonNetwork.GetRoomList())
    12.         {
    13.             if (index >= roomButtons.Length || !game.open)
    14.                 break;
    15.             RoomJoiner button = roomButtons[index++];
    16.             button.gameObject.SetActive(true);
    17.             button.RoomName = game.name;
    18.             string info = game.name.Trim() + " (" + game.playerCount + "/" + game.maxPlayers + ")";
    19.             button.GetComponentInChildren<Text>().text = info;
    20.         }
    21.     }
    Why do you use the OnGUI method? I guess with the Update method you can get the same result right? But, beyond this, this has to be done necessarily with one of those methods?

    Thanks in advance, and best regards!