Search Unity

FPS Tutorial update

Discussion in 'Editor & General Support' started by Jeff Aydelotte, Jun 10, 2009.

  1. Jeff Aydelotte

    Jeff Aydelotte

    Joined:
    Apr 7, 2009
    Posts:
    35
    UPDATE 8/5/09:
    [Amir]This is on the website now:
    http://unity3d.com/support/resources/tutorials/fpstutorial


    There have been a ton of forum posts about how the FPS tutorial from 1.x is broken in Unity 2.5. I pulled the project today to take a look at it and begin taking stock of what will have to be changed to get the tutorial updated.

    So now the big question: What's wrong with it?

    When I pulled the project down and dropped it into 2.5, it ran (which was more than I was expecting given many of the posts I'd read). I found some problems with the rocket launchers firing rockets, and I've gotten that one fixed. I can't find the horrible bugs that people were reporting. It looks like someone has already changed the scripts to remove the movie texture problem that some people were reporting.

    I now call upon the Unity community. If you've run into an error with the FPS tutorial then pull down the latest version from http://unity3d.com/support/resources/files/Complete FPS Tutorial.zip and see if you still run into that problem (some of those files were updated in 2.0, so errors you had with the 1.x files may already have been fixed). If you have some free time and you've never run into an error, then still grab the project and just poke at it a little to see if anything pops out at you. Then come back here and let me know what problems you can find. The more information you can give me about the problems, the better I can make this project (so please don't post "ZOMG THIS PROJECT IS BROKEZORS" because that's not helping anyone, and it's making your third grade grammar teacher cry).

    Thanks for any help you can give me.
     
  2. Armagon

    Armagon

    Joined:
    May 29, 2009
    Posts:
    246
    Create a new Unity Project. Then copy the entire Pro and Standard assets folders, and paste them inside the FPS Tutorial project. Replace all files. Now run the FPS Tutorial project and remove the water object that surrounds the level.

    Now pay attention to every little error reported by the debug window. And just follow the instructions to fix the errors. It's a little slow, but in the end, you'll get a working demo (with some bugs, of course).
     
  3. protozerg

    protozerg

    Joined:
    Apr 28, 2009
    Posts:
    23
    I finally execute fps example to Unity3D 2.5 with

    this old version example with some changes of codes.

    In order to move main character we use FPSwalker

    code in this example, but I can't walk on the stairs

    in the game because of collision detection I think.

    How can I change it to be ale to walk on the stair?
     
  4. Armagon

    Armagon

    Joined:
    May 29, 2009
    Posts:
    246
    Well, there's the beauty of upgrading the FPS Tutorial from 1.x to 2.x. You'll have to understand the problems, and sometimes, rewrite the scripts to fix some bugs. You'll get some pretty decent experience!
     
  5. JayCally

    JayCally

    Joined:
    Apr 22, 2009
    Posts:
    45
  6. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    FWIW It seemed that if ever instantiating enemies, where by default they just didnt work, if you call "Patrol()" on them it seemed to power them up.

    AC
     
  7. aerende

    aerende

    Joined:
    Apr 27, 2009
    Posts:
    316
    In step 4 of the FPS tutorial it says:

    4. Setting up the game environment
    With mainLevelMesh still selected in the Project panel, select "Settings" at the top of this panel and in the dialog box that opens, check that "Meshes have colliders" is selected.

    The problems I am having are:

    A. In the project panel of Unity 2.5 there is no settings selection. In Unity iPhone, the Project panel does have a Settings selection, but not in Unity 2.5.
    B. When I hit play, the First Person Controller falls through the floor.

    Q. How can I stop the player from falling through the floor? I've tried turning on the colliders for the floor, but that doesn't help.

    Thanks.
     
  8. Jeff Aydelotte

    Jeff Aydelotte

    Joined:
    Apr 7, 2009
    Posts:
    35
    Step 4 will need to be updated in the doc. The settings menu is one of the areas of the UI that has been changed. If you want to import a mesh with colliders in Unity 2.5 you need to click on the mesh in the project tab. This will bring up some options in your inspector. Under FBXImporter there is an option called "Generate Colliders". Toggle that on and your mesh will load in with colliders just like the old "Meshes have colliders".
     
  9. BetaRayBill

    BetaRayBill

    Joined:
    Jun 6, 2009
    Posts:
    188
    I have a question on this then,.. what is the difference between this,....

    "Under FBXImporter there is an option called "Generate Colliders". Toggle that on and your mesh will load in with colliders just like the old "Meshes have colliders"."...

    .... // or selecting the mesh and going to Component/Physics/Mesh Collider?

    Is it the same thing? (I've had the demo version running for 5 days, and gone through most of the tuts, and it looks like the component/physics/mesh collider is working for everything I have so far. Or no?....?
    thanks
     
  10. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yep.

    --Eric
     
  11. aerende

    aerende

    Joined:
    Apr 27, 2009
    Posts:
    316
    In the AI.js script in the MoveTowards function, for the line


    Code (csharp):
    1. GetComponent (CharacterController).SimpleMove(direction);
    I get the error:

    "SimpleMove" is not a member of "UnityEngine.Component"

    How does this line need to change so that it will run in Unity_iPhone?

    Thanks,

    Jim
     
  12. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    You need to get a reference to the component with an explicit type first, then call SimpleMove, that will take two lines of code where there is now one:

    Code (csharp):
    1. // Untested forum code to prove the point
    2. var tCharControl : CharacterController = GetComponent (CharacterController);
    3. tCharControl.SimpleMove(direction);

    And if I may request let's keep this on topic about the FPS tutorial as a desktop/web example and move iPhone questions to the iPhone Development section of the forums (if that's not being too pushy of me :) ).
     
  13. ipe1911

    ipe1911

    Joined:
    Jun 17, 2009
    Posts:
    2
    The problem is in the script, which isn't used in the newer version. For us newbies it is a mountain to climb, so could you pleeeeeeeeeeeeeease post the script you used to bypass it? :cry:
     
  14. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
    Jeff is working on fixing the whole thing and then submitting it to the web site once it's finished.
     
  15. bloodtiger10

    bloodtiger10

    Joined:
    Nov 9, 2008
    Posts:
    619
    so same thing (fps tutorial) but totally updated scripts?
     
  16. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    "Totally" isn't necessarily appropriate, but as a first step he's updating the existing tutorial so it's fully 2.x compatible and ready for immediate use.
     
  17. bloodtiger10

    bloodtiger10

    Joined:
    Nov 9, 2008
    Posts:
    619
  18. windmaomao

    windmaomao

    Joined:
    Jun 11, 2009
    Posts:
    50
    rocket launcher doesn't fire, and I don't know where to go. Other than that, fantastic :) well, no explosion, hehe.

    lots of these errors though,

    NullReferenceException: The prefab you want to instantiate is null.
    UnityEngine.Object.Instantiate (UnityEngine.Object original, Vector3 position, Quaternion rotation)
    RocketLauncher.Fire () (at Assets/WeaponScripts/RocketLauncher.js:11)
    UnityEngine.Component:BroadcastMessage(String, Object, SendMessageOptions)
    UnityEngine.Component:BroadcastMessage(String, Object, SendMessageOptions)
    UnityEngine.Component:BroadcastMessage(String)
    $:MoveNext() (at Assets/WeaponScripts/AI.js:65)
     
  19. uthink

    uthink

    Joined:
    Jun 21, 2009
    Posts:
    10
    Well I hope they make progress on the update soon.
     
  20. Jeff Aydelotte

    Jeff Aydelotte

    Joined:
    Apr 7, 2009
    Posts:
    35
    Don't worry, this project hasn't gotten lost in the shuffle. I've been making the necessary changes to update the tutorial, and I'm going to be putting this out once everything in the tutorial is ready and working correctly.

    I'm not completely rewriting all of the scripts in the project, I'm just modifying them to make the necessary changes to have the old script work in Unity 2.5 (although I have added a few new things).

    @windmaomao I know exactly the problem that you're having. What you have to do is select the rocket launcher and drag the rocket prefab onto the Projectile slot of the Rocket Launcher script.
     
  21. MikeDom

    MikeDom

    Joined:
    Jul 2, 2009
    Posts:
    10
    Can't wait for this, I cant download the tutorial right now but I'm really looking forward for the updated one ! :wink:
     
  22. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    Second that thought! I totally need this tut to chew on as we wait for the iPhone one to finish cooking...

    Feed the need!

    B. :twisted:
     
  23. grfxman

    grfxman

    Joined:
    May 28, 2009
    Posts:
    309
    I got the FPS tut working and I added it to the Island demo. You can even shoot the herons. But I am having issue with memory and too many waypoints. I am try to figure out where this activity monitor is in Unity so I can tell whats causing the memory issue. :)

    The waypoints seem to eat a LOT of memory.
     
  24. Seth1984

    Seth1984

    Joined:
    May 5, 2009
    Posts:
    19
    Are there some news? Will the updated project be downloadable soon?
    An idea could be working together to a "beta" version with multiple improvement of the old fps tutorial....
     
  25. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    @ Jeff there was also a racing game tutorial made some time ago that was an amazing resource- until it got broken by engine upgrades. It hade code for Ai Cars, Placings/rankings for drivers, and it taught noobs how to store high score tables based on race times using the player preferences.

    Its a shame that it never was maintained and yet again I've gone to go to an old project that used this to find I need a really old version of unity for it to work..argh..

    It would be awesome if you could look at that sometime too, and please make sure reckless development doesn't continue to break our projects in future? Its hard enough creating error free games as it is.

    Cheers
    AaronC
     
  26. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    The project itself is done and the hold-up now has been about updating the tutorial doc as it needed some love as well. The demo team is almost done with it and we expect that they'll have it done and ready by end of day tomorrow (Friday). When it's done and ready we will immediately update this thread with a temporary download link while we then separately slot it in for formal posting to Resources in our next site update.


    @Aaron: Go submit feedback on our feedback site so we have it properly logged and noted:

    http://feedback.unity3d.com/pages/17490-unity-demos

    And sorry but I see nothing "reckless" in the dev work we've done nor in relation to these projects or the racing demo in particular. Change happens and we felt that the cost was worth the benefits, that doesn't mean things happened without consideration, thought and care ahead of time.
     
  27. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    @Tom we have been over this, I think the number of people put out by the fps tutorial alone speaks for itself.

    If things are culled the support docs should keep up, really.

    Firstly it means that when developers open their established projects that dont work in newer versions, development time needs to be dedicated to fixing them. Which is a waste. To smooth this over, updated support docs would be most helpful but this hasn't been a priority.

    Secondly it means that when doing work for other people, we cant guarantee it, because we don't know whats going to get broken in the road ahead.

    I dont think it has been thought about at all because Utech developers at a human level would realise this, and wouldnt want it to happen to their userbase. Its more oversight, the human factor showing in a high-tech production environment. I'm sure this will happen less in the future, but its important the message gets across.

    AC
     
  28. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    There is no software that is 100% compatible between the latest version and the earliest. OS X 10.5 isn't 100% compatible with OS X 10.4 (never mind 10.0), and that affects a lot more people than Unity does. The notion that they "didn't think about it at all" is ridiculous...of course they did, and as Tom said, "Change happens and we felt that the cost was worth the benefits". As long as humans fail to do things 100% perfectly the first time, this will continue to happen; the alternative is that you can never improve and you're stuck with suboptimal solutions forever. It's true, there are no guarantees: welcome to the world of software development....

    --Eric
     
  29. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    Hence updating the support resources along the way...

    AC
     
  30. Seth1984

    Seth1984

    Joined:
    May 5, 2009
    Posts:
    19
    @HiggyB Perfect, thanks a lot, really!!! Hope the team can really finish within today, so me and a lot of people will be able to see the project on our 2.5.1 and the updated docs as well...
     
  31. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    Also looking forward to the FPS completion today. :D

    I'm sure Tom understands user's frustration with the delay in updating critical training material and is pushing his team to get it out the door as soon as possible. (Hell, I was inching my way through the old Racing Tutorial yesterday. It's actually quite good, and I'd love to see it resurrected too. (After the iPhone Tut of course)...

    With a crispy fresh FSP tut in hand, and a good excuse not to do my garden chores till it's done, I anticipate a wonderful weekend.

    B.
     
  32. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    That has nothing to do with "reckless development". We develop the product with lots of care, concern and forethought. Sure, we can and should do better about maintaining example projects and tutorials but nothing there breaks your content or speaks of "reckless development".

    Your choice of words is off in my book. We are not "reckless". Behind on FPS tutorial updates? Sure, but that is nothing like being "reckless".
     
  33. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    Fair enough. :p

    AC
     
  34. amirebrahimi

    amirebrahimi

    Joined:
    Jan 27, 2008
    Posts:
    171
    As promised, we're providing an early version of the FPS tutorial, which has been updated for Unity 2.5. See the original post for the download links.
     
  35. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    And very much appreciated. Thanks for the hard work and pushing this thing through. If I could email a nice cold beer, I would.

    best,

    B. 8)
     
  36. nimrodgames

    nimrodgames

    Joined:
    Mar 1, 2009
    Posts:
    17
    Dito brendang we really appreciate the work I hope you unity guys work to create more tutorials for us users.

    Downloading it right now :)
     
  37. Armagon

    Armagon

    Joined:
    May 29, 2009
    Posts:
    246
    Thank you guys for the amazing work dedicated to the community. We'll be waiting for other amazing tuts! :wink:

    ps.: Is it just me or, when decompressing the package, Unity crashes?
     
  38. camille

    camille

    Joined:
    Feb 23, 2009
    Posts:
    47
    nope. It crashes for me too. Using Unity 2.5 pro on vista..
     
  39. amirebrahimi

    amirebrahimi

    Joined:
    Jan 27, 2008
    Posts:
    171
    Is this if you double-click on the package or import it through the editor (Assets -> Import Package)?
     
  40. Seth1984

    Seth1984

    Joined:
    May 5, 2009
    Posts:
    19
    1) If i double click on the package it crashes also to me....
    2) If I try to import the package via "Assets->Import Package..." it crashes too...

    After doing the second option three times it was capable to load everything (at least I think)... There where mainly problems with the textures if this could help the demo team...
     
  41. amirebrahimi

    amirebrahimi

    Joined:
    Jan 27, 2008
    Posts:
    171
    Are you using Unity 2.5 or 2.5.1?
     
  42. Preludian

    Preludian

    Joined:
    Mar 29, 2009
    Posts:
    47
    Crashes here too under winXPPro SVP3, 2GB Ram, Unity Indie. The import seems o work fine when all of the sudden, bang!

    Edit: Maybe this helps, this was the last message.
    Edit2: Restarted Unity and created a new Project without anything, totally blank. Got no crashing but several errors.

    In these three cases the debugger states an error in line -1.


    FBXImporter.cpp at line 195

    Of course I have no Maya, I use Blender.

    Hope these infos help.
     
  43. Armagon

    Armagon

    Joined:
    May 29, 2009
    Posts:
    246
    I managed to unpack the Unity Package after trying 6 times. I then started Beyond Compare and compared the old FPS Tutorial folder with the new one, and honestly, i got pretty disappointed.

    There are no new features or significant updates. Just fixes that allow the FPS Tutorial to run fine on 2.5, which i believe, many users here in the community already did (me, for example).
     
  44. tholland

    tholland

    Joined:
    May 28, 2009
    Posts:
    129
    I'm working my way through part 1 of the tutorial and get an error message "Assets/WeaponScripts/FPSPlayer.js (124,31): BCE0019: 'frame' is not a member of 'UnityEngine.Texture2D' How do I fix this?
     
  45. jojimbo

    jojimbo

    Joined:
    Jun 25, 2009
    Posts:
    37
    crashes for me too :(
     
  46. Seth1984

    Seth1984

    Joined:
    May 5, 2009
    Posts:
    19
    @aebrahimi Version 2.5.1
     
  47. jojimbo

    jojimbo

    Joined:
    Jun 25, 2009
    Posts:
    37
    ok redownloaded the fpsassets and let windows wizard open it with appropriate program - "unity" and it all loaded into a new project successfully.

    however the main level mesh has no materials assigned and is gray
     
  48. G3David

    G3David

    Joined:
    Oct 1, 2007
    Posts:
    35
    im wondering, if you've fixed the waypoint problem like i did, one thing that was making waypoints wayy to slow at start was that every single waypoint was calculating every other waypoint from its start function, which wasnt nessacary, so i made another script that only called it on one of them at runtime, and did an update when i told it to in editor, made even 100 waypoints calc almost instant rather then lagging then popping up:
    time was (Big O of script*n)^n where n was number of waypoints
    Updated AutoWayPointScript:
    Code (csharp):
    1. static var waypoints = Array();
    2. var connected = Array();
    3. static var kLineOfSightCapsuleRadius = 0.25;
    4.  
    5. static function FindClosest (pos : Vector3) : AutoWayPoint {
    6.     // The closer two vectors, the larger the dot product will be.
    7.     var closest : AutoWayPoint;
    8.     var closestDistance = 100000.0;
    9.     for (var cur : AutoWayPoint in waypoints) {
    10.         var distance = Vector3.Distance(cur.transform.position, pos);
    11.         if (distance < closestDistance)
    12.         {
    13.             closestDistance = distance;
    14.             closest = cur;
    15.         }
    16.     }
    17.  
    18.     return closest;
    19. }
    20.  
    21. @ContextMenu ("Update Waypoints")
    22. function UpdateWaypoints () {
    23.     RebuildWaypointList();
    24. }
    25. // Draw the waypoint pickable gizmo
    26. function OnDrawGizmos () {
    27.     Gizmos.DrawIcon (transform.position, "Waypoint.tif");
    28. }
    29.  
    30. // Draw the waypoint lines only when you select one of the waypoints
    31. function OnDrawGizmosSelected () {
    32.     if (waypoints.length == 0)
    33.         RebuildWaypointList();
    34.     for (var p : AutoWayPoint in connected) {
    35.         if (Physics.Linecast(transform.position, p.transform.position)) {
    36.             Gizmos.color = Color.red;
    37.             Gizmos.DrawLine (transform.position, p.transform.position);
    38.         } else {
    39.             Gizmos.color = Color.green;
    40.             Gizmos.DrawLine (transform.position, p.transform.position);
    41.         }
    42.     }
    43. }
    44.  
    45. function RebuildWaypointList () {
    46.     var objects : Object[] = FindObjectsOfType(AutoWayPoint);
    47.     waypoints = Array(objects);
    48.     var i=1;
    49.     for (var point : AutoWayPoint in waypoints)
    50.     {
    51.         point.name="WayPoint"+i.ToString();
    52.         point.RecalculateConnectedWaypoints();
    53.         i++;
    54.     }
    55. }
    56.  
    57. function RecalculateConnectedWaypoints ()
    58. {
    59.     connected = Array();
    60.  
    61.     for (var other : AutoWayPoint in waypoints) {
    62.         // Don't connect to ourselves
    63.         if (other == this)
    64.             continue;
    65.        
    66.         // Do we have a clear line of sight?
    67.         if (!Physics.CheckCapsule(transform.position, other.transform.position, kLineOfSightCapsuleRadius)) {
    68.             connected.Add(other);
    69.         }
    70.     }  
    71. }
    WayPointController
    Code (csharp):
    1. private var way : AutoWayPoint;
    2. function Start()
    3. {
    4.     way=GetComponent(AutoWayPoint);
    5.     way.RebuildWaypointList();
    6. }
    7. function Update()
    8. {
    9.     if(way.waypoints.length == 0)
    10.         way.RebuildWaypointList();
    11. }
    hope this helps
     
  49. tholland

    tholland

    Joined:
    May 28, 2009
    Posts:
    129
    Just a thought for those suffering from crashing imports: I'm using Vista Home Edition and unless I access Unity using the "Run as administrator" facility, the asset import crashes for me too.
     
  50. amirebrahimi

    amirebrahimi

    Joined:
    Jan 27, 2008
    Posts:
    171
    I've confirmed the crash on Windows for 2.5.1 and am looking for a work-around. Worst case: we'll just provide a full project folder. I don't think this is happening on OSX at all though.