Search Unity

FPS Kit | Version 2.0

Discussion in 'Assets and Asset Store' started by NSdesignGames, Oct 2, 2012.

  1. SubZeroGaming

    SubZeroGaming

    Joined:
    Mar 4, 2013
    Posts:
    1,008
    Anyone else having an issue with the photon networking?

    Out of the box, I set up photon cloud with that ID, and when I run it, It says i'm connected to the master server, let's me create a room, and then i automatically join that room. But when I hit the Spawn button, nothing happens. no errors, or anything. Just won't spawn. I hit the button and nothing happens.

    Any help is greatly appreciated.

    Best,

    Jon
     
  2. midorina

    midorina

    Joined:
    Jun 1, 2012
    Posts:
    131
    Yes, you can use the bullet.prefab to trigger the animation of the firing range target. You will simply send a message to the firing range dummy/target like how it sends the message to the player.

    There are a few ways you can go about locking the room to one player. You can either code the offline functions which photon supports or simply hard code the server to 1 players when the user selects training. However the best way is to simply have a singleplayer version of the training level that doesn't use Photon. This means you'll need to re-create the local player again for the single player level.
     
  3. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    Hi there - I was trying to update my instructions "How to add the second character" but it seems the editor does not allow to edit posts with images.

    How to add the second character

    1. Clone NetworkPlayer prefab, change the skin and name it NetworkPlayer2.
    2. Clone Ragdoll2 prefab the same way and assign it to Ragdoll variable of NetworkDamage.cs:
    $np3.jpg

    3. in RoomMultiplayerMenu.cs add declaration:
    public GameObject playerPrefab;
    public GameObject playerPrefab2;

    4. Update the following function:
    void SpawnPlayer(string teamName){
    if(Player){
    PhotonNetwork.Destroy(Player);
    }
    enableHelper.SetActive(true);
    Hashtable setPlayerTeam = new Hashtable() {{"TeamName", teamName}};
    PhotonNetwork.player.SetCustomProperties(setPlayerTeam);
    //Spawn our player
    int temp;
    if(teamName == team_1.teamName){
    if(gameMode == "TDM"){
    temp = Random.Range(0, team_1.spawnPoints.Count);
    Player = PhotonNetwork.Instantiate(playerPrefab.name, team_1.spawnPoints[temp].position, team_1.spawnPoints[temp].rotation, 0);
    Player.name = PhotonNetwork.player.name;
    }else{
    //Spawn player in DM mode
    temp = Random.Range(0, allSpawnPoints.Count);
    Player = PhotonNetwork.Instantiate(playerPrefab.name, allSpawnPoints[temp].position, allSpawnPoints[temp].rotation, 0);
    Player.name = PhotonNetwork.player.name;
    }
    }else{
    temp = Random.Range(0, team_2.spawnPoints.Count);
    Player = PhotonNetwork.Instantiate(playerPrefab2.name, team_2.spawnPoints[temp].position, team_2.spawnPoints[temp].rotation, 0);
    Player.name = PhotonNetwork.player.name;
    }


    5. Open scene, under __Room find RoomMultiplayerMenu.cs and assign NetworkPlayer2 prefab to the PlayerPrefab2 variable
    $np2.jpg
     
    Last edited: Nov 6, 2013
    SunixDev likes this.
  4. Essekey

    Essekey

    Joined:
    Nov 6, 2013
    Posts:
    15
    How to make steps to hear the other players, not just me?
     
  5. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    I guess the right place to get movement state is Update function of PlayerNetworkController.cs. You'll also need to clone FPSSoundController.js script, then change logic to pass movement state and position from playernetworkcontroller.
     
  6. des43

    des43

    Joined:
    May 30, 2013
    Posts:
    23
    Help with installation of weapons
     
  7. esder

    esder

    Joined:
    Nov 7, 2013
    Posts:
    3
    hello I have a problem with the kit and how it could not fix.
    Is the player in the online game does not walk forwards, backwards, left and right.
    jump, crouch, aim and shoot if it works.
    Anyone know how I could fix it?
     
  8. Ds777

    Ds777

    Joined:
    Apr 30, 2013
    Posts:
    15
  9. Drymarti111

    Drymarti111

    Joined:
    Jun 23, 2013
    Posts:
    201
    Hi guys, now body knows how to add a bomb to game for a weapon to player? And what this bomb to do?
     
  10. BossRockers14

    BossRockers14

    Joined:
    Jul 23, 2013
    Posts:
    33
    Good Day Everyone !
    i have a problem setting up an collider function on the singleplayer prefab of the kit , i am trying to create a shooting/test range for weapons and i added a collider so that the player cannot enter the inner test range (the one with the moving targets back and forth ) i tried ontrigger and oncontrollercolliderhit function but it wont activate the box collider i added
    any ideas ???
    thanks in advance
    $ss (2013-11-10 at 10.20.18).jpg
     
  11. andyfilms

    andyfilms

    Joined:
    Nov 5, 2013
    Posts:
    8
    Hi Nsdesigngames!

    I'm looking for the best way to "give" a player a weapon in multiplayer. It seems that WeaponPickUp is just not meant for anything but it's intended use and trying to call WeaponManager directly is...problematic. Any ideas?
     
  12. Neo-Gamefactory

    Neo-Gamefactory

    Joined:
    Oct 18, 2012
    Posts:
    145
    Can is use without PhotonCloud?
    I have MultiOnline and this is better :)
     
  13. RamenxNoodles

    RamenxNoodles

    Joined:
    Aug 16, 2012
    Posts:
    10
    I have a few questions about the FPSKit. I'm not entirely sure where to go to ask about bugs or such so I came here. I haven't read through the entire thread yet so my question may have been answered so please bare with me for a moment.

    I'm currently having a problem syncing player positions when a player joins a room. To me it seems as if when entering a room the players are instantiated before the player received the synced position information. If someone has made or found a solution for this I would greatly appreciate it because it has been stopping me from moving forward in my development.

    Another bug that I was tasked to fix was the health bar and how it doesn't sync with a player's actual health when a new player enters the room. I just tested it with the multiplayer 2.7 in the original post and it also has the same bug.

    I'm going to try to skim through the thread now and see if there are any solutions that anyone may have posted. Though a response would be greatly appreciated.
     
  14. Smartline-Games

    Smartline-Games

    Joined:
    Aug 15, 2013
    Posts:
    67
    Hi guys,
    I have some bad news. I was reading some posts on this topic and looks interresting, but I'm not allowed to buy this kit :'(
    I think i have to start watching those tutorials from www.youtube.com/user/superroblox
    (39 Parts of tutorial videos)

    Feel free to ask me why I'm not allowed. For a singleplayer game I'm going to use the FPS Constructor from Dastardly Banana, because it's totally free.
     
  15. KingofMk98

    KingofMk98

    Joined:
    Oct 10, 2013
    Posts:
    63
    Hi how can i get a texture to change randomly when a character spawns? or have different models for each team. i tried but ultimately failed in the end
     
    Last edited: Nov 17, 2013
  16. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    Hi KingofMk98
    I just posted detailed instruction "How to add the second character", did you follow it?
     
  17. KingofMk98

    KingofMk98

    Joined:
    Oct 10, 2013
    Posts:
    63
    I didn't see it. But I'll go back and look for it. Thanks for telling me.
    Edit: oh I see it. I don't know how I missed it. Thanks will try it out
    Alright i tried and Team 1 spawns just fine but when team2 spawns im stuck on the tab menu and dont have a player.
    $Untitled.png
    Nevermind figured it out. Thanks!
     
    Last edited: Nov 17, 2013
  18. andyfilms

    andyfilms

    Joined:
    Nov 5, 2013
    Posts:
    8
    A major flaw of this kit is the unfortunate fact that it's half Javascript and half C#. Because they can't communicate with each other well, expanding the kit to do more advanced things can become extremely difficult. If one more update were to be released converting all the JS to C#, I'd say a lot of people would be happy.
     
  19. Arkantium

    Arkantium

    Joined:
    Nov 18, 2013
    Posts:
    1
    Are you and idea to create a Looby room (pré game) ?
    Ex: Create an room - Redirect to looby (view player in room Chat) Bouton Start for Room Master -> lunch the Game Room
     
  20. RamenxNoodles

    RamenxNoodles

    Joined:
    Aug 16, 2012
    Posts:
    10
    I know exactly what you mean. I'm currently trying to find a way to communicate with the WeaponScript.js and I've generally been going through trail and error to see what works and what doesn't. I don't know how much time I've wasted already. I've pretty much butchered the FPS kit just to get that working, a shame really.
     
  21. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    it's easy:
    Add function to WeaponScript.js like this:

    function AddWeapon (WeaponID : int) {
    //some logic here
    }


    Then call it from any C# or JS:

    GameObject.FindWithTag("Player").SendMessage("AddWeapon", WeaponID, SendMessageOptions.DontRequireReceiver);
     
  22. KingofMk98

    KingofMk98

    Joined:
    Oct 10, 2013
    Posts:
    63
    alright how can i go about having multiple footstep sounds for different surfaces? im quite new to scripting so im not to sure how to do some of this stuff. Can anyone point me in the right direction?
     
    Last edited: Nov 19, 2013
  23. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    Something like this(note I did not test it, just an idea how I'd do that):

    string surface;
    ...
    void OnCollisionEnter (Collision col)
    {
    surface = col.gameObject.name;
    }

    ...

    void Update()
    {
    if (surface == "grass")
    audio.Play(Grass Audio File);
    ...
    }
     
    Last edited: Nov 19, 2013
  24. RamenxNoodles

    RamenxNoodles

    Joined:
    Aug 16, 2012
    Posts:
    10
    That would work if you are making a single player game, though if it's over a network you wouldn't know which player you are sending that message to. Instead I made static player reference that would check photonView.isMine to make sure it doesn't reference the other players.
     
  25. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    I just gave you an idea. Yes you'll need to check photonView.isMine before sending the message to the local player, but in my sample it will work over network because local player has "Player" tag and network players "Network", so my message will hit only local one
     
  26. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    This times a million. I think in several areas of script, I literally threw in SendMessage, which appears to be the only way at the moment - even for things which have to communicate values per-frame (for which SendMessage is probably horribly inefficient).
    It may have shaved off some tasks and made part of my job way easier, but others require plenty of modification to get working. Still happy I got the kit, but it could be better. It would be nice to see a full C# version.

    Some bugs:
    - Crosshair script is a bit broken. To see, equip shotgun and start spamming left-click. It appears that the crosshair script doesn't take fire time into account.
    - Look script on the third person player is kind of spazzy when looking up or down.
    - Rocket often flies right out of the level (needs Continuous collision enabled)
    - Explosions cause damage per hitbox, when really it should apply one single damage value. I changed the explosion to send ApplyExplosionDamage instead of ApplyDamage (so hitboxes ignore explosion messages), which is handled by the root PlayerDamage (on a side note, I also modified it so that players can't harm teammates, but *can* suicide via explosions)

    There's probably others I missed.

    EDIT: Also, it's possible to survive on exactly 0 health, as PlayerDamage checks for health less than zero (it should check for less than or equal to zero)
     
    Last edited: Nov 22, 2013
  27. taichiu727magnus

    taichiu727magnus

    Joined:
    Sep 16, 2013
    Posts:
    144
    How do you remove the gui of the weapon's name on the top of the screen? i just can't find it..
     
  28. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    It's in AmmoDisplay.js
     
  29. taichiu727magnus

    taichiu727magnus

    Joined:
    Sep 16, 2013
    Posts:
    144
  30. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    Agree about problems with JS and I'm actually planning to convert all JS to C# in this project. I've already tried ILSpy to decompile the project, but it requires lots of manual work to fix all errors and some parts of the code look terrible. Another issue is missing comments. There is also an option to use some converters from asset store like "JS to C# script converter" or "UnityScript to C# Convertor" but I do not have them. Has anybody tried one of this tools?
     
  31. misterff1

    misterff1

    Joined:
    Nov 29, 2012
    Posts:
    33
    I have, gives alot of errors as well. Not worth using on this project. Btw, have you read my email?
     
  32. misterff1

    misterff1

    Joined:
    Nov 29, 2012
    Posts:
    33
    Does someone know a free photon server hosting? amazon EC2 is only free for the first year. I assume you can't just quit after that, so I wonder if it would be smarter to have a different hosting.

    So does anyone know a free alternative?
     
    Last edited: Nov 22, 2013
  33. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    Hi guys
    Since I found TNet a few months ago, I've been looking to convert this project from Photon to TNet.
    http://www.tasharen.com/?page_id=4518
    https://www.assetstore.unity3d.com/#/content/6059

    The main reason for the conversion is because photon is quite expensive even if you use your own hosting. With Photon you also have to pay a license fee per project.
    For Tnet you only pay once, $65 per-studio, and what is more important is that it's open source!
    Conversion itself was pretty easy except for a few missing Photon classes/functions that I've implemented myself.
    I use UDP to update frequent changes for players(movement, rotation and animation) and TCP for the rest.

    Take a look at the game demo. It has been hosted on VPS in New Jersey.

    http://exposedconflict.com/unity/TNet.html

    $unity.jpg
     
  34. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Nicely done, man. That should pave the way for a couple of cool modifications (I'm thinking server-authoritative movement and hit detection.... :cool:)

    After I finish the current project (porting FPS Kit over to use DF-GUI for a demo), I might try my hand at converting to C#.
     
  35. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    Thanks. BTW is splitscreen your asset? How hard is to implement it for FPS kit?
     
  36. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Yes, that's mine.
    Hard to say. You might end up having to manually convert all sounds to 2D (seems to depend on the project, not sure why), and you'll definitely have to replace all of the input code. Probably the spawning code as well, and the GUI. It also wouldn't work in online multiplayer (since FPS kit treats each client as one player - it would treat splitscreen players as the same person, with the same score).
     
  37. RamenxNoodles

    RamenxNoodles

    Joined:
    Aug 16, 2012
    Posts:
    10
    I posted this question before but I'm not sure if anyone noticed it.

    I'm getting a sync problem when a player joins a room the other players' sees the new player position to be (0,0,0). So potentially making the new player a ghost that can kill while not being killed.

    I replicated this bug by leaving and joining a room, it is really intermittent but also a game breaking bug. I really could use some help in this.
     
  38. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    What do you think about implementing split screen mode(not multiplayer) in the network mode running host locally(TNet server can be run on the client side in unity project)? In this case you just have 2 multiplayer games in 1
     
  39. Braindog

    Braindog

    Joined:
    Sep 15, 2012
    Posts:
    8
    Sounds good

    is it possible to post a tutorial
     
  40. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    You'd still have to modify FPS kit's logic to deal with each splitscreen player separately, as by default it acts on the assumption that there is one single local player.

    =========================

    In other news, thought I'd post my progress on C# conversion. I've converted FPSController, FPSInput, and FPSMouseLook to C#. I also took the opportunity to add a few extra things to FPSMouseLook - mouse smoothing (mouse input is averaged over several frames, which provides much smoother mouse input), and optional recoil recovery (so you could have it recoil, and then return back to the point of aim).

    Still got a few things left in the FPSController folder to port, then I'll port over the WeaponSystem.
     
  41. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    It will be too complicated to post tutorial - I've rewrite almost all networking, plus I've spent noticeable time on this project. I'm thinking to sale it as an integration package.
     
  42. Braindog

    Braindog

    Joined:
    Sep 15, 2012
    Posts:
    8
    Okay thanks for answer
     
  43. misterff1

    misterff1

    Joined:
    Nov 29, 2012
    Posts:
    33
    Can someone please help me how to get that 100 ccu for free on the server? I dont have a server to keep running myself and i need the extra ccu fast. I already mentioned it on the previous page, but it was ignored. Amazon ec2 is not an option, because you easily have to pay for it when you cross your bandwith or time.
     
  44. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    I do not think you can find free hosting with enough bandwidth, but for $8-10 a month there are lots of options
     
  45. misterff1

    misterff1

    Joined:
    Nov 29, 2012
    Posts:
    33
    Which means I could better use photon cloud :/ Well, I'll find a way.

    Also, does anyone know how the mouse is hooked to the weapon? because I am working on a new menu, but when I click a button it jsut shoots because the mouse needs to be detached first. Problem is I dont see how they did that.
     
  46. Braindog

    Braindog

    Joined:
    Sep 15, 2012
    Posts:
    8
    Hi
    Look at RoomMultiplayerMenu.cs line 163-173. "enableHelper.SetActive(false);"
     
  47. BuildABurgerBurg

    BuildABurgerBurg

    Joined:
    Nov 5, 2012
    Posts:
    566
    I've just played your multiplayer demo and you still have an issue with bullets spraying outside the cross-hairs. I tried this many months ago and it was the same. Are you aware of this? if yes why haven't you fixed it? is it not important to you?

    Try yourself, goto the wall and wait for the crosshairs to reduce to the minimum and then fire a single shot, do this several times and you will see that the bullets are not firing within the crosshairs.
     
  48. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    I think the problem is that he used a fire point to spawn bullets - which, while more realistic (the bullets actually come from the muzzle of the gun), is completely unexpected to many FPS players (especially when you get a crosshair, which implies a general indication of where the bullet will land). The better solution is just to spawn bullets at the camera (and in fact, this is what pretty much every FPS game does).
     
  49. misterff1

    misterff1

    Joined:
    Nov 29, 2012
    Posts:
    33
    No this is not the solution. I already tried that and it still wont work. I see the mouse, but when I click the weapon keeps moving and shooting.
     
  50. Smartline-Games

    Smartline-Games

    Joined:
    Aug 15, 2013
    Posts:
    67
    Ok, here's what I thought about this.
    I would like to buy it when it's on sale. That's all.
    Please just anyone let me know via a PM when its on sale :p