Search Unity

Tanks Multiplayer - complete networking project (Netcode, Photon)

Discussion in 'Assets and Asset Store' started by Baroni, Jun 11, 2016.

?

Which networking solution would you like to use with this asset?

  1. Unity Networking

    136 vote(s)
    51.5%
  2. Photon Networking

    98 vote(s)
    37.1%
  3. Other

    30 vote(s)
    11.4%
  1. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Version 1.2 is now live on the Asset Store!
    - added support for Photon Unity Networking (PUN)
    - minimum Unity version: 5.5.0
     
  2. BusyRobot

    BusyRobot

    Joined:
    Feb 22, 2013
    Posts:
    148
    Hi,

    1) How many players can you have playing at one time?
    2) Are the walls modular? can I build different structures with them?

    Looks like a great asset :)
     
  3. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hi @Biggerplay,

    1) As many as you can pay, basically. There is no limit.
    2) Yes. I can recommend the free version of ProBuilder, which is great to build such a "blocky" design.
     
  4. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    240
    i need lobby to see rooms or create rooms only list if is possible
     
  5. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @mentolatux The goal for this template was a straight forward UI, where only one button is needed to get right into the battle. There are no short-term plans to change that, although I could create a guide on how to implement a lobby yourself at some point. Please have a look at the official UNET lobby project or the samples which are included in PUN, if you are using that as a start.
     
  6. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    240
    yes
    yes i need an tutoril how to add that plugin lobby to your super great kit also i want to add more map and change model tank with another with wheels if is possible will be great
     
  7. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Writing a guide will take time, so feel free to go ahead and extend our base on your own.

    Changing map and tanks: https://www.rebound-games.com/forum/index.php?topic=463.0
     
  8. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Hi can you please add 'Capture the Flag/zones' game mode ?
     
  9. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hi @gamezuv, there are no short term plans to add more game modes at this point. The asset has been build as a tutorial / template to build upon, with documentation that goes into great detail about how the network and game logic has been set up. As a template, it naturally won't cover every feature requested ever. Please feel free to go ahead and implement this on your own! I'm always here to give advices if you are unsure on how to approach specific features.
     
  10. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    240
    if anyone want more good stuff added to this project you should find programmer on unity job, i do the same xD
     
  11. martaaay

    martaaay

    Joined:
    Apr 13, 2009
    Posts:
    136
    If I use photon networking in this package, can I still make LAN games (peer to peer)? The reason I ask is it seems like photon does not supply that capability.

    If LAN is supplied via unet, do I need a unity plus account to deploy with unet on? (I'm using 5.5 btw).

    Thanks!
     
    Last edited: Feb 3, 2017
  12. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    It does, we have a guide for that here. It works by running a separate Photon server you connect to.

    Depends on the CCU count you would like to provide for your app. There is no difference between Personal or Plus/Pro licenses in terms of functionality. You can find the CCU count limits for the licenses on the official UNET pages. Also you don't need to have a Plus/Pro license to 'go live', but have to contact Unity for your billing details.
     
  13. RF008

    RF008

    Joined:
    Oct 28, 2016
    Posts:
    20
    HI i am working on a helicopter game https://play.google.com/store/apps/details?id=com.extremedevelopers.battleofhelicopters
    similar to this i was able to move the helicopter but problem was it was not moving smoothly.
    i have played your demo player movement was smooth.

    i want to know if you are sending player input or you are using player position and rotation sync.

    pls explain which process you are using so i can decide which one to use.
     
  14. RF008

    RF008

    Joined:
    Oct 28, 2016
    Posts:
    20
    if i can use the process in my game i will buy the asset.
     
  15. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    336
    I just bought this asset and I am impressed with how well the UNET set up works when hosting over LAN via an Android device!
     
    Baroni likes this.
  16. vksamhith

    vksamhith

    Joined:
    May 10, 2016
    Posts:
    3
    Quick Question : I am looking for an offline lan game solution for ios and android. Does this offer network gaming on hotspot
     
  17. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hi @vksamhith, as the description in the first post (and the post prior to yours) states, this asset offers LAN gameplay. I'm not quite sure what you mean by "offline lan game solution for ios and android", since mobile phones do not have a LAN port and as such you will always need some kind of wifi/internet connection for them to find each other. Bluetooth is not supported - that would be a completely offline solution.
     
  18. DNS

    DNS

    Joined:
    May 7, 2013
    Posts:
    6
    Hi, tell me please how it will be easiest to remake IAP in a simple choice of skins. That is, I want to give players the opportunity to freely select the skin of the tank, without transactions / payment ...
     
  19. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hi @DNS, select the shop products in the Intro scene and uncheck 'Buyable' on all of them.

    Going further you will want to disable Unity IAP so that the In App Purchase permission is not showing up e.g. when releasing to Google Play.
     
  20. DNS

    DNS

    Joined:
    May 7, 2013
    Posts:
    6
    Now I understand, thanks! (I was close to unraveling :))
     
  21. taydevr

    taydevr

    Joined:
    Sep 18, 2013
    Posts:
    4
    Hi, I'm planning to buy it but I have 2 questions:
    - "*Step by Step Networking Documentation" == Unity - Tanks Multiplayer - Getting Started youtube video? That is, the instructions for configuring the Unity or Photon network service or Unity Project documentation?
    - What are the advantages of this asset compared to the free asset "Tanks!!! Reference Project" (Unity Technologies)?
     
  22. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hi @_martin_, thanks for your interest.

    Our getting started video on YouTube is not the "Step by Step Networking Documentation" referred to in the asset description. The video is just that, a very quick way for getting you started with the project and with full networking going on. With networking documentation I mean the manual included in the package which contains 20 pages and describes the principles we have used to synchronize the various game mechanics over the network. For example, for shooting, it says how and why Commands have been used to instantiate bullets.

    While it does not teach the very basics of what UNET is and how it is used (I didn't want to recreate Unity's official UNET tutorials and documentation pages), this asset concentrates more on the practical part of network synchronization and should cover everything you will need to build or extend something similar on your own, or adapt it to something completely different. The scripts are build in a way that you can tear them apart, read the code comments, and understand how the game works per feature.

    I think that's also the main "advantage" of our asset, being so flexible yet well documented. I had a look at Unity's "Tanks!!!" project some time ago (it came out after we released ours) and from looking at their code and classes I had the feeling that while it has been designed as a complete project, it's not really suited for a template where you can tear everything apart. They have a single player campaign too, but we really focus on the networking part and keeping that as simple as possible. Overall, both projects provide different aspects and could complement each other in some way. As with all of your assets, you also get free lifetime support via email or on our forums.
     
  23. Xain

    Xain

    Joined:
    Aug 3, 2013
    Posts:
    68
    Hello, I was going to buy this last year but couldn't :(. Now I will buy it in a couple hours, looks great so far. Only problem is earning exp and ranks. I hope I can integrate them without problem. Thanks for the asset Baroni :)
     
  24. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hey @Xain, sure, let me know if you get stuck. You should get familiar with the documentation and code really fast, so adding that yourself should not be a problem.
     
    Xain likes this.
  25. kurdBaxz

    kurdBaxz

    Joined:
    May 23, 2015
    Posts:
    1
    @Baroni hi,

    i have already purchased this but didn't do anything with it

    i have a couple questions

    is it possible to change the tanks prefabs? and if so how would i do that

    and i saw it has unityads but i prefer admob is it possible to integrate that into it?
     
  26. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hi @kurdBaxz,

    there is a tutorial on how to add your own tank on our forums, here.

    Regarding AdMob, sure, you'll just have to disable Unity Ads and insert your own code to show a video/interstitial where you want it to be. You can look at how I did it with Unity Ads. I'm not posting a code example since I'm not using AdMob in that asset myself.
     
  27. Zincord

    Zincord

    Joined:
    Dec 21, 2013
    Posts:
    14
    Hi @Baroni,
    is authoritative server?
    How complicated is it, to make other types of games using this asset?
     
    Last edited: Sep 18, 2017
  28. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hello @robsonbackend,

    please see here for a similar question.

    The adaption for other games depends on your knowledge on Unity and reading code, this is not something I can answer for you. We've described how we built this asset in the documentation, but using it requires general Unity knowledge.
     
  29. Zincord

    Zincord

    Joined:
    Dec 21, 2013
    Posts:
    14
    Hi @Baroni,
    Thank-you for your fast reply.
    The prediction of authoritative movement? Without this it's complicated, because of cheating.
     
  30. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Movement is not monitored on the server/host side at all. Of course you could add code to the host checking for unnatural position changes, but also ignore bigger position updates due to network lag (false positives).
     
  31. Zincord

    Zincord

    Joined:
    Dec 21, 2013
    Posts:
    14
    I'll buy it anyway, it will certainly make it easier to develop my game.
    Thank-you!
     
    Baroni likes this.
  32. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    39
    I need help here ! I don't know why my bullet spawn behind the tank on others player(Same Prefab and sames scripts) :
     
  33. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @Warsoul as I can see it, you are moving your tank faster than bullet speed. So if you shoot while moving, the bullets from the old position (behind the tank) are still flying. Looks like this is happening mostly when moving? It can't be related to the model then, but still check your bullet shot position on the turret.
     
  34. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    39
    The shoot position is okay and the 1st player is okay too. Only the non-host have this issue.
    Even with your Basic free tank this happen but it's harder to see because your tank move slowly. The shoot position and the smoke get offset by something on the second player and idk why.
     
    Last edited: Oct 10, 2017
  35. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @Warsoul
    The shot position is indeed interpolated between the shot position on both clients to reduce lag. You can see this in the Player script code and play around with the interpolation value (default is 60% host position, 40% remote client position). If you do not interpolate, all remote clients will see shot position lag - but not the local client. If your tanks move fast, this can be more obvious. When playing online rather than on LAN, network messages are being sent over Unity's servers so there will always be some lag happening, which cannot be avoided.

    But I also noticed something different. In your video, the blue tank is being pushed away when firing bullets. Even when not moving, firing pushes it away a bit. Do you have any forces applied or is the rigidbody not configured like on the other bullet prefabs?
     
  36. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    39
    I have a rigid body on it and a second collider for physX purpose. This is not happening on the 1st player only on the offset bug for others players. How others game do for fast moving players ?
     
  37. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    This is not a bug, because your first player is the host. The host will always receive all messages first, after which they get sent back to other clients for instantiating bullets on them too. The delay between the host and the clients is what you experience as network lag on clients. Of course you could let clients instantiate bullets on their own and allow for massive cheating, but that would only shift the issue to all other clients except the one shooting bullets.

    It should be obvious that neither you, nor I, can prevent network lag from happening. There are several different approaches for reducing lag you can look up elsewhere, e.g. having servers in each country. It's really an issue due to the nature of networking, not this asset. You can work around it though, as I said, play around with the interpolation values I mentioned above. Another approach would be instead of making your world bigger and tanks faster, make the world smaller and tanks slower, so that it doesn't look that far off. This depends on your design though.
     
  38. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    39
    II play that game with 4 players coop and i never saw that issue. The player move quickly and the shootposition is always accurate. How they does ?

     
    Last edited: Oct 10, 2017
  39. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @Warsoul I'm not sure what you expect me to tell you. You could ask them. If you are making your tanks much faster and still expect to run everything smooth as always, then you are running into natural boundaries of this asset it has not been designed for, and will need to make some adjustments. This is an interesting read as well.
     
    Last edited: Oct 11, 2017
  40. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    39
    Thank you ! To be clear; i have nothing against your asset. It's pretty solid for the price. All i want is to find a solution to fix this issue because it halt all my production. I know others games can fix this. So they have an solution for this.

    I had few answers on this :

    ------ Writing this without knowing the code structure but I think the problem is, server instantiates and spawn the bullets, and sets their first speed by also calculating the tank's speed, but doesn't let the clients know about this. So you have remove the code that sets the speed, and put it in a ClientRpc method and call this method from the Command method.

    This applies if the buggy behaviour is on the client and not on the server, you can check by testing this.[/QUOTE]
     
  41. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @Warsoul the second part of your post does not apply. It's exactly as Joe-Censored wrote in that other thread, which is what I wrote here about network delay too. Implementing #3 will make it even worse if you want to deal with fast movements. #1 would be the way to go, but he also mentions the issue that comes with it, which is what we've ultimately wanted to avoid - our approach is authoritative syncing of bullet positions on all clients, so that it doesn't look like the player hit something, but then the host decides that it didn't hit. This works for our asset and gameplay, but it may not work for your game. It's your decision to change this.

    And while we're at it: you really have to keep the bandwidth and message limit in mind when spawning bullets. I don't know whether you are using UNET or Photon, but spawning several bullets per second (each with a separate RPC), per player, can add up very quickly.
     
  42. Mr-Zhou

    Mr-Zhou

    Joined:
    May 4, 2016
    Posts:
    26
    Hi, i purchased the asset but i was just wondering if it is possible to add AI opponents if there aren't enough people in a room?
     
    LoDx likes this.
  43. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Thanks! Please note that there is no coop mode in this asset yet. So while it certainly is possible to add AI bots to an online game, the big issue with the current AI bots is that they are not being synchronized over the network. This means that only the master client would see them move around and shoot.

    Ultimately you would have to attach a NetworkTransform and View to the bot prefabs and make the PlayerBot script fully network aware. There is definitely some coding involved to implement this one.
     
  44. Mr-Zhou

    Mr-Zhou

    Joined:
    May 4, 2016
    Posts:
    26
    Thanks for your reply, I had try what you say, But I get some errors when the PlayerBot shot, Could you please show me you code about how to edit it.
     
  45. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    I tried to give you some starting point on how to implement this - I haven't done it yet, so I cannot provide finished code.
     
  46. Mr-Zhou

    Mr-Zhou

    Joined:
    May 4, 2016
    Posts:
    26
    Ok, If you have added this feature, please let me know, Thanks!
     
  47. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Version 1.3 has hit the Unity Asset Store:
    - added movement on Y axis: added tank gravity, new ramps at the map center
    - added individual (local) kills/death counter to the Game scene
    - added disconnect button to the Game scene for leaving the current match
    - changed bot AI to make more use of the entire map, not heading to the center
    - changed purchasing code to UNITY_PURCHASING define (was UNITY_ANALYTICS)
    - minimum Unity version: 5.6.0

     
  48. GaloDoido

    GaloDoido

    Joined:
    Jan 30, 2013
    Posts:
    2
    Several plugins are 50% off (black friday). Will this plugin also join Black Friday? = D
     
  49. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @GaloDoido The Black Friday Asset Store sale started last Monday, so this asset won't be included. Look out for future sales.
     
  50. dclgamingtr

    dclgamingtr

    Joined:
    Nov 3, 2016
    Posts:
    1
    good day i have purchased your asset. It is quite beatıfiul. But we couldnt change the tanks. Could you please help us to change the tanks? dsemercioglu@gmail.com